/* ==========================================================================
   Van den Broek Computational Mechanics: site styles
   Plain CSS, no build step. Colours are defined as tokens on :root and
   switch automatically with the visitor's light/dark system setting.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #f5f4ef;
  --bg-elev: #fbfaf7;
  --bg-sunk: #ecebe5;
  --ink: #15171b;
  --ink-2: #474b53;
  --ink-3: #62666f;
  --line: #dad7ce;
  --line-strong: #bfbbb0;
  --accent: #2443d6;
  --accent-hover: #1a32a8;
  --accent-soft: rgba(36, 67, 214, 0.09);
  --on-accent: #ffffff;
  --signal: #e2552b;
  --ok: #1d7a4c;
  --grid: rgba(21, 23, 27, 0.055);

  /* Diverging colour map used by the hero animation and the figures */
  --field-neg: #2443d6;
  --field-mid: #f2f0ea;
  --field-pos: #e2552b;
  --mesh-line: rgba(21, 23, 27, 0.3);

  /* Dark band (always dark, in both themes) */
  --band-bg: #121519;
  --band-ink: #ecebe6;
  --band-ink-2: #a9aeb7;
  --band-line: #2a2f37;
  --band-accent: #9fb0ff;

  /* Code / data records */
  --code-bg: #0c0e11;
  --code-ink: #d9dce1;
  --code-key: #9fb0ff;
  --code-str: #f2b89f;
  --code-num: #9fe3c3;
  --code-mute: #737a87;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --font-math: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;

  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 68px;
  --shadow: 0 1px 2px rgba(21, 23, 27, 0.04), 0 14px 34px -18px rgba(21, 23, 27, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --bg-elev: #15181c;
    --bg-sunk: #0b0d10;
    --ink: #ebe9e3;
    --ink-2: #b1b5bd;
    --ink-3: #8b9099;
    --line: #262a31;
    --line-strong: #3a3f48;
    --accent: #8ea0ff;
    --accent-hover: #b3bfff;
    --accent-soft: rgba(142, 160, 255, 0.13);
    --on-accent: #0f1114;
    --signal: #ff7a4a;
    --ok: #5fd39a;
    --grid: rgba(235, 233, 227, 0.045);

    --field-neg: #6d84ff;
    --field-mid: #23272e;
    --field-pos: #ff7a4a;
    --mesh-line: rgba(235, 233, 227, 0.15);

    --band-bg: #15181c;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -18px rgba(0, 0, 0, 0.7);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
}

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

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

strong,
b {
  font-weight: 650;
}

sub,
sup {
  line-height: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
  color: var(--bg);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(64px, 9vw, 120px);
}

.section--line {
  border-top: 1px solid var(--line);
}

.section--sunk {
  background: var(--bg-sunk);
  border-block: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px 64px;
  align-items: end;
  margin-bottom: clamp(36px, 5vw, 60px);
}

.section-head h2 {
  margin-top: 16px;
  font-size: clamp(1.85rem, 3.3vw, 2.7rem);
  letter-spacing: -0.03em;
}

.section-head > p {
  max-width: 36em;
  color: var(--ink-2);
}

@media (max-width: 860px) {
  .section-head {
    grid-template-columns: 1fr;
  }
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(32px, 6vw, 96px);
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ---------- Type helpers ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--signal);
}

.label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lead {
  font-size: clamp(1.1rem, 1.55vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-2);
}

.math {
  font-family: var(--font-math);
  font-size: 1.06em;
}

@media (min-width: 560px) {
  .math {
    white-space: nowrap;
  }
}

.muted {
  color: var(--ink-2);
}

