/* Dao Academy v2
   Ink, paper, and the mark's vermilion. Color carries meaning in course content:
   vermilion marks the Chinese tradition, azurite marks the Greek one. */

:root {
  --ink: #1b1a18;
  --paper: #ffffff;
  --stone: #eff0ed;
  --rule: #d9d9d3;
  --muted: #5b5a55;
  --red: #c9392f;
  --red-tint: #f6e2df;
  --blue: #24557f;
  --blue-tint: #dfe9f2;
  --on-ink: #ffffff;

  --display: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --zh: "Noto Serif SC", "Songti SC", "STSong", serif;

  --measure: 38rem;
  --note: 15rem;
  --note-gap: 3.5rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ebe9e3;
    --paper: #151514;
    --stone: #20201e;
    --rule: #3a3935;
    --muted: #aba89f;
    --red: #e4665b;
    --red-tint: #3d211e;
    --blue: #8ab2d8;
    --blue-tint: #1b2a38;
    --on-ink: #151514;
  }
}
/* the theme switch in the masthead overrides the device setting (dao.theme in localStorage) */
:root[data-theme="dark"] {
  --ink: #ebe9e3;
  --paper: #151514;
  --stone: #20201e;
  --rule: #3a3935;
  --muted: #aba89f;
  --red: #e4665b;
  --red-tint: #3d211e;
  --blue: #8ab2d8;
  --blue-tint: #1b2a38;
  --on-ink: #151514;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.65 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 700px) { body { font-size: 1.25rem; } }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
img, svg { max-width: 100%; }
.zh, [lang^="zh"] { font-family: var(--zh); font-style: normal; }
i[lang], i { font-style: italic; }
cite { font-style: italic; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--ink); color: var(--paper); padding: .5rem 1rem; font: 500 1rem var(--display); z-index: 10; }
.skip:focus { left: .5rem; }

/* ---------------------------------------------------------------- masthead */

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  height: 4.5rem; padding: 0 var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  color: var(--ink); text-decoration: none;
  font: 500 1.3rem/1 var(--display); letter-spacing: -.01em;
}
.brand img { display: block; width: 40px; height: 40px; }
.brand .brand-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .brand-light { display: none; }
  :root:not([data-theme="light"]) .brand .brand-dark { display: block; }
}
:root[data-theme="dark"] .brand .brand-light { display: none; }
:root[data-theme="dark"] .brand .brand-dark { display: block; }
.masthead nav { display: flex; align-items: center; gap: 1.25rem; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  border: 1px solid var(--rule); border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle[hidden] { display: none; }
.masthead nav a { font: 500 1rem var(--display); text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; }

.colophon {
  margin-top: 6rem; padding: 2.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--rule);
  font: 400 .95rem/1.5 var(--display); color: var(--muted);
}
.colophon p { margin: 0 0 .35rem; max-width: 40rem; }

/* ---------------------------------------------------------------- shared type */

.crumb { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 0 1.25rem; font: 400 1rem/1.4 var(--display); color: var(--muted); }
.crumb a { color: inherit; }
.promise { font: 400 clamp(1.2rem, 1.9vw, 1.45rem)/1.45 var(--serif); margin: 0 0 1.5rem; max-width: 34rem; }
.meta { font: 400 1rem/1.5 var(--display); color: var(--muted); margin: 0 0 1.75rem; }

