@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-variable.woff2') format('woff2');
}

:root {
  --bg: #ffffff;
  --surface: #f6f7f7;
  --surface-2: #eef0ef;
  --ink: #3f3f3f;
  --ink-soft: #666666;
  --ink-faint: #8c8c8c;
  --border: #e2e5e3;
  --line: #cfd4d1;
  --accent: #34a1a3;
  --accent-text: #2a8283;
  --on-accent: #ffffff;
  --shadow: rgba(20, 20, 20, 0.08);
  --rig: #3a3a3a;

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;

  --container: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --surface: #181818;
    --surface-2: #1f1f1f;
    --ink: #ececec;
    --ink-soft: #b7b7b7;
    --ink-faint: #8a8a8a;
    --border: #2a2a2a;
    --line: #333333;
    --accent: #34a1a3;
    --accent-text: #5dc9cb;
    --on-accent: #ffffff;
    --shadow: rgba(0, 0, 0, 0.4);
    --rig: #ececec;
  }
}
:root[data-theme="dark"] {
  --bg: #111111;
  --surface: #181818;
  --surface-2: #1f1f1f;
  --ink: #ececec;
  --ink-soft: #b7b7b7;
  --ink-faint: #8a8a8a;
  --border: #2a2a2a;
  --line: #333333;
  --accent: #34a1a3;
  --accent-text: #5dc9cb;
  --on-accent: #ffffff;
  --shadow: rgba(0, 0, 0, 0.4);
  --rig: #ececec;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f7f7;
  --surface-2: #eef0ef;
  --ink: #3f3f3f;
  --ink-soft: #666666;
  --ink-faint: #8c8c8c;
  --border: #e2e5e3;
  --line: #cfd4d1;
  --accent: #34a1a3;
  --accent-text: #2a8283;
  --on-accent: #ffffff;
  --shadow: rgba(20, 20, 20, 0.08);
  --rig: #3a3a3a;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}
img, svg { max-width: 100%; }

h1, h2, h3 {
  font-family: var(--font-body);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}
p { margin: 0; }
a { color: inherit; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: "";
  width: 1.4em;
  height: 1.5px;
  background: var(--accent);
}

/* ---------- Nav ---------- */
header.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding-block: 0.9rem;
}
.nav-links {
  display: flex;
  gap: clamp(1rem, 1.8vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.92rem;
}
.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 3px;
  white-space: nowrap;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-links a:hover::after,
.nav-links a:focus-visible::after { transform: scaleX(1); }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--ink); }
@media (max-width: 860px) { .nav-links { display: none; } }