.math var {
  font-style: italic;
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: 0.78em 1.3em;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn svg {
  width: 1em;
  height: 1em;
  transition: transform 0.15s ease;
}

.btn:hover svg {
  transform: translateX(3px);
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn--ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.btn--small {
  padding: 0.55em 1.05em;
  font-size: 0.9rem;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 600;
  text-decoration: none;
}

.link-arrow svg {
  width: 1em;
  height: 1em;
  transition: transform 0.15s ease;
}

.link-arrow:hover svg {
  transform: translateX(3px);
}

/* ---------- Header & navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  flex: none;
  width: 34px;
  height: 34px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  color: var(--ink-3);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-nav a:not(.btn) {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:not(.btn):hover {
  background: var(--bg-sunk);
  color: var(--ink);
}

.site-nav a:not(.btn)[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.site-nav a:not(.btn)[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--signal);
}

.site-nav .btn {
  margin-left: 10px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

@media (max-width: 920px) {
  /* Without JavaScript the menu simply wraps below the logo. */
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
  }

  .site-nav {
    flex-wrap: wrap;
    width: 100%;
    padding-bottom: 12px;
  }

  .js .header-inner {
    flex-wrap: nowrap;
    height: var(--header-h);
  }

  .js .nav-toggle {
    display: inline-flex;
  }

  .js .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 2px;
    width: auto;
    padding: 8px var(--gutter) 20px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    box-shadow: var(--shadow);
  }

  .js .site-nav.is-open {
    display: flex;
  }

  .js .site-nav a:not(.btn) {
    padding: 12px 10px;
    border-radius: 8px;
    font-size: 1.05rem;
  }

  .js .site-nav a:not(.btn)[aria-current="page"]::after {
    left: 0;
    right: auto;
    top: 12px;
    bottom: 12px;
    width: 3px;
    height: auto;
  }

  .js .site-nav .btn {
    margin: 10px 0 0;
  }
}

/* ---------- Graph-paper backdrop ---------- */
.hero,
.page-hero {
  position: relative;
  overflow: hidden;
}

.hero::before,
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 70% 85% at 74% 38%, #000 18%, transparent 74%);
  mask-image: radial-gradient(ellipse 70% 85% at 74% 38%, #000 18%, transparent 74%);
  pointer-events: none;
}

.hero > .container,
.page-hero > .container {
  position: relative;
}

/* ---------- Home: hero ---------- */
.hero {
  padding-block: clamp(36px, 6.5vw, 92px) clamp(56px, 8vw, 104px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(36px, 5vw, 80px);
  align-items: center;
}

.hero h1 {
  margin: 20px 0 24px;
  font-size: clamp(2.35rem, 4.6vw, 3.7rem);
  font-weight: 680;
  line-height: 1.03;
  letter-spacing: -0.036em;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero .lead {
  max-width: 34em;
}

.hero .btn-row {
  margin-top: 32px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-3);
}

.hero-tags li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-tags li::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--line-strong);
}

.hero-figure {
  width: 100%;
  max-width: 540px;
  justify-self: end;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-figure {
    justify-self: center;
  }
}

/* ---------- Figure panel (hero canvas) ---------- */
.fig-panel {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.fig-panel canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}

.fig-hud {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  pointer-events: none;
}

.fig-hud .live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.fig-hud .live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  animation: pulse 2.4s ease-in-out infinite;
}

.fig-panel figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-3);
}

.fig-panel figcaption b {
  color: var(--ink-2);
  font-weight: 600;
}

.colorbar {
  display: grid;
  flex: none;
  grid-template-columns: auto 84px auto;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.colorbar i {
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--field-neg), var(--field-mid), var(--field-pos));
  box-shadow: inset 0 0 0 1px var(--line);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ---------- Home: credentials strip ---------- */
.facts {
  border-block: 1px solid var(--line);
  background: var(--bg-elev);
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fact {
  padding: 26px 24px 26px 0;
}

.fact + .fact {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.fact strong {
  display: block;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.fact span {
  display: block;
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-2);
}

@media (max-width: 900px) {
  .facts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fact:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .fact:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .facts-grid {
    grid-template-columns: 1fr;
  }

  .fact,
  .fact + .fact {
    padding: 18px 0;
    border-left: 0;
  }

  .fact + .fact {
    border-top: 1px solid var(--line);
  }
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  gap: 20px;
}

.cards--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .cards--3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .cards--2 {
    grid-template-columns: 1fr;
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

a.card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow);
  color: inherit;
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.card-icon {
  width: 46px;
  height: 46px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--accent);
}

.card-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-3);
}

.card h3 {
  margin-bottom: 10px;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.card > .card-num + h3 {
  margin-top: 14px;
}

.card > p {
  color: var(--ink-2);
  font-size: 0.98rem;
}

.card-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: auto;
  padding-top: 24px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}

