/* Dive In: the hub (dive-in/index.html) and its chapters (dive-in/*.html).
   Loaded after site.css. Visual first: every claim is a question (h2), a short answer, then a figure
   that proves it. Brand green is for actions only; data colours below are not actions. */

:root {
  --action: #46fac8;          /* brand green: buttons, sliders, links you press */
  --action-ink: #062b20;
  --peak: #36d6ff;            /* focus peaking on the website (the app's red vanishes on a red ladybird) */
  --band: rgba(54, 214, 255, 0.22);
  --alt: #b48cff;             /* second data series (orange is for warnings only) */
  --c-line: rgba(255, 255, 255, 0.12);
  --c-fill: rgba(255, 255, 255, 0.05);
  --text-max: 640px;
}

/* ---------- Top nav on a standalone page (no hash routing) ---------- */
.segmented__item[aria-current="page"] { color: var(--text); }

/* ---------- Page frame ---------- */
.dv { padding: var(--topbar-h) var(--gutter) 0; }
.dv-wrap { max-width: var(--max); margin: 0 auto; }

.dv-crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: clamp(12px, 2vw, 24px); font-size: 13px; color: var(--muted); }
.dv-crumbs a { color: var(--muted); text-decoration: none; }
.dv-crumbs a:hover { color: var(--text); }
.dv-crumbs span[aria-hidden] { color: var(--faint); }

