/* =============================================================
   How Do We Know? — interactive science story
   movie.css — light jmaths-teal theme. Questions drive the story.

   Everything is scoped under .hdwk so it can't affect the host page.
   Colours lean on the jmaths design tokens (--color-*) when present,
   with teal fallbacks for standalone use. This file is intentionally
   exempt from the raw-hex check (it carries literal fallbacks).
   ============================================================= */

html, body { margin: 0; }

@keyframes hdwk-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hdwk, .hdwk *, .hdwk *::before, .hdwk *::after { box-sizing: border-box; }

/* Palette lives in science/tokens.css, which every .hdwk page loads. What
   stays here is the STORY page's own presentation — the gradient ground and
   the full-height stage are not wanted on the library or a printed paper. */
.hdwk {

  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #eafaf7 55%, #e3f6f2);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* body.hdwk-page previously also collapsed the site nav down to a bare logo
   for an "immersive" feel, but that left no visible way back to the rest of
   the site — the full header (with its normal Home/Science/etc. links and
   the mobile tab bar) now stays exactly as it is on every other page. Only
   the movie's own container padding is still trimmed, for a full-bleed fit. */
body.hdwk-page .page-wrapper { padding-bottom: 0 !important; }
body.hdwk-page .page-wrapper > .container-fluid { padding: 0 !important; }

/* ---- top brand bar ---- */
.hdwk .topbar {
  display: flex; align-items: baseline; gap: 12px;
  max-width: 1320px; margin: 0 auto; padding: 20px 32px 0;
}
.hdwk .topbar__brand { font-family: var(--font-display); font-size: 18px; color: var(--teal); font-weight: 600; }
.hdwk .topbar__brand::before { content: "◆"; color: var(--accent); font-size: 12px; margin-right: 7px; vertical-align: 1px; }
.hdwk .topbar__sub { font-size: 14px; color: var(--muted); }
.hdwk .topbar__controls { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.hdwk .langtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.hdwk .langtoggle button { appearance: none; border: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 13px; background: #fff; color: var(--muted); }
.hdwk .langtoggle button.is-on { background: var(--teal); color: #fff; }
.hdwk .chip-toggle { appearance: none; cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 999px; width: 32px; height: 30px; font-size: 15px; line-height: 1; padding: 0; filter: grayscale(1) opacity(0.6); }
.hdwk .chip-toggle:hover { filter: none; }
.hdwk .chip-toggle.is-on { background: var(--soft); border-color: var(--teal2); filter: none; box-shadow: 0 0 0 2px rgba(20,184,166,.2); }
.hdwk .chip-toggle--soon { cursor: not-allowed; filter: grayscale(1) opacity(0.35); }
.hdwk .chip-toggle--soon:hover { filter: grayscale(1) opacity(0.35); }

/* the persistent "badges & journey" link — same pill family as chip-toggle,
   but sized for text rather than a single icon glyph. */
.hdwk .chip-link { appearance: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: 999px; height: 30px; padding: 0 13px; font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.hdwk .chip-link:hover { color: var(--teal); border-color: var(--teal2); background: var(--soft); }

/* "chess.com style" live commentary bubble */
.hdwk .commentary { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 12px 15px;
  background: linear-gradient(180deg, #0f766e, #0c5f59); color: #eafdf9; border-radius: 12px; animation: hdwk-rise .3s ease both; }
.hdwk .commentary__mic { font-size: 17px; line-height: 1.4; }
.hdwk .commentary__say { font-size: 15.5px; line-height: 1.5; }
.hdwk .commentary__say strong { color: #fff; }
.hdwk .commentary__say em { color: #b8f5ec; font-style: italic; }

/* "the maths behind this" cross-link into JMaths */
.hdwk .mathslink { display: block; margin: 4px 0 8px; padding: 12px 15px; text-decoration: none;
  background: #eef6ff; border: 1px solid #cfe4fb; border-left: 5px solid var(--ib-blue); border-radius: 12px; }
.hdwk .mathslink:hover { background: #e3f0ff; }
.hdwk .mathslink__tag { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ib-blue); }
.hdwk .mathslink__name { display: block; font-weight: 700; color: var(--ib-blue); margin-top: 3px; }
.hdwk .mathslink__note { display: block; font-size: 14px; color: var(--text); margin-top: 2px; }

/* ---- split layout ---- */
.hdwk .app {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px;
  max-width: 1320px; margin: 0 auto; padding: 18px 32px 80px; align-items: start;
}

/* =============================================================
   Scene card (left)
   ============================================================= */
.hdwk .scene {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 22px 56px -36px rgba(15,118,110,.5);
  padding: clamp(22px, 3vw, 36px);
  animation: hdwk-rise .4s ease both;
}
.hdwk .scene__path { font-family: var(--font-mono); font-size: 11px; letter-spacing: .03em; color: var(--muted); margin-bottom: 13px; }
.hdwk .scene__path b { color: var(--teal); }
.hdwk .scene__meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.hdwk .scene__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 3.6vw, 34px); line-height: 1.1; color: var(--teal); margin: 5px 0 16px; }

/* Scene head "hangs" from a fixed point at the top -- a small accent tab
   plus a thin drop line, so the title reads as suspended from something
   rather than just floating loose at the top of the scroll. */
.hdwk .scene__head { position: relative; padding-top: 14px; margin-bottom: 4px; }
.hdwk .scene__head-peg { position: absolute; top: 0; left: 0; width: 30px; height: 3px; border-radius: 2px; background: var(--accent); }
.hdwk .scene__head-peg::after { content: ""; position: absolute; top: 3px; left: 13px; width: 2px; height: 12px; background: var(--accent); opacity: .45; }

.hdwk .scene__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 20px; }
.hdwk .scene-chip { appearance: none; cursor: pointer; font: inherit; font-size: 13.5px; background: var(--paper);
  color: var(--teal); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 12px;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.hdwk .scene-chip:hover, .hdwk .scene-chip:focus-visible { border-color: var(--teal2); outline: none; }
.hdwk .scene-chip.is-on { background: var(--teal); color: #fff; border-color: var(--teal); }

/* Shared inline panel -- who's here / read more / ask your own. Slides in
   from the right edge of the viewport rather than stacking a section below
   the scroll, and stays anchored while the reader keeps reading/scrolling. */
.hdwk .scene-panel {
  position: fixed; top: 84px; right: 20px; bottom: 20px; width: 300px; max-width: calc(100vw - 40px);
  background: #0c2b28; color: #eafdf9; border-radius: 16px; padding: 18px 20px;
  box-shadow: 0 24px 48px rgba(12,43,40,.4); z-index: 60; overflow-y: auto;
  transform: translateX(340px); opacity: 0; pointer-events: none;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .25s ease;
}
.hdwk .scene-panel.is-open { transform: translateX(0); opacity: 1; pointer-events: auto; }
.hdwk .scene-panel__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.hdwk .scene-panel__head span { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--teal2); }
.hdwk .scene-panel__close { background: none; border: none; color: rgba(255,255,255,.7); font-size: 16px; cursor: pointer; line-height: 1; padding: 0; }
.hdwk .scene-panel__close:hover { color: #fff; }

.hdwk .panel-who__row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.hdwk .panel-who__avatar { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.16); }
.hdwk .panel-who__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hdwk .panel-who__img--generated { padding: 4px; box-sizing: border-box; background: #fff; }
.hdwk .panel-who__portrait { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff; }
.hdwk .panel-who__name { font-family: var(--font-display); font-size: 13.5px; color: #fff; }
.hdwk .panel-who__name small { font-weight: 400; color: rgba(255,255,255,.6); font-size: 10.5px; }
.hdwk .panel-who__fact { margin: 2px 0 0; font-size: 11.5px; color: rgba(255,255,255,.75); line-height: 1.4; }

/* Inside the panel, the book chip and ask-your-own box need dark-friendly
   colours instead of their default light-page styling. */
.hdwk .scene-panel .bookchip { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); }
.hdwk .scene-panel .bookchip summary { color: var(--teal2); }
.hdwk .scene-panel .bookchip__title, .hdwk .scene-panel .bookchip__author { color: #fff; }
.hdwk .scene-panel .bookchip__blurb { color: rgba(255,255,255,.8); }
.hdwk .scene-panel .askown { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06); margin-top: 0; }
.hdwk .scene-panel .askown__note { color: rgba(255,255,255,.65); }
.hdwk .scene-panel .askown__note b { color: var(--teal2); }

@media (max-width: 640px) {
  .hdwk .scene-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-width: none;
    border-radius: 16px 16px 0 0; max-height: 70vh;
    transform: translateY(100%); }
  .hdwk .scene-panel.is-open { transform: translateY(0); }
}
.hdwk .scene__narr { font-size: clamp(17px, 1.7vw, 19px); line-height: 1.64; color: var(--ink); max-width: 62ch; }
.hdwk .scene__narr p { margin: 0 0 12px; }
.hdwk .scene__narr b, .hdwk .scene__narr strong { color: var(--teal); }
.hdwk .scene__narr em { color: var(--teal); font-style: italic; }

/* =============================================================
   Scroll-reveal — narration/diagram/archive/humanBeat and other content
   beats fade + slide into view as the reader scrolls (engine.js
   wireScrollReveal(), an IntersectionObserver that adds .is-visible once
   per element). Guaranteed visible with no motion when the reader prefers
   reduced motion (media query below) or when JS/IntersectionObserver is
   unavailable (engine.js adds .is-visible synchronously in that case too).
   ============================================================= */
.hdwk .hdwk-reveal { opacity: 0; transform: translateY(48px); transition: opacity .62s cubic-bezier(.16,1,.3,1), transform .62s cubic-bezier(.16,1,.3,1); }
.hdwk .hdwk-reveal.is-visible { opacity: 1; transform: none; }

.hdwk .scene__diagram { margin: 6px 0 18px; padding: 14px 16px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.hdwk .scene__diagram svg { width: 100%; max-width: 460px; height: auto; }

.hdwk .archive { margin: 6px 0 16px; }
.hdwk .archive__frame { background: var(--soft); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; min-height: 86px; display: flex; align-items: center; justify-content: center; }
.hdwk .archive__note { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.hdwk .archive__cap { font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.hdwk .archive__pd { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--teal); margin-left: 4px; }

/* "The scientist speaks" — a LARGE character figure planted mid-narration,
   delivering one strong line in a big speech bubble, so the scene feels
   narrated rather than just read. See engine.js scientistSpeaksHtml(). */
.hdwk .scispeak { display: flex; align-items: flex-end; gap: 20px; margin: 24px 0 28px; max-width: 100%; }
.hdwk .scispeak__figure { flex: 0 0 auto; text-align: center; }
.hdwk .scispeak__img, .hdwk .scispeak__portrait {
  width: 156px; height: 194px; border-radius: 22px; object-fit: cover; object-position: top center;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--teal2); box-shadow: 0 20px 40px -20px rgba(15,118,110,.55);
  background: var(--soft); font-family: var(--font-display); font-weight: 700; font-size: 46px; color: var(--teal);
}
.hdwk .scispeak__img--generated { padding: 8px; box-sizing: border-box; background: #fff; }
/* The figure always sits left of the speech bubble (bubble tail points at
   it from the right) -- mirrored so the character faces the words they're
   saying instead of facing off toward the edge of the page. Only the real
   <img> avatar, never the initials-text fallback (.scispeak__portrait is a
   span of letters -- flipping it would render backwards text). */
.hdwk .scispeak__img { transform: scaleX(-1); }
.hdwk .scispeak__credit { font-size: 9.5px; color: var(--muted); margin-top: 6px; max-width: 156px; line-height: 1.3; }
.hdwk .scispeak__credit a { color: var(--muted); }
.hdwk .scispeak__bubble { position: relative; background: #fff; border: 2px solid var(--teal2); border-radius: 20px;
  padding: 18px 22px; max-width: 48ch; box-shadow: 0 22px 46px -28px rgba(15,118,110,.5); }
.hdwk .scispeak__bubble::before { content: ""; position: absolute; left: -12px; bottom: 34px;
  border: 9px solid transparent; border-right-color: var(--teal2); }
.hdwk .scispeak__bubble::after { content: ""; position: absolute; left: -9px; bottom: 36px;
  border: 7px solid transparent; border-right-color: #fff; }
.hdwk .scispeak__name { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); margin-bottom: 8px; }
.hdwk .scispeak__line { font-family: var(--font-display); font-size: clamp(18px, 2.1vw, 22px); line-height: 1.45; color: var(--ink); font-style: italic; }

.hdwk .humanbeat { max-width: 62ch; margin: 18px 0 4px; padding: 12px 16px; border-left: 3px solid var(--teal2); background: var(--soft); font-size: 15px; color: var(--muted); font-style: italic; border-radius: 0 10px 10px 0; }
.hdwk .revisit { margin-bottom: 12px; padding: 7px 12px; font-family: var(--font-mono); font-size: 11.5px; color: var(--teal); background: var(--soft); border-radius: 8px; }

/* =============================================================
   Questions worth chasing — the story engine
   ============================================================= */
.hdwk .qhead { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 24px 0 12px; }
.hdwk .qhead h3 { font-family: var(--font-display); font-size: 20px; color: var(--teal); margin: 0; }
.hdwk .qhead span { font-size: 13.5px; color: var(--muted); }

.hdwk .q { display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-left: 5px solid var(--accent);
  border-radius: 13px; padding: 15px 18px; margin-bottom: 11px; transition: border-color .15s, background .15s, transform .12s, box-shadow .15s; }
.hdwk .q:hover, .hdwk .q:focus-visible { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 10px 24px -16px rgba(234,88,12,.6); outline: none; }
.hdwk .q:focus-visible { box-shadow: 0 0 0 3px rgba(234,88,12,.28); }
.hdwk .q.is-disabled { opacity: .5; }
.hdwk .q--continue { border-left-color: var(--teal2); }
.hdwk .feedback__cont { margin-top: 12px; }
.hdwk .q__text { font-size: 17px; color: var(--ink); line-height: 1.4; }
.hdwk .q__text b { color: var(--teal); }
.hdwk .q__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; font-size: 13.5px; }
.hdwk .asker { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 999px; padding: 3px 10px; color: var(--accent); font-weight: 600; }
.hdwk .lead { color: var(--accent); font-weight: 600; }
.hdwk .lead b { color: var(--accent); }

/* Choice bubbles — each onward question "delivered" by the scientist who
   asked it: a small avatar (real portrait / generated avatar / initials,
   see engine.js avatarHtml) beside a speech-bubble-styled .q button. The
   .q button itself keeps its existing click wiring (data-i) untouched. */
.hdwk .qlist { display: flex; flex-direction: column; }
.hdwk .qbubble { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.hdwk .qbubble .q { position: relative; width: auto; flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.hdwk .qbubble .q::before { content: ""; position: absolute; left: -7px; top: 50%; margin-top: -6px; width: 0; height: 0;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 7px solid #fff; }
.hdwk .qbubble .q--yours::before { border-right-color: #fffbeb; }
/* Choice avatars render as a proper half-figure character — a tall rounded
   panel showing head + shoulders, not a tiny circular head crop — so the
   scientist "delivering" the question actually reads as a character. */
.hdwk .qbubble__avatar { flex: 0 0 auto; width: 104px; height: 128px; border-radius: 20px;
  overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 46px;
  background: var(--accent-soft); border: 3px solid var(--accent-line); box-shadow: 0 10px 26px -16px rgba(234,88,12,.5); }
.hdwk .qbubble__avatar--you { background: #fef3c7; border-color: #fde68a; }
.hdwk .qbubble__avatar--explorer { background: var(--soft); border-color: var(--line); }
.hdwk .qbubble__img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.hdwk .qbubble__img--generated { padding: 5px; box-sizing: border-box; background: #fff; }
.hdwk .qbubble__portrait { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--teal); }

/* the questions "pop up" as a group once the reader scrolls to the end of
   the scene's narrative — a .hdwk-reveal (fade) plus a per-bubble staggered
   pop (scale + rise) driven purely by nth-child transition-delay. */
.hdwk .hdwk-choicezone .qbubble { opacity: 0; transform: translateY(24px) scale(.96); transition: opacity .45s ease, transform .45s ease; }
.hdwk .hdwk-choicezone.is-visible .qbubble { opacity: 1; transform: none; }
.hdwk .hdwk-choicezone.is-visible .qbubble:nth-child(1) { transition-delay: .04s; }
.hdwk .hdwk-choicezone.is-visible .qbubble:nth-child(2) { transition-delay: .11s; }
.hdwk .hdwk-choicezone.is-visible .qbubble:nth-child(3) { transition-delay: .18s; }
.hdwk .hdwk-choicezone.is-visible .qbubble:nth-child(4) { transition-delay: .25s; }
.hdwk .hdwk-choicezone.is-visible .qbubble:nth-child(5) { transition-delay: .32s; }
.hdwk .hdwk-choicezone.is-visible .qbubble:nth-child(6) { transition-delay: .39s; }

/* Quick wonders — density fix: ONE compact "🤔 Quick wonders (n)" expander
   instead of n stacked cards, with an inner one-open-at-a-time accordion
   (native <details>) for the tap-to-reveal answer. */
.hdwk .wonders { margin: 16px 0 0; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: #f7feff; cursor: pointer; }
.hdwk .wonders > summary { cursor: pointer; font-weight: 700; color: var(--cyan); font-size: 14.5px; list-style: none; }
.hdwk .wonders > summary::-webkit-details-marker { display: none; }
.hdwk .wonders__list { margin-top: 10px; cursor: auto; }
.hdwk .wonder { border-top: 1px solid #d4f0f3; padding: 9px 0; }
.hdwk .wonder:first-child { border-top: none; padding-top: 4px; }
.hdwk .wonder__q { cursor: pointer; font-size: 15px; color: var(--ink); list-style: none; }
.hdwk .wonder__q::-webkit-details-marker { display: none; }
.hdwk .wonder__q::before { content: "❓ "; }
.hdwk .wonder__a { font-size: 14.5px; line-height: 1.55; color: var(--ink); margin-top: 8px; }

/* the student's own question, on the trail */
.hdwk .q--yours { border-left-color: var(--amber); background: #fffbeb; cursor: default; }
.hdwk .q--yours:hover { transform: none; box-shadow: none; background: #fffbeb; border-color: #fde68a; }
.hdwk .asker--you { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-ink); }
.hdwk .tagnew { background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--gold-ink); border-radius: 999px; padding: 3px 10px; font-weight: 600; }
/* A question that has NOT reached the teacher — signed out, or the send
   failed. Muted rather than alarming: it is a state to notice, not an error
   the student caused. */
.hdwk .tagnew--muted { background: transparent; color: var(--muted); border: 1px dashed var(--line); }

/* prediction ("design the experiment") questions keep their predict + reveal flow */
.hdwk .choices__prompt { font-family: var(--font-mono); font-size: 13.5px; letter-spacing: .03em; color: var(--muted); margin: 6px 0 10px; }
.hdwk .q--predict { border-left-color: var(--amber); }
.hdwk .q--predict .q__text::before { content: "🔭 "; }
.hdwk .feedback { margin: 4px 0 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--teal2); background: var(--soft); font-size: 16px; line-height: 1.55; color: var(--ink); animation: hdwk-rise .35s ease both; }
.hdwk .feedback b, .hdwk .feedback strong { color: var(--teal); }

/* ask your own question */
.hdwk .askown { margin: 16px 0 0; padding: 14px 16px; border: 1.5px dashed var(--teal2); border-radius: 12px; background: #f3fbf9; }
.hdwk .askown__h { font-weight: 700; color: var(--teal); font-size: 16px; margin-bottom: 8px; }
.hdwk .askown__row { display: flex; gap: 8px; }
.hdwk .askown input { flex: 1; font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.hdwk .askown button { font: inherit; font-weight: 600; font-size: 15px; color: #fff; background: var(--teal); border: none; border-radius: 9px; padding: 10px 18px; cursor: pointer; }
.hdwk .askown button:hover { background: #0c5f59; }
.hdwk .askown button:disabled { opacity: .5; cursor: default; }
.hdwk .askown__note { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.hdwk .askown__note b { color: var(--teal); }

/* in-story jump link — rendered by fmt() for [text](#SCENE-ID) narration links,
   and reused as the base class for the foreshadow button below */
.hdwk .hdwk-jump { color: var(--teal); font-weight: 600; text-decoration: underline; text-decoration-color: var(--teal2); cursor: pointer; }
.hdwk .hdwk-jump:hover { color: #0c5f59; }

/* "How can I learn more?" — per-scene popular-science book recommendation */
.hdwk .bookchip { margin: 6px 0 16px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); cursor: pointer; }
.hdwk .bookchip summary { cursor: pointer; font-weight: 700; color: var(--teal); font-size: 14.5px; list-style: none; }
.hdwk .bookchip summary::-webkit-details-marker { display: none; }
.hdwk .bookchip__title { font-family: var(--font-display); font-size: 16.5px; color: var(--ink); margin-top: 8px; }
.hdwk .bookchip__author { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.hdwk .bookchip__blurb { font-size: 14.5px; color: var(--ink); margin-top: 6px; line-height: 1.5; }

/* "Still-open questions" — deliberately unanswered, kept visually apart from `ask` */
.hdwk .roomq { margin: 20px 0 0; padding: 14px 16px; border: 1.5px dashed var(--amber); border-radius: 12px; background: #fffdf6; }
.hdwk .roomq__h { font-weight: 700; color: var(--amber); font-size: 15px; margin-bottom: 8px; }
.hdwk .roomq ul { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.6; color: var(--ink); }
.hdwk .roomq li { margin: 4px 0; }

/* "…that's a story for later →" — subtle forward link to a later scene */
.hdwk .foreshadow { display: inline-block; margin-top: 14px; font: inherit; font-size: 14px; font-style: italic; color: var(--muted); background: none; border: none; padding: 0; text-decoration-style: dotted; }
.hdwk .foreshadow:hover { color: var(--teal); }

/* "where this comes from" — sources for the claims in the scene */
.hdwk .sources { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.hdwk .sources summary { cursor: pointer; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; list-style: none; }
.hdwk .sources summary::-webkit-details-marker { display: none; }
.hdwk .sources summary::before { content: "📚 "; }
.hdwk .sources ul { margin: 10px 0 0; padding-left: 18px; }
.hdwk .sources li { margin: 4px 0; }
.hdwk .sources a { color: var(--teal); font-size: 14.5px; }

/* =============================================================
   Right column — scientist card + trail of questions
   ============================================================= */
.hdwk .side { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 16px; }

.hdwk .sci { background: linear-gradient(180deg, var(--teal2), var(--teal)); color: #eafdf9; border-radius: var(--radius); padding: 22px; text-align: center; }
.hdwk .sci__portrait { width: 112px; height: 112px; border-radius: 50%; margin: 0 auto 12px; background: rgba(255,255,255,.16); border: 2px solid rgba(255,255,255,.45); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 36px; letter-spacing: .03em; color: #fff; }
.hdwk .sci__img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; margin: 0 auto 6px; display: block; border: 2px solid rgba(255,255,255,.55); }
.hdwk .sci__img--generated { background: rgba(255,255,255,.3); padding: 6px; box-sizing: border-box; }
.hdwk .sci__credit { font-size: 9.5px; line-height: 1.3; opacity: .75; margin: 0 0 10px; }
.hdwk .sci__credit a { color: inherit; text-decoration: underline; }
.hdwk .sci__name { font-family: var(--font-display); font-size: 21px; color: #fff; }
.hdwk .sci__role { font-size: 13.5px; opacity: .9; margin: 2px 0 14px; }
.hdwk .sci__rows { text-align: left; font-size: 14.5px; line-height: 1.7; border-top: 1px solid rgba(255,255,255,.22); padding-top: 12px; }
.hdwk .sci__rows div { display: flex; gap: 8px; }
.hdwk .sci__rows .k { opacity: .75; flex: 0 0 64px; }
.hdwk .sci__fact { font-size: 13.5px; font-style: italic; opacity: .95; border-top: 1px solid rgba(255,255,255,.22); margin-top: 12px; padding-top: 12px; text-align: left; }
.hdwk .sci__more { display: inline-block; margin-top: 14px; background: #fff; color: var(--teal); font-weight: 700; font-size: 14px; border: none; border-radius: 9px; padding: 8px 18px; cursor: pointer; }

/* "also here" — the scene's other scientists, as small avatar chips so
   multiple people stay visibly present at once (not just named in text). */
.hdwk .sci__others { border-top: 1px solid rgba(255,255,255,.22); margin-top: 12px; padding-top: 12px; text-align: left; }
.hdwk .sci__others-h { font-size: 13.5px; opacity: .85; margin-bottom: 8px; }
.hdwk .sci__otherlist { display: flex; flex-wrap: wrap; gap: 8px; }
.hdwk .sci-link { appearance: none; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  padding: 4px 11px 4px 4px; color: #fff; font-size: 13px; }
.hdwk .sci-link:hover, .hdwk .sci-link:focus-visible { background: rgba(255,255,255,.26); outline: none; }
.hdwk .sci-link__avatar { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.22); }
.hdwk .sci-link__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hdwk .sci-link__portrait { font-family: var(--font-display); font-weight: 700; font-size: 10px; color: #fff; }
/* A named character with no PEOPLE profile yet (e.g. Geiger/Marsden) -- a
   plain chip, not a "find out more" button that would silently do nothing. */
.hdwk span.sci-link--noprofile { cursor: default; }
.hdwk span.sci-link--noprofile:hover { background: rgba(255,255,255,.14); }

.hdwk .sci--explorer { background: linear-gradient(180deg, #0f766e, #0c5f59); }
.hdwk .sci--explorer .sci__role { margin-bottom: 0; }

.hdwk .trail { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.hdwk .trail__h { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.hdwk .trail__summary { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.hdwk .trail__bar { height: 6px; border-radius: 3px; background: var(--soft); margin: 8px 0 12px; overflow: hidden; }
.hdwk .trail__fill { height: 100%; background: linear-gradient(90deg, var(--teal2), var(--accent)); transition: width .5s ease; }
.hdwk .trail ol { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.75; color: var(--ink); }
.hdwk .trail__list { max-height: 280px; overflow-y: auto; padding-right: 2px; }
.hdwk .trail li.now { color: var(--teal); font-weight: 700; }
.hdwk .trail li.future { color: #9fb4bf; }
.hdwk .trail__step { appearance: none; border: none; background: none; padding: 0; margin: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; text-decoration: underline dotted var(--muted); text-underline-offset: 2px; }
.hdwk .trail__step:hover, .hdwk .trail__step:focus-visible { color: var(--teal); text-decoration-color: var(--teal); }
.hdwk .trail__earlier-row { list-style: none; margin-left: -18px; margin-bottom: 4px; }
.hdwk .trail__more { appearance: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--teal); background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; }
.hdwk .trail__more:hover { background: #e3f6f2; }
.hdwk .trail__earlier { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }

.hdwk footer.note { max-width: 1320px; margin: 0 auto; padding: 0 32px 24px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; color: var(--muted); opacity: .8; }

/* =============================================================
   Affordance legend + persistent key
   One rule to learn: dotted underline = explained here;
   solid underline + → = takes you somewhere.
   ============================================================= */
.hdwk .keystrip {
  max-width: 1320px; margin: 0 auto; padding: 0 32px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  font-size: 11.5px; color: var(--muted);
}
.hdwk .keystrip__item { display: inline-flex; align-items: center; gap: 4px; }
.hdwk .keystrip__open {
  appearance: none; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--teal); background: var(--soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px;
}
.hdwk .keystrip__open:hover { background: #e3f6f2; }
.hdwk .keystrip__dotted { border-bottom: 1px dotted var(--teal); }
.hdwk .keystrip__solid { border-bottom: 1px solid var(--teal); }

.hdwk .legend-overlay { position: fixed; inset: 0; z-index: 60; padding: 20px; background: rgba(15,118,110,.35); display: flex; align-items: center; justify-content: center; animation: hdwk-rise .2s ease both; }
.hdwk .legend-card { position: relative; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 26px; box-shadow: 0 30px 80px -30px rgba(15,118,110,.6); }
.hdwk .legend-close { position: absolute; top: 8px; right: 12px; border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.hdwk .legend-title { font-family: var(--font-display); color: var(--teal); margin: 0 0 8px; font-size: 22px; }
.hdwk .legend-intro { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.hdwk .legend-rule { font-size: 15.5px; font-weight: 600; color: var(--ink); background: var(--soft); border-radius: 10px; padding: 10px 12px; margin: 8px 0 16px; line-height: 1.5; }
.hdwk .legend-rule b, .hdwk .legend-rule strong { color: var(--teal); }
.hdwk .legend-list { margin: 0 0 18px; padding: 0; list-style: none; }
.hdwk .legend__row { font-size: 15px; line-height: 1.5; color: var(--ink); padding: 7px 0; border-top: 1px solid var(--line); }
.hdwk .legend__row:first-child { border-top: none; }
.hdwk .legend-gotit { display: block; width: 100%; font: inherit; font-weight: 700; font-size: 15.5px; color: #fff; background: var(--teal); border: none; border-radius: 10px; padding: 12px; cursor: pointer; }
.hdwk .legend-gotit:hover { background: #0c5f59; }

/* =============================================================
   Story-level image gallery overlay ("🖼️ Gallery" topbar chip)
   ============================================================= */
.hdwk .gallery-overlay { position: fixed; inset: 0; z-index: 60; padding: 20px; background: rgba(15,118,110,.45); display: flex; align-items: center; justify-content: center; animation: hdwk-rise .2s ease both; }
.hdwk .gallery-card { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 26px; box-shadow: 0 30px 80px -30px rgba(15,118,110,.6); }
.hdwk .gallery-close { position: absolute; top: 8px; right: 12px; border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); z-index: 1; }
.hdwk .gallery-count { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.hdwk .gallery-stage { position: relative; display: flex; align-items: center; justify-content: center; background: var(--soft); border-radius: 12px; overflow: hidden; min-height: 200px; }
.hdwk .gallery-img { display: block; width: 100%; max-height: 46vh; object-fit: contain; background: var(--soft); }
.hdwk .gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,.85); color: var(--teal); font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 4px 14px rgba(15,118,110,.3); }
.hdwk .gallery-nav--prev { left: 8px; }
.hdwk .gallery-nav--next { right: 8px; }
.hdwk .gallery-nav:hover { background: #fff; }
.hdwk .gallery-img-title { font-family: var(--font-display); color: var(--teal); margin: 14px 0 4px; font-size: 18px; }
.hdwk .gallery-caption { font-size: 15px; line-height: 1.55; color: var(--ink); margin: 0 0 8px; }
.hdwk .gallery-credit { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.hdwk .gallery-credit a { color: var(--muted); text-decoration: underline; }

/* =============================================================
   "Find out more" profile overlay
   ============================================================= */
.hdwk .profile-overlay { position: fixed; inset: 0; z-index: 50; padding: 20px; background: rgba(15,118,110,.35); display: flex; align-items: center; justify-content: center; animation: hdwk-rise .2s ease both; }
.hdwk .profile-card { position: relative; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: 0 30px 80px -30px rgba(15,118,110,.6); }
.hdwk .profile-close { position: absolute; top: 8px; right: 12px; border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.hdwk .profile__img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; display: block; margin: 4px 0 4px; border: 2px solid var(--line); }
.hdwk .profile__img--generated { padding: 5px; box-sizing: border-box; background: var(--soft); }
.hdwk .profile__portrait { width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 4px 0 4px; border: 2px solid var(--line); background: var(--soft); font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--teal); }
.hdwk .profile__credit { font-size: 10px; line-height: 1.3; color: var(--muted); margin: 0 0 10px; }
.hdwk .profile__credit a { color: var(--muted); text-decoration: underline; }
.hdwk .profile-name { font-family: var(--font-display); color: var(--teal); margin: 0 0 2px; font-size: 23px; }
.hdwk .profile-bio { font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.hdwk .profile-era { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.hdwk .profile-into { font-size: 16px; line-height: 1.55; color: var(--ink); margin: 0; }
.hdwk .profile-h { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); margin: 14px 0 6px; }
.hdwk .profile-link { display: block; color: var(--teal); font-size: 15px; padding: 3px 0; }
.hdwk ul.profile-q { margin: 0; padding-left: 18px; }
.hdwk ul.profile-q li { font-size: 15px; line-height: 1.5; margin: 4px 0; color: var(--ink); }

/* =============================================================
   Responsive + reduced motion
   ============================================================= */
@media (max-width: 880px) {
  .hdwk .topbar, .hdwk footer.note, .hdwk .keystrip { padding-left: 18px; padding-right: 18px; }
  .hdwk .app { grid-template-columns: 1fr; gap: 18px; padding: 16px 18px 64px; }
  .hdwk .side { position: static; flex-direction: column; }   /* scientist, then trail, below the scene */
}
@media (max-width: 480px) {
  .hdwk .scene { padding: 20px 18px; }
  .hdwk .askown__row { flex-direction: column; }
  .hdwk .askown button { width: 100%; }
  .hdwk .q { padding: 14px 15px; }
  .hdwk .qbubble { gap: 12px; }
  .hdwk .qbubble__avatar { width: 66px; height: 82px; border-radius: 14px; font-size: 30px; }
  .hdwk .scispeak { flex-direction: column; align-items: center; text-align: center; gap: 14px; }
  .hdwk .scispeak__img, .hdwk .scispeak__portrait { width: 128px; height: 158px; }
  .hdwk .scispeak__bubble { max-width: 100%; }
  .hdwk .scispeak__bubble::before { left: 50%; top: -18px; bottom: auto; margin-left: -9px;
    border-right-color: transparent; border-bottom-color: var(--teal2); }
  .hdwk .scispeak__bubble::after { left: 50%; top: -14px; bottom: auto; margin-left: -7px;
    border-right-color: transparent; border-bottom-color: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  .hdwk *, .hdwk *::before, .hdwk *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  /* No motion: every scroll-reveal beat and choice bubble is shown fully
     visible immediately (engine.js also skips the IntersectionObserver
     entirely and adds .is-visible synchronously when this is set, so this
     is a belt-and-suspenders CSS guarantee, not the only safety net). */
  .hdwk .hdwk-reveal, .hdwk .hdwk-choicezone .qbubble { opacity: 1 !important; transform: none !important; }
}

/* Glossary — dotted term with a hover / tap definition popover (see engine applyGlossary). */
.hdwk .gloss { border-bottom: 1px dotted var(--teal); cursor: help; position: relative; }
.hdwk .gloss:focus { outline: 2px solid var(--teal); outline-offset: 2px; }
.hdwk .gloss-pop {
  position: absolute; left: 0; bottom: 130%; z-index: 60;
  min-width: 180px; max-width: 280px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; line-height: 1.4; font-style: normal; font-weight: 400;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease; pointer-events: none;
}
.hdwk .gloss:hover .gloss-pop,
.hdwk .gloss:focus .gloss-pop,
.hdwk .gloss.is-open .gloss-pop { opacity: 1; visibility: visible; transform: translateY(0); }