.card-more svg {
  width: 1em;
  height: 1em;
  transition: transform 0.15s ease;
}

a.card:hover .card-more svg {
  transform: translateX(3px);
}

.ticks {
  display: grid;
  gap: 9px;
  margin: 18px 0 0;
  list-style: none;
  font-size: 0.94rem;
  color: var(--ink-2);
}

.ticks li {
  position: relative;
  padding-left: 20px;
  line-height: 1.45;
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 0.5em;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--accent);
}

/* ---------- Dark band ---------- */
.band {
  position: relative;
  overflow: hidden;
  background: var(--band-bg);
  color: var(--band-ink);
}

@media (prefers-color-scheme: dark) {
  .band {
    border-block: 1px solid var(--line);
  }
}

.band::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(110deg, transparent 35%, #000 85%);
  mask-image: linear-gradient(110deg, transparent 35%, #000 85%);
  pointer-events: none;
}

.band > .container {
  position: relative;
}

.band .eyebrow {
  color: var(--band-ink-2);
}

.band h2 {
  margin: 16px 0 18px;
  font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  letter-spacing: -0.03em;
  color: var(--band-ink);
}

.band p,
.band .lead {
  color: var(--band-ink-2);
}

.band a:not(.btn) {
  color: var(--band-accent);
}

.band .btn--primary {
  background: var(--band-ink);
  color: var(--band-bg);
}

.band .btn--primary:hover {
  background: #ffffff;
  color: var(--band-bg);
}

.band-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
}

.band-list {
  display: grid;
  margin: 28px 0 32px;
  border-top: 1px solid var(--band-line);
  list-style: none;
}

.band-list li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--band-line);
  color: var(--band-ink);
}

.band-list li span {
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--band-ink-2);
}

@media (max-width: 900px) {
  .band-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Code / data record card ---------- */
.code-card {
  margin: 0;
  border: 1px solid var(--band-line);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  box-shadow: 0 30px 60px -34px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.code-card__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--band-line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--code-mute);
}

.code-card__bar .verified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--code-num);
}

.code-card__bar .verified svg {
  width: 12px;
  height: 12px;
}

