:root {
  /* Layout idea: a plant-floor logbook. Steel ink on cool paper, one hi-vis amber rule marking what matters, mono labels for tenures and units. */
  --paper: #f5f6f4;
  --surface: #ffffff;
  --ink: #16212b;
  --muted: #56636e;
  --line: #d9dee2;
  --accent: #1d5f6b;
  --accent-soft: #e3eef0;
  --hivis: #e08a1e;
  --font-display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --font-body: "Public Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1120px;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10171d;
    --surface: #172129;
    --ink: #e7ecef;
    --muted: #9eabb5;
    --line: #2a3742;
    --accent: #6fb7c2;
    --accent-soft: #1b3036;
    --hivis: #f0a443;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10171d;
  --surface: #172129;
  --ink: #e7ecef;
  --muted: #9eabb5;
  --line: #2a3742;
  --accent: #6fb7c2;
  --accent-soft: #1b3036;
  --hivis: #f0a443;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--hivis); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-stretch: 87%; line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.02em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 10px; height: 22px; background: var(--hivis); border-radius: 2px; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 8px 12px; border-radius: var(--radius); }
.nav a:hover, .nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .nav-cta { background: var(--ink); color: var(--paper); margin-left: 6px; }
.nav .nav-cta:hover { background: var(--accent); color: #fff; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius); padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 960px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav .nav-cta { margin-left: 0; text-align: center; }
}

/* Hero */
.hero { padding: 56px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.35fr 1fr; gap: 48px; align-items: center; }
.eyebrow { color: var(--muted); display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.eyebrow::before { content: ""; width: 28px; height: 3px; background: var(--hivis); }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 3.7rem); font-weight: 700; letter-spacing: -0.01em; }
.hero .role { font-family: var(--font-display); font-size: clamp(1.15rem, 2.2vw, 1.45rem); font-weight: 600; color: var(--accent); margin-top: 10px; }
.hero .tagline { font-size: 1.15rem; max-width: 34em; margin-top: 20px; color: var(--ink); }
.hero .sub { color: var(--muted); max-width: 36em; margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: var(--radius); font-weight: 600; text-decoration: none; border: 1.5px solid var(--ink); color: var(--ink); background: transparent; font-size: 0.98rem; }
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.portrait { position: relative; }
.portrait img { border-radius: var(--radius); aspect-ratio: 4 / 5; height: auto; object-fit: cover; object-position: 50% 20%; width: 100%; max-width: 360px; margin-left: auto; box-shadow: 0 20px 40px -24px rgba(16, 23, 29, 0.45); }
.portrait figcaption { color: var(--muted); text-align: right; margin-top: 10px; }
@media (max-width: 860px) {
  .hero { padding-top: 32px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 28px; }
  .portrait { order: -1; }
  .portrait img { max-width: 150px; margin: 0; aspect-ratio: 1 / 1; object-position: 50% 25%; }
  .portrait figcaption { display: none; }
  .portrait figcaption { text-align: left; }
}

