/* ============================================================
   Alexander Hermann - hermann-innovation.com
   Design system: cool graphite ground, single amber accent,
   serif display + system sans + monospace metadata.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Light theme (default) - built on the site's warm Astra palette */
  --paper:      #fbf1ea;
  --surface:    #ffffff;
  --surface-2:  #f7e7dd;
  --ink:        #1a1413;
  --ink-soft:   #3b2d28;
  --muted:      #7c6a61;
  --line:       #ecd9cf;
  --line-soft:  #f4e6dd;
  --accent:     #7a0a0a;
  --accent-strong: #5c0304;
  --accent-tint: #fbe3d9;
  --on-accent:  #fff1ea;
  --shadow:     0 1px 2px rgba(74,26,20,.05), 0 8px 30px rgba(74,26,20,.08);
  --shadow-lg:  0 24px 60px rgba(74,26,20,.14);

  /* Typography */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, "Liberation Mono", monospace;

  --fs-display: clamp(2.55rem, 1.4rem + 4.6vw, 4.3rem);
  --fs-h2:      clamp(1.75rem, 1.2rem + 1.9vw, 2.55rem);
  --fs-h3:      clamp(1.2rem, 1.05rem + 0.6vw, 1.45rem);
  --fs-lead:    clamp(1.08rem, 1.02rem + 0.4vw, 1.28rem);
  --fs-body:    1.0625rem;
  --fs-small:   0.9rem;
  --fs-label:   0.72rem;

  /* Layout */
  --container: 1140px;
  --container-narrow: 760px;
  --pad-x: clamp(1.4rem, 0.6rem + 3vw, 2.75rem);
  --section-y: clamp(4.5rem, 2.6rem + 6vw, 8rem);
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 68px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #17100d;
    --surface:    #211712;
    --surface-2:  #2b1e18;
    --ink:        #f4e9e3;
    --ink-soft:   #ddccc4;
    --muted:      #a5928a;
    --line:       #382720;
    --line-soft:  #2b1d18;
    --accent:     #b23a2e;
    --accent-strong: #ef9e8f;
    --accent-tint: #2f1813;
    --on-accent:  #fff1ec;
    --shadow:     0 1px 2px rgba(0,0,0,.34), 0 10px 34px rgba(0,0,0,.42);
    --shadow-lg:  0 26px 64px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}

/* Explicit toggle overrides (must win over media query in both directions) */
:root[data-theme="light"] {
  --paper:#fbf1ea; --surface:#ffffff; --surface-2:#f7e7dd; --ink:#1a1413; --ink-soft:#3b2d28;
  --muted:#7c6a61; --line:#ecd9cf; --line-soft:#f4e6dd; --accent:#7a0a0a; --accent-strong:#5c0304;
  --accent-tint:#fbe3d9; --on-accent:#fff1ea;
  --shadow:0 1px 2px rgba(74,26,20,.05), 0 8px 30px rgba(74,26,20,.08);
  --shadow-lg:0 24px 60px rgba(74,26,20,.14);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper:#17100d; --surface:#211712; --surface-2:#2b1e18; --ink:#f4e9e3; --ink-soft:#ddccc4;
  --muted:#a5928a; --line:#382720; --line-soft:#2b1d18; --accent:#b23a2e; --accent-strong:#ef9e8f;
  --accent-tint:#2f1813; --on-accent:#fff1ec;
  --shadow:0 1px 2px rgba(0,0,0,.34), 0 10px 34px rgba(0,0,0,.42);
  --shadow-lg:0 26px 64px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.62;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; text-wrap: balance; color: var(--ink); }
p { text-wrap: pretty; }

::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--pad-x); }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.section + .section { padding-top: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: .55rem;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: currentColor; opacity: .6; }

.section-head { max-width: 62ch; display: flex; flex-direction: column; gap: 1rem; margin-bottom: clamp(2.5rem, 1.4rem + 3vw, 3.75rem); }
.section-head h2 { font-size: var(--fs-h2); }
.section-head p { color: var(--muted); font-size: var(--fs-lead); }