.button {
  display: inline-block; padding: .85rem 1.35rem;
  background: var(--ink); color: var(--paper);
  font: 500 1.05rem/1 var(--display); text-decoration: none;
  border: 0; cursor: pointer;
}
.button:hover { background: var(--red); color: #fff; }

/* ---------------------------------------------------------------- constructed figures */

.hero-figure svg, .static svg { display: block; width: 100%; height: auto; overflow: visible; }
.hero-mark, .hero-mark img { display: block; width: 100%; height: auto; }
.ln, .ln-red, .ln-blue, .guide { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ln { stroke: var(--ink); stroke-width: 1.6; }
.ln-red { stroke: var(--red); stroke-width: 1.8; }
.ln-blue { stroke: var(--blue); stroke-width: 1.8; }
.guide { stroke: var(--muted); stroke-width: 1; opacity: .55; }
.dash { stroke-dasharray: 5 5; }
.f-ink { fill: var(--ink); }
.f-red { fill: var(--red); }
.f-blue { fill: var(--blue); }
.f-red-tint { fill: var(--red-tint); }
.f-blue-tint { fill: var(--blue-tint); }
.fig-zh { font: 600 30px var(--zh); fill: var(--red); }
.fig-label { font: 400 14px var(--display); fill: var(--ink); }
.fig-label.strong { font-weight: 500; }
.fig-label.muted, .fig-label .muted { fill: var(--muted); }
.fig-label.on-ink { fill: var(--on-ink); }

/* Figures are complete by default; the animation only plays the construction on
   top (fill-mode backwards), so a page that never animates still shows them. */
.draw { animation: draw 1.1s cubic-bezier(.65, 0, .25, 1) var(--d, 0s) backwards; }
.draw.slow { animation-duration: 2.4s; animation-timing-function: linear; }
.fill-in { animation: fill-in .7s ease-out var(--d, 1.2s) backwards; }
@keyframes draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
@keyframes fill-in { from { opacity: 0; } }
.static .draw, .static .fill-in { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .draw, .fill-in { animation: none; }
}

/* ---------------------------------------------------------------- lesson hero */

.lesson-hero, .course-hero {
  display: grid; align-items: center; justify-content: center;
  gap: clamp(2rem, 6vw, 6rem);
  padding: clamp(2.5rem, 7vw, 6rem) var(--gutter);
}
.lesson-hero { grid-template-columns: minmax(0, 24rem) minmax(0, 40rem); border-bottom: 1px solid var(--rule); }
.lesson-hero h1, .course-hero h1 {
  font: 500 clamp(2.6rem, 6.2vw, 5.1rem)/1 var(--display);
  letter-spacing: -.035em; margin: 0 0 1.5rem;
  text-wrap: balance;
}
@media (max-width: 820px) {
  .lesson-hero, .course-hero { grid-template-columns: minmax(0, 1fr); }
  .lesson-hero .hero-figure, .course-hero .hero-figure { width: min(15rem, 60vw); }
  .course-hero .hero-figure { order: -1; }
}

/* ---------------------------------------------------------------- lesson videos */
/* One player and the lesson's chapters beside it. The video frame stays the films' own ink
   (#1b1a18) in both color schemes, so posters and gates match the footage. */

.watch {
  display: grid; grid-template-columns: minmax(0, 50rem) minmax(16rem, 21rem);
  gap: 1.5rem clamp(1.5rem, 3vw, 3rem); justify-content: center; align-items: start;
  padding: clamp(2rem, 5vw, 3.5rem) var(--gutter); border-bottom: 1px solid var(--rule);
}
@media (max-width: 980px) { .watch { grid-template-columns: minmax(0, 50rem); } }
.watch-stage { position: relative; aspect-ratio: 16 / 9; background: #1b1a18; }
.watch-video { display: block; width: 100%; height: 100%; background: #1b1a18; }
.watch-video[hidden] { display: none; }
.watch-video::cue { font-family: var(--display); font-size: 1.05em; line-height: 1.35; background: rgba(15, 14, 13, .78); color: #f7f3ea; }
.watch-gate {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: start; gap: .8rem;
  padding: clamp(1.25rem, 5vw, 3.5rem); background: #1b1a18; color: #ebe9e3;
}
.watch-gate[hidden] { display: none; }
.watch-gate-title { margin: 0; font: 500 clamp(1.25rem, 2.4vw, 1.75rem)/1.2 var(--display); letter-spacing: -.01em; }
.watch-gate-text { margin: 0; max-width: 32rem; font: 400 1rem/1.5 var(--display); color: #aba89f; }
.watch-gate .button { margin-top: .4rem; background: #ebe9e3; color: #1b1a18; }
.watch-gate .button:hover { background: #e4665b; color: #1b1a18; }
.watch-gate .button[hidden] { display: none; }
.watch-heading { margin: 0 0 .9rem; font: 500 1.3rem/1.2 var(--display); }
.watch-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.watch-item {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .9rem; align-items: center;
  width: 100%; padding: .8rem 0; border: 0; border-bottom: 1px solid var(--rule);
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.watch-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #1b1a18; }
.watch-text { display: grid; gap: .15rem; min-width: 0; }
.watch-n { font: 500 .85rem/1.3 var(--display); color: var(--muted); }
.watch-title { font: 500 1.02rem/1.3 var(--display); }
.watch-meta { font: 400 .85rem/1.3 var(--display); color: var(--muted); }
.watch-item:hover .watch-title { text-decoration: underline; text-underline-offset: .15em; }
.watch-item[aria-pressed="true"] .watch-n { color: var(--red); }
.watch-item[aria-pressed="true"] .watch-thumb { outline: 2px solid var(--red); outline-offset: 2px; }
/* up next: after a chapter ends, a 5-second countdown, then the next chapter plays unless you cancel */
.watch-next {
  position: absolute; inset: 0 0 3rem 0; z-index: 2; display: grid; align-content: center; justify-items: center; gap: .55rem;
  padding: 1.25rem; text-align: center; background: rgba(21, 20, 15, .88); color: #f3efe4;
}
.watch-next[hidden] { display: none; }
.watch-next-label { margin: 0; font: 500 .95rem/1.3 var(--display); color: #bcb6a6; }
.watch-next-title { margin: 0; max-width: 34rem; font: 500 clamp(1.25rem, 3.2vw, 2rem)/1.15 var(--display); letter-spacing: -.02em; text-wrap: balance; }
.watch-next-count { margin: 0; font: 400 1rem/1.3 var(--display); color: #bcb6a6; font-variant-numeric: tabular-nums; }
.watch-next-bar { display: block; width: min(18rem, 70%); height: 3px; background: rgba(243, 239, 228, .22); overflow: hidden; }
.watch-next-bar i { display: block; height: 100%; background: #f2c26b; transform-origin: left; transform: scaleX(0); }
.watch-next.run .watch-next-bar i { animation: watch-next-run 5s linear forwards; }
@keyframes watch-next-run { to { transform: scaleX(1); } }
.watch-next-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem .9rem; margin-top: .4rem; }
.watch-next-go, .watch-next-signin, .watch-next-cancel {
  min-height: 2.75rem; padding: 0 1.25rem; display: inline-flex; align-items: center; justify-content: center;
  font: 500 1rem/1 var(--display); border-radius: 2px; cursor: pointer; text-decoration: none;
}
.watch-next-go, .watch-next-signin { background: #f2c26b; color: #1b1a18; border: 1px solid #f2c26b; }
.watch-next-go:hover, .watch-next-signin:hover { background: #ffd689; border-color: #ffd689; }
.watch-next-cancel { background: transparent; color: #f3efe4; border: 1px solid rgba(243, 239, 228, .5); }
.watch-next-cancel:hover { border-color: #f3efe4; }
.watch-next-signin[hidden], .watch-next-go[hidden] { display: none; }
.watch-auto { display: flex; align-items: center; gap: .55rem; margin: 1rem 0 0; font: 400 .92rem/1.35 var(--display); color: var(--muted); cursor: pointer; }
.watch-auto input { width: 1.1rem; height: 1.1rem; accent-color: var(--red); }
@media (prefers-reduced-motion: reduce) { .watch-next-bar { display: none; } }
.watch-account { margin: 1rem 0 0; font: 400 .9rem/1.4 var(--display); color: var(--muted); }
.watch-account a { color: var(--ink); }

/* ---------------------------------------------------------------- lesson layout */

.lesson-body {
  display: grid;
  grid-template-columns: 12rem minmax(0, calc(var(--measure) + var(--note-gap) + var(--note)));
  gap: 4rem; justify-content: center;
  padding: 4rem var(--gutter) 0;
}
.rail { position: sticky; top: 2rem; align-self: start; font: 400 .95rem/1.35 var(--display); }
.rail-title { margin: 0 0 .75rem; font-weight: 500; }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail a { display: flex; gap: .65rem; padding: .35rem 0; color: var(--muted); text-decoration: none; }
.rail a::before { content: ""; flex: none; width: .5rem; height: .5rem; margin-top: .42em; border: 1.5px solid var(--rule); }
.rail a:hover { color: var(--ink); }
.rail a.is-current { color: var(--ink); }
.rail a.is-current::before { background: var(--red); border-color: var(--red); }

.prose { min-width: 0; }
.prose > * { max-width: var(--measure); }
.prose > p, .prose > ul { margin: 0 0 1.2em; }
.prose h2 {
  font: 500 clamp(1.75rem, 3vw, 2.2rem)/1.1 var(--display); letter-spacing: -.025em;
  margin: 3.75rem 0 1.25rem;
}
.prose > h2:first-child { margin-top: 0; }
.prose h3 { font: 500 1.35rem/1.25 var(--display); letter-spacing: -.01em; margin: 2.5rem 0 .75rem; }
.prose strong { font-weight: 600; }

/* Margin notes: floated into the right-hand column beside the paragraph that follows. */
.prose > .side {
  float: right; clear: right;
  width: var(--note); max-width: none;
  margin: .3rem 0 1.75rem;
  font: 400 .95rem/1.5 var(--display); color: var(--muted);
}
.side .term { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; margin-bottom: .35rem; color: var(--ink); }
.side .term .zh { font-size: 1.55rem; line-height: 1.2; color: var(--red); }
.side .term .gr { font: 400 1.4rem/1.2 var(--serif); color: var(--blue); }
.side .term i { font: italic 400 1.05rem var(--serif); }
.side-name { display: block; margin-bottom: .25rem; color: var(--ink); font-weight: 500; }
.side-name .zh { font-weight: 400; }

.prose .zh { font-size: .95em; }

@media (max-width: 1240px) {
  .lesson-body { grid-template-columns: minmax(0, calc(var(--measure) + var(--note-gap) + var(--note))); }
  .rail { display: none; }
}
@media (max-width: 980px) {
  .lesson-body { grid-template-columns: minmax(0, var(--measure)); padding-top: 3rem; }
  .prose > .side {
    float: none; width: auto; max-width: var(--measure);
    margin: 0 0 1.5rem; padding-left: 1rem; border-left: 2px solid var(--rule);
  }
}

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

.classic { margin: 2.25rem 0 2.5rem; padding-left: 1.5rem; border-left: 3px solid var(--red); }
.classic.greek { border-left-color: var(--blue); }
.classic p { margin: 0 0 .4rem; font-style: italic; }
.classic p[lang^="zh"] { font: 600 clamp(1.5rem, 3vw, 2rem)/1.35 var(--zh); letter-spacing: .06em; color: var(--red); }
.classic p.gr { font: 400 clamp(1.4rem, 2.6vw, 1.8rem)/1.35 var(--serif); font-style: normal; color: var(--blue); }
.classic cite { display: block; margin-top: .5rem; font: 400 .95rem/1.4 var(--display); color: var(--muted); }

.bridge, .counter { margin: 2.75rem 0; padding: 1.6rem 1.75rem; font-size: 1.08rem; }
.bridge { background: var(--stone); }
.counter { border: 1.5px solid var(--ink); }
.bridge h3, .counter h3 { display: flex; align-items: center; gap: .65rem; margin: 0 0 .8rem; font: 600 1.1rem/1.3 var(--display); }
.bridge h3::before { content: ""; width: 1.25rem; height: 1.25rem; background: url(/assets/dao-icon-light.svg) center / 150% no-repeat; }
.counter h3::before { content: ""; width: 1rem; height: 1rem; border: 1.5px solid currentColor; border-radius: 50%; }
.bridge p, .counter p { margin: 0 0 .9em; }
.bridge > :last-child, .counter > :last-child { margin-bottom: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bridge h3::before { background-image: url(/assets/dao-icon-dark.svg); } }
:root[data-theme="dark"] .bridge h3::before { background-image: url(/assets/dao-icon-dark.svg); }
/* "From idea to tool": the academy's own thread (AI today, builders and founders) */
.forward { margin: 2.75rem 0; padding: 1.4rem 1.75rem 1.5rem; font-size: 1.08rem; border-left: 4px solid var(--blue); }
.forward h3 { display: flex; align-items: center; gap: .65rem; margin: 0 0 .8rem; font: 600 1.1rem/1.3 var(--display); }
.forward h3::before { content: ""; width: .8rem; height: .8rem; background: var(--blue); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.forward p { margin: 0 0 .9em; }
.forward > :last-child { margin-bottom: 0; }

.plate { clear: both; margin: 2.5rem 0 2.75rem; max-width: calc(var(--measure) + var(--note-gap) + var(--note)); }
.plate-scroll { overflow-x: auto; }
.plate-scroll svg { display: block; width: 100%; min-width: 560px; height: auto; }
.plate figcaption { max-width: var(--measure); margin-top: .75rem; font: 400 .95rem/1.5 var(--display); color: var(--muted); }

.keep, .reflect, .sources { clear: both; }
.keep ul { list-style: none; padding: 0; margin: 0; }
.keep li { position: relative; padding-left: 1.6rem; margin-bottom: .85rem; }
.keep li::before { content: ""; position: absolute; left: 0; top: .6em; width: .55rem; height: .55rem; background: var(--red); }

.reflect label { display: block; margin-bottom: 1rem; font: 400 1.25rem/1.45 var(--serif); }
.reflect textarea {
  display: block; width: 100%; padding: .9rem 1rem;
  font: 400 1.05rem/1.55 var(--serif); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--rule); resize: vertical;
}
.reflect textarea:focus { border-color: var(--ink); outline: none; }
.saved-note { margin: .5rem 0 0; font: 400 .9rem var(--display); color: var(--muted); }

.sources ul { list-style: none; padding: 0; margin: 0; font: 400 .98rem/1.5 var(--display); color: var(--muted); }
.sources li { margin-bottom: .6rem; }
.sources cite { color: var(--ink); }

/* ---------------------------------------------------------------- knowledge checks */

.check { margin: 2.75rem 0; padding-top: 1.25rem; border-top: 2px solid var(--ink); font-family: var(--display); }
.check-q { margin: 0 0 1rem; font: 500 1.2rem/1.4 var(--display); }
.check-options button {
  position: relative; display: block; width: 100%; margin-top: .5rem;
  padding: .8rem 1rem .8rem 2.75rem;
  font: 400 1.05rem/1.4 var(--display); color: var(--ink); text-align: left;
  background: none; border: 1px solid var(--rule); cursor: pointer;
}
.check-options button::before {
  content: ""; position: absolute; left: 1.05rem; top: 1.12rem;
  width: .7rem; height: .7rem; border: 1.5px solid var(--muted);
}
.check-options button:hover { border-color: var(--ink); }
.check-options button.is-right { border-color: var(--ink); }
.check-options button.is-right::before { background: var(--ink); border-color: var(--ink); }
.check-options button.is-wrong { color: var(--muted); }
.check-options button.is-wrong::before { border-radius: 50%; }
.check-options .check-fb { margin: .6rem 0 1rem 2.75rem; font: 400 1rem/1.5 var(--display); color: var(--muted); }
.check-fb strong { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- activities */

.activity {
  clear: both; margin: 3rem 0; padding: clamp(1.25rem, 3vw, 2.25rem);
  max-width: calc(var(--measure) + var(--note-gap) + var(--note));
  background: var(--stone); font-family: var(--display);
}
.prose .activity h3 { margin: 0 0 .5rem; font: 600 1.4rem/1.2 var(--display); }
.act-intro { max-width: 40rem; margin: 0 0 1.5rem; font: 400 1.05rem/1.5 var(--display); }
.act-note { max-width: 40rem; margin: 1.25rem 0 0; font: 400 1rem/1.5 var(--display); color: var(--muted); }
.act-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 760px) { .act-grid { grid-template-columns: minmax(0, 1fr); } }

.seg { display: inline-flex; border: 1.5px solid var(--ink); }
.seg button {
  padding: .55rem 1rem; font: 500 .98rem/1 var(--display);
  color: var(--ink); background: transparent; border: 0; cursor: pointer;
}
.seg button + button { border-left: 1.5px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.act-button {
  padding: .6rem 1rem; font: 500 .98rem/1 var(--display);
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink); cursor: pointer;
}
.act-button:hover { background: var(--ink); color: var(--paper); }
.act-button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.act-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 1rem; }

.act-field { display: grid; gap: .35rem; margin-bottom: 1rem; font: 500 .95rem var(--display); }
.act-field input[type="range"] { width: 100%; accent-color: var(--ink); }
.act-field input[type="number"], .act-field input[type="text"] {
  width: 100%; padding: .55rem .7rem; font: 400 1.05rem var(--display);
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--rule);
}
.act-field input:focus { border-color: var(--ink); outline: none; }

.readout { font: 400 1.05rem/1.6 var(--display); }
.act-title { margin: 0 0 .35rem; font: 500 1.5rem/1.2 var(--display); }
.readout .big { display: block; font: 500 1.6rem/1.2 var(--display); margin-bottom: .35rem; }
.math { font-variant-numeric: tabular-nums; }

/* Sorter */
.sort-items { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.sort-items li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1.25rem; align-items: center; padding: .9rem 1rem; background: var(--paper); }
.sort-text { font: 400 1.02rem/1.45 var(--display); }
.sort-note { grid-column: 1 / -1; font: 400 .98rem/1.5 var(--display); color: var(--muted); }
.sort-note strong { color: var(--ink); font-weight: 600; }
.sort-items .seg button { padding: .5rem .8rem; font-size: .92rem; }
.sort-summary { margin: 1.25rem 0 0; font: 500 1.05rem/1.5 var(--display); max-width: 42rem; }
@media (max-width: 560px) { .sort-items li { grid-template-columns: minmax(0, 1fr); } }

/* Figures inside activities */
.act-svg { display: block; width: 100%; height: auto; background: var(--paper); }
.act-svg text { font: 400 13px var(--display); fill: var(--ink); }
.act-svg .hit { cursor: pointer; }
.act-svg .hit:focus { outline: none; }
.act-svg .hit:focus-visible > :first-child { stroke: var(--blue); stroke-width: 3; }
.act-canvas { display: block; width: 100%; background: var(--paper); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 1rem; padding: 0; list-style: none; }
.chips li { min-width: 2.2rem; padding: .3rem .55rem; text-align: center; background: var(--paper); font: 500 .98rem var(--display); font-variant-numeric: tabular-nums; }

.tally { display: flex; height: .9rem; margin: .5rem 0 .75rem; background: var(--paper); }
.tally span { display: block; height: 100%; transition: width .3s ease; }
.tally .t-rel { background: var(--red); }
.tally .t-per { background: var(--blue); }

.iam-rows { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.iam-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
.iam-row input { padding: .6rem .75rem; font: 400 1.05rem var(--display); color: var(--ink); background: var(--paper); border: 1.5px solid var(--rule); min-width: 0; }
.iam-row input:focus { border-color: var(--ink); outline: none; }
.iam-row .seg button { font-size: .9rem; padding: .5rem .75rem; }
.iam-row .seg button[data-kind="rel"][aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.iam-row .seg button[data-kind="per"][aria-pressed="true"] { background: var(--blue); color: #fff; }
@media (max-width: 560px) { .iam-row { grid-template-columns: minmax(0, 1fr); } }

.steps { list-style: none; padding: 0; margin: .75rem 0 1rem; display: grid; gap: .35rem; }
.steps li { display: grid; grid-template-columns: 2.5rem 3rem minmax(0, 1fr); gap: .75rem; align-items: baseline; padding: .45rem .75rem; background: var(--paper); font: 400 1rem/1.4 var(--display); }
.steps .zh { font-size: 1.3rem; color: var(--red); }
.steps .math { font-weight: 500; }
.steps li[hidden] { display: none; }

.status { min-height: 1.6em; font: 500 1rem/1.6 var(--display); }
.status.is-back { color: var(--blue); }

/* ---------------------------------------------------------------- lesson end */

.lesson-end {
  grid-column: -2 / -1;
  display: grid; gap: 1.5rem;
  margin-top: 1.5rem;
}
.complete {
  justify-self: start; padding: .85rem 1.35rem;
  font: 500 1.05rem/1 var(--display); color: var(--ink);
  background: none; border: 1.5px solid var(--ink); cursor: pointer;
}
.complete:hover { background: var(--ink); color: var(--paper); }
.complete.is-done { background: var(--ink); color: var(--paper); }
.onward {
  display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 1.5rem; align-items: center;
  padding: 1.5rem; background: var(--stone); text-decoration: none; color: var(--ink);
}
.onward:hover { color: var(--ink); background: var(--blue-tint); }
.onward-text { display: grid; gap: .3rem; }
.onward-label { font: 400 1rem var(--display); color: var(--muted); }
.onward-title { font: 500 clamp(1.4rem, 3vw, 1.9rem)/1.15 var(--display); letter-spacing: -.02em; }

/* ---------------------------------------------------------------- course page */

.course-hero { grid-template-columns: minmax(0, 42rem) minmax(0, 22rem); border-bottom: 1px solid var(--rule); }
.course-section { max-width: 72rem; margin: 0 auto; padding: 4rem var(--gutter) 0; }
.course-section h2 { font: 500 clamp(1.6rem, 3vw, 2rem)/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 1.5rem; }
.lesson-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.lesson-row {
  display: grid; grid-template-columns: 5.5rem 2.5rem minmax(0, 1fr) auto; gap: 1.5rem; align-items: center;
  padding: 1.5rem 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink);
}
.lesson-row:hover { color: var(--ink); }
.lesson-row:hover .row-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.row-n { font: 500 2rem/1 var(--display); color: var(--muted); }
.row-text { display: grid; gap: .3rem; }
.row-title { font: 500 1.5rem/1.2 var(--display); letter-spacing: -.015em; }
.row-promise { font: 400 1.08rem/1.45 var(--serif); color: var(--muted); max-width: 40rem; }
.row-meta { display: grid; justify-items: end; gap: .3rem; font: 400 .95rem var(--display); color: var(--muted); }
.row-done { display: none; color: var(--ink); font-weight: 500; }
.is-done .row-done { display: block; }
.is-done .row-n { color: var(--red); }
@media (max-width: 680px) {
  .lesson-row { grid-template-columns: 4rem minmax(0, 1fr); gap: 1rem; }
  .row-n { display: none; }
  .row-meta { grid-column: 2; justify-items: start; }
}
.course-about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem 4rem; }
.course-about p { margin: 0 0 1em; font-size: 1.1rem; }
.outcomes { list-style: none; padding: 0; margin: 0; }
.outcomes li { position: relative; padding-left: 1.6rem; margin-bottom: .9rem; font-size: 1.1rem; line-height: 1.5; }
.outcomes li::before { content: ""; position: absolute; left: 0; top: .55em; width: .55rem; height: .55rem; background: var(--red); }
@media (max-width: 760px) { .course-about { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- home (v3: learn for life) */

.home { overflow-x: clip; }

/* the night band: the same ground as the films (ink, gold, azurite, vermilion) in both themes */
.h-hero, .h-close {
  --h-bg: #15140f; --h-ink: #f3efe4; --h-muted: #bcb6a6; --h-gold: #f2c26b; --h-azure: #8ab2d8; --h-red: #e4665b;
  background:
    radial-gradient(60rem 38rem at 78% 40%, rgba(242,194,107,.13), transparent 62%),
    radial-gradient(40rem 30rem at 8% 100%, rgba(138,178,216,.08), transparent 60%),
    var(--h-bg);
  color: var(--h-ink);
}
.h-hero { padding: clamp(2.25rem, 6vw, 5.5rem) var(--gutter) clamp(2.5rem, 6vw, 5rem); }
.h-hero-in {
  max-width: 76rem; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.h-hero h1 {
  font: 500 clamp(2.3rem, 7.8vw, 5.6rem)/.98 var(--display); letter-spacing: -.04em; margin: 0 0 1.4rem; text-wrap: balance;
}
.h-hero h1 span { display: block; text-wrap: balance; }
.h-lede { font: 400 clamp(1.15rem, 2.4vw, 1.4rem)/1.5 var(--serif); color: var(--h-muted); margin: 0 0 2rem; max-width: 34rem; }
.h-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; }
.h-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 3.25rem; padding: .9rem 1.6rem;
  background: var(--h-gold); color: #1b1a18; font: 600 1.1rem/1 var(--display); text-decoration: none; border-radius: 2px;
  box-shadow: 0 0 0 0 rgba(242,194,107,.5); transition: transform .15s ease, box-shadow .2s ease;
}
.h-btn:hover { background: #ffd689; color: #1b1a18; transform: translateY(-2px); box-shadow: 0 .6rem 1.6rem -.4rem rgba(242,194,107,.45); }
.h-link { color: var(--h-ink); font: 500 1.1rem/1 var(--display); padding: .9rem 0; text-decoration-color: var(--h-gold); text-decoration-thickness: 2px; text-underline-offset: .3em; }
.h-link:hover { color: var(--h-gold); }
.h-q { margin: 1.5rem 0 0; font: 400 1rem/1.5 var(--display); color: var(--h-muted); }
.h-q a { color: var(--h-ink); }
.h-q a:hover { color: var(--h-gold); }
.h-fig { margin: 0; }
.spiral { display: block; width: 100%; height: auto; overflow: visible; }
.sq-n { fill: var(--h-gold); font-family: var(--display); font-weight: 500; opacity: .85; }
.arc { fill: none; stroke: var(--h-gold); stroke-width: .16; stroke-linecap: round; }
.next { stroke-dasharray: .5 .45; }
.h-legend { margin: 1rem 0 0; font: 400 .92rem/1.9 var(--display); color: var(--h-muted); }
.h-legend i { font-style: normal; font-weight: 600; color: var(--h-gold); margin-right: .15em; }
.h-legend span { white-space: nowrap; }
.next-n { fill: var(--h-gold); font: 500 2.6px var(--display); }
.next-t { fill: var(--h-muted); font: italic 400 1.2px var(--serif); }
.next-lab { opacity: 0; animation: sq-in .9s ease-out forwards 3.9s; }

@keyframes sq-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes arc-draw { to { stroke-dashoffset: 0; } }
@keyframes next-pulse { 50% { opacity: .55; } }
.sq { opacity: 0; transform-box: fill-box; transform-origin: center; animation: sq-in .6s ease-out forwards; animation-delay: calc(.2s + var(--i) * .42s); }
.arc { stroke-dasharray: 1; stroke-dashoffset: 1; animation: arc-draw .75s ease-in-out forwards; animation-delay: calc(.35s + var(--i) * .42s); }
.next { opacity: 0; animation: sq-in .9s ease-out forwards 3.6s, next-pulse 3.2s ease-in-out infinite 4.6s; }
@media (prefers-reduced-motion: reduce) {
  .sq, .arc, .next, .next-lab { animation: none; opacity: 1; transform: none; stroke-dashoffset: 0; }
}

@media (max-width: 860px) {
  .h-hero-in { grid-template-columns: minmax(0, 1fr); }
  .h-fig { max-width: 30rem; margin: 0 auto; }
  .h-cta { flex-direction: column; align-items: stretch; }
  .h-btn { width: 100%; }
  .h-link { text-align: center; }
}

/* at a glance */
.h-stats { border-bottom: 1px solid var(--rule); background: var(--stone); }
.h-stats ul { list-style: none; margin: 0 auto; padding: 1.1rem var(--gutter); max-width: 76rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem 1rem; font: 400 .95rem/1.3 var(--display); color: var(--muted); }
.h-stats b { display: block; font: 500 clamp(1.6rem, 4vw, 2.3rem)/1.05 var(--display); color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .h-stats ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* sections */
.h-sec { max-width: 76rem; margin: 0 auto; padding: clamp(3.5rem, 8vw, 6rem) var(--gutter) 0; }
.h-sec h2, .h-close h2 { font: 500 clamp(1.9rem, 5vw, 3.2rem)/1.04 var(--display); letter-spacing: -.03em; margin: 0 0 clamp(1.5rem, 3vw, 2.5rem); text-wrap: balance; }
.h-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem 4rem; align-items: end; margin-bottom: 1.75rem; }
.h-head h2 { margin: 0; }
.h-head p { margin: 0; font: 400 1.05rem/1.5 var(--display); color: var(--muted); }
@media (max-width: 760px) { .h-head { grid-template-columns: minmax(0, 1fr); gap: .75rem; } }

.h-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem); }
.h-three article { border-top: 3px solid var(--ink); padding-top: 1.25rem; }
.h-three article:nth-child(2) { border-top-color: var(--red); }
.h-three article:nth-child(3) { border-top-color: var(--blue); }
.glyph { display: block; width: 3rem; height: 3rem; margin-bottom: 1rem; }
.glyph svg { display: block; width: 100%; height: 100%; }
.h-three h3 { font: 500 clamp(1.35rem, 2.4vw, 1.7rem)/1.15 var(--display); letter-spacing: -.02em; margin: 0 0 .7rem; text-wrap: balance; }
.h-three p { margin: 0; font: 400 1.1rem/1.55 var(--serif); }
@media (max-width: 820px) { .h-three { grid-template-columns: minmax(0, 1fr); } }

.h-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.25rem; }
.h-steps li { display: grid; gap: .45rem; align-content: start; padding: 1.2rem 1.1rem; background: var(--stone); border-radius: 2px; }
.step-i { width: 2.6rem; height: 2.6rem; fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; margin-bottom: .35rem; }
.h-steps b { font: 500 1.3rem/1.1 var(--display); letter-spacing: -.01em; }
.h-steps span { font: 400 .98rem/1.45 var(--display); color: var(--muted); }
@media (max-width: 900px) { .h-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .h-steps { grid-template-columns: minmax(0, 1fr); gap: .75rem; } .h-steps li { grid-template-columns: 3rem minmax(0, 1fr); column-gap: 1rem; } .h-steps .step-i { grid-row: 1 / span 2; margin: 0; } }

/* the course cards: a grid on desktop, a compact vertical list on phones (a swipe row stopped working once there were dozens of courses) */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 1.25rem; }
.ccard {
  display: grid; align-content: start; gap: .3rem; height: 100%; padding: 0 0 1.2rem; background: var(--stone); color: var(--ink); text-decoration: none;
  border-bottom: 3px solid transparent; transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.ccard:hover { color: var(--ink); background: var(--blue-tint); border-bottom-color: var(--red); transform: translateY(-3px); }
.ccard-fig { display: block; padding: 1.25rem 1.25rem .5rem; }
.ccard-fig svg { display: block; width: 100%; max-width: 9rem; height: auto; margin: 0 auto; }
.ccard > :not(.ccard-fig) { padding: 0 1.25rem; }
.ccard-n { font: 500 .92rem/1.3 var(--display); color: var(--red); }
.ccard-title { font: 500 1.4rem/1.1 var(--display); letter-spacing: -.02em; text-wrap: balance; }
.ccard-meta { font: 400 .92rem/1.4 var(--display); color: var(--muted); margin-top: .4rem; }
@media (max-width: 700px) {
  .cards { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .ccard { grid-template-columns: 4.5rem minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 1rem; row-gap: .15rem; align-items: start; padding: .85rem 1rem .85rem .85rem; }
  .ccard:hover { transform: none; }
  .ccard-fig { grid-row: 1 / span 3; padding: 0; }
  .ccard-fig svg { width: 4.5rem; max-width: none; }
  .ccard > :not(.ccard-fig) { padding: 0; }
  .ccard-title { font-size: 1.18rem; }
  .ccard-meta { margin-top: .15rem; font-size: .88rem; }
}

/* all thirty-six, by subject */
.map { margin-top: 2.25rem; border-top: 1px solid var(--rule); }
.map summary { cursor: pointer; padding: 1.1rem 0; font: 500 1.1rem/1.3 var(--display); list-style: none; display: flex; align-items: center; gap: .6rem; min-height: 3rem; }
.map summary::-webkit-details-marker { display: none; }
.map summary::before { content: ""; width: .6rem; height: .6rem; border-right: 2px solid var(--red); border-bottom: 2px solid var(--red); transform: rotate(-45deg); transition: transform .15s ease; }
.map[open] summary::before { transform: rotate(45deg); }
.lanes { display: grid; gap: 1.5rem; padding-bottom: .5rem; }
.lane { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .5rem 1.5rem; align-items: start; }
.lane h3 { margin: .35rem 0 0; font: 500 1rem/1.3 var(--display); color: var(--muted); }
.lane ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.pill { display: inline-block; padding: .4rem .75rem; border: 1px solid var(--rule); border-radius: 2rem; font: 400 .92rem/1.25 var(--display); color: var(--muted); text-decoration: none; }
.pill b { font-weight: 600; margin-right: .2em; font-variant-numeric: tabular-nums; }
.pill.is-open { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pill.is-open:hover { background: var(--red); border-color: var(--red); color: #fff; }
/* in dark mode a filled light pill glares: released courses become a dark card with light type, still distinct from the outlined planned ones */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.is-open { background: var(--stone); border-color: #55534d; color: var(--ink); } }
:root[data-theme="dark"] .pill.is-open { background: var(--stone); border-color: #55534d; color: var(--ink); }
@media (max-width: 640px) { .lane { grid-template-columns: minmax(0, 1fr); } a.pill { display: inline-flex; align-items: center; min-height: 2.75rem; } }

.h-mandel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.75rem, 5vw, 4.5rem); align-items: center; }
.h-mandel h2 { margin-bottom: 1.25rem; }
.m-text p { margin: 0 0 1.1rem; font: 400 clamp(1.1rem, 2vw, 1.3rem)/1.55 var(--serif); max-width: 34rem; }
.m-fig { margin: 0; }
.m-panel { position: relative; background: #15140f; border-radius: 3px; overflow: hidden; box-shadow: 0 1.2rem 3rem -1.5rem rgba(0,0,0,.55); }
.m-zoom { display: block; width: 100%; height: auto; aspect-ratio: 5 / 4; image-rendering: auto; }
.m-toggle { position: absolute; right: .7rem; bottom: .7rem; min-height: 2.75rem; padding: 0 1rem; border: 1px solid rgba(243,239,228,.45); background: rgba(21,20,15,.78); color: #f3efe4; font: 500 .95rem/1 var(--display); cursor: pointer; border-radius: 2px; }
.m-toggle:hover { background: #f2c26b; color: #1b1a18; border-color: #f2c26b; }
.m-fig figcaption { margin-top: .9rem; font: 400 .98rem/1.5 var(--display); color: var(--muted); }
.m-read { color: var(--red); font-weight: 600; margin-right: .35em; font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .h-mandel { grid-template-columns: minmax(0, 1fr); } }
/* why */
.h-why { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 1rem 4rem; align-items: start; }
.h-why h2 { margin: 0; }
.h-why p { margin: 0 0 1.1rem; font: 400 clamp(1.15rem, 2vw, 1.4rem)/1.5 var(--serif); max-width: 36rem; }
@media (max-width: 760px) { .h-why { grid-template-columns: minmax(0, 1fr); } }

.h-close { margin-top: clamp(4rem, 9vw, 7rem); padding: clamp(3rem, 8vw, 6rem) var(--gutter); text-align: center; }
.h-close h2 { margin-bottom: 1.75rem; }
.h-close .h-cta { justify-content: center; }
@media (max-width: 860px) { .h-close .h-cta { align-items: stretch; } }
.home ~ .colophon { margin-top: 0; }

/* Four-way choices: a grid of buttons that folds to two columns on phones */
.seg.seg-grid { display: inline-grid; grid-template-columns: repeat(4, auto); gap: 1.5px; background: var(--ink); }
.seg.seg-grid button, .seg.seg-grid button + button { border: 0; background: var(--paper); }
.seg.seg-grid button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
@media (max-width: 560px) { .seg.seg-grid { display: grid; grid-template-columns: 1fr 1fr; } }
/* Aristotle's four kinds of change: four answers per item, so each item gets its own row */
[data-activity="changes"] .sort-items li { grid-template-columns: minmax(0, 1fr); }
[data-activity="changes"] .sort-items li .seg { justify-self: start; }
.watch-next.manual .watch-next-bar { display: none; }   /* the next-course offer has no countdown */
@media (max-width: 560px) {     /* on a phone the card is as tall as the video: tighter type, smaller buttons */
  .watch-next { gap: .3rem; padding: .6rem .9rem; }
  .watch-next-label { font-size: .8rem; }
  .watch-next-title { font-size: 1.1rem; }
  .watch-next-count { font-size: .82rem; line-height: 1.25; }
  .watch-next-actions { margin-top: .15rem; gap: .5rem; }
  .watch-next-go, .watch-next-signin, .watch-next-cancel { min-height: 2.5rem; padding: .35rem .9rem; font-size: .92rem; }
}
