/* ===========================
   Landing page – design tokens
   =========================== */
:root {
    --paper: #f6f4ee;
    --paper-tint: #edeae0;
    --surface: #ffffff;
    --ink: #13292b;
    --ink-soft: #435557;
    --ink-muted: #6b7a7b;
    --line: #dcd8cc;
    --accent: #1f6b63;          /* deep sea green */
    --accent-strong: #154f49;
    --accent-soft: #dcebe6;
    --warm: #b8461f;            /* warming signal, used sparingly */
    --dark-bg: #0f2224;
    --dark-ink: #e8efec;
    --dark-muted: #a3b4b2;

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --radius: 14px;
    --radius-sm: 8px;
    --header-h: 68px;
    --maxw: 1160px;
    --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0e1a1b;
        --paper-tint: #132324;
        --surface: #172a2b;
        --ink: #e6eeeb;
        --ink-soft: #b9c7c4;
        --ink-muted: #8b9d9a;
        --line: #284042;
        --accent: #6cc3b4;
        --accent-strong: #8fd6c9;
        --accent-soft: #1d3a37;
        --warm: #f08a5d;
        --dark-bg: #081213;
    }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #0e1a1b;
    --paper-tint: #132324;
    --surface: #172a2b;
    --ink: #e6eeeb;
    --ink-soft: #b9c7c4;
    --ink-muted: #8b9d9a;
    --line: #284042;
    --accent: #6cc3b4;
    --accent-strong: #8fd6c9;
    --accent-soft: #1d3a37;
    --warm: #f08a5d;
    --dark-bg: #081213;
}

/* ===========================
   Base
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    transition: color .2s, text-decoration-color .2s;
}
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.25rem; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
    position: absolute; left: 16px; top: -48px; z-index: 100;
    background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

.eyebrow {
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .75rem;
}

/* Buttons & links */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 46px; padding: .7rem 1.35rem;
    border-radius: 999px; border: 1px solid transparent;
    font: 600 .95rem/1.2 var(--font-body);
    text-decoration: none; transition: background .2s, color .2s, border-color .2s, transform .2s;
    overflow-wrap: anywhere; text-align: center;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .btn-primary, :root:not([data-theme="light"]) .btn-primary:hover { color: #0b1718; }
}
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-primary:hover { color: #0b1718; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.text-link { font-weight: 600; font-size: .95rem; text-decoration: none; }
.text-link span { display: inline-block; transition: transform .2s; }
.text-link:hover span { transform: translateX(3px); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

/* ===========================
   Header / nav
   =========================== */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.nav { height: var(--header-h); display: flex; align-items: center; gap: .5rem; }
.nav .brand { margin-right: auto; }

.brand {
    display: inline-flex; align-items: center; gap: .6rem;
    font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
    color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark {
    display: inline-flex; align-items: baseline;
    font-family: 'Italiana', var(--font-display); font-weight: 400; font-size: 1.75rem; line-height: 1;
    -webkit-text-stroke: .012em currentColor;
}
.brand-s { color: var(--accent); }
.brand-a { color: var(--warm); opacity: .92; margin-left: -.3em; }

.nav-menu { display: flex; align-items: center; gap: .25rem; }
.nav-menu a {
    display: block; padding: .5rem .85rem; border-radius: 999px;
    color: var(--ink-soft); font-size: .95rem; font-weight: 500; text-decoration: none;
}
.nav-menu a:hover { color: var(--ink); background: var(--paper-tint); }
.nav-menu .nav-cv { border: 1px solid var(--line); color: var(--ink); margin-left: .35rem; }
.nav-menu a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }

.nav-toggle {
    display: none; width: 44px; height: 44px; border: 0; background: none; cursor: pointer;
    border-radius: var(--radius-sm); color: var(--ink);
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
    display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px;
    margin-inline: auto; position: relative; transition: transform .2s, background .2s;
}
.nav-toggle-bar::before, .nav-toggle-bar::after { content: ''; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

/* Light / dark switch: shows a moon in light mode, a sun in dark mode */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 999px;
    background: transparent; color: var(--ink-soft); cursor: pointer;
    transition: color .2s, background .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--ink); background: var(--paper-tint); border-color: var(--ink-muted); }
.theme-icon { transition: transform .4s ease; }
.theme-toggle:hover .theme-icon { transform: rotate(-15deg); }
.theme-icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }

@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .theme-toggle { order: 1; width: 44px; height: 44px; }
    .nav-toggle { order: 2; }
    .nav-menu {
        position: absolute; top: var(--header-h); left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0;
        padding: .5rem var(--gutter) 1rem;
        background: var(--paper); border-bottom: 1px solid var(--line);
        display: none;
    }
    .nav-menu.is-open { display: flex; }
    .nav-menu a { padding: .85rem .5rem; border-radius: var(--radius-sm); }
    .nav-menu .nav-cv { border: 0; margin-left: 0; }
}

/* ===========================
   Hero
   =========================== */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 6vw, 5rem);
    padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(2.5rem, 6vw, 4.5rem);
}

