/* ==========================================================================
   WildBionics – main stylesheet
   Concept: field notebook meets lab journal. Editorial serif (Fraunces),
   neutral sans (Inter), technical mono (JetBrains Mono); night-forest,
   paper, sand and deep-sea surfaces; amber = nature, teal = signal/science.
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL OFL 1.1, see assets/fonts) ---------- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-full-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-full-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  --night: #0d1a16;
  --night-2: #14261f;
  --ocean: #08171e;
  --ocean-2: #0e2a33;
  --paper: #f6f2e9;
  --sand: #ece5d5;
  --card: #fbf9f4;

  --ink: #16211d;
  --ink-2: #45524c;
  --line: rgba(22, 33, 29, 0.14);

  --on-dark: #eef2ea;
  --on-dark-2: #a9b9b1;
  --line-dark: rgba(238, 242, 234, 0.14);

  --accent: #e3a93a;       /* amber, for dark surfaces */
  --accent-ink: #8a5a00;   /* amber, for light surfaces (5.4:1 on paper) */
  --signal: #5ccbb6;       /* teal, for dark surfaces */
  --signal-ink: #0e6b5d;   /* teal, for light surfaces (5.9:1 on paper) */

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
  --radius: 18px;
  --header-h: 68px;
  --section-pad: clamp(80px, 10vw, 140px);

  /* Context-dependent colours; overridden per surface below. */
  --text: var(--ink);
  --text-2: var(--ink-2);
  --rule: var(--line);
  --eyebrow: var(--accent-ink);
  --focus: var(--signal-ink);
}

.hero, .site-header, .site-footer, .section--ocean {
  --text: var(--on-dark);
  --text-2: var(--on-dark-2);
  --rule: var(--line-dark);
  --eyebrow: var(--accent);
  --focus: var(--accent);
}

/* ---------- 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(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { list-style: none; padding: 0; }  /* lists are UI by default; prose re-enables markers */
img, svg { display: block; max-width: 100%; }
a { color: inherit; }

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

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--night);
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.container {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Shared typography ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--eyebrow);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.35rem + 2.6vw, 3.5rem);
  font-weight: 380;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  line-height: 1.06;
  letter-spacing: -0.018em;
  color: var(--text);
  text-wrap: balance;
}

.section-intro {
  max-width: 58ch;
  color: var(--text-2);
  font-size: 1.125rem;
  line-height: 1.7;
  text-wrap: pretty;
}