.lead { font-size: var(--fs-lead); color: var(--ink-soft); }
.muted { color: var(--muted); }
.measure { max-width: 65ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; white-space: nowrap;
  padding: .72rem 1.25rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; transition: transform .15s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
  text-decoration: none; line-height: 1; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); transform: translateY(-1px); }
.btn svg { width: 1.05em; height: 1.05em; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.nav { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--ink); letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 36px; height: auto; flex: none; }
.brand .mark, .footer-brand .mark { transition: filter .2s ease; }
:root[data-theme="dark"] .brand .mark, :root[data-theme="dark"] .footer-brand .mark { filter: invert(1) brightness(1.9); }
:root[data-theme="light"] .brand .mark, :root[data-theme="light"] .footer-brand .mark { filter: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .brand .mark, :root:not([data-theme]) .footer-brand .mark { filter: invert(1) brightness(1.9); } }
.brand .brand-sub { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display:block; line-height: 1; margin-top: 3px; }
.brand-name { display:flex; flex-direction:column; line-height:1.05; white-space:nowrap; }

.nav-links { display: flex; align-items: center; gap: clamp(.45rem, 1.1vw, 1.25rem); }
.nav-links a { color: var(--ink-soft); font-size: .95rem; font-weight: 500; padding: .35rem 0; position: relative; white-space: nowrap; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-links a::after { content:""; position:absolute; left:0; right:0; bottom:-2px; height:2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s ease; }
.nav-links a:hover::after, .nav-links a[aria-current="true"]::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px;
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  transition: border-color .2s ease, background-color .2s ease, color .2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.lang-select { font-family: var(--font-mono); font-size: .78rem; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: .42rem .45rem; cursor: pointer; }
.lang-select:hover { border-color: var(--accent); color: var(--accent-strong); }
.lang-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .moon,
:root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun,
:root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .theme-toggle .moon { display:none; } :root:not([data-theme]) .theme-toggle .sun { display:block; } }

.nav-toggle { display: none; }

/* Mobile nav */
@media (max-width: 880px) {
  .nav-links {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: .5rem var(--pad-x) 1.25rem;
    transform: translateY(-12px); opacity: 0; visibility: hidden;
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav-links a { padding: .85rem .25rem; border-bottom: 1px solid var(--line-soft); font-size: 1.05rem; }
  .nav-links a::after { display: none; }
  .nav-toggle { display: inline-grid; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-top: clamp(2.5rem, 1rem + 5vw, 4.5rem); padding-bottom: clamp(3rem, 1.5rem + 5vw, 5.5rem); }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero-veil { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 15% 25%, var(--paper) 0%, color-mix(in srgb, var(--paper) 60%, transparent) 42%, transparent 70%);
}
.hero .container { position: relative; z-index: 2; }
.hero-grid { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: clamp(2rem, 1rem + 4vw, 4rem); align-items: center; }
.hero-copy { display: flex; flex-direction: column; gap: 1.55rem; }
.hero h1 { font-size: var(--fs-display); letter-spacing: -0.01em; }
.hero h1 .accent { color: var(--accent-strong); }
.type-cursor {
  display: inline-block;
  width: 0; height: 0.84em;
  margin-left: 0.05em;
  border-right: 0.07em solid var(--accent-strong);
  vertical-align: -0.09em;
  animation: type-blink 1.05s steps(1) infinite;
}
.type-cursor.done { animation: none; opacity: 0; transition: opacity 0.5s ease; }
@keyframes type-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .type-cursor { display: none; } }
.hero-role { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.hero-lead { font-size: var(--fs-lead); color: var(--ink-soft); max-width: 46ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .3rem; }
.hero-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.tag { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: .34rem .7rem; background: color-mix(in srgb, var(--surface) 60%, transparent); }

.hero-figure { position: relative; }
.hero-figure .portrait-frame {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  aspect-ratio: 3 / 2.15;
}
.hero-figure img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 22%; }
.hero-figure figcaption {
  margin-top: .85rem; font-family: var(--font-mono); font-size: .76rem; color: var(--muted);
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; line-height: 1.4;
}
.hero-figure figcaption svg { width: 16px; height: 16px; flex: none; color: var(--accent-strong); }
.hero-figure figcaption b { color: var(--accent-strong); font-weight: 600; }

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero-figure { order: -1; max-width: 460px; width: 100%; margin-inline: auto; }
  .hero-veil { background: radial-gradient(140% 80% at 50% 10%, var(--paper) 0%, color-mix(in srgb, var(--paper) 55%, transparent) 45%, transparent 75%); }
}