.hero-title {
    font-size: clamp(2.5rem, 6.2vw, 4.5rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.02;
    margin-bottom: 1.25rem;
}
.hero-lede {
    font-size: clamp(1.1rem, 1.8vw, 1.3rem);
    line-height: 1.55;
    color: var(--ink-soft);
    max-width: 36ch;
    margin-bottom: 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 2rem; }

.hero-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: .9rem; }
.hero-links a { color: var(--ink-muted); font-weight: 500; }
.hero-links a:hover { color: var(--accent); }

.hero-portrait { position: relative; max-width: 420px; justify-self: end; width: 100%; }
.hero-portrait img {
    width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%;
    border-radius: 200px 200px var(--radius) var(--radius);
    background: var(--paper-tint);
}
.hero-portrait figcaption {
    position: absolute; left: -1.25rem; bottom: 1.5rem; max-width: 80%;
    display: flex; align-items: flex-start; gap: .6rem;
    padding: .75rem 1rem; font-size: .85rem; line-height: 1.4; font-weight: 500;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px -12px rgba(15, 34, 36, .35);
}
.status-dot {
    flex: none; width: 8px; height: 8px; margin-top: .4em; border-radius: 50%;
    background: #2e9d6b; box-shadow: 0 0 0 4px color-mix(in srgb, #2e9d6b 22%, transparent);
}

@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; }
    .hero-portrait { justify-self: start; max-width: 320px; }
    .hero-portrait figcaption { left: auto; right: -.5rem; max-width: 85%; }
}
@media (max-width: 480px) {
    .hero-portrait { max-width: 260px; }
    .hero-portrait figcaption { right: auto; left: 0; bottom: -1rem; position: relative; margin-top: -1.5rem; max-width: 100%; }
    .hero-actions .btn { flex: 1 1 100%; }
}

/* ===========================
   Warming stripes band
   =========================== */
.stripes-band { position: relative; }
.stripes-band-canvas { display: block; width: 100%; height: clamp(56px, 8vw, 96px); }
.stripes-band-caption {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    padding-block: .75rem; font-size: .8125rem; color: var(--ink-muted);
}
.stripes-band-caption span:nth-child(2) { text-align: center; }
@media (max-width: 600px) {
    .stripes-band-caption { flex-wrap: wrap; }
    .stripes-band-caption span:nth-child(2) { order: 3; flex-basis: 100%; text-align: left; }
}

/* ===========================
   Facts
   =========================== */
.facts {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px; margin-block: clamp(2rem, 5vw, 3.5rem);
    background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; padding-inline: 0;
    width: calc(100% - 2 * var(--gutter));
}
.fact { background: var(--paper); padding: 1.5rem clamp(1.25rem, 2.5vw, 2rem); display: flex; flex-direction: column; gap: .25rem; }
.fact-value { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 600; line-height: 1; color: var(--accent); }
.fact-label { color: var(--ink-soft); font-size: .95rem; }
@media (max-width: 700px) { .facts { grid-template-columns: 1fr; } }

/* ===========================
   Sections
   =========================== */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-tint { background: var(--paper-tint); }
.section-head { max-width: 760px; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.section-head-row { max-width: none; display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.section-lede { margin-top: 1rem; color: var(--ink-soft); max-width: 62ch; }

/* About */
.about-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.prose p { color: var(--ink-soft); margin-bottom: 1.1rem; max-width: 66ch; }
.prose strong { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.chips li {
    padding: .35rem .85rem; border-radius: 999px; font-size: .875rem; font-weight: 500;
    background: var(--accent-soft); color: var(--accent-strong);
}
.education h3 { margin-bottom: 1.25rem; }
.edu-list { display: grid; gap: 1.25rem; margin-bottom: 1.5rem; }
.edu-list li { display: grid; grid-template-columns: 3.25rem 1fr; gap: .75rem; }
.edu-year { font-family: var(--font-display); font-weight: 600; color: var(--accent); padding-top: .1rem; }
.edu-list strong { display: block; font-weight: 600; margin-bottom: .15rem; }
.edu-list span:not(.edu-year) { display: block; color: var(--ink-muted); font-size: .9rem; line-height: 1.45; }
@media (max-width: 860px) { .about-body { grid-template-columns: 1fr; } }

/* Research themes */
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.theme { display: flex; flex-direction: column; gap: .9rem; transition: transform .25s, box-shadow .25s, border-color .25s; }
.theme:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 18px 40px -24px rgba(15, 34, 36, .45); }
.theme-num { font-family: var(--font-display); color: var(--warm); font-weight: 600; font-size: .95rem; }
.theme p { color: var(--ink-soft); font-size: .98rem; flex: 1; }
.theme-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.theme-tags li { font-size: .78rem; font-weight: 500; color: var(--ink-muted); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .65rem; }
@media (max-width: 900px) { .themes { grid-template-columns: 1fr; } }

/* Principles */
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 4vw, 3rem); }
.principle { border-top: 2px solid var(--ink); padding-top: 1.25rem; }
.principle h3 { margin-bottom: .6rem; }
.principle p { color: var(--ink-soft); font-size: .98rem; }
@media (max-width: 800px) { .principles { grid-template-columns: 1fr; } }