.code-card pre {
  margin: 0;
  padding: 18px 20px 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-card code {
  font-family: inherit;
}

.code-card figcaption {
  padding: 10px 16px;
  border-top: 1px solid var(--band-line);
  font-size: 0.78rem;
  color: var(--code-mute);
}

.t-k {
  color: var(--code-key);
}

.t-s {
  color: var(--code-str);
}

.t-n {
  color: var(--code-num);
}

.t-p {
  color: var(--code-mute);
}

/* ---------- Home: research highlights ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 820px) {
  .work-grid {
    grid-template-columns: 1fr;
  }
}

.work {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}

.work-fig {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.work-fig svg {
  width: 100%;
  height: 100%;
}

.work-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 22px 24px 24px;
}

.work-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--ink-3);
}

.work h3 {
  margin: 10px 0 8px;
  font-size: 1.2rem;
  letter-spacing: -0.015em;
}

.work p {
  color: var(--ink-2);
  font-size: 0.96rem;
}

.work-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}

.work-foot a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-decoration: none;
}

.work-foot a:hover {
  text-decoration: underline;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink);
}

.stat-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
}

.more-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.95rem;
}

.more-row p {
  flex: 1 1 30rem;
  max-width: 50rem;
  margin: 0;
}

/* SVG figure styling (inline SVGs inherit the theme) */
.fg-ink {
  fill: none;
  stroke: currentColor;
}

.fg-muted {
  fill: none;
  stroke: var(--ink-3);
}

.fg-line {
  fill: none;
  stroke: var(--line-strong);
}

.fg-accent {
  fill: none;
  stroke: var(--accent);
}

.fg-signal {
  fill: none;
  stroke: var(--signal);
}

.ff-neg {
  fill: var(--field-neg);
}

.ff-mid {
  fill: var(--field-mid);
}

.ff-pos {
  fill: var(--field-pos);
}

.ff-accent {
  fill: var(--accent);
}

.ff-signal {
  fill: var(--signal);
}

.ff-ink {
  fill: currentColor;
}

.ff-bg {
  fill: var(--bg);
}

.ff-elev {
  fill: var(--bg-elev);
}

.ff-band {
  fill: var(--accent);
  fill-opacity: 0.15;
}

@media (prefers-color-scheme: dark) {
  .ff-band {
    fill-opacity: 0.24;
  }
}

.fg-text {
  fill: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

/* ---------- Steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 28px;
  list-style: none;
}

.steps--spaced {
  margin-top: clamp(48px, 6vw, 72px);
}

.step {
  padding-top: 22px;
  border-top: 2px solid var(--ink);
}

.step:first-child {
  border-top-color: var(--signal);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-3);
}

.step h3 {
  margin: 12px 0 8px;
  font-size: 1.14rem;
}

.step p {
  color: var(--ink-2);
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 36px 24px;
  }
}

@media (max-width: 520px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

/* ---------- Call to action ---------- */
.cta {
  padding-block: clamp(56px, 8vw, 104px);
}

.cta-box {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto;
  gap: 32px;
  align-items: end;
  padding: clamp(32px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--bg-elev);
  overflow: hidden;
}

.cta-box::before {
  content: "";
  position: absolute;
  inset: 0 0 0 55%;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000);
  mask-image: linear-gradient(90deg, transparent, #000);
  pointer-events: none;
}

.cta-box > * {
  position: relative;
}

.cta-box h2 {
  margin: 14px 0 12px;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  letter-spacing: -0.03em;
}

.cta-box p {
  max-width: 36em;
  color: var(--ink-2);
}

@media (max-width: 760px) {
  .cta-box {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

/* ---------- Inner page hero ---------- */
.page-hero {
  padding-block: clamp(44px, 7vw, 96px) clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  max-width: 21ch;
  margin: 18px 0 20px;
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  font-weight: 680;
  line-height: 1.04;
  letter-spacing: -0.034em;
}

.page-hero .lead {
  max-width: 40em;
}

.page-hero .btn-row {
  margin-top: 30px;
}

.title-lg {
  margin-top: 16px;
  font-size: clamp(1.85rem, 3.3vw, 2.7rem);
  letter-spacing: -0.03em;
}

.label--block {
  display: block;
  margin-top: 28px;
}

.lead + .facts-list {
  margin-top: 28px;
}

.page-hero--split > .container {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

@media (max-width: 900px) {
  .page-hero--split > .container {
    grid-template-columns: 1fr;
  }
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  list-style: none;
}

.subnav a {
  display: inline-flex;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--ink-2);
  font-size: 0.9rem;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.subnav a:hover {
  border-color: var(--accent);
  color: var(--ink);
}

/* ---------- Services detail ---------- */
.svc {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(32px, 6vw, 96px);
  padding-block: clamp(56px, 8vw, 104px);
}

.svc + .svc {
  border-top: 1px solid var(--line);
}

.svc-intro {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
}

.svc-intro h2 {
  margin: 16px 0 16px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: -0.028em;
}

.svc-intro p {
  color: var(--ink-2);
}

.note {
  margin-top: 22px;
  padding: 14px 16px;
  border-left: 2px solid var(--signal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-elev);
  font-size: 0.92rem;
  color: var(--ink-2);
}

.svc-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 36px;
  list-style: none;
}

.svc-item {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.svc-item h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 1.04rem;
  letter-spacing: -0.01em;
}

.svc-item h3::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--accent);
  transform: translateY(-1px);
}

.svc-item p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

@media (max-width: 960px) {
  .svc {
    grid-template-columns: 1fr;
  }

  .svc-intro {
    position: static;
  }
}

@media (max-width: 620px) {
  .svc-list {
    grid-template-columns: 1fr;
  }
}

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  list-style: none;
}

.tool-list li {
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-2);
}