/* ---------- Stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: clamp(1.4rem, .8rem + 1.6vw, 2.1rem) clamp(1.1rem,.6rem + 1vw,1.5rem); display: flex; flex-direction: column; gap: .4rem; }
.stat .num { font-family: var(--font-display); font-size: clamp(1.9rem, 1.2rem + 2vw, 2.7rem); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.stat .num .plus { color: var(--accent-strong); }
.stat .lbl { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
@media (max-width: 440px) { .stats { grid-template-columns: 1fr; } }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: clamp(1.15rem, .7rem + 1.5vw, 1.9rem); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.5rem, 1rem + 1.4vw, 2.1rem); display: flex; flex-direction: column; gap: .8rem;
  box-shadow: var(--shadow); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-lg); }
.card .card-ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: var(--accent-strong); background: var(--accent-tint); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.card .card-ic svg { width: 22px; height: 22px; }
.card h3 { font-size: var(--fs-h3); }
.card p { color: var(--muted); font-size: var(--fs-small); }
.card .card-tags { margin-top: auto; display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .3rem; }
.card .card-tags span { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-soft); background: var(--surface-2); border-radius: 6px; padding: .2rem .5rem; }

/* ---------- About / bio ---------- */
.about-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(2rem, 1rem + 4vw, 4rem); align-items: start; }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }
.bio-text { display: flex; flex-direction: column; gap: 1.1rem; }
.bio-text p { color: var(--ink-soft); }
.about-aside { display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: calc(var(--header-h) + 1.5rem); }
.about-photo { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 4/5; }
.about-photo img { width: 100%; height: 100%; object-fit: cover; }
.fact-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.fact-list li { display: flex; gap: .7rem; align-items: baseline; font-size: var(--fs-small); }
.fact-list .k { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); min-width: 74px; flex: none; }
.fact-list .v { color: var(--ink-soft); }

