/* paths.css -- layout for the learning-path prototype.
 *
 * Every colour, radius, width and font family here is a token from
 * assets/tokens-b.css. No literal colour appears below. Light is the default
 * because :root in the token file is the light theme and nothing here sets
 * data-theme.
 *
 * No @font-face and no font host. The token font stacks name Newsreader,
 * Inter Tight and IBM Plex Mono first and fall back to system faces, so a page
 * served from a plain local server makes zero network requests.
 */

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

/* Any explicit `display` on an element defeats the [hidden] attribute, because
   the browser's own [hidden] rule is a low-specificity default. `.room-done`
   set display:inline-block and so painted the "Room complete" badge on a room
   with nothing done in it. This puts [hidden] back in charge everywhere. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

code, pre, .sc-input { font-family: var(--font-mono); }

h1, h2, h3, .eyebrow, .badge, .button, .shape, summary, .label {
  font-family: var(--font-display);
}

h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; letter-spacing: -0.005em; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }

p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li { margin: 0 0 0.35rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

.index-page { max-width: 52rem; }

.notice {
  margin: 0;
  padding: 0.75rem 1.25rem;
  background: var(--warning-soft);
  border-bottom: 1px solid var(--warning-line);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.9rem;
}

/* ---- head ---------------------------------------------------------------- */

.crumbs {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 0.4rem; color: var(--faint); }

.page-head { margin-bottom: 2.5rem; }

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 0.4rem;
}

.lede, .why { color: var(--muted); margin-bottom: 1.25rem; }

/* ---- badges. Always a label next to a value, never a bare bar. ----------- */

.badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 0; }

.badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-1);
  font-size: 0.82rem;
  line-height: 1.4;
}
.badge-label { color: var(--muted); }
.badge-value { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.badge.gold { border-color: var(--highlight-line); background: var(--highlight-soft); }
.badge.gold .badge-value { color: var(--highlight); }
.badge.done { border-color: var(--accent-line); background: var(--accent-soft); }
.badge.done .badge-value { color: var(--accent); }
.badge.plain { border-style: dashed; }

.room-done {
  display: inline-block;
  margin: 1rem 0 0;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---- blocks -------------------------------------------------------------- */

.block {
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
  margin-bottom: 2.5rem;
}
.block.optional { border-top-style: dashed; }

.help { color: var(--muted); font-size: 0.94rem; }

.prompt {
  padding: 0.9rem 1.1rem;
  background: var(--surface-3);
  border-left: 3px solid var(--accent-line);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.25rem;
}

.leaf { margin-bottom: 2rem; }
.leaf h3 { margin-top: 0; color: var(--text); }
.leaf h4, .leaf h5 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin: 1.25rem 0 0.4rem;
  color: var(--muted);
}

code {
  font-size: 0.9em;
  padding: 0.1em 0.3em;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}

pre {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
}
pre code { padding: 0; background: none; font-size: inherit; }

/* ---- tasks --------------------------------------------------------------- */

ol.tasks { list-style: none; padding-left: 0; counter-reset: task; }

li.task {
  counter-increment: task;
  position: relative;
  padding: 0.9rem 1rem 0.9rem 2.6rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
}
li.task::before {
  content: counter(task);
  position: absolute;
  left: 0.9rem;
  top: 0.95rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
li.task.done { border-color: var(--accent-line); background: var(--accent-soft); }

li.task label { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.task-box { margin-top: 0.42rem; width: 1rem; height: 1rem; accent-color: var(--accent); flex: none; }
.task-text { flex: 1; }

.shape {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-sm);
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

details.answer { margin-top: 0.6rem; }
details.answer summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  list-style-position: outside;
}
details.answer[open] summary { margin-bottom: 0.5rem; }
details.answer p { margin: 0; font-size: 0.95rem; color: var(--text); }

.traps { color: var(--muted); }

/* ---- toggles ---------------------------------------------------------------
 * Six kinds, one shape. A toggle sits inside the prose it interrupts, so it is
 * indented by a left rule rather than boxed: a box reads as a callout the eye
 * skips, and these are meant to be opened. The kind label carries the colour,
 * which is the only thing that separates the six, and every colour is a token.
 * Closed height is one line, so a reader who opens nothing loses no room.
 */

details.toggle {
  margin: 1rem 0 1.25rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--border-strong);
}
details.toggle > summary {
  cursor: pointer;
  list-style-position: outside;
  font-family: var(--font-body);
  color: var(--text);
}
details.toggle[open] > summary { margin-bottom: 0.7rem; }

.toggle-kind {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-sm);
  background: var(--neutral-soft);
  color: var(--neutral);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  vertical-align: 0.08em;
}

.toggle-body > :last-child { margin-bottom: 0; }
.toggle-body p, .toggle-body li { font-size: 0.98rem; }

/* One nested toggle is legal and it has to look nested, so the inner rule is
   lighter than the outer one and the indent stacks. */
.toggle-body details.toggle { border-left-color: var(--border); margin-bottom: 0.75rem; }

details.toggle-predict { border-left-color: var(--accent-line); }
details.toggle-predict .toggle-kind {
  border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent);
}

details.toggle-breaks { border-left-color: var(--warning-line); }
details.toggle-breaks .toggle-kind {
  border-color: var(--warning-line); background: var(--warning-soft); color: var(--warning);
}