/* ---------- LLM data page ---------- */
.fail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.fail {
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.fail .label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fail .label::before {
  content: "";
  width: 10px;
  height: 2px;
  background: var(--signal);
}

.fail h3 {
  margin: 12px 0 8px;
  font-size: 1.06rem;
}

.fail p {
  color: var(--ink-2);
  font-size: 0.93rem;
}

@media (max-width: 1000px) {
  .fail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .fail-grid {
    grid-template-columns: 1fr;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.chips li {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 0.92rem;
  color: var(--ink-2);
}

.sample {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}

.sample-main,
.sample-side {
  padding: clamp(24px, 4vw, 40px);
}

.sample-side {
  border-left: 1px solid var(--line);
  background: var(--bg);
}

.sample h3 {
  margin-bottom: 14px;
  font-size: 1.12rem;
}

.sample h3 + .label,
.sample .label + h3 {
  margin-top: 6px;
}

.problem {
  margin: 14px 0 0;
  padding: 18px 20px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 1.02rem;
}

.solution {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  list-style: none;
  counter-reset: sol;
}

.solution li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 6px;
  color: var(--ink-2);
  font-size: 0.97rem;
}

.solution li::before {
  counter-increment: sol;
  content: counter(sol);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  transform: translateY(2px);
}

.solution .math {
  color: var(--ink);
}

.answer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 22px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.answer strong {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.answer span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-3);
}

.rubric {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.rubric th,
.rubric td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  color: var(--ink-2);
}

.rubric th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.rubric td:last-child,
.rubric th:last-child {
  width: 3.5em;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink);
}

.pitfalls {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  list-style: none;
}

.pitfalls li {
  position: relative;
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 0.93rem;
}

.pitfalls li::before,
.pitfalls li::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 11px;
  height: 1.6px;
  background: var(--signal);
  transform: rotate(45deg);
}

.pitfalls li::after {
  transform: rotate(-45deg);
}

.sample-side > * + .label {
  display: block;
  margin-top: 28px;
}

@media (max-width: 900px) {
  .sample {
    grid-template-columns: 1fr;
  }

  .sample-side {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

.qa-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
  list-style: none;
  counter-reset: qa;
}

.qa-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 4px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.qa-list li::before {
  counter-increment: qa;
  content: counter(qa, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-3);
  padding-top: 3px;
}

.qa-list h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.qa-list p {
  color: var(--ink-2);
  font-size: 0.95rem;
}

@media (max-width: 760px) {
  .qa-list {
    grid-template-columns: 1fr;
  }
}

/* ---------- About ---------- */
.profile {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.portrait {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 5;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.portrait img,
.portrait svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait {
  color: var(--ink);
}

.portrait-mono {
  font-family: var(--font-sans);
  font-size: 92px;
  font-weight: 650;
  letter-spacing: -0.045em;
  fill: currentColor;
}

.facts-list.facts-list--spaced {
  margin-top: 28px;
}

.chips-note {
  margin-top: 24px;
  font-size: 0.95rem;
}

.portrait figcaption {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-3);
}

.profile h1 {
  max-width: none;
}

.profile .role {
  margin-top: -6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-3);
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

@media (max-width: 860px) {
  .profile {
    grid-template-columns: 1fr;
  }

  .portrait {
    max-width: 300px;
  }
}

.prose-lg p {
  font-size: 1.08rem;
  color: var(--ink-2);
}

.prose-lg p:first-child {
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.55;
}

.facts-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.facts-list div {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.facts-list dt {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.facts-list dd {
  margin: 4px 0 0;
  color: var(--ink);
}

.cv {
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.cv li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 6px 32px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.cv .when {
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-3);
}

.cv h3 {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.cv .where {
  margin: 3px 0 0;
  color: var(--ink-2);
  font-size: 0.97rem;
}

.cv .detail {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 0.94rem;
}

.cv .badge {
  display: inline-flex;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  vertical-align: 2px;
  color: var(--ink-3);
}

@media (max-width: 640px) {
  .cv li {
    grid-template-columns: 1fr;
  }
}

.repo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.repo .label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.repo h3 {
  margin: 10px 0 8px;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  letter-spacing: 0;
}

.repo p {
  max-width: 46em;
  color: var(--ink-2);
}

@media (max-width: 700px) {
  .repo {
    grid-template-columns: 1fr;
  }
}

/* ---------- Publications ---------- */
.pub-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
}

.pub-toc {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
}

.pub-toc ul {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  list-style: none;
}

.pub-toc a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-left: -10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 0.94rem;
  text-decoration: none;
}

.pub-toc a:hover {
  background: var(--bg-sunk);
  color: var(--ink);
}

.pub-toc a span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-3);
}

@media (max-width: 860px) {
  .pub-layout {
    grid-template-columns: 1fr;
  }

  .pub-toc {
    position: static;
  }

  .pub-toc ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .pub-toc a {
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }
}

.pub-section + .pub-section {
  margin-top: clamp(48px, 6vw, 72px);
}

.pub-section > h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 1.4rem;
}