/* Publications */
.pubs { border-top: 1px solid var(--line); }
.pub { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; padding-block: 1.35rem; border-bottom: 1px solid var(--line); }
.pub-year { font-family: var(--font-display); font-weight: 600; color: var(--ink-muted); }
.pub-title { display: block; font-weight: 600; font-size: 1.05rem; line-height: 1.45; color: var(--ink); text-decoration: none; margin-bottom: .3rem; }
.pub-title:hover { color: var(--accent); }
.pub-meta { color: var(--ink-muted); font-size: .9rem; }
.pub-meta strong { color: var(--ink-soft); }
@media (max-width: 560px) { .pub { grid-template-columns: 1fr; gap: .25rem; } }

/* News */
.news { display: grid; gap: 0; max-width: 860px; }
.news li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1.25rem; padding-block: 1.1rem; border-bottom: 1px solid var(--line); }
.news li:first-child { border-top: 1px solid var(--line); }
.news time { font-size: .875rem; font-weight: 600; color: var(--accent); padding-top: .15rem; white-space: nowrap; }
.news p { color: var(--ink-soft); }
@media (max-width: 560px) { .news li { grid-template-columns: 1fr; gap: .2rem; } }

/* Climate context (dark band) */
.section-dark { background: var(--dark-bg); color: var(--dark-ink); }
.section-dark .eyebrow { color: #8fd6c9; }
.section-dark .section-lede { color: var(--dark-muted); }
.section-dark a { color: #8fd6c9; }
.stripes-container { position: relative; border-radius: var(--radius-sm); overflow: visible; }
.interactive-stripes { display: block; width: 100%; height: clamp(140px, 22vw, 240px); border-radius: var(--radius-sm); cursor: crosshair; }
.stripes-tooltip {
    position: absolute; top: -2.5rem; transform: translateX(-50%);
    padding: .35rem .65rem; border-radius: 6px; font-size: .85rem; font-weight: 600; white-space: nowrap;
    background: #fff; color: #13292b; pointer-events: none; opacity: 0; transition: opacity .15s;
}
.stripes-labels { display: flex; justify-content: space-between; margin-top: .6rem; font-size: .8rem; color: var(--dark-muted); }

/* ===========================
   Footer
   =========================== */
.footer { background: var(--paper); border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem; padding-block: clamp(3rem, 7vw, 5rem); align-items: end; }
.footer-title { font-size: clamp(1.6rem, 3vw, 2.25rem); margin-bottom: 1.5rem; max-width: 20ch; }
.footer-info p { color: var(--ink-soft); font-size: .95rem; margin-bottom: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: .9rem; }
.footer-links a { color: var(--ink-soft); font-weight: 500; }
.footer-stripes { display: block; width: 100%; height: 10px; }
.footer-bottom { padding-block: 1.25rem; font-size: .8125rem; color: var(--ink-muted); }
.footer-bottom a { color: var(--ink-muted); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ===========================
   Inner pages
   =========================== */
.page-hero { padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem); }
.page-hero h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); letter-spacing: -0.02em; margin-bottom: 1rem; }
.page-hero .section-lede { margin-top: 0; font-size: 1.15rem; }
.page-stripes { display: block; width: 100%; height: 10px; }
.page-body { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3.5rem, 8vw, 6rem); }

.page-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.25rem; font-size: .95rem; }

/* Publications page */
.pub-group + .pub-group { margin-top: clamp(2.5rem, 6vw, 4rem); }
.pub-group-title { font-size: clamp(1.4rem, 2.6vw, 1.85rem); margin-bottom: 1.25rem; }
.pubs-plain .pub { grid-template-columns: 1fr; }
.pub-title-text { display: block; font-weight: 600; font-size: 1.05rem; line-height: 1.45; color: var(--ink); margin-bottom: .3rem; }
.pub-meta + .pub-meta { margin-top: .15rem; }
.pub-meta .highlight { color: var(--ink-soft); font-weight: 600; }
.pub-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.pub-actions a {
    font-size: .8rem; font-weight: 600; text-decoration: none;
    padding: .25rem .7rem; border-radius: 999px;
    border: 1px solid var(--line); color: var(--accent);
}
.pub-actions a:hover { border-color: var(--accent); }

/* Research page */
.projects { display: grid; gap: 1.25rem; }
.project { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: clamp(1rem, 4vw, 3rem); }
.project-side { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.project-badge {
    font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    padding: .25rem .7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong);
}
.project-badge.is-past { background: var(--paper-tint); color: var(--ink-muted); }
.project-side h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); }
.project-body p { color: var(--ink-soft); margin-bottom: 1rem; }
.project-body .theme-tags { margin-bottom: 1rem; }
.project-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
@media (max-width: 760px) { .project { grid-template-columns: 1fr; } }

/* Notice (e.g. page in progress) */
.notice { max-width: 640px; }
.notice h2 { margin-bottom: .75rem; }
.notice p { color: var(--ink-soft); margin-bottom: 1.25rem; }

/* ===========================
   Reveal on scroll (only when JS runs)
   =========================== */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .js .reveal { opacity: 1; transform: none; }
}