details.toggle-tryit { border-left-color: var(--accent-line); }
details.toggle-tryit .toggle-kind {
  border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent);
}

details.toggle-levelup { border-left-color: var(--highlight-line); }
details.toggle-levelup .toggle-kind {
  border-color: var(--highlight-line); background: var(--highlight-soft); color: var(--highlight);
}

/* ---- self check ---------------------------------------------------------- */

.self-check { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.sc-input {
  flex: 1 1 18rem;
  min-width: 12rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-1);
  color: var(--text);
  font-size: 0.92rem;
}

button, .button {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--surface-3); }

.sc-reveal { border-color: var(--border-strong); background: var(--surface-1); color: var(--muted); }

.sc-feedback, .sc-answer { flex: 1 1 100%; margin: 0.4rem 0 0; font-size: 0.94rem; }
.sc-feedback:empty { display: none; }
.sc-feedback.right { color: var(--accent); }
.sc-feedback.retry { color: var(--muted); }
.sc-answer {
  padding: 0.7rem 0.9rem;
  background: var(--surface-3);
  border-radius: var(--radius);
}

/* ---- path catalog -------------------------------------------------------- */

.group { margin-bottom: 3rem; }
.group h2 {
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

ul.paths { list-style: none; padding-left: 0; }

li.path {
  padding: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
}
li.path h3 { margin-top: 0; font-size: 1.2rem; }
li.path.designed { background: none; border-style: dashed; }
li.path.designed h3 { color: var(--muted); }

.summary { margin-bottom: 0.6rem; }
.audience, .designed-note { color: var(--muted); font-size: 0.94rem; }
.label { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }

/* The node row is the tree filling in. Every node carries its number and its
   name, so it is never an unlabeled bar. */
ol.nodes {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.25rem 0 1.25rem;
}
li.node { margin: 0; }
li.node a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem 0.35rem 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.8rem;
}
li.node a:hover { border-color: var(--accent-line); color: var(--accent); }
.node-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--faint);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
li.node.filled a { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
li.node.filled .node-num { background: var(--accent); color: var(--surface-1); }
li.node.partial .node-num { background: var(--highlight-soft); color: var(--highlight); }

.go { margin: 0; }

/* ---- room nav ------------------------------------------------------------ */

.room-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
}
.nav-up { color: var(--muted); }

/* ---- the celebration beat ------------------------------------------------ */

.celebrate {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}
.confetti {
  position: absolute;
  width: 0.5rem;
  height: 0.8rem;
  border-radius: 1px;
  opacity: 0;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 34rem) {
  .page { padding: 1.75rem 1rem 4rem; }
  h1 { font-size: 1.55rem; }
  .node-name { display: none; }
  li.node a { padding: 0.3rem; }
}

/* ---- depth and deferral. Added with the bridge room. --------------------- */

.depth {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-sm);
  background: var(--neutral-soft);
  color: var(--neutral);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.block.defers {
  border-top-style: dashed;
  border-left: 3px solid var(--neutral-line);
  padding-left: 1.1rem;
  background: var(--neutral-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding-bottom: 0.25rem;
}
.block.defers h2 { color: var(--muted); }

.leaf h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* A prerequisite is named, never re-taught. */
.block.assumes { border-top-style: dashed; }
.block.assumes h2 { color: var(--muted); }
ul.assumed { color: var(--muted); font-size: 0.95rem; margin-bottom: 0; }

/* A leaf the room deliberately leaves out, named rather than silently dropped. */
.block.skips { border-top-style: dashed; }
.block.skips h2 { color: var(--muted); }
ul.skipped { color: var(--muted); font-size: 0.95rem; margin-bottom: 0; }

/* ---- leaf level and next step. Added with slice U3. ----------------------
   Both are written into the page empty and hidden by the generator and filled
   by room-page.js from the site-wide progression manifest. With scripting off
   neither shows, and the page is what it was before the slice. */

.leaf-level {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.55rem;
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.level-band {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--neutral-line);
  border-radius: var(--radius-sm);
  background: var(--neutral-soft);
  color: var(--neutral);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* The four bands the spine's own depth vocabulary names, plus the two floors.
   Color rises with the band so a glance down a page reads as a shape, and the
   two floors stay in the low-emphasis chrome color rather than reading as a
   failure. */
.level-band.band-named { border-color: var(--accent-line); color: var(--accent); }
.level-band.band-working {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}
.level-band.band-full {
  border-color: var(--highlight-line);
  background: var(--highlight-soft);
  color: var(--highlight);
}
.level-band.band-certified {
  border-color: var(--highlight);
  background: var(--highlight-soft);
  color: var(--highlight);
}

.level-count { font-variant-numeric: tabular-nums; }
.level-move { color: var(--faint); }

/* The only place a level line links out. Added with slice U4: when the one
   thing left for an idea is attesting a level-up challenge, the line names that
   challenge and this carries its title. Hidden in every other case. */
.level-move-link { color: var(--accent); }

.block.next-step { border-top-style: dashed; }
.next-step-line { margin-bottom: 0.5rem; }
.next-step-link { font-family: var(--font-display); font-size: 0.9rem; }
.block.next-step .help { margin-bottom: 0; }

@media (max-width: 480px) {
  .leaf-level { font-size: 0.78rem; }
}