.pub-section > h2 .count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-3);
}

.pubs {
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.pub {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px 28px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.pub-year {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-3);
}

.pub-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.38;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.pub-title a {
  color: inherit;
  text-decoration: none;
}

.pub-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.pub-authors,
.pub-venue {
  margin: 6px 0 0;
  font-size: 0.94rem;
  color: var(--ink-2);
}

.pub-venue {
  margin-top: 2px;
}

.pub-authors .me {
  color: var(--ink);
  font-weight: 600;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.pub-links a {
  text-decoration: none;
}

.pub-links a:hover {
  text-decoration: underline;
}

.tag {
  display: inline-flex;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-3);
}

.tag--oa {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  color: var(--ok);
}

@media (max-width: 560px) {
  .pub {
    grid-template-columns: 1fr;
  }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}

@media (max-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.form-card {
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.form {
  display: grid;
  gap: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field label .opt {
  font-weight: 400;
  color: var(--ink-3);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.72em 0.9em;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.4em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238b9099' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.9em center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
}

.field textarea {
  min-height: 170px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input:user-invalid,
.field textarea:user-invalid {
  border-color: var(--signal);
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-note {
  max-width: 32em;
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-3);
}

.form-status {
  display: none;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  color: var(--ink);
}

.form-status.is-visible {
  display: block;
}

.form-status.is-success {
  border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 11%, transparent);
}

.form-status.is-error {
  border: 1px solid color-mix(in srgb, var(--signal) 45%, transparent);
  background: color-mix(in srgb, var(--signal) 11%, transparent);
}

/* ---------- Prose (privacy & legal) ---------- */
.prose {
  max-width: 720px;
}

.prose h2 {
  margin: 2.2em 0 0.6em;
  font-size: 1.35rem;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p,
.prose li {
  color: var(--ink-2);
}

.prose ul {
  display: grid;
  gap: 6px;
  margin: 0 0 1em;
  padding-left: 1.2em;
}

.prose dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 24px;
  margin: 0 0 1em;
}

.prose dt {
  color: var(--ink-3);
}

.prose dd {
  margin: 0;
  color: var(--ink);
}

@media (max-width: 520px) {
  .prose dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .prose dd {
    margin-bottom: 10px;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 56px 28px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 0.93rem;
  color: var(--ink-2);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: 40px;
}

.footer-grid h2 {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.footer-grid ul {
  display: grid;
  gap: 8px;
  list-style: none;
}

.footer-grid a {
  color: var(--ink-2);
  text-decoration: none;
}

.footer-grid a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.footer-brand p {
  max-width: 30em;
  margin-top: 16px;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-3);
}

.footer-legal p {
  margin: 0;
}

.footer-legal ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
}

.footer-legal a {
  color: var(--ink-3);
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

/* ---------- Placeholders still to be filled in (see README) ---------- */
.todo {
  padding: 0 0.3em;
  border-radius: 4px;
  outline: 1px dashed #b98a00;
  background: rgba(255, 196, 0, 0.25);
  color: inherit;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > *,
  .page-hero .container > * {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero-copy > :nth-child(2),
  .page-hero .container > :nth-child(2) {
    animation-delay: 0.06s;
  }

  .hero-copy > :nth-child(3) {
    animation-delay: 0.12s;
  }

  .hero-copy > :nth-child(4) {
    animation-delay: 0.18s;
  }

  .hero-copy > :nth-child(5) {
    animation-delay: 0.24s;
  }

  .hero-figure {
    animation: rise 0.9s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .site-footer,
  .nav-toggle,
  .btn,
  .hero::before,
  .page-hero::before,
  .band::before,
  .fig-panel {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .band {
    background: none;
    color: #000;
  }

  .section,
  .page-hero {
    padding-block: 24px;
  }
}
