/* ==========================================================================
   Design A: "Editorial"
   Light, warm paper background, serif display type, sticky top bar,
   full-bleed sea-ice hero. Dark mode follows the system setting.
   ========================================================================== */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1c2227;
  --muted: #5d6872;
  --line: #e6e2d9;
  --accent: #0d5c78;
  --accent-strong: #08435a;
  --accent-soft: #e2eef3;
  --warm: #a9502a;
  --warm-soft: #f7e8df;
  --figure-bg: #ffffff;
  --icon-knockout: var(--surface);
  --shadow: 0 1px 2px rgba(20, 30, 40, .05), 0 10px 30px rgba(20, 30, 40, .07);
  --radius: 14px;
  --maxw: 1120px;
  --narrow: 780px;
  --header-h: 64px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --surface: #161d22;
    --surface-2: #1c252c;
    --text: #e6e9ec;
    --muted: #9ba7b0;
    --line: #27323b;
    --accent: #72c4df;
    --accent-strong: #a3dbee;
    --accent-soft: #15303c;
    --warm: #eb9b72;
    --warm-soft: #3a2419;
    --figure-bg: #f4f4f2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--toolbar-h, 0px) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.7 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.15em; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: var(--narrow); }
@media (max-width: 600px) { .container { padding: 0 16px; } }