/* ---------- Timeline (CV) ---------- */
.timeline { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 1rem + 3vw, 3rem); }
@media (max-width: 780px) { .timeline { grid-template-columns: 1fr; } }
.tl-col h3 { font-size: var(--fs-h3); margin-bottom: 1.2rem; display: flex; align-items: center; gap: .6rem; }
.tl-col h3 .card-ic { width: 34px; height: 34px; }
.tl { list-style: none; padding: 0; position: relative; display: flex; flex-direction: column; gap: 1.35rem; }
.tl::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl li { position: relative; padding-left: 1.9rem; }
.tl li::before { content: ""; position: absolute; left: 1px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.tl .yr { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .05em; color: var(--accent-strong); }
.tl .ti { font-weight: 600; color: var(--ink); margin-top: .12rem; }
.tl .pl { font-size: var(--fs-small); color: var(--muted); }

/* ---------- Split feature (research highlight) ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem,1rem + 3vw,3.5rem); align-items: center; }
.split.rev .split-media { order: 2; }
@media (max-width: 860px) { .split, .split.rev { grid-template-columns: 1fr; } .split.rev .split-media { order: 0; } }
.split-media { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: #000; }
.split-media video, .split-media img { width: 100%; display: block; }
.split-copy { display: flex; flex-direction: column; gap: 1rem; }
.split-copy h3 { font-size: var(--fs-h2); }
.split-copy p { color: var(--ink-soft); }
.video-caption { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); margin-top: .5rem; }

/* Simulation media gallery (uniform tiles, figures on white) */
.media-grid { display: grid; gap: clamp(1rem, .6rem + 1.4vw, 1.7rem); grid-template-columns: repeat(2, 1fr); }
.work-block { display: flex; flex-direction: column; gap: clamp(1.2rem, .9rem + 1.3vw, 1.85rem); }
.work-block + .work-block { margin-top: clamp(2.75rem, 1.8rem + 3vw, 4.75rem); }
.work-head { max-width: 66ch; display: flex; flex-direction: column; gap: .7rem; }
.work-head h3 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.85rem); }
.work-head p { color: var(--ink-soft); }
.work-more { font-size: var(--fs-small); color: var(--muted); }
.work-more a { color: var(--accent-strong); }
.repo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(.9rem, .6rem + 1vw, 1.35rem); }
.repo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.15rem, .9rem + .7vw, 1.5rem); display: flex; flex-direction: column; gap: .55rem; box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.repo:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow-lg); text-decoration: none; }
.repo-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.repo-name { font-family: var(--font-mono); font-weight: 600; font-size: .9rem; color: var(--ink); overflow-wrap: anywhere; }
.repo-desc { font-size: var(--fs-small); color: var(--muted); line-height: 1.5; margin: 0; }
.repo-all .repo-name { color: var(--accent-strong); }
.repo-all svg { color: var(--accent-strong); flex: none; }
.repo-all { grid-column: 1 / -1; }
.media-grid .split-media { margin: 0; background: #fff; display: flex; flex-direction: column; }
.media-grid .split-media video { width: 100%; aspect-ratio: 16 / 10; object-fit: contain; background: #fff; display: block; }
.media-grid .video-caption { margin: 0; padding: .7rem .85rem .9rem; color: #6a574f; line-height: 1.45; }
.media-grid .video-caption b { color: var(--accent-strong); font-weight: 600; }
@media (max-width: 620px) { .media-grid { grid-template-columns: 1fr; } }

/* ---------- Innovation band ---------- */
.band { background: var(--surface); border-block: 1px solid var(--line); }
.innov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2.5rem,1.5rem + 4vw,5rem); align-items: center; }
.innov-grid > div.reveal { padding-right: clamp(1rem, 3vw, 4rem); }
@media (max-width: 900px) { .innov-grid > div.reveal { padding-right: 0; } }
@media (max-width: 900px){ .innov-grid { grid-template-columns: 1fr; } }
.innov-photo { border-radius: var(--radius); overflow:hidden; border:1px solid var(--line); box-shadow: var(--shadow-lg); }
.innov-photo img { width:100%; }
.pill-row { display:flex; flex-wrap:wrap; gap:.55rem; }
.pill { font-family: var(--font-mono); font-size:.74rem; color: var(--ink-soft); border:1px solid var(--line); border-radius:999px; padding:.4rem .8rem; background: var(--surface-2); }

/* ---------- Projects ---------- */
.proj-list { display:flex; flex-direction:column; gap: 1px; background: var(--line); border:1px solid var(--line); border-radius: var(--radius); overflow:hidden; }
.proj {
  background: var(--surface); padding: clamp(1.3rem,1rem + 1vw,1.8rem) clamp(1.3rem,1rem + 1vw,1.9rem);
  display:grid; grid-template-columns: 92px 1fr auto; gap: 1.4rem; align-items: center;
  transition: background-color .18s ease;
}
.proj:hover { background: var(--surface-2); }
.proj .p-lang { font-family: var(--font-mono); font-size:.7rem; color: var(--accent-strong); border:1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius:6px; padding:.3rem .5rem; text-align:center; justify-self:start; }
.proj .p-main { min-width: 0; display: flex; flex-direction: column; }
.proj .p-name { font-weight: 600; color: var(--ink); display:inline-flex; align-items:center; gap:.5rem; }
.proj .p-desc { font-size: var(--fs-small); color: var(--muted); margin-top:.35rem; line-height:1.5; }
.proj .p-meta { font-family: var(--font-mono); font-size:.74rem; color: var(--muted); white-space: nowrap; display:flex; align-items:center; gap:.35rem; justify-self:end; }
@media (max-width: 680px){ .proj { grid-template-columns: auto 1fr; gap: 1rem; } .proj .p-meta { display:none; } }

/* ---------- Contact ---------- */
.contact-grid { display:grid; grid-template-columns: 1.25fr 1fr; column-gap: clamp(3rem,2rem + 3vw,5.5rem); row-gap: 2rem; align-items:start; }
.contact-grid > div, .contact-grid > aside { min-width: 0; }
@media (min-width: 861px) { .contact-grid > div.reveal { padding-right: clamp(1rem, 2.5vw, 2.5rem); } }
@media (max-width: 860px){ .contact-grid { grid-template-columns: 1fr; } }
.form { display:flex; flex-direction:column; gap: 1rem; }
.field { display:flex; flex-direction:column; gap:.4rem; }
.field label { font-family: var(--font-mono); font-size:.74rem; letter-spacing:.05em; text-transform:uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border:1px solid var(--line);
  border-radius: var(--radius-sm); padding:.8rem .9rem; width:100%; transition: border-color .18s ease, box-shadow .18s ease;
}
.field select { height: calc(1rem + 1.6rem + 2px); cursor: pointer; }
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline:none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field.hp { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }
.form-row { display:grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px){ .form-row { grid-template-columns: 1fr; } }
.form-note { font-size:.8rem; color: var(--muted); }
.field-check { display: flex; align-items: flex-start; gap: .6rem; }
.field-check input { margin-top: .18rem; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.field-check label { font-family: var(--font-body); font-size: .84rem; letter-spacing: 0; text-transform: none; color: var(--muted); line-height: 1.5; }
.field-check a { color: var(--accent-strong); }
.form-status { font-size:.9rem; padding:.7rem .9rem; border-radius: var(--radius-sm); display:none; }
.form-status.show { display:block; }
.form-status.ok { background: color-mix(in srgb, #2f9e44 16%, var(--surface)); color: #1a7a34; border:1px solid color-mix(in srgb,#2f9e44 40%, transparent); }
.form-status.err { background: color-mix(in srgb, #e03131 14%, var(--surface)); color:#c92a2a; border:1px solid color-mix(in srgb,#e03131 40%, transparent); }
:root[data-theme="dark"] .form-status.ok { color:#69db7c; } :root[data-theme="dark"] .form-status.err { color:#ff8787; }

.contact-side { display:flex; flex-direction:column; gap:1.1rem; }
.contact-links { list-style:none; padding:0; display:flex; flex-direction:column; gap:.7rem; }
.contact-links a { display:flex; align-items:center; gap:.8rem; padding:.85rem 1rem; border:1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--surface); transition: border-color .18s ease, transform .18s ease; }
.contact-links a:hover { border-color: var(--accent); transform: translateX(2px); text-decoration:none; }
.contact-links svg { width:20px; height:20px; color: var(--accent-strong); flex:none; }
.contact-links .cl-sub { font-family: var(--font-mono); font-size:.72rem; color: var(--muted); }

/* ---------- Publications page ---------- */
.pub-hero { padding-top: clamp(2.5rem,1.5rem + 3vw,4rem); }
.pub-year { font-family: var(--font-display); font-size: clamp(1.6rem,1.2rem + 1.5vw,2.2rem); color: var(--ink); margin: clamp(2rem,1.5rem + 2vw,3rem) 0 1rem; padding-bottom:.5rem; border-bottom:1px solid var(--line); display:flex; align-items:baseline; gap:.7rem; }
.pub-year .n { font-family: var(--font-mono); font-size:.8rem; color: var(--muted); }
.pub { display:grid; grid-template-columns: auto 1fr; gap: 1.1rem; padding: 1.1rem 0; border-bottom:1px solid var(--line-soft); }
.pub:last-child { border-bottom:none; }
.pub .p-idx { font-family: var(--font-mono); font-size:.8rem; color: var(--accent-strong); padding-top:.2rem; }
.pub .p-title { font-weight:600; color: var(--ink); line-height:1.35; }
.pub .p-authors { font-size: var(--fs-small); color: var(--muted); margin-top:.3rem; }
.pub .p-authors b { color: var(--ink-soft); font-weight:600; }
.pub .p-venue { font-family: var(--font-mono); font-size:.78rem; color: var(--ink-soft); margin-top:.4rem; display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.pub .p-venue .dot { opacity:.5; }
.pub .p-links { margin-top:.55rem; display:flex; flex-wrap:wrap; gap:.5rem; }
.pub .p-links a { font-family: var(--font-mono); font-size:.74rem; border:1px solid var(--line); border-radius:6px; padding:.28rem .6rem; color: var(--accent-strong); }
.pub .p-links a:hover { border-color: var(--accent); text-decoration:none; }

/* ---------- Legal pages ---------- */
.legal { padding-block: clamp(3rem,2rem + 3vw,5rem); }
.legal h1 { font-size: var(--fs-h2); margin-bottom: 1.5rem; }
.legal h2 { font-size: var(--fs-h3); margin: 2rem 0 .6rem; }
.legal p, .legal li { color: var(--ink-soft); font-size: var(--fs-small); margin-bottom:.6rem; }
.legal ul { padding-left: 1.2rem; }
.legal a { word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: var(--section-y); }
.footer-grid { display:grid; grid-template-columns: 1.4fr 1fr 1fr; gap: clamp(2rem,1.4rem + 2vw,3.2rem); padding-block: clamp(3rem,2rem + 3vw,4.75rem); }
@media (max-width: 760px){ .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 460px){ .footer-grid { grid-template-columns: 1fr; } }
.footer-brand { display:flex; flex-direction:column; gap:.8rem; max-width: 34ch; }
.footer-brand .mark { width: 44px; height: auto; }
.footer-brand p { color: var(--muted); font-size: var(--fs-small); }
.footer-col h4 { font-family: var(--font-mono); font-size:.72rem; letter-spacing:.1em; text-transform:uppercase; color: var(--muted); font-weight:500; margin-bottom:1rem; }
.footer-col ul { list-style:none; padding:0; display:flex; flex-direction:column; gap:.85rem; }
.footer-col a { color: var(--ink-soft); font-size: var(--fs-small); }
.footer-col a:hover { color: var(--accent-strong); }
.footer-social { display:flex; gap:.6rem; margin-top:.3rem; }
.footer-social a { width:38px; height:38px; border:1px solid var(--line); border-radius:9px; display:grid; place-items:center; color: var(--ink-soft); }
.footer-social a:hover { border-color: var(--accent); color: var(--accent-strong); }
.footer-social svg { width:18px; height:18px; }
.footer-bottom { border-top:1px solid var(--line); padding-block: 1.7rem; display:flex; flex-wrap:wrap; justify-content:space-between; gap:.8rem; align-items:center; }
.footer-bottom p, .footer-bottom a { font-size:.8rem; color: var(--muted); }
.footer-bottom .fl { display:flex; gap:1.2rem; flex-wrap:wrap; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1 !important; transform: none !important; transition: none; } }

/* ---------- Utilities ---------- */
.skip-link { position:absolute; left:-9999px; top:0; background: var(--accent); color: var(--on-accent); padding:.6rem 1rem; border-radius:0 0 8px 0; z-index:100; }
.skip-link:focus { left:0; }
.divider { height:1px; background: var(--line); border:0; }
.text-center { text-align:center; }
.mt-2 { margin-top: 2rem; }
@media (max-width: 560px) { .hide-sm { display: none; } }

/* ---------- OASiS terminal mockup (intentionally dark in both themes) ---------- */
.terminal { width: 100%; background: #17100d; color: #efe4dd; }
.term-bar { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.09); }
.term-bar > span { width: 11px; height: 11px; border-radius: 50%; background: #5a4038; }
.term-bar > span:nth-child(1) { background: #e0685c; }
.term-bar > span:nth-child(2) { background: #e0b15c; }
.term-bar > span:nth-child(3) { background: #7bbf6a; }
.term-title { margin-left: auto; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; color: rgba(239,228,221,.55); }
.term-body { margin: 0; padding: 1.1rem 1.15rem 1.35rem; font-family: var(--font-mono); font-size: clamp(.72rem, .68rem + .3vw, .84rem); line-height: 1.9; white-space: pre-wrap; word-break: break-word; overflow-x: auto; color: #d3c3ba; }
.term-body .tl-user { display: block; color: #f6ede7; margin-bottom: .45rem; }
.term-body .tl-step { display: block; }
.term-body .ok { color: #7bbf6a; }
.term-body .hl { color: #f0a192; }
.term-body .tl-done { display: block; color: #7bbf6a; margin-top: .55rem; }

/* ---------- Feature list ---------- */
.feature-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.feature-list li { position: relative; padding-left: 1.7rem; color: var(--ink-soft); font-size: var(--fs-small); }
.feature-list li::before { content: "\2713"; position: absolute; left: 0; top: -1px; color: var(--accent-strong); font-weight: 700; }

/* OASiS flagship + Figure 1 diagram */
.oasis-feature { display: flex; flex-direction: column; gap: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); }
.oasis-intro { max-width: 74ch; display: flex; flex-direction: column; gap: 1rem; }
.oasis-intro h3 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.05rem); }
.oasis-intro p { color: var(--ink-soft); }
.oasis-diagram { margin: 0; }
.oasis-diagram .diagram-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1rem, .6rem + 1.5vw, 2rem); }
.oasis-diagram svg.dg { width: 100%; min-width: 640px; height: auto; display: block; font-family: var(--font-body); }
.oasis-diagram figcaption { margin-top: .85rem; font-size: var(--fs-small); color: var(--muted); max-width: 84ch; }
.oasis-result { margin-top: 1.1rem; max-width: 440px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1rem 1.15rem 1.2rem; box-shadow: var(--shadow); }
.oasis-result-label { display: block; margin-bottom: .75rem; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-strong); }
.oasis-result-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.oasis-result-imgs figure { margin: 0; }
.oasis-result-imgs img { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--line); }
.oasis-result-imgs figcaption { margin-top: .4rem; text-align: center; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); }
.oasis-result { margin-top: 1.1rem; display: flex; align-items: flex-end; gap: clamp(.8rem, .5rem + 1.4vw, 1.6rem); flex-wrap: wrap; }
.oasis-result-label { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-bottom: .35rem; }
.oasis-result figure { margin: 0; }
.oasis-result img { display: block; width: clamp(160px, 30vw, 250px); height: auto; border: 1px solid var(--line); border-radius: 8px; }
.oasis-result figcaption { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); margin-top: .35rem; text-align: center; }
.dg-box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.dg-oasis { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 2; }
.dg-codes { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 5 6; }
.dg-chip { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.dg-arrow { stroke: var(--ink-soft); stroke-width: 2; fill: none; }
.dg-head { fill: var(--accent-strong); }
.dg-oasis-title { fill: var(--accent-strong); font-weight: 700; font-size: 30px; }
.dg-text { fill: var(--ink-soft); font-size: 18px; }
.dg-quote { font-size: 16px; font-style: italic; fill: var(--ink); }
.dg-chip-t { fill: var(--ink); font-size: 16px; font-weight: 500; }
.dg-label { fill: var(--muted); font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; }
.dg-flow { fill: var(--muted); font-family: var(--font-mono); font-size: 14px; }
.dg-oasis-loop { fill: var(--accent-strong); font-size: 26px; }
/* OASiS: one shared box for the diagram + verified result */
.oasis-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); padding: clamp(1rem, .6rem + 1.5vw, 2rem); }
.oasis-diagram .diagram-scroll { overflow-x: auto; background: none; border: 0; box-shadow: none; padding: 0; border-radius: 0; }
.oasis-diagram .oasis-result { margin: 1.25rem 0 0; padding: 1.25rem 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; max-width: 460px; }

/* ---------- CTA band ---------- */
.cta-band {
  margin-top: clamp(2rem, 1.4rem + 2vw, 3.2rem);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.4rem, 1rem + 2vw, 2.3rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
}
.cta-band h3 { font-size: var(--fs-h3); margin-bottom: .3rem; }
.cta-band p { color: var(--muted); font-size: var(--fs-small); max-width: 54ch; }
.cta-band .btn { flex: none; }