.nav-right { display: flex; align-items: center; gap: 0.75rem; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-soft); }
.theme-toggle .icon { width: 1.15rem; height: 1.15rem; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* ---------- Logo ---------- */
.logo-lockup { display: inline-flex; align-items: center; text-decoration: none; }
.logo-img { height: 60px; width: auto; display: block; }
.footer-logo-mark { height: 120px; width: auto; display: block; opacity: 0.5; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.4rem;
  border-radius: 3px;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { filter: brightness(0.92); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-row { display: flex; gap: 0.85rem; flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5.5rem); }

.hero-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}
.hero-copy { max-width: 36rem; }
.hero h1 {
  font-size: clamp(2rem, 2.6vw + 1.2rem, 3.6rem);
  margin-bottom: 1.1rem;
}
.hero-sub {
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: 1.1rem;
  line-height: 1.55;
  margin-bottom: 1.8rem;
}

.hero-visual { display: flex; justify-content: center; }

/* ===== 2D HERO (SVG) — fallback only. js/hero-3d.js swaps it in from <template id="hero-2d-archive">
   when the Three.js CDN or WebGL is unavailable; otherwise none of this matches anything. ===== */
/* Titration drawing: rig strokes draw on, then js/hero-titration.js runs the liquids. */
.titration { display: block; width: 100%; max-width: 440px; height: auto; overflow: visible; }
.t-rig path {
  stroke: var(--rig);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1.01;
  animation: rigDraw var(--dur, .8s) cubic-bezier(.55, .1, .3, 1) var(--d, 0s) forwards;
  transition: stroke 0.2s ease;
}
.t-rig .t-ticks { stroke-width: 1.25; }
@keyframes rigDraw { to { stroke-dashoffset: 0; } }
.liq { stroke: none; fill-opacity: 0.7; }
.liq-teal { fill: #14c3c6; }
.liq-red { fill: #e5354d; }
/* Titrant is colourless until it reacts — a faint tint + outline keeps it visible in both themes. */
.liq-clear { fill: var(--rig); fill-opacity: 0.1; }
.t-drop { stroke: var(--rig); stroke-opacity: 0.55; stroke-width: 0.9; }
.t-meniscus { fill: none; stroke: var(--rig); stroke-opacity: 0.55; stroke-width: 1.2; }
.t-gold { fill: none; stroke: url(#t-gold-grad); stroke-width: 2.4; stroke-linecap: round; opacity: 0; }
.t-gold-shine { fill: none; stroke: #fffbe6; stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 3 29; opacity: 0; }
.t-gold-glint { fill: none; stroke: #ffffff; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 0.1 47; opacity: 0; }
.titration.is-static .t-rig path { animation: none; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) {
  .t-rig path { animation: none; stroke-dashoffset: 0; }
}
/* ===== END 2D HERO ===== */

/* 3D titration hero — js/hero-3d.js renders into this box with Three.js. */
.hero-3d {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 4 / 5;
}
.hero-3d canvas { display: block; width: 100% !important; height: 100% !important; }

@media (max-width: 860px) {
  .theme-toggle { display: none; }
  .hero-stage { grid-template-columns: 1fr; }
  .hero .btn-row { flex-direction: column; }
  .hero .btn-row .btn { width: 100%; justify-content: center; }
  .hero-3d { max-width: 340px; }
  .titration { max-width: 320px; }
}

.hero-caption {
  margin-top: 1rem;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------- Section rhythm ---------- */
section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.band { background: var(--surface); border-block: 1px solid var(--border); }

.section-head { max-width: 42rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head h2 { font-size: clamp(1.9rem, 1.6vw + 1.4rem, 2.6rem); margin-bottom: 0.9rem; }
.section-head p { color: var(--ink-soft); font-size: 1.05rem; }

.lede { max-width: 44rem; }
.lede p + p { margin-top: 1.1rem; }
.metaphor-line {
  margin-top: 1.6rem;
  padding-left: 1.15rem;
  border-left: 2px solid var(--accent);
  font-size: 1.08rem;
  color: var(--ink);
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 880px) { .card-grid, .card-grid-2 { grid-template-columns: 1fr; } }
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.8rem 1.6rem;
}
.band .card { background: var(--surface-2); }
.card h3 { font-size: 1.25rem; margin-bottom: 0.7rem; }
.card p { color: var(--ink-soft); font-size: 0.98rem; }

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  margin-bottom: 1.6rem;
}
@media (max-width: 880px) { .stat-grid { grid-template-columns: 1fr; } }
.stat {
  padding: 1.9rem 1.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 3px;
}
.stat .n {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.1rem, 3vw, 2.9rem);
  font-weight: 700;
  color: var(--accent-text);
  display: block;
  margin-bottom: 0.5rem;
}
.stat p { color: var(--ink-soft); font-size: 0.93rem; }
.stat-foot {
  font-size: 0.8rem;
  color: var(--ink-faint);
  max-width: 52rem;
  line-height: 1.6;
}
.stat-foot a { color: var(--accent-text); text-decoration: underline; }

/* ---------- Process ---------- */
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
@media (max-width: 980px) { .process-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .process-grid { grid-template-columns: 1fr; } }
.step { position: relative; padding-top: 0.4rem; }
.step .num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-text);
  display: block;
  margin-bottom: 0.9rem;
  letter-spacing: 0.05em;
}
.step h3 { font-size: 1.18rem; margin-bottom: 0.55rem; }
.step p { color: var(--ink-soft); font-size: 0.95rem; }
.step:not(:last-child) {
  border-right: 1px dashed var(--border);
  padding-right: 1.3rem;
}
@media (max-width: 980px) { .step:not(:last-child) { border-right: none; padding-right: 0; } }

/* ---------- Role table ---------- */
.role-table { width: 100%; border-collapse: collapse; }
.role-table th, .role-table td {
  text-align: left;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.97rem;
}
.role-table thead th {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--ink-soft);
}
.role-table td:first-child { font-weight: 600; white-space: nowrap; }
.role-table td:last-child, .role-table th:last-child { color: var(--ink-soft); }
.table-wrap { overflow-x: auto; }

/* ---------- Bench spotlight ---------- */
.bench-grid {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (max-width: 860px) { .bench-grid { grid-template-columns: 1fr; } }
.bench-grid h2 { font-size: clamp(1.7rem, 1.6vw + 1.2rem, 2.3rem); margin-bottom: 1rem; }
.bench-grid p { color: var(--ink-soft); }

.bench-mockup {
  max-width: 320px;
  width: 100%;
  height: auto;
  display: block;
  margin-inline: auto;
}

/* ---------- Trust list ---------- */
.trust-list { display: grid; gap: 1.3rem; max-width: 46rem; }
.trust-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: flex-start;
}
.trust-item .mark {
  color: var(--accent-text);
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  margin-top: 0.1rem;
}
.trust-item .mark .icon { width: 1.05rem; height: 1.05rem; }
.trust-item p { color: var(--ink-soft); padding-top: 0.3rem; }
.trust-item strong { color: var(--ink); }

/* ---------- CTA ---------- */
.cta { text-align: center; padding-block: clamp(4rem, 8vw, 6.5rem); }
.cta h2 { font-size: clamp(2rem, 2vw + 1.4rem, 2.9rem); margin-bottom: 1rem; }
.cta p { color: var(--ink-soft); max-width: 34rem; margin: 0 auto 2rem; font-size: 1.08rem; }
.cta .btn-row { justify-content: center; }
.cta .fine { margin-top: 1.4rem; font-size: 0.85rem; color: var(--ink-faint); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding-block: 2.5rem; }
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.88rem;
  color: var(--ink-faint);
}
.footer-admin-link { text-decoration: none; color: var(--ink-faint); font-weight: 500; }
.footer-admin-link:hover { color: var(--ink); text-decoration: underline; }

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

/* ---------- Icons ---------- */
.icon { width: 1.4em; height: 1.4em; display: inline-block; flex-shrink: 0; vertical-align: -0.28em; fill: currentColor; }
.btn .icon { width: 1.15em; height: 1.15em; }
.step-icon { color: var(--accent-text); margin-bottom: 0.7rem; }
.step-icon .icon { width: 1.6rem; height: 1.6rem; }
.card-icon { color: var(--accent-text); margin-bottom: 0.9rem; }
.card-icon .icon { width: 1.5rem; height: 1.5rem; }

/* ---------- Theme-swapped assets ----------
   Kept last and !important so this visibility switch always wins, no matter
   what other rule also happens to set `display` on a themed logo/photo. */
.theme-dark-only { display: none !important; }
.theme-light-only { display: block !important; }
@media (prefers-color-scheme: dark) {
  .theme-light-only { display: none !important; }
  .theme-dark-only { display: block !important; }
}
:root[data-theme="dark"] .theme-light-only { display: none !important; }
:root[data-theme="dark"] .theme-dark-only { display: block !important; }
:root[data-theme="light"] .theme-light-only { display: block !important; }
:root[data-theme="light"] .theme-dark-only { display: none !important; }

/* ---------- Contact modal ---------- */
.contact-modal {
  border: none;
  border-radius: 10px;
  padding: 2rem;
  width: min(420px, calc(100vw - 2.5rem));
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px var(--shadow);
}
.contact-modal::backdrop { background: rgba(0, 0, 0, 0.5); }
.contact-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.3rem; }
.contact-modal-head h3 { font-size: 1.3rem; margin: 0; }
.contact-modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1; color: var(--ink-faint); padding: 0.2rem;
}
.contact-modal-close:hover { color: var(--ink); }
.contact-modal-sub { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 1.4rem; }
.contact-modal-form .field { margin-bottom: 1rem; }
.contact-modal-form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.contact-modal-form input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
}
.contact-modal-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.contact-modal-form .btn { width: 100%; justify-content: center; margin-top: 0.4rem; }
.contact-modal-error {
  color: #d64545;
  background: rgba(214, 69, 69, 0.1);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.contact-modal-success { text-align: center; }
.contact-modal-success h3 { margin-bottom: 0.4rem; }
.contact-modal-success p { color: var(--ink-soft); margin-bottom: 1.4rem; }
.contact-modal-success .btn { width: 100%; justify-content: center; }
