/* Inside a confocal microscope — UNLV CBIC. Plain CSS, no build step. */
:root {
  --bg: #06080B;
  --panel: #0D1116;
  --line: rgba(255, 255, 255, 0.12);
  --text: #F4F5F7;
  --muted: #A4ABB5;
  --exc: #5B8CFF;
  --ret: #3DE88A;
  --oof: #FF8A3D;
  --accent: #B10202;
  --accent-hover: #d10a0a;
  --radius: 18px;
  --radius-sm: 14px;
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-text: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: 24px;
  --maxw: 1180px;
  --stage-aside: 340px;
  --parts-aside: 300px;           /* legend / card column of the exploded view */
  --track: 11000px;               /* set by JS: scroll length of the photon film */
  --track-parts: 3600px;          /* set by JS: scroll length of the exploded view */
}
@media (max-width: 640px) { :root { --gutter: 16px; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-text); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.005em; margin: 0; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.02; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.08; }
h3 { font-size: 1.55rem; line-height: 1.15; }
p { margin: 0 0 1em; }
a { color: var(--text); text-decoration-color: rgba(255,255,255,0.35); text-underline-offset: 0.15em; }
a:hover { text-decoration-color: var(--text); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.92em; }
.muted { color: var(--muted); }
kbd { font-family: var(--font-mono); font-size: 0.85em; border: 1px solid var(--line); border-radius: 6px; padding: 0.05em 0.4em; background: var(--panel); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -48px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 12px; }

/* focus states (keyboard) */
:focus-visible { outline: 2px solid var(--exc); outline-offset: 3px; border-radius: 6px; }
button:focus-visible { outline-offset: 2px; }

/* frames for images/video: square corners by design */
.frame { position: relative; border: 1px solid var(--line); background: #000; overflow: hidden; border-radius: 0; }
.frame > canvas, .frame > video, .frame > img { display: block; width: 100%; height: auto; }

/* ---------------------------------------------------------------- header */
.site-header { max-width: var(--maxw); margin: 0 auto; padding: clamp(40px, 8vh, 96px) var(--gutter) 24px; }
.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--muted); max-width: 60ch; margin: 18px 0 22px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 0; margin: 0; font-size: 0.92rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 26px; height: 3px; border-radius: 2px; display: inline-block; box-shadow: 0 0 10px currentColor; }
.swatch--exc { background: var(--exc); color: var(--exc); }
.swatch--ret { background: var(--ret); color: var(--ret); }
.swatch--oof { background: var(--oof); color: var(--oof); }

/* ---------------------------------------------------------------- hero (Film A) */
.hero { max-width: var(--maxw); margin: 0 auto; padding: 8px var(--gutter) 48px; }
.hero figure { margin: 0; }
.frame > .hero__poster { display: none; }            /* beats .frame > img */
html.reduced .frame > .hero__video { display: none; }
html.reduced .frame > .hero__poster { display: block; }
.hero figcaption { color: var(--muted); font-size: 0.92rem; padding: 10px 2px 0; }

/* ---------------------------------------------------------------- scroll-driven sections */
.scrolly { max-width: var(--maxw); margin: 0 auto; padding: 24px var(--gutter) 0; }
.scrolly__intro { max-width: 64ch; margin-bottom: 18px; }
.scrolly__intro p { color: var(--muted); }
.scrolly__track { height: var(--track); position: relative; }
.scrolly--parts .scrolly__track { height: var(--track-parts); }

.stage {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: grid; gap: 12px 20px; align-content: start;
  grid-template-columns: minmax(0, 1fr) var(--stage-aside);
  grid-template-areas:
    "media card"
    "caption card"
    "rail parts"
    "controls parts";
  padding-top: 14px; padding-bottom: 14px;
}
.stage__media { grid-area: media; aspect-ratio: 16 / 9; width: 100%; max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); justify-self: center; }
.stage__media > canvas { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage__loading { position: absolute; left: 12px; bottom: 10px; font-size: 0.78rem; color: var(--muted); background: rgba(6,8,11,0.7); padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; transition: opacity 0.4s; }
.stage__loading.is-done { opacity: 0; pointer-events: none; }
.stage__caption { grid-area: caption; font-family: var(--font-display); font-size: clamp(1.2rem, 2.1vw, 1.65rem); line-height: 1.25; margin: 0; min-height: 1.3em; }

.stage__rail { grid-area: rail; position: relative; height: 26px; }
.rail__track { position: absolute; left: 0; right: 0; top: 11px; height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; }
.rail__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--exc) 0 42%, var(--ret) 46% 100%); border-radius: 2px; }
.rail__markers { position: absolute; inset: 0; }
.marker { position: absolute; top: 5px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; border: 2px solid var(--muted); background: var(--bg); padding: 0; cursor: pointer; }
.marker:hover, .marker.is-active { border-color: var(--text); background: var(--text); }
.marker.is-active { background: var(--accent); border-color: var(--accent); }
.marker__label { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); white-space: nowrap; font-size: 0.78rem; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.marker:hover .marker__label, .marker:focus-visible .marker__label { opacity: 1; }

