/* Colour and font tokens. Each block carries a "theme:" marker that tests/test_contrast.py reads. */

/* theme: minimal-light */
:root, [data-theme="minimal"] {
  --bg: #ffffff; --surface: #f5f5f5; --fg: #111111; --strong: #000000; --muted: #575757; --accent: #1d4ed8; --mark: #1d4ed8; --rule: #e2e2e2;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-body);
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

/* theme: mission-light */
/* A tinted off-white page with navy text. Links are navy; the orange of the dark scheme stays
   bright because it only colours marks and icons (--mark), which need 3 to 1 and not 4.5 to 1. */
[data-theme="mission"] {
  --bg: #eef2f7; --surface: #f8fafc; --fg: #14203a; --strong: #030a1a; --muted: #4b5a73; --accent: #1f4e8c; --mark: #d9621a; --rule: #c5cedb;
  --font-display: "Space Grotesk", var(--font-body);
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  /* theme: minimal-dark */
  :root, [data-theme="minimal"] {
    --bg: #0f0f10; --surface: #1a1a1d; --fg: #ededed; --strong: #ffffff; --muted: #a3a3a8; --accent: #7fa8ff; --mark: #7fa8ff; --rule: #2c2c30;
    color-scheme: dark;
  }

  /* theme: mission-dark */
  [data-theme="mission"] {
    --bg: #0d1420; --surface: #131d2e; --fg: #d6dde8; --strong: #ffffff; --muted: #8f9cb2; --accent: #fb923c; --mark: #fb923c; --rule: #22304a;
    color-scheme: dark;
  }
}

@font-face { font-family: "Inter"; src: url("fonts/inter.3100e775e8.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk.0640890476.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-400.14425ba9c6.woff2") format("woff2"); font-weight: 400; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--font-body); }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; display: block; }

.skip { position: absolute; left: -999px; top: 0; padding: 8px 16px; background: var(--fg); color: var(--bg); z-index: 10; }
.skip:focus { left: 16px; }

