/* ==========================================================================
   Tutor Help — video library
   Tokens → base → chrome → views → components → chart → motion → print
   No frameworks. Every colour is declared once via light-dark().
   ========================================================================== */

/* ---------- 1. Tokens ----------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Surfaces — light is a cool paper, dark is a true low-glare near-black */
  --bg:        light-dark(#fafafc, #0b0c11);
  --surface:   light-dark(#ffffff, #14161d);
  --surface-2: light-dark(#f4f5f9, #1b1e27);
  --surface-3: light-dark(#eceef4, #232733);
  --veil:      light-dark(rgba(250,250,252,.85), rgba(11,12,17,.85));

  /* Ink */
  --ink:       light-dark(#101114, #edeef3);
  --ink-2:     light-dark(#51566380, #b6bcccdd);
  --ink-2s:    light-dark(#515663, #b6bccc);
  --ink-3:     light-dark(#767c8c, #838a9b);

  /* Lines */
  --line:      light-dark(#e3e5ed, #262a35);
  --line-soft: light-dark(#eef0f5, #1d212b);

  /* Accent — indigo. Dark mode steps are chosen for the dark surface, not flipped. */
  --accent:      light-dark(#4f46e5, #8b93ff);
  --accent-deep: light-dark(#4338ca, #6d78f5);
  --accent-ink:  light-dark(#ffffff, #0b0c11);
  --accent-wash: light-dark(#eef0ff, #1a1d33);
  --accent-line: light-dark(#c9cdfa, #343a63);

  /* Status */
  --good:      light-dark(#0f766e, #2dd4bf);
  --good-wash: light-dark(#e6f5f3, #0e2a2a);

  /* Chart — single-hue magnitude ramp, validated against both surfaces */
  --bar:       light-dark(#6366f1, #7c85f7);
  --bar-soft:  light-dark(#e6e7fd, #262b47);
  --grid:      light-dark(#eceef4, #232733);

  --shadow-1: 0 1px 2px light-dark(rgba(16,17,20,.05), rgba(0,0,0,.5));
  --shadow-2: 0 1px 2px light-dark(rgba(16,17,20,.05), rgba(0,0,0,.5)),
              0 8px 20px -8px light-dark(rgba(16,17,20,.14), rgba(0,0,0,.65));
  --shadow-3: 0 2px 4px light-dark(rgba(16,17,20,.06), rgba(0,0,0,.5)),
              0 22px 48px -18px light-dark(rgba(16,17,20,.22), rgba(0,0,0,.8));

  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --topbar-h: 3.75rem;
  --sidebar-w: 17.5rem;
}

[data-theme="light"] { color-scheme: light; }
[data-theme="dark"]  { color-scheme: dark; }

/* ---------- 2. Base ------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-synthesis-weight: none;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 600; letter-spacing: -.018em; text-wrap: balance; }
p { margin: 0 0 .85em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

::selection { background: color-mix(in oklab, var(--accent) 26%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: fixed; top: .6rem; left: .6rem; z-index: 200;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem;
  border-radius: var(--r-sm); font-size: .8125rem; font-weight: 500;
  transform: translateY(-180%); transition: transform .2s var(--ease);
}
.skip-link:focus-visible { transform: none; }

.noscript {
  max-width: 42rem; margin: 4rem auto; padding: 2rem;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.noscript h1 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 1rem; font-weight: 400; }
.noscript code { font-family: var(--mono); font-size: .8125rem; background: var(--surface-2); padding: .1em .4em; border-radius: 4px; }

/* ---------- 3. Top bar ---------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--veil);
  backdrop-filter: saturate(1.7) blur(14px);
  -webkit-backdrop-filter: saturate(1.7) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  padding-inline: clamp(.85rem, 2vw, 1.35rem);
}

.brand { display: flex; align-items: center; gap: .6rem; flex: none; }
.brand__mark {
  width: 1.85rem; height: 1.85rem; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 18px -6px var(--accent);
}
.brand__mark svg { width: 1.15rem; height: 1.15rem; fill: var(--accent-ink); }
.brand__text { display: grid; line-height: 1.2; }
.brand__text strong { font-size: .9375rem; font-weight: 650; letter-spacing: -.02em; }
.brand__text em { font-style: normal; font-size: .6875rem; color: var(--ink-3); }
@media (max-width: 52rem) { .brand__text { display: none; } }

.course-pill {
  display: inline-flex; align-items: center; gap: .5rem; flex: none;
  padding: .32rem .7rem .32rem .55rem; border-radius: 999px;
  background: var(--accent-wash); border: 1px solid var(--accent-line);
  font-size: .75rem; font-weight: 550; color: var(--accent);
}
.course-pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.course-pill__count { color: var(--ink-3); font-family: var(--mono); font-size: .6875rem; font-weight: 400; }
@media (max-width: 64rem) { .course-pill { display: none; } }

.search {
  flex: 1 1 auto; min-width: 0; max-width: 34rem; margin-inline: auto;  /* flex items default to min-width:auto and refuse to shrink */
  display: flex; align-items: center; gap: .6rem;
  padding: .45rem .7rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid transparent;
  color: var(--ink-3);
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.search:focus-within { border-color: var(--accent); background: var(--surface); }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: inherit; font-size: .875rem; color: var(--ink);
}
.search input::-webkit-search-cancel-button { display: none; }
@media (max-width: 40rem) { .search .kbd { display: none; } }

.topbar__actions { display: flex; align-items: center; gap: .4rem; flex: none; }
@media (max-width: 46rem) { #saved-link span:not(.badge) { display: none; } }

.badge {
  font-family: var(--mono); font-size: .625rem; font-weight: 500;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: .1rem .35rem; min-width: 1.15rem; text-align: center;
}

.kbd {
  font-family: var(--mono); font-size: .625rem; line-height: 1;
  padding: .25rem .35rem; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
}

.icon { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#saved-link .icon { fill: none; }
#saved-link[data-has="true"] .icon { fill: currentColor; }

/* Theme toggle */
#theme-toggle .icon { display: none; }
:root[data-theme="system"] #theme-toggle .icon--auto { display: block; }
:root[data-theme="light"]  #theme-toggle .icon--sun  { display: block; }
:root[data-theme="dark"]   #theme-toggle .icon--moon { display: block; }

/* ---------- 4. Buttons ---------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .5rem .9rem; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  font-size: .8125rem; font-weight: 550; white-space: nowrap;
  transition: background-color .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--solid {
  background: linear-gradient(150deg, var(--accent), var(--accent-deep));
  color: var(--accent-ink); box-shadow: var(--shadow-1), 0 0 22px -10px var(--accent);
}
.btn--solid:hover { filter: brightness(1.08); }
.btn--quiet { border-color: var(--line); color: var(--ink-2s); background: var(--surface); }
.btn--quiet:hover { border-color: var(--ink-3); color: var(--ink); }
.btn--ghost { color: var(--ink-2s); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--sm { padding: .38rem .7rem; font-size: .75rem; }
.btn--icon { padding: 0; width: 2.1rem; height: 2.1rem; border-radius: 50%; color: var(--ink-2s); }
.btn--icon:hover { background: var(--surface-2); color: var(--ink); }
.btn[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent); }

/* ---------- 5. Shell + sidebar -------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 62rem) { .shell { grid-template-columns: minmax(0, 1fr); } }

.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100dvh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  padding: 1rem .75rem 1.5rem;
  scrollbar-width: thin;
}
@media (max-width: 62rem) {
  .sidebar {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line);
    padding: .65rem .85rem;
  }
  .sidebar__foot { display: none; }
  .unitnav { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .15rem; }
  .unitnav::-webkit-scrollbar { display: none; }
  .navgroup__label { display: none; }
  .unitnav__item { flex: none; width: auto; }
  .unitnav__meta, .unitnav__bar { display: none; }
}

.navgroup__label {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: .6rem .7rem .4rem;
}

.unitnav__item {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem .6rem;
  width: 100%; text-align: left;
  padding: .5rem .65rem; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.unitnav__item:hover { background: var(--surface-2); }
.unitnav__item[aria-current="true"] { background: var(--accent-wash); border-color: var(--accent-line); }
.unitnav__item[aria-current="true"] .unitnav__label { color: var(--accent); }

.unitnav__label { font-size: .8125rem; font-weight: 550; letter-spacing: -.01em; }
.unitnav__title {
  grid-column: 1 / -1; font-size: .75rem; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: -.15rem;
}
.unitnav__meta { font-family: var(--mono); font-size: .625rem; color: var(--ink-3); }
.unitnav__bar {
  grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--surface-3);
  overflow: hidden; margin-top: .2rem;
}
.unitnav__bar i { display: block; height: 100%; border-radius: 2px; background: var(--good); width: var(--p, 0%); transition: width .4s var(--ease); }

.sidebar__foot {
  margin-top: 1.25rem; padding: .85rem .7rem 0; border-top: 1px solid var(--line);
  font-size: .6875rem; line-height: 1.55; color: var(--ink-3);
}

/* ---------- 6. View / layout ---------------------------------------------- */

.view { min-height: calc(100dvh - var(--topbar-h)); padding: clamp(1.25rem, 3vw, 2.25rem); }
.view:focus { outline: none; }
.wrap { max-width: 78rem; margin-inline: auto; }

.crumb {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .75rem; color: var(--ink-3); margin-bottom: .9rem;
}
.crumb a:hover { color: var(--accent); }
.crumb__sep { opacity: .5; }

.page-head { margin-bottom: 1.75rem; }
.page-head h1 {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em;
  font-size: clamp(1.75rem, 3.6vw, 2.75rem); margin-bottom: .5rem;
}
.page-head p { color: var(--ink-2s); max-width: 46rem; font-size: .9375rem; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin: 2.25rem 0 1rem;
}
.section-head h2 { font-size: 1.0625rem; font-weight: 600; }
.section-head .more { font-size: .8125rem; color: var(--ink-3); }
.section-head .more:hover { color: var(--accent); }

/* ---------- 7. Hero ------------------------------------------------------- */

.hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-xl);
  background:
    radial-gradient(48rem 26rem at 88% -10rem, var(--accent-wash), transparent 70%),
    var(--surface);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  display: grid; gap: 1.75rem;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
@media (max-width: 64rem) { .hero { grid-template-columns: minmax(0, 1fr); } }

.hero__eyebrow {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .8rem;
}
.hero__title {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -.015em;
  font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.02; margin-bottom: .75rem;
}
.hero__blurb { color: var(--ink-2s); max-width: 34rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }

.stats { display: flex; flex-wrap: wrap; gap: 1.75rem; margin-top: 1.75rem; }
.stats div { display: grid; gap: .1rem; }
.stats dt { font-family: var(--mono); font-size: .625rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats dd small { font-size: .8125rem; font-weight: 500; color: var(--ink-3); margin-left: .15rem; }

/* ---------- 8. Exam-weight chart ------------------------------------------
   One series (exam weight by unit) → a single hue, no legend, direct value
   labels. Identity is carried by the category axis, never by colour.
   -------------------------------------------------------------------------- */

.chart { align-self: start; }
.chart__head { margin-bottom: .9rem; }
.chart__title { font-size: .875rem; font-weight: 600; margin-bottom: .2rem; }
.chart__sub { font-size: .75rem; color: var(--ink-3); }

.chart__rows { display: grid; gap: 2px; }          /* 2px surface gap between bars */
.chart__row {
  display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) 2.6rem;
  align-items: center; gap: .6rem;
  padding: 2px 4px; border-radius: 6px; cursor: pointer;
  border: 0; background: transparent; text-align: left; width: 100%;
  transition: background-color .15s var(--ease);
}
.chart__row:hover, .chart__row:focus-visible { background: var(--surface-2); }
.chart__row[data-current="true"] { background: var(--accent-wash); }

.chart__label { font-size: .6875rem; color: var(--ink-2s); font-weight: 500; white-space: nowrap; }
.chart__track { height: 11px; border-radius: 3px; background: var(--bar-soft); overflow: hidden; }
.chart__fill {
  display: block; height: 100%; width: var(--w, 0%);
  background: var(--bar);
  border-radius: 3px 4px 4px 3px;                  /* 4px rounded data-end */
  transition: width .55s var(--ease);
}
.chart__value {
  font-family: var(--mono); font-size: .6875rem; color: var(--ink-2s);
  text-align: right; font-variant-numeric: tabular-nums;
}
.chart__note { margin-top: .85rem; font-size: .6875rem; color: var(--ink-3); line-height: 1.5; }

/* ---------- 9. Cards ------------------------------------------------------ */

.grid { display: grid; gap: 1.25rem 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); }
.grid--units { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }

.vcard { display: grid; gap: .6rem; align-content: start; }
.vcard__thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md);
  overflow: hidden; background: var(--surface-3);
  box-shadow: var(--shadow-1);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.vcard:hover .vcard__thumb { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.vcard__thumb img { width: 100%; height: 100%; object-fit: cover; }

.vcard__dur {
  position: absolute; right: .4rem; bottom: .4rem;
  font-family: var(--mono); font-size: .6875rem; font-weight: 500;
  padding: .12rem .34rem; border-radius: 4px;
  background: rgba(8, 9, 13, .82); color: #fff;
}
.vcard__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(0deg, rgba(8,9,13,.35), rgba(8,9,13,.05));
  opacity: 0; transition: opacity .22s var(--ease);
}
.vcard:hover .vcard__play, .vcard:focus-within .vcard__play { opacity: 1; }
.vcard__play span {
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: rgba(255,255,255,.94); display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.vcard__play svg { width: 1.1rem; height: 1.1rem; fill: #101114; margin-left: 2px; }

.vcard__seen {
  position: absolute; left: .4rem; top: .4rem;
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .625rem; font-weight: 600; padding: .15rem .4rem;
  border-radius: 999px; background: var(--good); color: #fff;
}
.vcard__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.28); }
.vcard__progress i { display: block; height: 100%; background: var(--good); width: var(--p, 0%); }

.vcard__title {
  font-size: .875rem; font-weight: 550; line-height: 1.35; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vcard:hover .vcard__title { color: var(--accent); }
.vcard__meta { font-size: .75rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: .3rem .5rem; }
.vcard__chan { color: var(--ink-2s); font-weight: 500; }

/* Unit cards */
.ucard {
  display: grid; gap: .55rem; align-content: start;
  padding: 1.1rem 1.15rem; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.ucard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--accent-line); }
.ucard__top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.ucard__label { font-family: var(--mono); font-size: .6875rem; font-weight: 500; color: var(--accent); letter-spacing: .04em; }
.ucard__weight {
  font-family: var(--mono); font-size: .625rem; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 999px; padding: .1rem .45rem;
}
.ucard__title { font-size: 1rem; font-weight: 600; letter-spacing: -.015em; }
.ucard__blurb {
  font-size: .8125rem; color: var(--ink-3); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ucard__foot { display: flex; align-items: center; gap: .6rem; margin-top: .25rem; font-size: .75rem; color: var(--ink-3); }
.ucard__bar { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.ucard__bar i { display: block; height: 100%; background: var(--good); width: var(--p, 0%); border-radius: 2px; transition: width .4s var(--ease); }

/* ---------- 10. Watch view ------------------------------------------------ */

.watch { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.75rem; align-items: start; }
@media (max-width: 68rem) { .watch { grid-template-columns: minmax(0, 1fr); } }

.player {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  border-radius: var(--r-lg); overflow: hidden; background: #000;
  box-shadow: var(--shadow-2);
}
.player iframe { width: 100%; height: 100%; border: 0; display: block; }

.watch__title {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem); line-height: 1.15; margin: 1.15rem 0 .65rem;
}
.watch__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem;
  font-size: .8125rem; color: var(--ink-3); padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.watch__chan { color: var(--ink); font-weight: 550; }
.watch__actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 0; }

.upnext__head { font-size: .8125rem; font-weight: 600; color: var(--ink-2s); margin-bottom: .75rem; }
.upnext { display: grid; gap: .6rem; }
.upnext__item {
  display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .7rem;
  padding: .3rem; border-radius: var(--r-md);
  transition: background-color .16s var(--ease);
}
.upnext__item:hover { background: var(--surface-2); }
.upnext__item[aria-current="true"] { background: var(--accent-wash); }
.upnext__thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: var(--surface-3); }
.upnext__thumb img { width: 100%; height: 100%; object-fit: cover; }
.upnext__dur {
  position: absolute; right: .2rem; bottom: .2rem;
  font-family: var(--mono); font-size: .5625rem; padding: .08rem .25rem;
  border-radius: 3px; background: rgba(8,9,13,.82); color: #fff;
}
.upnext__title {
  font-size: .78125rem; font-weight: 550; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.upnext__meta { font-size: .6875rem; color: var(--ink-3); margin-top: .2rem; }

/* ---------- 11. Empty / misc ---------------------------------------------- */

.empty {
  display: grid; gap: .6rem; justify-items: start;
  padding: 3rem 1.5rem; border: 1px dashed var(--line);
  border-radius: var(--r-lg); color: var(--ink-3); background: var(--surface);
}
.empty h2 { font-size: 1.0625rem; color: var(--ink); }
.empty p { max-width: 34rem; font-size: .875rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.chip {
  font-size: .75rem; font-weight: 500; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2s); cursor: pointer;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent); }

.toast {
  position: fixed; bottom: 1.5rem; left: 0; right: 0; z-index: 150;
  margin-inline: auto; width: max-content; max-width: calc(100% - 2rem);
  padding: .6rem 1.05rem; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: .8125rem; font-weight: 500;
  box-shadow: var(--shadow-3);
  opacity: 0; translate: 0 1rem; pointer-events: none;
  transition: opacity .22s var(--ease), translate .22s var(--ease);
}
.toast[data-show="true"] { opacity: 1; translate: 0; }

/* ---------- 12. Motion ---------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .view > * { animation: fade .3s var(--ease) both; }
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- 13. Print ----------------------------------------------------- */

@media print {
  :root { color-scheme: light; }
  .topbar, .sidebar, .vcard__play, .toast, .skip-link, .watch__actions, .player { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
  .ucard, .hero { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
}

/* ---------- 14. Per-course hue -------------------------------------------
   Each course carries its own validated hue as two inline custom properties
   (light step + dark step). light-dark() picks the right one from the active
   colour-scheme, so the choice happens once, here, and nowhere else.
   Colour is never the only cue: every card also shows its title and monogram.
   -------------------------------------------------------------------------- */

.ccard, .wrap, .unitnav__item {
  --c: light-dark(var(--hue, var(--accent)), var(--hue-d, var(--accent)));
}

/* ---------- 15. Course cards ---------------------------------------------- */

.grid--courses { grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 1rem; }

.ccard {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem 1rem;
  align-content: start;
  padding: 1.25rem 1.3rem 1.5rem;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.ccard::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c);
}
.ccard:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: color-mix(in oklab, var(--c) 42%, var(--line)); }

.ccard__mono {
  width: 2.6rem; height: 2.6rem; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .8125rem; font-weight: 500; letter-spacing: .02em;
  color: var(--c);
  background: color-mix(in oklab, var(--c) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--c) 26%, transparent);
}
.ccard__body { display: grid; gap: .2rem; }
.ccard__title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.015em; }
.ccard__tag { font-size: .75rem; color: var(--c); font-weight: 550; margin: 0; }
.ccard__blurb {
  font-size: .8125rem; color: var(--ink-3); line-height: 1.55; margin: .35rem 0 0;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ccard__foot {
  grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  font-size: .75rem; color: var(--ink-3); margin-top: .5rem;
}
.ccard__done { color: var(--good); font-weight: 550; }
.ccard__bar {
  position: absolute; inset: auto 0 0 0; height: 3px; background: var(--surface-3);
}
.ccard__bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--c); transition: width .4s var(--ease); }

/* ---------- 16. Course-tinted chrome -------------------------------------- */

.hero--course .hero__eyebrow { color: var(--c); }
.hero--course { background: radial-gradient(48rem 26rem at 88% -10rem, color-mix(in oklab, var(--c) 12%, transparent), transparent 70%), var(--surface); }
.hero--home .hero__title { max-width: 18ch; }

.chart__fill { background: var(--c, var(--bar)); }
.ucard__label { color: var(--c); }
.ucard:hover { border-color: color-mix(in oklab, var(--c) 42%, var(--line)); }
.crumb a { color: var(--ink-2s); }
.crumb a:hover { color: var(--c); }
.vcard:hover .vcard__title { color: var(--c); }

.page-head__meta {
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); margin-top: .75rem;
}

/* Sidebar course rows get a hue dot */
.unitnav__item[style] .unitnav__label::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--c); margin-right: .5rem; vertical-align: .05em;
}

.unitnav__back {
  display: block; padding: .4rem .65rem; margin-bottom: .35rem;
  font-size: .75rem; color: var(--ink-3); border-radius: var(--r-md);
}
.unitnav__back:hover { background: var(--surface-2); color: var(--ink); }
@media (max-width: 62rem) { .unitnav__back { flex: none; white-space: nowrap; margin-bottom: 0; } }

/* ---------- 17. Hero (home) layout ---------------------------------------- */

.hero--home { grid-template-columns: minmax(0, 1fr); }
.hero--home .hero__blurb { max-width: 46rem; }

/* ---------- 18. Very narrow phones ---------------------------------------
   At 360px the top bar's gaps and padding pushed the document 16px wider than
   the viewport. Tighten the chrome rather than let the page scroll sideways.
   -------------------------------------------------------------------------- */

@media (max-width: 26rem) {
  .topbar__inner { gap: .45rem; padding-inline: .55rem; }
  .search { padding: .4rem .55rem; gap: .45rem; }
  .topbar__actions { gap: .25rem; }
  .btn--icon { width: 1.9rem; height: 1.9rem; }
  #saved-link { padding: .3rem .5rem; }
  .view { padding: 1rem .75rem; }
}