.kicker {
  margin-bottom: 10px;
  color: var(--signal-ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.caption {
  margin-top: 14px;
  max-width: 62ch;
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-style: italic;
  font-variation-settings: "opsz" 14;
  line-height: 1.5;
}
.caption__label {
  margin-right: 6px;
  color: var(--eyebrow);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-style: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

var {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 24, "WONK" 0;  /* no wonky b/d/h in formulas */
}

/* ---------- Buttons & links ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.975rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.button svg { width: 18px; height: 18px; flex: none; }
.button:hover { transform: translateY(-1px); }
.button--primary { background: var(--accent); color: var(--night); }
.button--primary:hover { background: #f0bb52; }
.button--primary svg { transition: transform 0.2s; }
.button--primary:hover svg { transform: translateX(3px); }
.button--ghost { border-color: var(--line-dark); color: var(--on-dark); }
.button--ghost:hover { border-color: var(--on-dark-2); background: rgba(238, 242, 234, 0.06); }
.button--dark { background: var(--ink); color: var(--paper); }
.button--dark:hover { background: #26352f; }
.button--outline { border-color: rgba(22, 33, 29, 0.35); color: var(--ink); }
.button--outline:hover { border-color: var(--ink); background: rgba(22, 33, 29, 0.04); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(227, 169, 58, 0.4);
  padding-bottom: 2px;
}
.link-arrow svg { width: 18px; height: 18px; transition: transform 0.2s; }
.link-arrow:hover { border-bottom-color: var(--accent); }
.link-arrow:hover svg { transform: translateX(4px); }

/* ---------- Chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips li {
  padding: 4px 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 26, 22, 0.86);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-dark);
  color: var(--on-dark);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--on-dark);
  text-decoration: none;
}
.brand__mark { width: 30px; height: 30px; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 560;
  font-variation-settings: "opsz" 48, "SOFT" 50;
  letter-spacing: -0.01em;
}
.brand__name em {
  font-weight: 380;
  color: var(--accent);
}

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 28px; }
.site-nav a {
  position: relative;
  color: var(--on-dark-2);
  font-size: 0.925rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s;
}
.site-nav a:hover { color: var(--on-dark); }
.site-nav a:hover::after { transform: scaleX(1); }

.site-header__tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-switch ul {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
}
.lang-switch a,
.lang-switch span[aria-current] {
  display: block;
  min-width: 38px;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  text-decoration: none;
}
.lang-switch a { color: var(--on-dark-2); }
.lang-switch a:hover { color: var(--on-dark); background: rgba(238, 242, 234, 0.08); }
.lang-switch span[aria-current] { background: var(--on-dark); color: var(--night); }

.icon-link {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--on-dark-2);
  transition: color 0.2s, background-color 0.2s;
}
.icon-link svg { width: 20px; height: 20px; }
.icon-link:hover { color: var(--on-dark); background: rgba(238, 242, 234, 0.08); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 72% 38%, rgba(92, 203, 182, 0.10), transparent 70%),
    radial-gradient(700px 500px at 8% 100%, rgba(227, 169, 58, 0.07), transparent 70%),
    linear-gradient(180deg, var(--night) 0%, #0b1714 100%);
  color: var(--on-dark);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(32px, 4vw, 64px);
  padding-block: clamp(56px, 8vw, 104px) clamp(40px, 5vw, 64px);
}
.hero__title {
  margin-bottom: 28px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 1.9rem + 4.4vw, 5.75rem);
  font-weight: 340;
  font-variation-settings: "opsz" 144, "SOFT" 40;
  line-height: 0.98;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
.hero__title em {
  font-weight: 300;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  color: var(--accent);
}
.hero__lede {
  max-width: 34rem;
  margin-bottom: 36px;
  color: var(--on-dark-2);
  font-size: 1.15rem;
  line-height: 1.7;
  text-wrap: pretty;
}
.hero__figure { position: relative; }
.hero__figure .caption { margin-left: auto; margin-right: 0; max-width: 46ch; text-align: right; }

.disciplines {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 32px;
  padding-block: 24px 32px;
  border-top: 1px solid var(--line-dark);
}
.disciplines__label {
  color: var(--on-dark-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.disciplines ul { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.disciplines li {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-style: italic;
  font-weight: 350;
  font-variation-settings: "opsz" 36;
  color: var(--on-dark);
}
.disciplines li + li::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 32px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
  translate: 0 -2px;
}

/* ---------- SVG illustration styles ---------- */
.hero-svg, .lens-svg, .cav-svg { width: 100%; height: auto; overflow: visible; }
.lens-svg { overflow: hidden; }
.lens-svg .label { font-size: 11.5px; }

.label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  fill: var(--text);
}
.label-muted { fill: var(--text-2); }
.label-tick { font-size: 10px; fill: var(--text-2); }
.label-echo, .label-accent { fill: var(--accent); }
.label-dim { font-size: 12.5px; }
.math {
  font-family: var(--font-display);
  font-size: 20px;
  font-style: italic;
  font-variation-settings: "opsz" 24, "WONK" 0;
  fill: var(--text);
}

.bat-membrane { fill: var(--bat-fill, #e8e2d2); }
.bat-body { fill: var(--bat-body, #f4efe3); }
.bat-bones { fill: none; stroke: var(--bat-bone, rgba(13, 26, 22, 0.35)); stroke-width: 0.9; stroke-linecap: round; }
.moth { color: #dccda6; fill: currentColor; }

/* Hero */
.hero-grid { color: rgba(238, 242, 234, 0.07); }
.wave path { stroke-linecap: round; }
.wave-call path { stroke: var(--signal); stroke-width: 2; opacity: calc(1 - var(--i) * 0.16); }
.wave-echo path { stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 5 6; opacity: calc(1 - var(--i) * 0.22); }
.ray { stroke: rgba(238, 242, 234, 0.2); stroke-width: 1; stroke-dasharray: 2 6; }
.dim path { fill: none; stroke: var(--on-dark-2); stroke-width: 1; }
.dim .dim-arrow { fill: var(--on-dark-2); stroke: none; }
.callout path { fill: none; stroke: var(--on-dark-2); stroke-width: 1; }
.callout circle { fill: var(--on-dark); }
.callout-echo circle { fill: var(--accent); }
.inset-bg { fill: rgba(8, 18, 15, 0.72); stroke: var(--line-dark); }
.axis, .tick { fill: none; stroke: var(--text-2); stroke-width: 1; }
.axis-arrow { fill: var(--text-2); }
.chirp { fill: none; stroke: var(--signal); stroke-width: 3.5; stroke-linecap: round; }

@media (prefers-reduced-motion: no-preference) {
  .wave-call path { animation: ping 3.2s ease-out infinite both; animation-delay: calc(var(--i) * 0.2s); }
  .wave-echo path { animation: ping 3.2s ease-out infinite both; animation-delay: calc(1.25s + var(--i) * 0.2s); }
}
@keyframes ping {
  0%   { opacity: 0.1; }
  10%  { opacity: 1; }
  50%  { opacity: 0.3; }
  100% { opacity: 0.1; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-pad); }
.section--paper { background: var(--paper); }
.section--sand { background: var(--sand); }
.section--ocean {
  background:
    radial-gradient(800px 520px at 20% 30%, rgba(92, 203, 182, 0.10), transparent 70%),
    radial-gradient(600px 400px at 90% 90%, rgba(227, 169, 58, 0.06), transparent 70%),
    linear-gradient(180deg, var(--ocean-2) 0%, var(--ocean) 100%);
  color: var(--on-dark);
}

.section-head { margin-bottom: clamp(40px, 5vw, 64px); }
.section-head .section-title { max-width: 18ch; margin-bottom: 20px; }
.section-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: end;
  gap: 24px 64px;
}
.section-head--split .section-title { margin-bottom: 0; }

/* ---------- Lens ---------- */
.lens__tabs {
  display: flex;
  gap: 8px;
  margin-bottom: clamp(32px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.lens__tabs[hidden] { display: none; }
.lens__tab {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 20px -1px 0;
  padding: 14px 2px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-2);
  font: 600 1.05rem/1.2 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.lens__tab:hover { color: var(--ink); }
.lens__tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent-ink); }
.lens__tab-index {
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.lens__panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
}
.lens__panel[hidden] { display: none; }
.lens:not(.is-enhanced) .lens__panel + .lens__panel {
  margin-top: 56px;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}
.lens__panel:focus-visible { outline-offset: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .lens.is-enhanced .lens__panel:not([hidden]) { animation: panel-in 0.45s ease-out; }
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.lens__title {
  margin-bottom: 16px;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.4rem + 1vw, 2.25rem);
  font-weight: 420;
  font-variation-settings: "opsz" 72, "SOFT" 30;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.lens__text > p:not(.kicker):not(.example) { color: var(--ink-2); max-width: 52ch; text-wrap: pretty; }

.formula {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 28px 0 18px;
  padding: 18px 26px;
  border-left: 3px solid var(--accent-ink);
  border-radius: 0 12px 12px 0;
  background: var(--card);
  box-shadow: 0 1px 0 var(--line);
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-variation-settings: "opsz" 36;
  line-height: 1;
  color: var(--ink);
}
.formula--pair { gap: 18px 44px; }
.formula > span[role="math"] { display: inline-flex; align-items: center; gap: 10px; }
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  font-size: 0.82em;
  text-align: center;
  vertical-align: middle;
}
.frac__num { padding: 0 6px 6px; border-bottom: 1.5px solid currentColor; }
.frac__den { padding: 6px 6px 0; }
.paren { font-size: 1.5em; font-weight: 250; line-height: 1; }
.formula sub { font-size: 0.6em; }

.example { color: var(--ink-2); font-size: 0.95rem; }
.example .legend { display: block; margin-top: 8px; font-size: 0.85rem; opacity: 0.9; }

.lens__figure {
  padding: clamp(16px, 2.5vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(22, 33, 29, 0.055) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(22, 33, 29, 0.055) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--card);
  box-shadow: 0 30px 60px -40px rgba(22, 33, 29, 0.35);
}
.lens__figure:has(.code-card) { padding: 0; border: 0; background: none; box-shadow: none; }

/* Light-surface SVG colours */
.lens-svg .bat-ink { --bat-fill: #2a3a34; --bat-body: #16211d; --bat-bone: rgba(246, 242, 233, 0.4); }
.lens-svg .moth-ink { color: #9a7440; }
.fronts circle { stroke: var(--signal-ink); stroke-width: 1.6; }
.fronts circle:nth-child(1) { opacity: 0.3; }
.fronts circle:nth-child(2) { opacity: 0.45; }
.fronts circle:nth-child(3) { opacity: 0.6; }
.fronts circle:nth-child(4) { opacity: 0.8; }
.guide { fill: none; stroke: rgba(22, 33, 29, 0.3); stroke-width: 1; stroke-dasharray: 3 5; }
.vec { stroke: var(--ink); stroke-width: 2; }
.vec-arrow { fill: var(--ink); }
.chip-bg { fill: rgba(251, 249, 244, 0.92); stroke: var(--line); }
.chip-accent { fill: #fbeccd; stroke: rgba(138, 90, 0, 0.3); }
.lens-svg .chip-accent + .label { fill: var(--accent-ink); }
.leg { fill: none; stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 4 5; }
.hyp { stroke: var(--signal-ink); stroke-width: 2.5; stroke-linecap: round; }
.angle { fill: none; stroke: var(--accent-ink); stroke-width: 1.6; }
.wave-call-ink { fill: none; stroke: var(--signal-ink); stroke-width: 1.8; }
.wave-echo-ink { fill: none; stroke: var(--accent-ink); stroke-width: 1.8; }

/* Code */
.code-card {
  overflow: hidden;
  border-radius: var(--radius);
  background: #0f1c18;
  color: var(--on-dark);
  box-shadow: 0 30px 60px -30px rgba(13, 26, 22, 0.55);
}
.code-card__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-dark);
  color: var(--on-dark-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.code-card__dots { display: flex; gap: 6px; }
.code-card__dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(238, 242, 234, 0.16); }
.code-card__lang { margin-left: auto; color: var(--signal); }
.code-card pre {
  margin: 0;
  padding: 22px 24px 26px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.75;
  tab-size: 4;
}
.code-card .highlight { margin: 0; background: none; }
.highlight .c, .highlight .c1, .highlight .cm { color: #7f958c; font-style: italic; }
.highlight .k, .highlight .kn, .highlight .kd, .highlight .kc, .highlight .ow { color: var(--accent); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sd { color: var(--signal); }
.highlight .sd { font-style: italic; }
.highlight .nf, .highlight .fm { color: #9fd3f5; }
.highlight .mi, .highlight .mf { color: #f2a07b; }
.highlight .nn { color: #e6d3a3; }
.highlight .o, .highlight .p { color: #b9c7c0; }
.highlight .n, .highlight .nb, .highlight .bp { color: var(--on-dark); }

/* ---------- Dimensions ---------- */
.dimensions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  counter-reset: dim;
}
.dimension {
  --dim: var(--signal-ink);
  --card-bg: var(--card);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 26px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.dimension::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--dim);
  opacity: 0;
  transition: opacity 0.3s;
}
.dimension:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -32px rgba(22, 33, 29, 0.45); }
.dimension:hover::before { opacity: 1; }
.dimension--time { --dim: #95560f; }
.dimension--space { --dim: #0e6b5d; }
.dimension--rules { --dim: #2d5b88; }
.dimension--adjacent { --dim: #7a3d5c; }

.dimension__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
}
.dimension__icon { width: 52px; height: 52px; color: var(--dim); }
.dimension__index {
  color: rgba(22, 33, 29, 0.28);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}
.dimension__title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 450;
  font-variation-settings: "opsz" 48, "SOFT" 30;
  line-height: 1.15;
  hyphens: auto;
}
.dimension__sub {
  margin: 6px 0 16px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.dimension__text {
  flex: 1;
  margin-bottom: 22px;
  color: var(--ink-2);
  font-size: 0.975rem;
  line-height: 1.6;
}

/* ---------- Flagship ---------- */
.flagship {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(40px, 6vw, 88px);
}
.flagship__figure {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: rgba(4, 14, 19, 0.45);
}
.flagship .section-title { margin-bottom: 24px; }
.flagship__text { margin-bottom: 36px; color: var(--on-dark-2); font-size: 1.1rem; line-height: 1.7; text-wrap: pretty; }

.cav-svg .bubbles circle { fill: rgba(92, 203, 182, 0.12); stroke: var(--signal); stroke-width: 1.5; }
.cav-svg .bubble-shine path { stroke: rgba(255, 255, 255, 0.65); stroke-width: 1.5; stroke-linecap: round; }
.cav-svg .guide { stroke: rgba(238, 242, 234, 0.22); }
.cav-svg .curve { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.cav-svg .curve-area { fill: url(#cav-area); }
.cav-svg .shock path { stroke: var(--accent); stroke-width: 1.3; }
.cav-svg .shock path:nth-child(2) { opacity: 0.6; }
.cav-svg .shock path:nth-child(3) { opacity: 0.3; }
.cav-svg .callout-line { fill: none; stroke: var(--on-dark-2); stroke-width: 1; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line-dark);
}
.stat dd {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem);
  font-weight: 380;
  font-variation-settings: "opsz" 96;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--accent);
  white-space: nowrap;
}
.stat dt { color: var(--on-dark-2); font-size: 0.85rem; line-height: 1.4; }

.chips--dark { margin-bottom: 32px; }

.sources {
  margin-bottom: 32px;
  padding: 20px 22px;
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  color: var(--on-dark-2);
  font-size: 0.85rem;
  line-height: 1.55;
}
.sources__label {
  margin-bottom: 10px;
  color: var(--on-dark);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.sources ol { padding-left: 1.2em; list-style: decimal; }
.sources li + li { margin-top: 8px; }
.sources cite { font-style: italic; }
.sources a { color: var(--signal); text-underline-offset: 3px; overflow-wrap: anywhere; }
.sources a:hover { color: var(--on-dark); }

/* ---------- Contribute ---------- */
.contribute {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(40px, 6vw, 96px);
}
.contribute__head .section-title { margin-bottom: 20px; }
.section-title .line { display: block; }
.contribute__head .section-intro { margin-bottom: 36px; }
.ways { border-top: 1px solid var(--line); }
.way {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  column-gap: 20px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.way__icon {
  grid-row: span 2;
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: 50%;
  background: var(--sand);
  color: var(--signal-ink);
}
.way__title {
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 450;
  font-variation-settings: "opsz" 36;
}
.way p { color: var(--ink-2); font-size: 0.975rem; }

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 72px 32px;
  background: var(--night);
  color: var(--on-dark-2);
  font-size: 0.925rem;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: 40px;
  padding-bottom: 48px;
}
.site-footer__tagline {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  font-variation-settings: "opsz" 24;
}
.site-footer__heading {
  margin-bottom: 14px;
  color: var(--on-dark);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.site-footer nav:not(.lang-switch) li + li { margin-top: 8px; }
.site-footer nav:not(.lang-switch) a { text-decoration: none; }
.site-footer nav:not(.lang-switch) a:hover { color: var(--on-dark); text-decoration: underline; text-underline-offset: 3px; }
.site-footer .lang-switch ul { display: inline-flex; }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line-dark);
  font-size: 0.825rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .dimensions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-nav ul { gap: 20px; }
}

@media (max-width: 920px) {
  .hero__grid,
  .lens__panel,
  .flagship,
  .contribute,
  .section-head--split { grid-template-columns: minmax(0, 1fr); }
  .hero__figure .caption { text-align: left; margin-left: 0; }
  .flagship__figure { order: 2; position: static; }
  .site-nav { display: none; }
  .site-header__tools { margin-left: auto; }
  .site-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .dimensions { grid-template-columns: minmax(0, 1fr); }
  .dimension__top { margin-bottom: 24px; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .stat { flex-direction: row-reverse; justify-content: space-between; align-items: baseline; padding-block: 12px; }
  .formula { font-size: 1.4rem; padding: 16px 20px; }
  .lens__tab { margin-right: 12px; font-size: 0.975rem; }
  .actions .button { flex: 1 1 auto; justify-content: center; }
  .disciplines li + li::before { display: none; }
  .disciplines ul { gap: 2px 20px; }
  .disciplines li { font-size: 1.15rem; }
  .hero-svg .label { font-size: 18px; }
  .hero-svg .label-tick { font-size: 15px; }
  .lens__tab-index { display: none; }
}

@media (forced-colors: active) {
  .button, .lens__tab[aria-selected="true"] { border: 2px solid CanvasText; }
}