.eyebrow { font: 600 .78rem/1.4 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--warm); margin: 0 0 .75rem; }
.section-title { font-size: 1.75rem; margin-bottom: 1rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .7em 1.2em; border-radius: 999px;
  font: 600 .95rem/1 var(--sans); text-decoration: none;
  border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.btn-primary { background: #fff; color: #0b3346; }
.btn-primary:hover { background: #e7f2f6; color: #0b3346; }
.btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .55); }
.btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.btn-light { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .35); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { font: 600 1.3rem/1 var(--serif); color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem;
  padding: .45em .85em; border-radius: 999px; transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-toggle, .nav-burger { display: none; }

@media (max-width: 760px) {
  .nav-toggle { display: block; position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
  .nav-toggle:focus-visible + .nav-burger { outline: 2px solid var(--accent); outline-offset: 2px; }
  .nav-burger { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; border-radius: 10px; }
  .nav-burger span, .nav-burger span::before, .nav-burger span::after {
    content: ""; display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; position: relative; transition: transform .2s;
  }
  .nav-burger span::before { position: absolute; top: -6px; }
  .nav-burger span::after { position: absolute; top: 6px; }
  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    display: none;
  }
  .site-nav a { padding: .8em .9em; border-radius: 10px; }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .nav-toggle:checked + .nav-burger span { background: transparent; }
  .nav-toggle:checked + .nav-burger span::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked + .nav-burger span::after { transform: translateY(-6px) rotate(-45deg); }
}

/* ---------- Home: hero ---------- */
.hero {
  position: relative; color: #fff;
  min-height: clamp(380px, 58vh, 540px);
  display: flex; align-items: flex-end;
  background:
    linear-gradient(180deg, rgba(6, 22, 33, .15) 0%, rgba(6, 22, 33, .55) 55%, rgba(6, 22, 33, .85) 100%),
    var(--hero-img) center 40% / cover no-repeat, #0b3346;
}
.hero-inner { padding-top: 64px; padding-bottom: 56px; }
.hero .eyebrow { color: #bfe3f0; }
.hero h1 { font-size: clamp(2.6rem, 6.5vw, 4.6rem); font-weight: 700; letter-spacing: -.02em; margin-bottom: .3em; }
.hero-sub { font: 400 clamp(1.08rem, 2vw, 1.3rem)/1.55 var(--serif); max-width: 52ch; color: #e8f1f5; margin: 0 0 1.8rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Home: about + profile ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; padding-top: 72px; padding-bottom: 56px; align-items: start; }
.about .about-text { padding: 0; }
.about-text p { font-size: 1.06rem; }
.profile-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.profile-card img { aspect-ratio: 4 / 4.2; object-fit: cover; object-position: 50% 20%; width: 100%; }
.profile-body { padding: 20px 22px 22px; }
.profile-name { font: 600 1.15rem/1.3 var(--serif); margin: 0 0 12px; }
.contact-list { list-style: none; margin: 0 0 16px; padding: 0; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.contact-list li { display: flex; gap: 10px; padding: 6px 0; }
.contact-list .icon { margin-top: .2em; color: var(--accent); }
.contact-list a { word-break: break-all; }
.icon-links { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; }
.icon-links a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  color: var(--muted); background: var(--surface-2); transition: color .15s, background .15s;
}
.icon-links a:hover { color: var(--accent); background: var(--accent-soft); --icon-knockout: var(--accent-soft); }
.icon-links .icon { width: 20px; height: 20px; }
.icon-links a { --icon-knockout: var(--surface-2); }
@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; }
  .profile-card { display: grid; grid-template-columns: 160px 1fr; }
  .profile-card img { height: 100%; aspect-ratio: auto; }
}
@media (max-width: 520px) { .profile-card { grid-template-columns: 1fr; } .profile-card img { aspect-ratio: 1; } }

/* ---------- Home: project highlight ---------- */
.highlight {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 40px;
  padding: 44px; border-radius: 20px; text-decoration: none; color: #e6f1f5;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(114, 196, 223, .28) 0%, transparent 55%),
    linear-gradient(135deg, #082c3d 0%, #0d5c78 100%);
  box-shadow: var(--shadow); transition: transform .2s;
}
.highlight:hover { color: #e6f1f5; transform: translateY(-2px); }
.highlight .eyebrow { color: #9fd6ea; }
.highlight h2 { font-size: 2.4rem; color: #fff; margin-bottom: .2em; }
.highlight-title { font: italic 400 1.2rem/1.45 var(--serif); color: #fff; margin: 0 0 1rem; }
.highlight p { margin: 0 0 1.4rem; }
.highlight-facts { margin: 0; display: grid; gap: 14px; align-content: center; }
.highlight-facts div { padding: 14px 18px; border-radius: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.highlight-facts dt { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: #9fd6ea; }
.highlight-facts dd { margin: 2px 0 0; font: 600 1.05rem/1.4 var(--serif); color: #fff; }
@media (max-width: 860px) { .highlight { grid-template-columns: 1fr; padding: 28px 22px; gap: 24px; } .highlight h2 { font-size: 2rem; } }

/* ---------- Home: themes + news ---------- */
.themes, .news { padding-top: 72px; }
.news { padding-bottom: 80px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.more-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .95rem; text-decoration: none; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.theme-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.theme-card:hover { color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow); }
.theme-img { background: var(--figure-bg); aspect-ratio: 16 / 9; padding: 14px; border-bottom: 1px solid var(--line); }
.theme-img img { width: 100%; height: 100%; object-fit: contain; }
.theme-card h3 { font-size: 1.25rem; margin: 18px 20px 6px; }
.theme-card p { margin: 0 20px 22px; color: var(--muted); font-size: .95rem; line-height: 1.6; }

.news-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.news-list li { display: grid; grid-template-columns: 110px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.news-list time { font-size: .85rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .15em; }
.news-list p { margin: 0; }
.news-list a { display: inline-flex; vertical-align: middle; }
@media (max-width: 520px) { .news-list li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Inner pages ---------- */
.page-hero { padding: 64px 0 36px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--bg)); }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 700; margin: 0; }
.page-subtitle { font: italic 400 1.2rem/1.5 var(--serif); color: var(--muted); margin: .6rem 0 0; max-width: 60ch; }
.prose { padding-top: 40px; padding-bottom: 88px; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose h2 { font-size: 1.7rem; margin-top: 2.4em; padding-top: .2em; }
.prose h3 { font-size: 1.3rem; margin-top: 2em; }
.prose h2:first-child, .prose nav + h2 { margin-top: 1.2em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: .35em 0; }
.prose .lead { font: 400 1.25rem/1.6 var(--serif); color: var(--text); }
.prose figure { margin: 2em 0 2.4em; }
.prose figure img { background: var(--figure-bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; }
.prose figcaption { font-size: .88rem; line-height: 1.55; color: var(--muted); margin-top: .8em; }
.prose figcaption b { color: var(--text); }
.prose table { width: 100%; border-collapse: collapse; font-size: .97rem; margin: 0 0 1.5em; }
.prose td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose td:first-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; width: 9.5em; }
@media (max-width: 520px) { .prose td:first-child { width: auto; white-space: normal; } }

.toc { display: flex; flex-wrap: wrap; gap: 8px; }
.toc a {
  font-size: .88rem; font-weight: 500; text-decoration: none; color: var(--accent);
  padding: .45em .95em; border-radius: 999px; background: var(--accent-soft);
}
.toc a:hover { background: var(--accent); color: var(--bg); }

/* ---------- BGCTip components ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 1.8em 0 .5em; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.fact-label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--warm); font-weight: 600; }
.fact-value { font: 600 1rem/1.35 var(--serif); }

.wp-figure { margin: 2em 0 2.4em !important; }
.wp-input {
  text-align: center; font-size: .88rem; color: var(--muted); padding: 12px 16px;
  border: 1.5px dashed var(--line); border-radius: 12px; margin-bottom: 14px;
}
.wp-flow { display: grid; grid-template-columns: 1fr 34px 1fr 34px 1fr; align-items: stretch; }
.wp-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 12px; padding: 18px 18px 14px; box-shadow: var(--shadow); }
.wp-card:nth-child(3) { border-top-color: var(--warm); }
.wp-card:nth-child(5) { border-top-color: #4b8a5f; }
.wp-tag { display: inline-block; font: 700 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.wp-card h3 { font-size: 1.1rem; margin: 0 0 .5em; }
.wp-card p { font-size: .88rem; line-height: 1.55; color: var(--muted); margin: 0 0 .8em; }
.wp-points { list-style: none; padding: 0 !important; margin: 0 !important; font-size: .85rem; }
.wp-points li { padding: 5px 0; border-top: 1px solid var(--line); margin: 0 !important; }
.wp-arrow { display: grid; place-items: center; position: relative; }
.wp-arrow::before { content: "→"; font-size: 1.4rem; color: var(--muted); }
.wp-arrow span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wp-base {
  margin-top: 14px; padding: 12px 16px; border-radius: 12px; text-align: center;
  background: var(--accent); color: var(--bg); font-weight: 600; font-size: .9rem;
}
@media (max-width: 760px) {
  .wp-flow { grid-template-columns: 1fr; }
  .wp-arrow { height: 34px; }
  .wp-arrow::before { content: "↓"; }
}

.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.member { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.member-role { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--warm); font-weight: 600; }
.member-name { font: 600 1.05rem/1.3 var(--serif); }
.member-name:empty { display: none; }
.member-topic { font-size: .88rem; color: var(--muted); line-height: 1.45; }

.funding { display: flex; gap: 18px; align-items: flex-start; margin-top: 3em !important; padding: 18px; border-radius: 12px; background: var(--surface-2); }
.eu-flag { width: 72px; flex: none; border-radius: 3px; }
.funding p { font-size: .82rem; line-height: 1.55; color: var(--muted); margin: 0 !important; }

/* ---------- Publications ---------- */
.pub-links { color: var(--muted); }
.pub-toolbar {
  position: sticky; top: var(--header-h); z-index: 10;
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  padding: 14px 0; margin: 0 0 8px !important; background: var(--bg); border-bottom: 1px solid var(--line);
}
.pub-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.pub-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pub-search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.pub-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: .95rem; padding: 10px 0; }
.pub-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.pub-filters button {
  font: 500 .85rem/1 var(--sans); padding: .6em 1em; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.pub-filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.pub-count { margin: 0 !important; font-size: .85rem; color: var(--muted); width: 100%; }

.pub-group { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0 24px; margin: 0 !important; border-bottom: 1px solid var(--line); padding: 18px 0; }
.pub-group[hidden] { display: none; }
.pub-group h3 { margin: 0; padding-top: 14px; font-size: 1.5rem; color: var(--accent); position: sticky; top: calc(var(--header-h) + var(--toolbar-h, 0px)); align-self: start; }
.pub-group[data-kind="review"] h3, .pub-group[data-kind="other"] h3 { font-size: 1.05rem; line-height: 1.3; }
.pub-list { list-style: none; padding: 0 !important; margin: 0 !important; }
.pub { padding: 14px 0; margin: 0 !important; font-size: .95rem; line-height: 1.6; }
.pub + .pub { border-top: 1px dashed var(--line); }
.pub[hidden] { display: none; }
.pub ul { list-style: none; padding: 0; margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.pub strong.me { color: var(--text); font-weight: 700; box-shadow: inset 0 -.45em 0 var(--accent-soft); }
.pub a.doi {
  display: inline-block; font: 500 .78rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: .25em .6em; margin-left: .2em; border-radius: 6px; text-decoration: none;
  background: var(--surface-2); color: var(--accent); border: 1px solid var(--line); word-break: break-all;
}
.pub a.doi::before { content: "DOI "; font-weight: 700; }
.pub a.doi:hover { background: var(--accent-soft); }
.badge {
  display: inline-block; font: 600 .7rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  padding: .35em .6em; border-radius: 6px; margin-right: .5em; vertical-align: .1em;
  background: var(--warm-soft); color: var(--warm);
}
@media (max-width: 640px) {
  .pub-group { grid-template-columns: 1fr; }
  .pub-group h3 { position: static; padding-top: 4px; }
  .pub-toolbar { position: static; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); padding: 40px 0; font-size: .9rem; color: var(--muted); }
.footer-inner { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.footer-inner p { margin: 0 0 .8em; line-height: 1.6; }
.footer-name { font: 600 1.05rem/1.3 var(--serif); color: var(--text); }
.footer-meta { text-align: right; }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; gap: 16px; } .footer-meta { text-align: left; } }

/* 404 page (uses layout: default) */
.container h1 { font-family: var(--serif); }

/* Let the work-package figure use more width than the text column on large screens */
@media (min-width: 980px) {
  .wp-figure { width: min(1040px, calc(100vw - 64px)); position: relative; left: 50%; transform: translateX(-50%); }
}