.stage__controls { grid-area: controls; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.btn { font: inherit; font-weight: 500; color: #fff; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px; cursor: pointer; }
.btn:hover { border-color: rgba(255,255,255,0.3); }
.btn--accent { background: var(--accent); border-color: transparent; min-width: 88px; }
.btn--accent:hover { background: var(--accent-hover); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.seg__btn { font: inherit; font-size: 0.92rem; color: var(--muted); background: transparent; border: 0; padding: 8px 12px; cursor: pointer; }
.seg__btn + .seg__btn { border-left: 1px solid var(--line); }
.seg__btn[aria-pressed="true"] { color: var(--text); background: rgba(255,255,255,0.08); }
.seg__btn:focus-visible { outline-offset: -3px; }
/* touch screens (QA 2026-11-23): speed and Scroll/Watch buttons 44 px tall; chapter markers get a taller invisible hit area.
   Their width stays 16 px: at 390 px the 10.0/11.5/13.0 s markers are only ~13 px apart, so a wider area would steal taps from a neighbour */
@media (pointer: coarse) {
  .seg__btn { min-height: 44px; min-width: 44px; }
  .marker::before { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 40px; transform: translate(-50%, -50%); }
}
.readout { color: var(--muted); margin-left: auto; font-size: 0.85rem; }
.linklike { font: inherit; color: var(--text); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.stage__card { grid-area: card; align-self: start; display: flex; flex-direction: column; min-height: 0; }
.card__index { font-size: 0.78rem; color: var(--muted); margin: 0 0 6px; letter-spacing: 0.04em; }
.card__title { margin-bottom: 12px; }
.card__text { margin: 0; color: var(--text); font-size: 0.98rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { font: inherit; font-size: 0.86rem; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 8px 8px; margin-bottom: -1px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

/* parts list rail */
.stage__parts { grid-area: parts; overflow: auto; min-height: 0; }
.partlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.partlist li { display: flex; align-items: baseline; gap: 10px; padding: 5px 10px; border-radius: 10px; color: var(--muted); font-size: 0.9rem; cursor: pointer; }
.partlist li .num { width: 1.6em; color: var(--muted); }
.partlist li:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.partlist li.is-active { color: var(--text); background: rgba(255,255,255,0.07); }
.partlist li.is-active .num { color: var(--accent); }
.partlist li:focus-visible { outline-offset: -2px; }

/* exploded view section: picture with numbered callouts, playback row, legend / card */
.stage--parts {
  grid-template-columns: minmax(0, 1fr) var(--parts-aside);
  grid-template-areas: "media aside" "controls aside";
  align-content: center; align-items: start;
}
.stage--parts .stage__media { max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); }
.stage__controls--parts { min-height: 44px; }
.stage__controls--parts .btn { min-height: 44px; }
.stage__aside { grid-area: aside; align-self: center; min-width: 0; min-height: 0; max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); overflow: auto; }
.frame > .stage__poster { display: none; }

/* legend 1–11: the keyboard and screen-reader path to the cards; mirrors the dots */
.partlist--big { gap: 0; }
.partlist--big li { padding: 0; font-size: 1rem; cursor: default; }
.partlist__link { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 12px; border-radius: 10px; color: inherit; text-decoration: none; cursor: pointer; }
.partlist__link .num { width: 1.6em; flex: none; }
.partlist__link:focus-visible { outline-offset: -2px; border-radius: 10px; }
.partlist--big li.is-hot { color: var(--text); background: rgba(255,255,255,0.07); }
.partlist--big li.is-hot .num { color: var(--text); }

/* callouts: numbered dots on the parts; on wide pictures a hairline leader and the part name */
.callouts { position: absolute; inset: 0; pointer-events: none; --dot: 24px; --k: 1; }
.callout {
  position: absolute; left: 50%; top: 50%; width: var(--dot); height: var(--dot); padding: 0; margin: 0;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums;
  color: var(--text); background: rgba(6, 8, 11, 0.72); border: 1px solid rgba(255, 255, 255, 0.72); border-radius: 50%;
  cursor: pointer; pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s, background-color 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.callout.is-on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.3s ease, visibility 0s, background-color 0.15s, color 0.15s, border-color 0.15s; }
.callout::before { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); border-radius: 50%; }   /* 44 px touch target */
.callout:hover, .callout.is-hot { background: var(--text); color: var(--bg); border-color: var(--text); z-index: 2; }
.callout.is-open { background: var(--accent); color: #fff; border-color: var(--accent); z-index: 3; }
.callout:focus-visible { outline: 2px solid var(--exc); outline-offset: 2px; border-radius: 50%; z-index: 4; }

.callout__lead, .callout__label { position: absolute; display: none; pointer-events: none; }
.callouts.has-labels.show-labels .callout__lead, .callouts.has-labels.show-labels .callout__label { display: block; }
.callout__lead { background: rgba(255, 255, 255, 0.6); }
.callout__label {
  font-family: var(--font-text); font-size: 12px; font-weight: 500; line-height: 1; letter-spacing: 0.01em; white-space: nowrap;
  color: rgba(244, 245, 247, 0.9);
  text-shadow: 0 0 2px #000, 0 0 5px rgba(0, 0, 0, 0.9), 0 1px 10px rgba(0, 0, 0, 0.8);
}
.callout.is-hot .callout__label, .callout:hover .callout__label, .callout.is-open .callout__label { color: #fff; }
.callout.is-hot .callout__lead, .callout:hover .callout__lead, .callout.is-open .callout__lead { background: #fff; }
.callout { --lead: calc(var(--len, 20px) * var(--k)); }
.callout--up .callout__lead { left: 50%; bottom: 100%; width: 1px; height: var(--lead); }
.callout--up .callout__label { left: 50%; bottom: calc(100% + var(--lead) + 4px); margin-left: -3px; }
.callout--down .callout__lead { left: 50%; top: 100%; width: 1px; height: var(--lead); }
.callout--down .callout__label { left: 50%; top: calc(100% + var(--lead) + 4px); margin-left: -3px; }
.callout--up.callout--flip .callout__label, .callout--down.callout--flip .callout__label { left: auto; right: 50%; margin-left: 0; margin-right: -3px; }
.callout--right .callout__lead { left: 100%; top: 50%; height: 1px; width: var(--lead); }
.callout--right .callout__label { left: calc(100% + var(--lead) + 6px); top: 50%; transform: translateY(-50%); }
.callout--left .callout__lead { right: 100%; top: 50%; height: 1px; width: var(--lead); }
.callout--left .callout__label { right: calc(100% + var(--lead) + 6px); top: 50%; transform: translateY(-50%); }
/* dots that stand beside a small part (objective, dish): a hairline stub from the dot's edge to a point on the part */
.callout__stub { position: absolute; left: 50%; top: 50%; display: none; width: var(--stub, 0px); height: 1px; margin-top: -0.5px; background: rgba(255, 255, 255, 0.6); transform-origin: 0 50%; transform: rotate(var(--stub-a, 0deg)) translateX(calc(var(--dot) / 2)); pointer-events: none; }
.callout.has-stub .callout__stub { display: block; }
.callout__stub::after { content: ""; position: absolute; right: -2.5px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: inherit; }
.callout.is-hot .callout__stub, .callout:hover .callout__stub, .callout.is-open .callout__stub { background: #fff; }

/* the card a dot or a legend item opens: the same three-tab component as in the photon section */
.parts-card { display: flex; flex-direction: column; min-height: 0; }
.parts-card:focus { outline: none; }
.parts-card:focus-visible { outline: 2px solid var(--exc); outline-offset: -2px; border-radius: var(--radius); }
.parts-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -8px -10px 2px 0; }
.parts-card__head .card__index { margin: 0; }
.parts-card__close { font: inherit; font-size: 0.86rem; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 0 14px; cursor: pointer; }
.parts-card__close:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.parts-card .tabs { flex-wrap: wrap; }

/* one still picture instead of the scroll film: no frame sequence available (reduced motion is handled further down) */
.scrolly--parts.is-still .scrolly__track { height: auto; }
.scrolly--parts.is-still .stage { position: static; height: auto; }
.scrolly--parts.is-still .stage__controls--parts { display: none; }
.scrolly--parts.is-still .stage__aside { max-height: none; overflow: visible; }

/* static cards section */
.cards { max-width: var(--maxw); margin: 0 auto; padding: 72px var(--gutter) 24px; }
.cards__lede { color: var(--muted); margin: 10px 0 26px; }
.cards__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card--static dl { margin: 0; }
.card--static dt { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; }
.card--static dd { margin: 0; font-size: 0.98rem; }
.card--static.is-active { border-color: rgba(255,255,255,0.35); }
mark.verify { background: none; color: inherit; }

/* captions text */
.captions { max-width: var(--maxw); margin: 0 auto; padding: 40px var(--gutter) 24px; }
.captions__list { margin: 18px 0; padding-left: 0; list-style: none; display: grid; gap: 6px; max-width: 70ch; }
.captions__list li { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; color: var(--text); }
.captions__list .num { color: var(--muted); }
.captions__download { color: var(--muted); font-size: 0.92rem; }

/* posters fallback (reduced motion / no JS) */
.posters { margin-top: 12px; }
.posters__note { color: var(--muted); }
.posters__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 28px; }
.posters__list li { display: grid; gap: 10px; }
.posters__list .frame img { width: 100%; height: auto; }
.posters__list .poster-caption { font-family: var(--font-display); font-size: 1.3rem; }

/* footer */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 40px var(--gutter) 80px; border-top: 1px solid var(--line); margin-top: 48px; }
.notice { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text); }
.site-footer .muted { font-size: 0.9rem; }

/* review copy: yellow [VERIFY] markers */
html[data-review] mark.verify { background: #FFE14D; color: #111; padding: 0 0.15em; border-radius: 3px; }
html[data-review] body::before { content: "REVIEW COPY — yellow = [VERIFY], see REVIEW.md"; display: block; position: sticky; top: 0; z-index: 40; background: #FFE14D; color: #111; font-family: var(--font-mono); font-size: 0.8rem; padding: 6px var(--gutter); }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage__loading { transition: none; }
  .callout, .callout.is-on { transition: none; }
}
html.reduced .scrolly__track { height: auto; }
html.reduced .stage { position: static; height: auto; }
html.reduced #photon-stage { display: none; }
html.reduced .posters[hidden] { display: block; }
html.reduced #parts-canvas { display: none; }
html.reduced .frame > .stage__poster { display: block; }
html.reduced .stage--parts { align-items: start; }
html.reduced .stage__controls--parts { display: none; }
html.reduced .stage__aside { max-height: none; overflow: visible; align-self: start; }
html.reduced .stage--parts .stage__media { aspect-ratio: auto; max-height: none; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "media" "caption" "rail" "controls" "card";
    gap: 8px;
  }
  .stage__media { max-height: 52vh; max-height: 52dvh; }
  .stage__caption { font-size: 1.15rem; }
  .stage__card { padding: 14px 16px; }
  .card__title { font-size: 1.3rem; margin-bottom: 8px; }
  .card__text { font-size: 0.92rem; }
  .stage__parts { display: none; }
  .readout { width: 100%; margin-left: 0; }
  .stage--parts { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "media" "controls" "aside"; align-content: start; }
  html.reduced .stage--parts, .scrolly--parts.is-still .stage--parts { grid-template-rows: none; }
  .stage--parts .stage__media { max-height: 46vh; max-height: 46dvh; }
  .stage__aside { align-self: start; max-height: none; }
  .stage--parts .stage__aside { overflow: auto; }
  .partlist--big { grid-template-columns: 1fr 1fr; column-gap: 8px; }
  .partlist--big li { font-size: 0.9rem; }
  .partlist__link { padding: 4px 8px; line-height: 1.25; }
  .stage__controls--parts .readout { width: auto; margin-left: auto; }
}
@media (max-width: 480px) {
  .partlist--big li { font-size: 0.86rem; }
  .partlist__link { gap: 6px; padding: 4px 6px; }
}