/* Chapter switcher: the three chapters as a glass strip, current one raised. */
.dv-chapters {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  max-width: 720px; margin: 20px auto 0; padding: 4px;
  border: 1px solid var(--glass-edge); border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.dv-chapters a, .dv-chapters span {
  display: grid; gap: 2px; justify-items: center; text-align: center; padding: 10px 14px; border-radius: 14px;
  text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.25;
}
.dv-chapters small { font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-right: -.12em; }
.dv-chapters a:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.dv-chapters [aria-current="page"] {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 2px 8px rgba(0, 0, 0, .3);
}
.dv-chapters span { cursor: default; }
.dv-chapters span small::after { content: " · soon"; }

/* ---------- Chapter header ---------- */
.dv-head { text-align: center; padding: clamp(36px, 6vw, 72px) 0 0; }
.dv-head h1 {
  margin: 0 auto; max-width: 14em;
  font-size: clamp(40px, 6.6vw, 80px); letter-spacing: -0.035em; line-height: 1.02; text-wrap: balance;
  background: linear-gradient(180deg, #fff 30%, #aab5b0); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.dv-head .dv-answer { margin: 20px auto 0; max-width: 36em; font-size: clamp(17px, 1.7vw, 20px); color: var(--muted); text-wrap: balance; }
.dv-head .dv-answer strong { color: var(--text); font-weight: 500; }

/* ---------- Article layout: sticky contents + sections ---------- */
.dv-article {
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px);
  margin-top: clamp(64px, 9vw, 120px);
}
.dv-toc { position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start; }
.dv-toc p { margin-bottom: 12px; }
.dv-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.dv-toc a {
  display: grid; grid-template-columns: 22px 1fr; padding: 6px 8px; border-radius: 8px;
  color: var(--faint); font-size: 13px; line-height: 1.3; text-decoration: none;
  transition: color .2s, background-color .2s;
}
.dv-toc a::before { counter-increment: toc; content: counter(toc, decimal-leading-zero); font: 500 10px/1.9 var(--mono); }
.dv-toc a:hover { color: var(--text); }
.dv-toc a[aria-current="true"] { color: var(--text); background: rgba(255, 255, 255, .06); }

.dv-sections { display: grid; gap: clamp(96px, 12vw, 160px); min-width: 0; }

.dv-sec { scroll-margin-top: calc(var(--topbar-h) + 20px); }
.dv-sec > .hud-label { display: block; margin-bottom: 14px; }
.dv-sec h2 { max-width: 18em; font-size: clamp(28px, 3.8vw, 44px); letter-spacing: -0.03em; line-height: 1.06; text-wrap: balance; }
.dv-sec .dv-answer { max-width: var(--text-max); margin-top: 16px; font-size: clamp(17px, 1.5vw, 19px); color: var(--muted); }
.dv-sec .dv-answer strong { color: var(--text); font-weight: 500; }
.dv-more { max-width: var(--text-max); margin-top: 24px; color: var(--muted); font-size: 15px; }
.dv-more + .dv-more { margin-top: 12px; }

/* ---------- Figures ---------- */
.dv-fig {
  position: relative; margin: 32px 0 0;
  border: 1px solid #ffffff24; border-radius: 24px;
  background: linear-gradient(180deg, #1c1f1eb8, #121413c4);
  box-shadow: inset 0 1px 0 #ffffff1f, 0 24px 60px #00000073;
  overflow: hidden;
}
.dv-fig figcaption {
  padding: 14px 20px 16px; border-top: 1px solid var(--c-line);
  color: var(--muted); font-size: 14px; line-height: 1.45;
}
.dv-fig figcaption strong { color: var(--text); font-weight: 500; }
.dv-fig__body { padding: 20px; }
.dv-fig__split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Two photo panes side by side (alignment: as shot | aligned). */
.dv-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--c-line); }
.dv-fig__split > * + * { border-left: 1px solid var(--c-line); }

/* Photo stage: layers on one grid cell */
.dv-photo { position: relative; display: grid; background: #0d100c; overflow: hidden; }
.dv-photo > * { grid-area: 1 / 1; width: 100%; height: auto; display: block; }
.dv-photo > .dv-photo__tag { width: auto; }
.dv-photo img { aspect-ratio: var(--photo-ar, 3 / 4); object-fit: cover; }
.dv-photo .is-off { opacity: 0; }
.dv-photo__tag {
  position: absolute; left: 12px; top: 12px; z-index: 3;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(10, 12, 11, .62); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid #ffffff1f; font: 600 11px/1 var(--mono); letter-spacing: .06em; color: var(--text);
}

/* Controls row */
.dv-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 20px; border-top: 1px solid var(--c-line); }
.dv-controls .grow { flex: 1 1 200px; }
.dv-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px;
  border: 1px solid #ffffff26; border-radius: 999px; background: #ffffff0f;
  color: var(--text); font: 600 13px var(--font); cursor: pointer;
}
.dv-btn:hover { background: #ffffff1a; }
.dv-btn svg { width: 12px; height: 12px; }
.dv-readout { font: 500 12px/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.dv-readout b { color: var(--text); font-weight: 600; }

/* Glass segmented control */
.dv-seg {
  --n: 2; --selected: 0;
  position: relative; display: inline-grid; grid-template-columns: repeat(var(--n), auto);
  padding: 3px; border: 1px solid #ffffff1a; border-radius: 999px; background: #ffffff0a;
}
.dv-seg__thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 999px;
  background: linear-gradient(180deg, #ffffff2b, #ffffff17);
  box-shadow: inset 0 1px 0 #ffffff38, 0 2px 8px #0005;
  transition: transform .2s ease, width .2s ease; pointer-events: none;
}
.dv-seg button {
  position: relative; z-index: 1; min-height: 28px; padding: 0 13px;
  border: 0; border-radius: 999px; background: none;
  color: var(--muted); font: 600 12px var(--font); white-space: nowrap; cursor: pointer;
}
.dv-seg button[aria-pressed="true"], .dv-seg button:hover { color: var(--text); }

/* Range slider in the action colour */
.dv-range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; cursor: pointer; }
.dv-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--action) var(--p, 0%), #ffffff26 var(--p, 0%)); }
.dv-range::-moz-range-track { height: 4px; border-radius: 2px; background: #ffffff26; }
.dv-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--action); }
.dv-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #0008; }
.dv-range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #0008; }

