:root {
  color-scheme: dark;
  --ink: #07111f;
  --raised: #0c1a2a;
  --line: #29445d;
  --paper: #e9f1f5;
  --muted: #9fb3c2;
  --cyan: #69d2e7;
  --amber: #ffb35c;
  --max: 1240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a { color: inherit; text-underline-offset: 0.22em; }
a:hover { color: var(--cyan); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 0.8rem;
  background: var(--paper);
  color: var(--ink);
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

.site-header,
main,
footer {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
}

.site-header {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(105, 210, 231, 0.2);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: Georgia, serif;
}

.site-header nav { display: flex; align-items: center; gap: 1.25rem; }
.site-header nav a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}
.site-header .nav-cta {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  color: var(--paper);
}

.intro { padding: clamp(2rem, 5vw, 4rem) 0 2rem; }
.intro h1 { max-width: 54rem; line-height: 1.04; }
.intro-lead { max-width: 49rem; color: #c7d5de; font-size: 1.125rem; }
.intro-jump { display: inline-flex; align-items: center; gap: 1rem; color: var(--cyan); font-weight: 700; }
.context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin-top: 2.5rem;
}
.context-grid section { min-width: 0; border-top: 1px solid var(--line); padding-top: 1rem; }
.context-grid h2 { margin: 0 0 1rem; font-size: 1.3rem; line-height: 1.25; font-weight: 600; }
.context-grid p { color: #c7d5de; }
.context-grid strong { color: var(--paper); }
.context-grid a { color: var(--cyan); }
.source-links { display: flex; flex-wrap: wrap; gap: 0.65rem 1.5rem; font-size: 0.875rem; }
#result { scroll-margin-top: 1.5rem; }
.media-pending { color: var(--muted); font-size: 0.875rem; }
.stream-movie { max-width: 720px; margin: 1rem 0 2rem; }
.stream-movie.three-view { max-width: none; }
.stream-movie.three-view video, .stream-movie.three-view img { width: 100%; min-width: 1000px; height: auto; }
.grid-schematic { margin-bottom: 2rem; }
.grid-schematic summary { color: var(--muted); cursor: pointer; }
.stream-movie video { display: block; width: 720px; background: #050c16; }
.stream-movie figcaption { display: flex; flex-wrap: wrap; gap: 0.7rem 1.5rem; justify-content: space-between; padding: 0.8rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.media-links { display: flex; gap: 1.25rem; }
.media-links a, .archive-link a { color: var(--cyan); }
.archive-link { margin: 1rem 0 2rem; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.8rem;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 0 0.28rem rgba(105, 210, 231, 0.12);
}

h1, p, figure, dl, dd { margin-top: 0; }
h1 {
  max-width: none;
  margin-bottom: 1.25rem;
  font-family: inherit;
  font-size: clamp(2.8rem, 4.5vw, 4.3rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.96;
}
.math { font-family: Georgia, serif; font-style: italic; }
.dek {
  max-width: 37rem;
  margin-bottom: 1.5rem;
  color: #c1d0da;
  font-size: 1.05rem;
}

.gif-card {
  overflow: hidden;
  margin: 0;
  background: var(--ink);
}
.gif-card img { display: block; width: 100%; height: auto; background: var(--ink); }
.gif-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--line);
}
.gif-card figcaption strong, .gif-card figcaption span { display: block; }
.gif-card figcaption span { color: var(--muted); font-size: 0.875rem; }
.gif-card figcaption a {
  flex: 0 0 auto;
  padding: 0.32rem 0.55rem;
  border: 1px solid var(--line);
  font-size: 0.875rem;
  font-weight: 800;
  text-decoration: none;
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}

.gif-grid-single {
  grid-template-columns: minmax(0, 46rem);
}

.featured-measure {
  border-top-color: var(--cyan);
}

.gif-card { min-width: 0; }
.gif-card figcaption { padding: 0.85rem 0; align-items: flex-start; }
.gif-card figcaption > div { min-width: 0; }

footer {
  min-height: 4rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}
footer p { margin-bottom: 0; }

.measure { border-top: 1px solid var(--line); padding-top: 1.5rem; }
.measure h2 { margin: 0; font-size: 1.25rem; font-weight: 600; }
.measure-note, .grid-note { color: var(--muted); font-size: 0.875rem; }
.measure-note { margin: 0.3rem 0 0; }

.docs-hero {
  max-width: 52rem;
  padding: clamp(3.5rem, 8vw, 7rem) 0 2.5rem;
}

.docs-hero h1,
.doc-page h1 {
  margin-bottom: 1rem;
}

.docs-hero .dek {
  max-width: 46rem;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.5rem 0 4rem;
  border-top: 1px solid var(--line);
}

.docs-card {
  min-height: 12rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  background: var(--raised);
  text-decoration: none;
}

.docs-card:hover {
  border-color: var(--cyan);
}

.docs-card .card-number {
  display: block;
  margin-bottom: 2rem;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.docs-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.4rem;
}

.docs-card p {
  margin: 0;
  color: var(--muted);
}

.docs-shell {
  display: grid;
  grid-template-columns: 13rem minmax(0, 48rem);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
  padding: 3rem 0 5rem;
}

.docs-nav {
  position: sticky;
  top: 1.5rem;
  display: grid;
  gap: 0.15rem;
  padding-top: 0.45rem;
}

.docs-nav a {
  padding: 0.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.docs-nav a[aria-current="page"] {
  color: var(--cyan);
}

.doc-page {
  min-width: 0;
}

.doc-page > .eyebrow {
  margin-bottom: 1rem;
}

.doc-page h1 {
  font-size: clamp(2.6rem, 6vw, 4.5rem);
}

.doc-page h2 {
  margin: 3.25rem 0 0.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 1.55rem;
}

.doc-page h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.1rem;
}

.doc-page p,
.doc-page li {
  color: #c7d5de;
}

.doc-page a {
  color: var(--cyan);
}

.doc-page code,
.equation {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.equation,
.callout {
  overflow-x: auto;
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--cyan);
  background: var(--raised);
  color: var(--paper);
}

.callout.warning {
  border-left-color: var(--amber);
}

.doc-page table {
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.doc-page th,
.doc-page td {
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.doc-page th {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-page pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  background: #050c16;
  color: var(--paper);
}

.page-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .context-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .context-grid section { max-width: 48rem; }
  .gif-grid { max-width: 100%; margin-inline: auto; }
}

@media (max-width: 680px) {
  .site-header nav a:not(.nav-cta) { display: none; }
  h1 { font-size: clamp(2.65rem, 14vw, 4rem); }
  .gif-grid { grid-template-columns: 1fr; }
  .wordmark { gap: 0.45rem; font-size: 0.875rem; }
  .site-header { gap: 0.5rem; }
  .site-header nav { gap: 0; flex-shrink: 0; }
  .docs-grid { grid-template-columns: 1fr; }
  .docs-shell { grid-template-columns: 1fr; padding-top: 2rem; }
  .docs-nav {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
  }
  .docs-nav a { padding-right: 0.4rem; }
  .page-links { flex-direction: column; }
}

.view-tabs { display: flex; gap: 0.3rem; margin: 1rem 0; }
.view-tabs button, .refresh-3d { padding: 0.55rem 1rem; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 1rem; cursor: pointer; }
.view-tabs button[aria-selected="true"] { border-color: var(--cyan); background: var(--raised); color: var(--paper); }
.view-tabs button:disabled { cursor: wait; opacity: 0.5; }
.volume-panel { max-width: 960px; }
.volume-panel iframe { display: block; width: 100%; height: 760px; margin-top: 1rem; border: 0; background: var(--ink); }
.volume-link { margin: 0.8rem 0 2rem; font-size: 0.875rem; color: var(--cyan); }
.refresh-3d { color: var(--cyan); margin-top: 0.7rem; }
[hidden] { display: none !important; }

.faq-page { max-width: 52rem; padding-block: 3rem; }
.big-numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 2rem; border-block: 1px solid var(--line); }
.big-numbers > div { padding: 1.4rem 1.2rem; min-width: 0; }
.big-numbers > div + div { border-left: 1px solid var(--line); }
.number-label { color: var(--muted); font-size: 0.875rem; margin-bottom: 0.55rem; }
.number-value { font-size: clamp(1.6rem, 2.1vw, 2rem); line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.035em; margin-bottom: 0.65rem; }
.number-note { font-size: 0.875rem; color: var(--muted); margin: 0; }
.number-note a, .mesh-diagram a { color: var(--cyan); }
.mesh-diagram img { display: block; width: 720px; height: auto; }
.plot-viewport { overflow-x: auto; overscroll-behavior-x: contain; }
.plot-scroll-hint { display: none; margin: 0.5rem 0; color: var(--muted); font-size: 0.875rem; }
#mesh-3d { height: clamp(540px, calc(100vw + 170px), 760px); }
@media (max-width: 751px) { .plot-scroll-hint { display: block; } }
@media (max-width: 1032px) { .three-view .plot-scroll-hint { display: block; } }
@media (max-width: 900px) {
  .big-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .big-numbers > div:nth-child(3) { border-left: 0; }
  .big-numbers > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .big-numbers { grid-template-columns: 1fr; }
  .big-numbers > div + div { border-left: 0; border-top: 1px solid var(--line); }
}
/* The third mesh panel stays interactive within the shared row. */
.mesh-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; min-width: 1000px; margin-top: 1.5rem; }
.mesh-row figure { margin: 0; min-width: 0; }
.mesh-row h3 { font-size: 1rem; text-align: center; margin: 0 0 1rem; }
.mesh-row img { display: block; width: 100%; height: auto; }
.mesh-row iframe { display: block; width: 100%; aspect-ratio: 1 / 1.17; border: 0; background: var(--ink); }
.mesh-row-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 20px; margin: 1rem 0; font-size: 0.875rem; }
.mesh-row-legend span::before { content: ""; display: inline-block; width: 12px; height: 3px; margin-right: 6px; vertical-align: middle; background: var(--level); }
@media (max-width: 1032px) { .mesh-row-hint { display: block; } }