/* Key numbers */
.figures { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.figures ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.figures li { padding: 22px 20px; border-left: 1px solid var(--line); }
.figures li:first-child { border-left: 0; }
.figures .num { font-family: var(--font-display); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.figures .lbl { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
@media (max-width: 860px) {
  .figures ul { grid-template-columns: repeat(2, 1fr); }
  .figures li { border-left: 0; border-top: 1px solid var(--line); }
  .figures li:nth-child(-n+2) { border-top: 0; }
  .figures li:nth-child(even) { border-left: 1px solid var(--line); }
  .figures li:last-child { grid-column: 1 / -1; border-left: 0; }
}

/* Sections */
section.block { padding: 72px 0; }
section.block + section.block { border-top: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: 220px 1fr; gap: 32px; margin-bottom: 36px; align-items: end; }
.section-head .mono { color: var(--muted); }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); font-weight: 700; }
.section-head p { color: var(--muted); max-width: 40em; margin-top: 8px; }
.body-grid { display: grid; grid-template-columns: 220px 1fr; gap: 32px; }
@media (max-width: 860px) {
  section.block { padding: 52px 0; }
  .section-head, .body-grid { grid-template-columns: 1fr; gap: 8px; }
  .body-grid { gap: 20px; }
}

/* Highlights */
.highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 10px; transition: border-color 0.15s; }
.hl:hover { border-color: var(--accent); }
.hl h3 { font-size: 1.3rem; }
.hl p { color: var(--muted); font-size: 0.97rem; }
.hl .go { margin-top: auto; color: var(--accent); font-weight: 600; font-size: 0.95rem; }
@media (max-width: 860px) { .highlights { grid-template-columns: 1fr; } }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.pub { display: grid; grid-template-columns: 90px 1fr; gap: 20px; padding: 20px 0; border-top: 1px solid var(--line); }
.pub:last-child { border-bottom: 1px solid var(--line); }
.pub .yr { font-family: var(--font-mono); color: var(--muted); font-size: 0.9rem; padding-top: 2px; }
.pub h3 { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
.pub h3 a { color: var(--ink); text-decoration: none; }
.pub h3 a:hover { color: var(--accent); text-decoration: underline; }
.pub .venue { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.pub .authors { font-size: 0.95rem; margin-top: 4px; }
.status { display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; vertical-align: 2px; }
.status.ok { border-color: var(--accent); color: var(--accent); }
@media (max-width: 600px) { .pub { grid-template-columns: 1fr; gap: 4px; } }
.more-link { margin-top: 20px; display: inline-block; font-weight: 600; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.job { display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 28px 0; border-top: 1px solid var(--line); }
.job:last-child { border-bottom: 1px solid var(--line); }
.job .when { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.job .org { font-weight: 600; color: var(--ink); font-family: var(--font-body); font-size: 0.95rem; margin-top: 6px; }
.job .loc { color: var(--muted); font-size: 0.9rem; }
.job h3 { font-size: 1.3rem; }
.job ul { margin: 12px 0 0; padding-left: 1.1em; max-width: 44em; }
.job li { margin: 6px 0; }
.job li::marker { color: var(--hivis); }
.job.now h3::after { content: "Current"; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; color: var(--accent); border: 1px solid var(--accent); border-radius: 99px; padding: 1px 8px; margin-left: 10px; vertical-align: 4px; }
.group-label { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 36px 0 4px; }
.group-label:first-child { margin-top: 0; }
@media (max-width: 860px) { .job { grid-template-columns: 1fr; gap: 6px; } }

/* Projects */
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.feature-top { display: grid; grid-template-columns: 1.1fr 1fr; }
.feature-text { padding: 32px; display: flex; flex-direction: column; gap: 12px; }
.feature-text h3 { font-size: 1.7rem; }
.feature-text .meta { color: var(--muted); }
.feature-text .lead { font-size: 1.05rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font-family: var(--font-mono); font-size: 0.75rem; background: var(--accent-soft); color: var(--accent); padding: 3px 9px; border-radius: 4px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.links .btn { padding: 9px 16px; font-size: 0.92rem; }
.media { background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; min-height: 280px; position: relative; padding: 24px; }
.media .ph { text-align: center; max-width: 22em; }
.media .ph strong { display: block; font-family: var(--font-display); font-size: 1.15rem; margin: 10px 0 4px; }
.media .ph span { font-size: 0.9rem; opacity: 0.75; }
.play { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--hivis); display: inline-flex; align-items: center; justify-content: center; }
.play::after { content: ""; border-left: 16px solid var(--hivis); border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 4px; }
.media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media.has-video { padding: 0; }
.poster { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .play { position: relative; width: 72px; height: 72px; background: rgba(22, 33, 43, 0.82); border-color: var(--hivis); transition: transform 0.15s; }
.poster:hover .play, .poster:focus-visible .play { transform: scale(1.08); }
.case { border-top: 1px solid var(--line); }
.case summary { cursor: pointer; padding: 16px 32px; font-weight: 600; color: var(--accent); list-style: none; display: flex; align-items: center; gap: 10px; }
.case summary::-webkit-details-marker { display: none; }
.case summary::before { content: "+"; font-family: var(--font-mono); font-size: 1.1rem; width: 1em; }
.case[open] summary::before { content: "\2212"; }
.case-body { padding: 0 32px 32px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 40px; }
.case-body h4 { font-size: 1.05rem; margin-bottom: 6px; }
.case-body ul { margin: 0; padding-left: 1.1em; }
.case-body li { margin: 4px 0; }
.case-body .full { grid-column: 1 / -1; }
.result-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.result { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.result .num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.result .lbl { font-size: 0.88rem; color: var(--muted); }
.note { font-size: 0.88rem; color: var(--muted); font-style: italic; }
@media (max-width: 860px) {
  .feature-top { grid-template-columns: 1fr; }
  .media { min-height: 220px; }
  .feature-text { padding: 24px; }
  .case summary { padding: 16px 24px; }
  .case-body { padding: 0 24px 24px; grid-template-columns: 1fr; }
  .result-row { grid-template-columns: 1fr; }
}
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.card .kind { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.card h3 { font-size: 1.15rem; }
.card p { font-size: 0.95rem; color: var(--muted); }
.card .links { margin-top: auto; padding-top: 6px; }
.card .links a { font-weight: 600; font-size: 0.92rem; }
@media (max-width: 960px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }
.sub-head { font-family: var(--font-display); font-size: 1.3rem; margin: 40px 0 14px; }

/* Research */
.research-now { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--hivis); border-radius: var(--radius); padding: 28px; }
.research-now h3 { font-size: 1.45rem; margin-bottom: 10px; }
.research-now p + p { margin-top: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--surface); }
.panel h3 { font-size: 1.1rem; margin-bottom: 8px; }
.panel p { color: var(--muted); font-size: 0.97rem; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* About */
.story { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: s; }
.story li { counter-increment: s; border-top: 3px solid var(--ink); padding-top: 14px; }
.story li:last-child { border-top-color: var(--hivis); }
.story li::before { content: "0" counter(s); font-family: var(--font-mono); color: var(--muted); font-size: 0.8rem; }
.story h3 { font-size: 1.15rem; margin: 6px 0 8px; }
.story p { font-size: 0.95rem; color: var(--muted); }
@media (max-width: 960px) { .story { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .story { grid-template-columns: 1fr; } }
.edu { list-style: none; margin: 0; padding: 0; }
.edu li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.edu li:last-child { border-bottom: 1px solid var(--line); }
.edu strong { font-weight: 600; }
.edu .where { color: var(--muted); font-size: 0.95rem; grid-column: 1; }
.edu .when { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); grid-row: 1; grid-column: 2; text-align: right; }
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; }
.skills h4 { font-size: 1rem; margin-bottom: 6px; }
.skills p { color: var(--muted); font-size: 0.95rem; }
@media (max-width: 600px) { .skills { grid-template-columns: 1fr; } .edu li { grid-template-columns: 1fr; } .edu .when { grid-row: auto; grid-column: 1; text-align: left; } }
.about-stack { display: grid; gap: 40px; }


/* Page intro spacing */
.page-intro { padding-top: 56px; }
.page-intro.block { border-top: 0; }
@media (max-width: 860px) { .page-intro { padding-top: 36px; } }

/* Contact page */
.contact-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: start; }
.contact-main { display: grid; gap: 20px; }
.email-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.email-card .k, .profiles .k, .cv-card .k { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.email-address { display: block; font-family: var(--font-display); font-stretch: 87%; font-weight: 700; font-size: clamp(1.25rem, 2.6vw, 1.7rem); color: var(--ink); text-decoration: none; margin: 8px 0 18px; overflow-wrap: anywhere; }
.email-address:hover { color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.small { padding: 9px 16px; font-size: 0.92rem; cursor: pointer; font-family: inherit; }
.cv-card { border: 1px solid var(--line); border-left: 4px solid var(--hivis); border-radius: var(--radius); padding: 24px 28px; background: var(--surface); }
.cv-card h3 { font-size: 1.3rem; margin: 6px 0 16px; }
.cv-card p { color: var(--muted); margin-bottom: 16px; max-width: 34em; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.facts li { border-top: 1px solid var(--line); padding-top: 10px; }
.facts .k { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); display: block; }
.facts .v { font-weight: 500; }
.profiles { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.profiles li { border-bottom: 1px solid var(--line); }
.profiles a { display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; align-items: center; padding: 16px 8px; text-decoration: none; color: var(--ink); border-radius: var(--radius); }
.profiles a:hover { background: var(--accent-soft); }
.profiles a:hover .arrow { transform: translate(2px, -2px); color: var(--accent); }
.badge { width: 44px; height: 44px; border-radius: 8px; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 500; font-size: 0.9rem; }
.profiles .name { font-weight: 600; display: block; }
.profiles .handle { color: var(--muted); font-size: 0.92rem; display: block; overflow-wrap: anywhere; }
.arrow { color: var(--muted); font-size: 1.2rem; transition: transform 0.15s; }
.profiles-head { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 12px; }
@media (max-width: 860px) { .contact-layout { grid-template-columns: 1fr; gap: 36px; } .email-card, .cv-card { padding: 22px; } }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; } }

/* Closing band on every page */
.cta-band { border-top: 1px solid var(--line); background: var(--surface); }
.cta-band .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-top: 36px; padding-bottom: 36px; }
.cta-band h2 { font-size: 1.5rem; }
.cta-band p { color: var(--muted); margin-top: 4px; }

footer { background: var(--paper); color: var(--muted); border-top: 1px solid var(--line); padding: 22px 0; font-size: 0.88rem; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
footer a { color: inherit; }
footer a:hover { color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); font-size: 0.92rem; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 80; }
.toast.show { opacity: 1; }

.details-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-weight: 600; font-size: 0.92rem; }
.details-link::after { content: "\2192"; transition: transform 0.15s; }
.details-link:hover::after { transform: translateX(3px); }

.focus { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.focus li { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 5px 10px; }