/* Tick labels under a slider */
.dv-ticks { display: flex; justify-content: space-between; margin-top: -2px; font: 500 10px/1 var(--mono); color: var(--faint); }

/* ---------- Hero: the bracket fans out, then folds into one picture ---------- */
.dv-hero { margin: clamp(36px, 5vw, 56px) auto 0; max-width: 1000px; }
.dv-fan {
  /* --fw = one card's width in px (set by dive-focus.js), so depth scales with the cards. */
  position: relative; aspect-ratio: 3 / 2;
  perspective: calc(var(--fw, 400px) * 4.4); perspective-origin: 50% 45%;
  margin: 0 auto; width: min(100%, 900px, calc((100svh - 230px) * 1.5));
}
/* One portrait card, centred in the box when merged. Fanned: the frames only go back into depth
   (never toward the viewer), hinged on the front frame's left edge, so the whole fan stays
   inside this box and never covers text. */
.dv-fan__rig {
  position: absolute; top: 0; bottom: 0; left: 50%; aspect-ratio: 3 / 4;
  transform-style: preserve-3d; transform-origin: 0 50%; transform: translateX(-50%);
  transition: transform 1.4s cubic-bezier(.2, .7, .2, 1);
}
.dv-fan.is-fanned .dv-fan__rig { transform: translateX(var(--fan-x, -72%)) rotateY(var(--fan-ry, -38deg)) scale(var(--fan-s, .85)); }
.dv-fan__layer {
  position: absolute; inset: 0; border-radius: 18px; overflow: hidden;
  box-shadow: 0 0 0 1px #ffffff2e, 0 20px 50px #0009;
  transition: transform 1.4s cubic-bezier(.2, .7, .2, 1), opacity .8s ease;
  transform: translateZ(0);
  background: #111 center / cover no-repeat;
}
.dv-fan__layer img { position: absolute; inset: 0; width: 100%; height: 100%; }
.dv-fan.is-fanned .dv-fan__layer { transform: translateZ(calc(var(--i) * var(--fw, 400px) * var(--fan-dz, -.076))); }
.dv-fan__result { opacity: 0; transition: opacity .9s ease .9s; }
.dv-fan.is-merged .dv-fan__result { opacity: 1; }
.dv-fan.is-fanned .dv-fan__result { transition-delay: 0s; }
.dv-fan__num {
  position: absolute; right: 10px; top: 10px; padding: 4px 8px; border-radius: 999px;
  background: #000a; font: 600 11px/1 var(--mono); color: var(--text);
  transition: opacity .4s;
}
.dv-fan:not(.is-fanned) .dv-fan__num { opacity: 0; }
.dv-hero__bar { position: relative; z-index: 1; display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.dv-hero__glow {
  position: absolute; inset: 10% 0 0; z-index: -1; pointer-events: none;
  background: radial-gradient(34% 45% at 52% 50%, #c99a6a55, transparent 70%), radial-gradient(40% 50% at 42% 55%, #8d8a8455, transparent 70%);
  filter: blur(60px);
}

/* ---------- Bracket scrubber (section 1) ---------- */
.dv-side { display: grid; align-content: center; gap: 12px; padding: 20px; }
.dv-side svg { width: 100%; height: auto; display: block; overflow: visible; }
.dv-side .dv-readout { text-align: center; }
.dv-strip { display: grid; grid-template-columns: repeat(var(--n, 13), minmax(0, 1fr)); gap: 4px; }
.dv-strip button {
  position: relative; aspect-ratio: 3 / 4; padding: 0; border: 0; border-radius: 4px; overflow: hidden;
  background: #222 center / cover; cursor: pointer; opacity: .55; transition: opacity .2s;
}
.dv-strip button[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--action); }
.dv-strip button:last-child { background: #1d1f1e; color: var(--text); font: 700 9px var(--mono); letter-spacing: .04em; }

/* ---------- Aperture (section 2) ---------- */
.dv-ap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dv-ap > div { display: grid; align-content: start; gap: 12px; padding: 18px 20px 20px; }
.dv-ap > div + div { border-left: 1px solid var(--c-line); }
.dv-ap h3 { font: 600 11px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.dv-ap svg { width: 100%; height: auto; display: block; }
.dv-big { font-size: clamp(26px, 2.6vw, 34px); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.dv-big small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.dv-sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.dv-loupe { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #000; }
.dv-loupe img { width: 100%; height: 100%; display: block; image-rendering: auto; transform: scale(1.6); transform-origin: 50% 45%; }
.dv-verdict { padding: 14px 20px; border-top: 1px solid var(--c-line); font-size: 15px; color: var(--text); text-align: center; }
.dv-verdict span { color: var(--muted); }

.dv-foot { margin-top: 12px; font-size: 12px; color: var(--faint); max-width: var(--text-max); }

/* ---------- Frames-needed table (section 3) ---------- */
.dv-table { width: 100%; border-collapse: separate; border-spacing: 4px; font-variant-numeric: tabular-nums; }
.dv-table th { font: 600 11px var(--mono); color: var(--muted); padding: 6px; letter-spacing: .06em; }
.dv-table th[scope="row"] { width: 1%; text-align: right; padding-right: 10px; white-space: nowrap; }
.dv-table td {
  padding: 12px 6px; border-radius: 8px; text-align: center; font-size: 15px; font-weight: 600;
  background: rgba(54, 214, 255, var(--a, .1)); color: var(--text);
}
.dv-table td small { display: block; font: 500 10px var(--mono); color: var(--muted); margin-top: 2px; }

/* ---------- Breathing / footprints (sections 4, 7) ---------- */
.dv-feet svg { width: 100%; height: auto; display: block; }
.dv-feet .fp { fill: none; stroke: #ffffff59; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.dv-feet .fp.is-hot { stroke: var(--alt); stroke-width: 2; }
.dv-feet .fp.is-anchor { stroke: #fff; stroke-width: 2; }
.dv-feet .crop { fill: rgba(54, 214, 255, .12); stroke: var(--peak); stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.dv-feet text { font: 600 12px var(--mono); fill: var(--muted); }

.dv-crosshair { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.dv-crosshair line { stroke: #ffffffb0; stroke-width: 1; vector-effect: non-scaling-stroke; }

/* ---------- Keyframes (section 6) ---------- */
.dv-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; }
.dv-bars div { display: grid; gap: 6px; justify-items: center; font: 600 10px var(--mono); color: var(--faint); }
.dv-bars i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--peak); min-height: 2px; }
.dv-bars i.alt { background: var(--alt); }
.dv-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.dv-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; background: var(--c, var(--peak)); }
.dv-arcs svg { width: 100%; height: auto; display: block; }

/* ---------- Interpolation (section 8) ---------- */
.dv-interp { display: grid; grid-template-columns: minmax(0, 1fr) 260px; }
.dv-interp__panes { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--c-line); }
.dv-interp__view { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: #000; }
/* Exactly 300%: the 440 px crop drawn 1320 CSS px wide, centred. */
.dv-interp__view img { position: absolute; width: 1320px; height: 1320px; left: 50%; top: 50%; transform: translate(-54%, -46%); image-rendering: pixelated; max-width: none; }
.dv-interp__side { display: grid; align-content: start; gap: 18px; padding: 20px; border-left: 1px solid var(--c-line); }
.dv-meter { display: grid; gap: 6px; }
.dv-meter header { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.dv-meter header b { color: var(--text); font-variant-numeric: tabular-nums; }
.dv-meter div { height: 8px; border-radius: 4px; background: #ffffff14; overflow: hidden; }
.dv-meter div i { display: block; height: 100%; background: var(--c, var(--peak)); }

/* ---------- Next chapter + app CTA ---------- */
.dv-next { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: clamp(96px, 12vw, 160px); }
.dv-card {
  position: relative; display: grid; gap: 8px; align-content: end; min-height: 220px; padding: 24px;
  border: 1px solid #ffffff24; border-radius: 24px; overflow: hidden; text-decoration: none; isolation: isolate;
  background: #121413;
}
.dv-card img { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; opacity: .55; transition: opacity .3s, transform .6s; }
.dv-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 20%, #0b0c0ce6); }
a.dv-card:hover img { opacity: .75; transform: scale(1.03); }
.dv-card h3 { font-size: clamp(22px, 2.4vw, 28px); }
.dv-card p { color: var(--muted); font-size: 15px; }
.dv-card .hud-label { color: var(--muted); }
.dv-card--soon { cursor: default; }
.dv-card--soon .hud-label::after { content: " · coming soon"; }

.dv-cta { display: grid; justify-items: center; gap: 14px; text-align: center; padding: clamp(80px, 10vw, 140px) 0; }
.dv-cta h2 { font-size: clamp(30px, 4.4vw, 52px); letter-spacing: -.03em; }
.dv-cta p { color: var(--muted); max-width: 32em; }
.dv-cta .dv-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }
.button--action { background: var(--action); color: var(--action-ink); }
.button--action:hover { background: #a6ffe6; }

/* ---------- Hub ---------- */
.dv-hub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: clamp(48px, 7vw, 88px); }
.dv-hub-grid .dv-card { min-height: 420px; }
.dv-hub-grid .dv-card .num { font: 600 12px var(--mono); color: var(--text); letter-spacing: .1em; }
.dv-hub-grid ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.dv-hub-grid li::before { content: "→ "; color: var(--faint); }
.dv-hood { margin-top: clamp(80px, 10vw, 128px); }
.dv-hood h2 { font-size: clamp(26px, 3.2vw, 36px); letter-spacing: -.02em; }
.dv-hood > p { color: var(--muted); margin-top: 10px; max-width: var(--text-max); }
.dv-hood__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.dv-hood__grid article { display: grid; gap: 8px; align-content: start; padding: 20px; border: 1px solid var(--c-line); border-radius: 18px; background: var(--c-fill); }
.dv-hood__grid h3 { font-size: 17px; letter-spacing: -.01em; }
.dv-hood__grid p { color: var(--muted); font-size: 14px; }
.dv-hood__grid .hud-label::after { content: " · soon"; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .dv-article { grid-template-columns: minmax(0, 1fr); }
  .dv-toc { display: none; }
  .dv-hood__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .dv-interp { grid-template-columns: minmax(0, 1fr); }
  .dv-interp__side { border-left: 0; border-top: 1px solid var(--c-line); }
  .dv-ap { grid-template-columns: minmax(0, 1fr); }
  .dv-ap > div + div { border-left: 0; border-top: 1px solid var(--c-line); }
  .dv-hub-grid, .dv-next { grid-template-columns: minmax(0, 1fr); }
  .dv-hub-grid .dv-card { min-height: 320px; }
}
@media (max-width: 560px) {
  .dv-chapters { grid-template-columns: minmax(0, 1fr); }
  .dv-fig__split { grid-template-columns: minmax(0, 1fr); }
  .dv-fig__split > * + * { border-left: 0; border-top: 1px solid var(--c-line); }
  .dv-strip { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .dv-fan { aspect-ratio: 5 / 4; }
  .dv-fig { border-radius: 18px; }
  .dv-fig__body, .dv-side { padding: 14px; }
  .dv-controls { padding: 12px 14px; }
  .dv-hood__grid { grid-template-columns: minmax(0, 1fr); }
  .dv-table td { padding: 10px 2px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .dv-fan__rig, .dv-fan__layer, .dv-fan__result { transition: none; }
}

/* Phones: the top bar is only the sideways section row, as on the home page (mobile/css/hero-mobile.css); Home is in it. */
@media (max-width: 600px) {
  .nav__brand, .nav__brand:has(.t3-wordmark) { display: none; }
}
