/* Open Study Library — warm paper, deep ink and one ochre-red accent.
   Every colour token is written once with light-dark(): the page follows the
   system scheme, and theme.js pins light or dark when the reader picks one. */
:root {
  color-scheme: light dark;

  /* Surfaces */
  --paper: light-dark(#f4eee4, #191613);
  --sheet: light-dark(#fcf9f3, #221e1a);
  --wash: light-dark(#ede5d7, #2b2621);
  --raised: light-dark(#fffdf9, #282320);

  /* Ink */
  --ink: light-dark(#2a231e, #ece4d8);
  --ink-soft: light-dark(#4b4139, #cfc5b6);
  --quiet: light-dark(#6c6056, #a29686);
  --rule: light-dark(#e3d9c9, #36302a);
  --rule-strong: light-dark(#cdbfaa, #4a4239);

  /* Accent: ochre red */
  --accent: light-dark(#a1452a, #e38e69);
  --accent-hover: light-dark(#843620, #eea482);
  --accent-wash: light-dark(#f4e4d9, #3a2920);
  --on-accent: light-dark(#fffaf4, #231510);

  /* States */
  --ok: light-dark(#4f6a3a, #a7c38c);
  --ok-wash: light-dark(#e7ecdc, #263020);
  --alert: light-dark(#a8261e, #f0877b);
  --alert-wash: light-dark(#f8e2de, #3b201c);

  /* Depth */
  --shadow-near: light-dark(rgb(74 52 30 / .07), rgb(0 0 0 / .35));
  --shadow-far: light-dark(rgb(74 52 30 / .16), rgb(0 0 0 / .55));
  --shadow-card: 0 1px 2px var(--shadow-near), 0 8px 22px -12px var(--shadow-far);
  --shadow-raise: 0 2px 4px var(--shadow-near), 0 18px 36px -16px var(--shadow-far);
  --shadow-pop: 0 4px 10px var(--shadow-near), 0 30px 60px -20px var(--shadow-far);
  --ring: color-mix(in srgb, var(--accent) 30%, transparent);

  /* Shape */
  --radius-sm: 7px;
  --radius: 12px;
  --radius-lg: 18px;

  /* Type */
  --body: "Inter", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --display: "Inter", "Microsoft YaHei UI", "Segoe UI", sans-serif;
  --sans: var(--body);
  --mono: ui-monospace, "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;

  /* The page uses most of the window; only very wide screens keep side margins. */
  --shell: 120rem;
  --gutter: clamp(1rem, 3.3vw, 4.5rem);
  font: 16px/1.6 var(--body);
  -webkit-text-size-adjust: 100%;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--ink); }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.45rem + 1.9vw, 2.75rem); line-height: 1.2; font-weight: 700; letter-spacing: -.03em; }
h2 { font-size: 1.36rem; line-height: 1.35; font-weight: 650; letter-spacing: -.02em; }
h3 { font-size: 1.1rem; line-height: 1.45; font-weight: 650; letter-spacing: -.01em; }
h4 { font-size: 1.02rem; line-height: 1.5; font-weight: 650; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
ul, ol { list-style: none; margin: 0; padding: 0; }
code, pre, kbd { font-family: var(--mono); }

/* --------------------------------------------------------------- controls */
button, .button {
  font: 500 .92rem/1.4 var(--sans); color: var(--ink); background: var(--raised);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: .5rem .95rem; min-height: 40px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none;
  box-shadow: 0 1px 1px var(--shadow-near);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
button:hover, .button:hover { background: var(--wash); border-color: var(--rule-strong); color: var(--ink); }
button:disabled { color: var(--quiet); background: var(--wash); border-color: var(--rule); box-shadow: none; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.primary:disabled { background: var(--accent); border-color: var(--accent); color: var(--on-accent); opacity: .55; }
.text-button {
  display: inline; border: 0; background: none; padding: 0; min-height: 0; text-align: start; box-shadow: none;
  font: inherit; color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 3px; font-weight: 600;
}
.text-button:hover { background: none; color: var(--accent-hover); }
.text-button.quiet { color: var(--quiet); font-weight: 400; font-size: .88rem; }
input, select, textarea {
  font: 400 .95rem/1.5 var(--sans); color: var(--ink); width: 100%; min-width: 0; min-height: 40px;
  background: var(--raised); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: .5rem .7rem; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid transparent; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
input[type=checkbox], input[type=radio] {
  width: 1.05rem; height: 1.05rem; min-height: 0; padding: 0; flex: none; box-shadow: none; accent-color: var(--accent);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--quiet); opacity: 1; }
label { display: grid; gap: .3rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip:focus {
  position: absolute; z-index: 20; top: .6rem; left: .6rem; padding: .6rem .9rem;
  background: var(--sheet); border: 1px solid var(--accent); border-radius: var(--radius-sm); box-shadow: var(--shadow-raise);
}
.eyebrow { font: 600 .74rem/1.5 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.lead { color: var(--ink-soft); max-width: 62ch; font-size: 1.04rem; }
.band-note, .empty { color: var(--quiet); font-size: .9rem; }
.empty { padding: .9rem 0; }
.field-label { color: var(--quiet); font-size: .84rem; margin-inline-end: .45rem; }
.dot { color: var(--rule-strong); margin-inline: .1rem; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }

/* ----------------------------------------------------------------- header */
.site-header {
  position: relative; z-index: 5; background: color-mix(in srgb, var(--sheet) 82%, var(--paper));
  border-bottom: 1px solid var(--rule); box-shadow: 0 1px 0 var(--shadow-near);
}
.header-inner {
  max-width: var(--shell); margin-inline: auto; padding: .6rem var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 2.2rem; min-height: 66px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink);
  font: 700 1.12rem/1.3 var(--display); letter-spacing: -.025em;
}
.wordmark:hover { color: var(--ink); }
.wordmark img { display: block; width: 30px; height: 30px; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .2rem; }
.site-header nav a {
  font: 500 .93rem/1.4 var(--sans); color: var(--quiet); text-decoration: none; white-space: nowrap;
  padding: .45rem .8rem; border-radius: 999px; transition: background-color .15s ease, color .15s ease;
}
.site-header nav a:hover { color: var(--ink); background: var(--wash); }
.site-header nav a[aria-current="page"] { color: var(--accent); background: var(--accent-wash); font-weight: 600; }
.header-tools { margin-inline-start: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; max-width: 100%; }
.header-tools button {
  min-height: 34px; padding: .25rem .75rem; font-size: .86rem; font-weight: 500;
  background: transparent; border-color: var(--rule-strong); color: var(--ink-soft); box-shadow: none; border-radius: 999px;
}
.header-tools button:hover { background: var(--wash); color: var(--ink); }
.theme-toggle { width: 34px; padding: 0 !important; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
#lock-profile { display: inline-block; max-width: min(13rem, 50vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 32px; padding-block: 0; }

main { max-width: var(--shell); margin-inline: auto; padding: clamp(1.5rem, 3.5vw, 2.8rem) var(--gutter) 5rem; }
main:focus { outline: none; }
#notice:empty { display: none; }
#notice {
  padding: .7rem 1rem; margin-bottom: 1.4rem; border-radius: var(--radius-sm);
  background: var(--accent-wash); color: var(--ink-soft); border-inline-start: 3px solid var(--accent);
}
#notice[data-error] { background: var(--alert-wash); color: var(--alert); border-inline-start-color: var(--alert); }

/* ------------------------------------------------------------------ bands */
.band { margin-top: 1.6rem; }
.band-head { display: grid; gap: .5rem; margin-bottom: 1.6rem; }
.search { display: flex; gap: .5rem; max-width: 36rem; margin-top: .4rem; }
.search button { white-space: nowrap; }
.directory-link {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .9rem;
  padding: .7rem .85rem; text-decoration: none; color: inherit; background: var(--sheet);
}
.directory-link:hover { color: inherit; }
.directory-name { font-weight: 600; font-size: 1.04rem; color: var(--ink); }
.directory-count { color: var(--quiet); font: .8rem/1.6 var(--sans); white-space: nowrap; font-variant-numeric: tabular-nums; }
.directory-text { grid-column: 1 / -1; color: var(--quiet); font-size: .9rem; }

/* ------------------------------------------------------------------ major */
.major-head { display: grid; gap: .45rem; }
.major-tools { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem 1.4rem; margin-bottom: 1rem; }
.back-link { font: 500 .88rem/1.5 var(--sans); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.back-link::before { content: "← " / ""; }
.major-switch { max-width: 20rem; flex: 1 1 14rem; }
.major-tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; margin-top: 1.2rem; padding: .25rem; background: var(--wash); border-radius: 999px; justify-self: start; }
.major-tab {
  display: inline-flex; align-items: baseline; gap: .45rem; padding: .42rem 1rem; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none; font: 600 .92rem/1.4 var(--sans);
}
.major-tab:hover { color: var(--ink); background: color-mix(in srgb, var(--sheet) 60%, transparent); }
.major-tab[aria-current="page"] { background: var(--sheet); color: var(--accent); box-shadow: var(--shadow-card); }
.chip-count { font: .78rem/1.4 var(--sans); color: var(--quiet); font-variant-numeric: tabular-nums; }
.map-section { margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); display: grid; gap: .3rem; }
.map-hint { color: var(--quiet); font-size: .9rem; }

.map { position: relative; margin-top: 1.2rem; }
.map-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; color: var(--rule-strong); overflow: visible; }
.map-edges > path { stroke: currentColor; fill: none; }
.map-layers { display: grid; gap: 1.4rem; }
.layer-label {
  font: 600 .74rem/1.5 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--quiet);
  padding-bottom: .4rem; margin-bottom: .8rem; border-bottom: 1px solid var(--rule);
}
.layer-nodes { display: grid; gap: 1rem; align-content: start; }
.route-node {
  position: relative; display: grid; gap: .3rem; align-content: start; padding: 1rem 1.15rem;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.route-node.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-raise); }
.route-name a { font-weight: 600; color: var(--ink); text-decoration: none; }
.route-name a:hover { color: var(--accent); text-decoration: underline; }
.route-text { color: var(--quiet); font-size: .92rem; }
.route-meta { color: var(--quiet); font: .82rem/1.6 var(--sans); font-variant-numeric: tabular-nums; }
.route-prereq { font-size: .88rem; }
.route-open { font: 600 .88rem/1.5 var(--sans); justify-self: start; margin-top: .2rem; text-decoration: none; }
.route-open:hover { text-decoration: underline; }
.route-open::after { content: " →" / ""; }

.state-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; font: .8rem/1.6 var(--sans); color: var(--quiet); }
.state-mark { font-size: .72rem; line-height: 1; }
.state-line[data-state="done"] { color: var(--ok); }
.state-line[data-state="done"] .state-name { font-weight: 650; }
.state-count { font-variant-numeric: tabular-nums; }
.state-current {
  margin-inline-start: auto; padding: 0 .5rem; border-radius: 999px; font-size: .74rem;
  background: var(--accent-wash); color: var(--accent);
}

/* ------------------------------------------------------------ stage flow */
.stage-panel { margin-top: 2.6rem; border-top: 1px solid var(--rule); padding-top: 1.6rem; }
.stage-head { display: grid; gap: .45rem; }
#stage-heading { font-size: 1.7rem; }
.stage-label { margin-top: 1.6rem; }
.stage-flow { display: flex; flex-direction: column; align-items: stretch; margin-top: .8rem; }
.stage-step { display: flex; flex-direction: column; align-items: stretch; flex: 1 1 0; min-width: 0; }
.flow-arrow { color: var(--rule-strong); font-size: 1.1rem; line-height: 1; flex: none; text-align: center; padding: .35rem 0; transform: rotate(90deg); }
.stage-link {
  flex: 1 1 auto; display: grid; gap: .25rem; align-content: start; padding: .85rem 1rem; min-width: 0;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-card);
  text-decoration: none; color: inherit; transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.stage-link:hover { color: inherit; border-color: var(--rule-strong); box-shadow: var(--shadow-raise); }
.stage-step.selected .stage-link { border-color: var(--accent); background: var(--accent-wash); box-shadow: 0 0 0 1px var(--accent), var(--shadow-card); }
.stage-index { font: 600 .72rem/1.5 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--quiet); }
.stage-step.selected .stage-index { color: var(--accent); }
.stage-name { font-weight: 600; }
.stage-state { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; font: .8rem/1.6 var(--sans); color: var(--quiet); font-variant-numeric: tabular-nums; }
.stage-resources { margin-top: 2rem; }
.stage-resources > h3 { padding-bottom: .55rem; margin-bottom: .4rem; border-bottom: 1px solid var(--rule); }

/* --------------------------------------------------------- resource rows */
.specimen { display: grid; gap: .45rem; padding: 1.1rem .2rem; border-bottom: 1px solid var(--rule); }
.specimen-list:not(.curriculum-specimens) { display: grid; gap: .9rem; margin-top: 1rem; }
.specimen-list:not(.curriculum-specimens) > .specimen {
  padding: 1.15rem 1.3rem; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--sheet); box-shadow: var(--shadow-card);
}
.specimen-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .55rem; }
.kind-tag {
  font: 500 .72rem/1.6 var(--sans); letter-spacing: .04em; color: var(--ink-soft);
  background: var(--wash); border-radius: 999px; padding: .05rem .55rem;
}
.saved-tag { color: var(--accent); background: var(--accent-wash); }
.specimen-title { font: inherit; font-size: 1.06rem; color: var(--ink); text-decoration: none; }
.specimen-title:hover { color: var(--accent); text-decoration: underline; }
.specimen-text { color: var(--ink-soft); max-width: 76ch; }
.specimen-text.advice { color: var(--quiet); }
.facts { display: flex; flex-wrap: wrap; gap: .1rem 1.2rem; }
.facts div { display: flex; gap: .4rem; font-size: .87rem; }
.facts dt { color: var(--quiet); }
.specimen-stats, .specimen-tags { display: flex; flex-wrap: wrap; gap: .1rem .4rem; font-size: .85rem; color: var(--quiet); }
.stat-value { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.specimen-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; margin-top: .35rem; }
.specimen-actions .button { min-height: 36px; padding: .35rem .8rem; font-size: .88rem; }
.open-link::after { content: " ↗" / ""; }
.link-host { font: .8rem/1.5 var(--sans); color: var(--quiet); overflow-wrap: anywhere; }

/* ------------------------------------------------------ whole-card targets
   A course or resource opens from anywhere on its card: the title link stretches
   over the card, and the card's other controls sit above it. */
.study-course-row, .specimen, .route-node, .record, .sp-course-list > li, .sp-week-courses > li { position: relative; }
.course-name::after, .specimen-title::after, .route-name a::after, .record > .text-button::after,
.sp-course-list .sp-course-link::after, .sp-week-courses .sp-course-link::after {
  content: ""; position: absolute; inset: 0;
}
.study-course-row > input, .course-row-tutorial,
.specimen-actions :is(a, button), .specimen-text a,
.route-prereq a, .route-open,
.sp-course-list > li :is(button:not(.sp-course-link), input, label, select),
.sp-week-courses > li :is(button:not(.sp-course-link), input, label, select, details, a) { position: relative; z-index: 1; }
.study-course-row, .record, .sp-course-list > li, .sp-week-courses > li, .curriculum .specimen { transition: background-color .15s ease; }
.study-course-row:hover, .record:hover, .sp-course-list > li:has(.sp-course-link):hover,
.sp-week-courses > li:hover, .curriculum .specimen:hover { background: color-mix(in srgb, var(--wash) 70%, transparent); }
.specimen-list:not(.curriculum-specimens) > .specimen { transition: box-shadow .2s ease, border-color .2s ease; }
.specimen-list:not(.curriculum-specimens) > .specimen:hover,
.route-node:not(.selected):hover { border-color: var(--rule-strong); box-shadow: var(--shadow-raise); }
.study-course-row:hover .course-name, .specimen:hover .specimen-title, .route-node:hover .route-name a { color: var(--accent); }
.study-course-row:has(.course-name:focus-visible), .specimen:has(.specimen-title:focus-visible),
.route-node:has(.route-name a:focus-visible), .record:has(> .text-button:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
:is(.course-name, .specimen-title, .route-name a, .record > .text-button):focus-visible { outline: none; }

/* ---------------------------------------------------------------- library */
.search-panel {
  display: grid; gap: .9rem; padding: 1.2rem 1.3rem; background: var(--sheet);
  border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .7rem; }
.search-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.search-actions button { min-height: 34px; padding: .3rem .8rem; font-size: .86rem; }
#library-message:not(:empty) { padding-top: .6rem; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: 1.4rem; }
.page-count { color: var(--quiet); font: .86rem/1.5 var(--sans); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- personal records */
.record-block {
  display: grid; gap: .7rem; padding: 1.3rem 1.4rem; margin-top: 1.2rem;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.record-group { display: grid; gap: .4rem; padding-top: .6rem; }
.record-list { display: grid; }
.record { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .9rem; padding: .55rem .1rem; border-bottom: 1px solid var(--rule); }
.record:last-child { border-bottom: 0; }
.record-meta { color: var(--quiet); font-size: .86rem; }
.recovery {
  display: grid; gap: .55rem; padding: 1.1rem 1.25rem; background: var(--sheet);
  border: 1px solid var(--rule); border-inline-start: 3px solid var(--alert); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.recovery .eyebrow { color: var(--alert); }
.recovery-text { color: var(--ink-soft); }
.recovery-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.recovery-actions .button { min-height: 36px; padding: .35rem .8rem; font-size: .88rem; }

/* ----------------------------------------------------------------- dialog */
dialog {
  width: min(44rem, calc(100% - 2rem)); max-height: 88dvh; padding: 0; color: var(--ink);
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgb(28 22 17 / .55); backdrop-filter: blur(2px); }
#feedback-dialog { width: min(32rem, calc(100% - 2rem)); }
.feedback-body { padding: 1.1rem 1.3rem 1.4rem; }
.feedback-field { display: grid; gap: .35rem; }
.feedback-field label { font-weight: 600; }
#feedback-count { justify-self: end; color: var(--quiet); font: .8rem/1.5 var(--sans); font-variant-numeric: tabular-nums; }
#feedback-submit { justify-self: start; }
#feedback-error { color: var(--alert); }
#feedback-status { color: var(--ok); }
#feedback-error:empty, #feedback-status:empty { display: none; }
.dialog-heading {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; padding: .95rem 1.3rem; background: var(--sheet); border-bottom: 1px solid var(--rule);
}
.dialog-heading h2 { overflow-wrap: anywhere; font-size: 1.22rem; }
.dialog-heading button { min-height: 34px; padding: .25rem .8rem; border-radius: 999px; }
#dialog-body { padding: 1.1rem 1.3rem 1.5rem; }
#dialog-error:empty, #dialog-status:empty { display: none; }
#dialog-error { padding: .6rem 1.3rem 0; color: var(--alert); }
#dialog-status { padding: .6rem 1.3rem 0; color: var(--ok); }
.stack { display: grid; gap: .85rem; }
.stack > * { min-width: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; max-width: 42rem; }
.inline-form label { flex: 1 1 11rem; }
.dialog-resource .action-row label { flex: 0 1 12rem; }
.comments { display: grid; gap: .7rem; margin-top: .3rem; overflow-wrap: anywhere; }
.comments li { border-inline-start: 2px solid var(--rule-strong); padding-inline-start: .8rem; }
.comment-author { color: var(--quiet); font-size: .85rem; }

/* ------------------------------------------------------------- responsive
   At 900px and up the route map and the stage diagram read horizontally;
   below it everything reads top to bottom. */
@media (min-width: 900px) {
  .map-layers { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3.4rem; }
  .stage-flow { flex-direction: row; }
  .stage-step { flex-direction: row; align-items: center; }
  .flow-arrow { transform: none; padding: 0 .6rem; }
  .stage-link { flex: 1 1 auto; }
}
@media (max-width: 950px) {
  .header-inner { gap: .5rem 1.1rem; }
  .site-header nav a { padding-inline: .6rem; }
}
@media (max-width: 899px) {
  .filters { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
}
@media (max-width: 700px) {
  .header-inner { gap: .45rem .8rem; min-height: 0; padding-block: .6rem; }
  .site-header nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -.4rem; }
  .header-tools { order: 2; gap: .3rem; }
  .wordmark img { width: 27px; height: 27px; }
  main { padding-top: 1.2rem; }
  .specimen { padding-inline: 0; }
  .specimen-list:not(.curriculum-specimens) > .specimen { padding: 1rem 1.05rem; }
  .search-panel { padding: 1rem; }
}
@media (max-width: 460px) {
  .search-panel .search { flex-wrap: wrap; }
  .search-panel .search button { width: 100%; }
  .filters { grid-template-columns: 1fr; }
  .directory-link { grid-template-columns: 1fr; line-height: 1.5; }
  .directory-count { justify-self: start; }
  .state-current { margin-inline-start: 0; }
  .site-header nav a { padding-inline: .6rem; }
  .wordmark { font-size: 1rem; gap: .5rem; }
  .wordmark img { width: 25px; height: 25px; }
  .header-tools button { padding-inline: .55rem; font-size: .82rem; }
  .theme-toggle { width: 32px; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