.layout { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
/* The bar sticks only when the menu can be closed; with no script the menu is always open and would cover the page. */
.js .sidebar { position: sticky; }
.sidebar { top: 0; z-index: 5; margin: 0 -16px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--rule); }
.identity { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
.photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.photo--initials { display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.85rem; color: var(--muted); }
.name { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.menu-toggle { display: inline-flex; padding: 9px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--fg); cursor: pointer; }
.menu-toggle[hidden] { display: none; }
.menu-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu { padding: 14px 0 6px; }
.js .menu { display: none; }
.js .sidebar.open .menu { display: block; max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow-y: auto; }
.actions { font-size: 0.9rem; }
.actions p { margin: 12px 0; }
.cv { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--fg); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; transition: border-color 0.15s; }
.cv svg { color: var(--mark); }
.cv:hover, .cv:focus-visible { border-color: var(--mark); }
.actions .group-label, .footer .group-label { margin: 16px 0 6px; font-family: var(--font-mono, monospace); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toc { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 6px 0; color: var(--muted); text-decoration: none; }
.toc a[aria-current="true"] { color: var(--fg); font-weight: 600; }
[data-theme="mission"] .toc a[aria-current="true"] { color: var(--accent); }

main { padding: 8px 0 48px; max-width: 46rem; overflow-wrap: anywhere; }
section { padding-top: 44px; scroll-margin-top: 76px; }
h2 { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 20px; padding-bottom: 8px; border-bottom: 2px solid var(--rule); }
[data-theme="mission"] h2::before { content: "// "; font-family: var(--font-mono); font-weight: 400; color: var(--mark); }
.bio p { font-size: 1.05rem; margin: 0; }

/* The trajectory animation. The stage is dark in every theme, and its colours are those of the paper's figures. */
.hero { margin: 0; padding-top: 24px; --t-thrust: #d55e00; --t-coast: #0072b2; --t-shadow: #e69f00; --t-gto: #009e73; --t-geo: #b22222; }
.stage { position: relative; border-radius: 10px; background: #03050b; overflow: hidden; }
.stage canvas, .hud, .keys, .ctl { display: none; }
.poster { width: 100%; }
.hero.is-live .poster { display: none; }
.hero.is-live canvas { display: block; width: 100%; }
.hero.is-live canvas.free { cursor: grab; touch-action: none; }
.hero.is-live canvas.free:active { cursor: grabbing; }
.hero.is-live .hud, .hero.is-live .keys { display: block; position: absolute; top: 10px; margin: 0; padding: 8px 10px; list-style: none; border-radius: 8px; background: rgba(3, 5, 11, 0.55); color: #dfe6f0; font-size: 0.72rem; line-height: 1.55; pointer-events: none; }
.hud { left: 10px; font-family: var(--font-mono); }
.hud span { display: block; white-space: pre; }
.keys { right: 10px; }
.keys i { display: inline-block; width: 16px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.k-thrust { background: var(--t-thrust); } .k-coast { background: var(--t-coast); } .k-eclipse { background: var(--t-shadow); } .k-gto { background: var(--t-gto); } .k-geo { background: var(--t-geo); }
.hero.is-live .ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.ctl .seek { flex: 1 1 160px; min-width: 0; accent-color: var(--mark); }
.ctl .clock { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ctl button { display: inline-flex; padding: 6px 9px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--fg); cursor: pointer; }
.ctl button:hover { border-color: var(--mark); }
.ctl button:focus-visible, .ctl .seek:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }
.ctl .cam[aria-pressed="true"] { border-color: var(--mark); color: var(--mark); }
.hero figcaption { color: var(--muted); }
@media (max-width: 520px) { .hero.is-live .hud, .hero.is-live .keys { top: 6px; padding: 5px 7px; font-size: 0.62rem; } .hud { left: 6px; } .keys { right: 6px; } }

/* One project is one bordered block: title, figure with its caption, then the text. */
.card { margin: 0 0 28px; padding: 20px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); scroll-margin-top: 76px; }
.card:last-child { margin-bottom: 0; }
.card h3 { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.3; margin: 0 0 14px; }
.card figure { margin: 0 0 14px; padding: 12px; background: #ffffff; border: 1px solid var(--rule); border-radius: 8px; }
.figure-placeholder { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; background: #eeeeee; color: #444444; border: 2px dashed #b0b0b0; border-radius: 4px; font-size: 0.9rem; }
figcaption { margin-top: 8px; font-size: 0.85rem; color: #444444; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.85rem; }
/* A card with a paper is one link: the title link covers the card, and the figure and the other links stay on top of it. */
.card { position: relative; transition: border-color 0.15s; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
/* Under the pointer the card shows that it is one link: mark-coloured border, stronger title.
   The figure is a separate target (it opens the viewer), so there the ring goes around the figure only. */
.card h3 a { transition: color 0.15s; }
.card:has(h3 a):hover:not(:has(figure:hover)), .card:has(h3 a:focus-visible) { border-color: var(--mark); }
.card:has(h3 a):hover:not(:has(figure:hover)) h3 a, .card h3 a:focus-visible { color: var(--strong); }
.card figure:has(.zoom) { outline: 2px solid transparent; outline-offset: 3px; transition: outline-color 0.15s; }
.card figure:has(.zoom):hover, .card figure:has(.zoom:focus-visible) { outline-color: var(--strong); }
.card h3 a:focus-visible { outline: none; }
.card figure, .card .meta { position: relative; z-index: 1; }
.zoom { display: block; cursor: zoom-in; }
.clip { display: block; width: 100%; height: auto; border-radius: 4px; background: #000000; }
.viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 12, 20, 0.92); overflow: hidden; }
.viewer[open] { display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 94vw; max-height: 86vh; width: auto; height: auto; background: #ffffff; border-radius: 6px; cursor: grab; touch-action: none; user-select: none; -webkit-user-drag: none; }
.viewer img:active { cursor: grabbing; }
.viewer-bar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 10px; background: rgba(13, 20, 32, 0.85); border: 1px solid rgba(255, 255, 255, 0.18); }
.viewer-bar button { min-width: 40px; height: 36px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #e8edf5; font: 600 1rem var(--font-mono, monospace); cursor: pointer; }
.viewer-bar button:hover, .viewer-bar button:focus-visible { background: rgba(255, 255, 255, 0.14); }
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 5; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--rule); border-radius: 50%; background: var(--surface); color: var(--mark); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.to-top:hover, .to-top:focus-visible { border-color: var(--mark); }
.to-top-off { visibility: hidden; }

.pubs h3 { font-size: 0.95rem; margin: 24px 0 8px; color: var(--muted); font-weight: 600; }
.pubs ul { margin: 0; padding-left: 1.25rem; }
.pubs li { margin-bottom: 10px; scroll-margin-top: 76px; }
.pubs li:target { outline: 2px solid var(--mark); outline-offset: 6px; border-radius: 4px; }

.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: grid; grid-template-columns: 1fr; margin-bottom: 18px; }
.when { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.what { font-weight: 600; }
.where { color: var(--muted); }
.entries p { margin: 4px 0 0; }
.skills { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; }

.elsewhere { list-style: none; margin: 0; padding: 0; }
.elsewhere li { display: grid; grid-template-columns: 1fr; margin-bottom: 12px; }
.elsewhere a, .elsewhere strong { font-weight: 600; }
.elsewhere span { color: var(--muted); }

.footer { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--rule); }
.footer p { margin: 0; }
.footer .group-label { margin: 14px 0 0; }
.credits { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }

@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); column-gap: 56px; padding: 0 32px; }
  .js .sidebar.open .menu { max-height: none; overflow: visible; }
  .sidebar { position: sticky; align-self: start; height: 100vh; overflow-y: auto; margin: 0; padding: 48px 24px 24px 0; border-bottom: 0; border-right: 1px solid var(--rule); }
  .identity { display: block; }
  .photo { width: 96px; height: 96px; margin-bottom: 16px; }
  .photo--initials { font-size: 1rem; }
  .name { font-size: 1.5rem; }
  [data-theme="mission"] .name { font-size: 1.7rem; }
  .tagline { margin-top: 4px; font-size: 0.95rem; line-height: 1.5; }
  .menu-toggle, .menu-toggle[hidden] { display: none; }
  .menu, .js .menu { display: block; padding: 20px 0 0; }
  .toc { margin-top: 24px; padding-top: 0; border-top: 0; }
  .toc a { padding: 3px 0; }
  main { padding-top: 16px; }
  section, .card, .pubs li { scroll-margin-top: 16px; }
  .entries li { grid-template-columns: 7.5rem 1fr; column-gap: 16px; }
  .elsewhere li { grid-template-columns: 7.5rem 1fr; column-gap: 16px; }
  .footer { padding: 24px 32px 40px; }
}
