/* ==========================================================================
   Earth System Dynamics Lab — site stylesheet
   Colors and fonts are defined once here as variables; change them to retheme.
   ========================================================================== */

:root {
  --ink: #0E2433;          /* dark navy: hero, buttons */
  --ink-2: #16232C;        /* body text */
  --text-2: #3C4A53;       /* secondary text */
  --muted: #4F5D66;        /* captions, meta */
  --accent: #1D6A85;       /* links, labels */
  --accent-dark: #0E4A60;
  --warm: #E8895A;         /* highlight on dark backgrounds */
  --warm-soft: #F2B48F;
  --bg: #FFFFFF;
  --surface: #F4F6F5;      /* alternate section background */
  --placeholder: #E9EEF0;
  --line: #DDE3E6;
  --line-2: #C5D0D5;
  --radius: 14px;
  --max: 1200px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: #fff; padding: 8px 14px; z-index: 100; }
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header / navigation ---------- */
.site-header { background: var(--bg); border-bottom: 1px solid var(--line); position: relative; z-index: 10; }
.site-header--dark { background: var(--ink); border-bottom-color: rgba(255,255,255,0.12); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink-2); text-decoration: none; }
.brand:hover { color: var(--ink-2); }
.brand svg { flex: none; stroke: var(--ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12.5px; color: var(--muted); }
.site-header--dark .brand, .site-header--dark .brand:hover { color: #fff; }
.site-header--dark .brand svg { stroke: #fff; }
.site-header--dark .brand-sub { color: #B9C7CF; }

.nav-links { display: flex; align-items: center; gap: 4px 22px; list-style: none; margin: 0; padding: 0; font-size: 15px; }
.nav-links a { color: #2C3A43; text-decoration: none; padding: 6px 0; }
.nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--ink-2); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.site-header--dark .nav-links a { color: #E6EDF1; }
.site-header--dark .nav-links a:hover { color: #fff; }
.site-header--dark .nav-links a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--warm); }

.nav-toggle { display: none; background: none; border: 1px solid var(--line-2); border-radius: 10px; width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-2); }
.site-header--dark .nav-toggle { color: #fff; border-color: rgba(255,255,255,0.35); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn-lg { min-height: 50px; padding: 13px 24px; font-size: 16px; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1B3B52; color: #fff; }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: #E6EDF1; color: var(--ink); }
.btn-warm { background: var(--warm); color: #1A0E06; }
.btn-warm:hover { background: #F09A6E; color: #1A0E06; }
.btn-outline { border-color: var(--line-2); color: var(--ink-2); background: transparent; }
.btn-outline:hover { border-color: var(--ink-2); color: var(--ink-2); }
.btn-ghost-light { border-color: rgba(255,255,255,0.45); color: #fff; }
.btn-ghost-light:hover { border-color: #fff; color: #fff; }
.nav-links .btn { padding: 8px 18px; }
.nav-links .btn-dark, .nav-links .btn-dark:hover { color: #fff; }
.nav-links .btn-light, .nav-links .btn-light:hover, .site-header--dark .nav-links a.btn-light, .site-header--dark .nav-links a.btn-light:hover { color: var(--ink); }

/* ---------- Type helpers ---------- */
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.on-dark .eyebrow { color: var(--warm-soft); }
.section-title { font-size: clamp(30px, 3.4vw, 44px); font-weight: 700; }
.lead { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; color: var(--text-2); max-width: 680px; }
.prose { max-width: 760px; color: #2C3A43; }
.prose p + p { margin-top: 1em; }
.prose h2 { font-size: 28px; margin: 48px 0 14px; }
.prose ul { padding-left: 1.2em; }
.muted { color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section--surface { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin-bottom: 48px; }
.section-head > div { display: flex; flex-direction: column; gap: 12px; max-width: 680px; }
.more-link { font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap; }

.page-header { background: var(--surface); border-bottom: 1px solid var(--line); padding: 72px 0 56px; }
.page-header .container { display: flex; flex-direction: column; gap: 14px; }
.page-header h1 { font-size: clamp(36px, 4.5vw, 56px); font-weight: 700; letter-spacing: -0.03em; }

/* ---------- Hero ---------- */
.hero { background: var(--ink); color: #fff; position: relative; overflow: hidden; }
.hero-lines { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; pointer-events: none; }
.hero .container { position: relative; padding-top: 112px; padding-bottom: 120px; display: flex; flex-direction: column; gap: 28px; }
.hero h1 { font-size: clamp(38px, 6vw, 76px); line-height: 1.03; letter-spacing: -0.03em; font-weight: 700; max-width: 980px; }
.hero .lead { color: #D3DEE4; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---------- Facts strip ---------- */
.facts { border-bottom: 1px solid var(--line); }
.facts .container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; padding-top: 32px; padding-bottom: 32px; }
.fact { display: flex; flex-direction: column; gap: 2px; }
.fact strong { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.fact span { font-size: 14.5px; color: var(--muted); }

/* ---------- Research cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; }
.theme-card { display: flex; flex-direction: column; gap: 14px; color: inherit; text-decoration: none; }
.theme-card:hover { color: inherit; }
.theme-card:hover h3 { color: var(--accent); }
.figure-box { aspect-ratio: 4 / 3; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 12px; }
.figure-box img { width: 100%; height: 100%; object-fit: contain; }
.theme-card h3 { font-size: 23px; font-weight: 700; transition: color .15s; }
.theme-card p { font-size: 16px; color: var(--text-2); }
.tags { font-size: 14px; color: var(--muted); }

/* ---------- News + pubs (home) ---------- */
.split { display: flex; flex-wrap: wrap; gap: 64px; }
.split > * { flex: 1 1 420px; min-width: 0; }
.split-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 24px; }
.split-head h2 { font-size: 32px; font-weight: 700; }

.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { display: flex; gap: 20px; padding: 18px 0; border-top: 1px solid #D3DBDF; }
.news-list li:last-child { border-bottom: 1px solid #D3DBDF; }
.news-date { flex: 0 0 92px; font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 3px; text-transform: uppercase; }
.news-list p { font-size: 16.5px; line-height: 1.5; }

.pub-card { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; color: inherit; text-decoration: none; transition: border-color .15s; }
.pub-card + .pub-card { margin-top: 16px; }
.pub-card:hover { border-color: var(--accent); color: inherit; }
.pub-card .journal { font-family: var(--mono); font-size: 12.5px; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; }
.pub-card h3 { font-size: 18.5px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
.pub-card span { font-size: 14.5px; color: var(--muted); }

/* ---------- Join band ---------- */
.join { background: var(--ink); color: #fff; border-radius: 24px; padding: clamp(32px, 5vw, 64px); display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; }
.join > div { flex: 1 1 380px; display: flex; flex-direction: column; gap: 16px; }
.join h2 { font-size: clamp(28px, 3vw, 40px); font-weight: 700; }
.join p { color: #D3DEE4; max-width: 560px; }
.join-links { gap: 0 !important; }
.join-links a { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; min-height: 44px; border-top: 1px solid rgba(255,255,255,0.2); color: #fff; text-decoration: none; font-size: 17px; font-weight: 600; }
.join-links a:last-child { border-bottom: 1px solid rgba(255,255,255,0.2); }
.join-links a:hover { color: var(--warm-soft); }

/* ---------- Research page ---------- */
.theme-section { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; padding: 80px 0; border-top: 1px solid var(--line); }
.theme-section:first-child { border-top: 0; }
.theme-section .figure-box { flex: 1 1 360px; max-width: 460px; aspect-ratio: auto; }
.theme-section .figure-box img { height: auto; }
.theme-body { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.theme-body h2 { font-size: clamp(28px, 3vw, 38px); font-weight: 700; }
.theme-body p { color: #2C3A43; max-width: 720px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chips li { font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; color: var(--text-2); }
.related h3 { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 15.5px; line-height: 1.45; }
.related li a { text-decoration: none; font-weight: 600; }
.related li span { color: var(--muted); }

/* ---------- Team page ---------- */
.pi { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.pi .photo { flex: 0 1 340px; min-width: 240px; aspect-ratio: 4 / 5; border-radius: 18px; }
.pi-body { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.pi-body h2 { font-size: 40px; font-weight: 700; }
.pi-role { font-size: 18px; color: var(--text-2); }
.pi-body p { max-width: 680px; color: #2C3A43; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.photo { position: relative; background: var(--placeholder); border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 40px; font-weight: 600; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 32px 28px; }
.member { display: flex; flex-direction: column; gap: 10px; }
.member .photo { aspect-ratio: 1 / 1; margin-bottom: 4px; }
.member h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.member .role { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.member p { font-size: 15.5px; line-height: 1.55; color: var(--text-2); }

.table-box { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.table-box table { width: 100%; border-collapse: collapse; font-size: 15.5px; min-width: 600px; }
.table-box th { text-align: left; font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; color: var(--muted); padding: 16px 24px; border-bottom: 1px solid var(--line); }
.table-box td { padding: 14px 24px; border-bottom: 1px solid #EEF1F2; vertical-align: top; }
.table-box tr:last-child td { border-bottom: 0; }
.table-box td:first-child { font-weight: 600; }
.table-box td:last-child { color: var(--muted); }

/* ---------- Publications page ---------- */
.pub-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 18px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn { font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 18px; border-radius: 999px; cursor: pointer; background: #fff; color: var(--ink-2); border: 1px solid var(--line-2); }
.filter-btn:hover { border-color: var(--ink-2); }
.filter-btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line-2); border-radius: 999px; padding: 0 18px; min-height: 44px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,106,133,0.15); }
.search input { border: 0; outline: none; font: inherit; font-size: 15.5px; color: var(--ink-2); background: transparent; flex: 1; min-width: 0; height: 42px; }
.pub-count { font-size: 15px; color: var(--muted); margin-top: 4px; }

.pub-year { display: flex; flex-wrap: wrap; gap: 8px 48px; padding-top: 8px; }
.pub-year + .pub-year { margin-top: 40px; }
.pub-year > h2 { flex: 0 0 120px; font-size: 26px; font-weight: 700; padding-top: 18px; }
.pub-year > ol { flex: 999 1 560px; min-width: 0; list-style: none; margin: 0; padding: 0; }
.pub { padding: 20px 0; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.pub:target { background: #FFF6EF; box-shadow: -12px 0 0 #FFF6EF, 12px 0 0 #FFF6EF; }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.pub-num { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.tag { font-size: 12.5px; color: var(--muted); background: #EEF2F3; padding: 2px 10px; border-radius: 999px; }
.tag--student { color: #7A3412; background: #FBE9DF; }
.tag--invited { color: #070707; background: #abb4e8; }
.pub-cite { font-size: 16px; line-height: 1.55; color: #2C3A43; }
.pub-cite b { color: var(--ink-2); }
.pub-links { display: flex; gap: 18px; margin-top: 8px; font-size: 14.5px; font-weight: 600; }
.pub-links a { text-decoration: none; }
.pub-empty { display: none; font-size: 17px; color: var(--muted); }
.pub-empty.is-visible { display: block; }
.pub-section-title { font-size: 30px; font-weight: 700; margin: 80px 0 16px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 16px 0; border-top: 1px solid var(--line); font-size: 15.5px; line-height: 1.55; color: #2C3A43; }

/* ---------- Teaching ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.course { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.course .code { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: 0.04em; }
.course h3 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.course p { font-size: 15.5px; color: var(--text-2); }
.course .when { font-size: 14px; color: var(--muted); margin-top: auto; }

/* ---------- Opportunities / contact ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.info-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.info-card h2 { font-size: 24px; font-weight: 700; }
.info-card p { font-size: 16px; color: var(--text-2); }
.info-card ul { margin: 0; padding-left: 1.2em; color: var(--text-2); font-size: 16px; }
.info-card .btn { align-self: flex-start; margin-top: auto; }
.contact-row { display: flex; gap: 14px; align-items: flex-start; }
.contact-row svg { flex: none; margin-top: 3px; stroke: var(--accent); }
.map-box { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 9; background: var(--placeholder); }
.map-box iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 64px 0 32px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 40px; }
.footer-grid > div { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.footer-grid strong { font-size: 17px; }
.footer-label { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; margin-bottom: 2px; }
.footer-grid a { text-decoration: none; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid #D3DBDF; font-size: 13.5px; color: var(--muted); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 24px 20px; box-shadow: 0 12px 24px rgba(14,36,51,0.08); }
  .site-header--dark .nav-links { background: var(--ink); border-bottom-color: rgba(255,255,255,0.12); }
  .nav-links.is-open { display: flex; }
  .nav-links li a { display: block; padding: 12px 0; font-size: 17px; }
  .nav-links li + li { border-top: 1px solid var(--line); }
  .site-header--dark .nav-links li + li { border-top-color: rgba(255,255,255,0.12); }
  .nav-links li:last-child { border-top: 0; padding-top: 12px; }
  .nav-links .btn { display: flex; width: 100%; }
  .nav-links a[aria-current="page"] { box-shadow: none; color: var(--accent); }
  .site-header--dark .nav-links a[aria-current="page"] { color: var(--warm-soft); }
  .section { padding: 64px 0; }
  .hero .container { padding-top: 72px; padding-bottom: 80px; }
  .theme-section { padding: 56px 0; gap: 28px; }
  .pub-year > h2 { padding-top: 0; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .news-list li { flex-direction: column; gap: 4px; }
  .news-date { flex: none; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media print { .site-header, .site-footer, .pub-tools { display: none; } }
