/* The class design: a chart recorder. Grid paper, one red pen, everything else quiet. Used by content pages. */
:root {
  color-scheme: light;
  --paper: #eef2ec;
  --grid-minor: #d5e1d7;
  --grid-major: #b8ccbe;
  --ink: #15201b;
  --ink-2: #4c5c54;
  --rule: #c9d6cc;
  --trace: #c4302b;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 5vw, 72px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e1512;
    --grid-minor: #17221d;
    --grid-major: #22322a;
    --ink: #e4ece7;
    --ink-2: #9db0a6;
    --rule: #22322a;
    --trace: #ff6b5e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e1512;
  --grid-minor: #17221d;
  --grid-major: #22322a;
  --ink: #e4ece7;
  --ink-2: #9db0a6;
  --rule: #22322a;
  --trace: #ff6b5e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
}

a:focus-visible {
  outline: 3px solid var(--trace);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- The recorder ------------------------------------------------------ */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
}
.recorder {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.hero-text {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  /* The bottom padding is the paper the pen writes on. */
  padding: clamp(40px, 9vh, 104px) var(--gutter) clamp(200px, 32vh, 340px);
}
h1 {
  margin: 0 0 0.3em;
  font-size: clamp(3rem, 10vw, 8.75rem);
  font-stretch: 125%;
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.035em;
}
.purpose {
  max-width: 32em;
  margin: 0 0 14px;
  font-size: clamp(1.15rem, 2.1vw, 1.45rem);
  line-height: 1.42;
}
.when { margin: 0 0 24px; color: var(--ink-2); }
.go {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font-stretch: 112%;
  font-weight: 700;
  text-decoration: none;
  transition: background 150ms;
}
.go:hover { background: var(--trace); }

/* --- The quiet part ---------------------------------------------------- */
main {
  max-width: 1180px;
  padding: 0 var(--gutter);
}
section { margin-top: clamp(64px, 10vw, 104px); }
h2 {
  margin: 0 0 28px;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-stretch: 112%;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h3 { margin: 0 0 6px; font-size: 1.12rem; font-weight: 700; }
.aside { max-width: 40em; margin: 28px 0 0; color: var(--ink-2); }

.aim-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 56px;
  max-width: 980px;
}
.aim-grid p { max-width: 34em; margin: 0; color: var(--ink-2); }

/* The quarter as the recorder's time axis */
.axis {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  margin: 0;
  padding: 0 0 64px;
  border-top: 2px solid var(--ink);
  list-style: none;
}
.tick { position: relative; padding-top: 14px; color: var(--ink-2); font-size: 0.88rem; }
.tick::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 2px;
  height: 10px;
  background: var(--ink);
}
.tick time { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tick span {
  position: absolute;
  top: 40px;
  width: 13em;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
}
.tick.now::after { /* the pen, where the quarter is now */
  content: "";
  position: absolute;
  top: -7px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--trace);
}
.tick a { color: inherit; text-decoration: none; }
.tick a:hover time { color: var(--ink); text-decoration: underline; text-decoration-color: var(--trace); text-underline-offset: 4px; }
.tick.now a:hover span { text-decoration: underline; text-decoration-color: var(--trace); text-underline-offset: 4px; }
.tick.now time { color: var(--ink); font-weight: 700; }
.tick.goal { text-align: right; }
.tick.goal::before { right: 0; left: auto; height: 18px; }
.tick.goal span { right: 0; width: 16em; }

/* Lists of things to open */
.rows { margin: 0; padding: 0; border-top: 1px solid var(--rule); list-style: none; }
.rows li {
  display: flex;
  align-items: baseline;
  gap: 20px;
  border-bottom: 1px solid var(--rule);
}
.rows a { flex: 1; display: block; padding: 18px 0; color: inherit; text-decoration: none; }
.rows strong { display: block; font-size: 1.18rem; font-stretch: 108%; font-weight: 700; }
.rows span { display: block; max-width: 44em; margin-top: 2px; color: var(--ink-2); }
.rows a:hover strong {
  text-decoration: underline;
  text-decoration-color: var(--trace);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.live {
  flex: none;
  color: var(--ink-2);
  font-size: 0.92rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.practical dl { display: grid; gap: 14px; margin: 0; max-width: 820px; }
.practical dl > div { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 16px; }
dt { font-weight: 700; }
dd { margin: 0; color: var(--ink-2); }

footer {
  margin-top: clamp(72px, 12vw, 128px);
  padding: 28px var(--gutter) 40px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  .aim-grid { grid-template-columns: 1fr; gap: 24px; }
  .axis {
    grid-template-columns: 1fr;
    padding: 0 0 0 18px;
    border-top: 0;
    border-left: 2px solid var(--ink);
  }
  .tick { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; }
  .tick::before { top: 50%; left: -18px; width: 10px; height: 2px; }
  .tick.now::after { top: calc(50% - 5px); left: -24px; }
  .tick span { position: static; width: auto; }
  .tick.goal { text-align: left; }
  .tick.goal::before { left: -18px; right: auto; width: 16px; height: 2px; }
  .rows li { flex-wrap: wrap; gap: 0; }
  .rows a { padding-bottom: 6px; }
  .live { padding-bottom: 14px; }
  .practical dl > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .go { transition: none; }
}

/* --- Week pages -------------------------------------------------------- */
.crumb { margin: 0 0 14px; font-size: 1rem; font-weight: 600; }
.crumb a { color: var(--ink-2); text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.subtitle {
  margin: 0 0 22px;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  font-stretch: 112%;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.status { margin: 0 0 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.in-session .status::before { /* the pen is live */
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--trace);
  vertical-align: 1px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
.where { max-width: 36em; margin: 0; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 26px; }
.go-quiet {
  display: inline-block;
  padding: 10px 20px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
  font-stretch: 112%;
  font-weight: 700;
  text-decoration: none;
}
.go-quiet:hover { border-color: var(--trace); color: var(--trace); }
.live-line { min-height: 1.5em; margin: 16px 0 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.steps { display: grid; gap: 28px; max-width: 780px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); column-gap: 18px; counter-increment: step; }
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  color: var(--ink-2);
  font-size: 2.5rem;
  font-stretch: 125%;
  font-weight: 800;
  line-height: 1;
}
.steps h3 { margin: 4px 0 4px; }
.steps p { margin: 0; color: var(--ink-2); }

.homework p { max-width: 40em; }
.due { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 18px 0 22px; }
.due span { color: var(--ink-2); font-variant-numeric: tabular-nums; }

footer a { color: inherit; }

/* Homework page: a shorter strip of paper, and the prompt to copy */
.hero-slim .hero-text { padding-bottom: clamp(120px, 20vh, 200px); }
.lead { max-width: 38em; margin: 0 0 16px; font-size: 1.12rem; }
.prompt {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  max-width: 44em;
  margin: 12px 0 8px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
}
.prompt code { flex: 1 1 18em; font-family: var(--font); font-size: 1.02rem; font-weight: 600; overflow-wrap: anywhere; }
.prompt button {
  padding: 8px 16px;
  border: 0;
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.prompt button:hover { background: var(--trace); }
.prompt button:focus-visible { outline: 3px solid var(--trace); outline-offset: 3px; }
.plain { max-width: 42em; margin: 0; padding-left: 22px; }
.plain li + li { margin-top: 10px; }
.plain li { color: var(--ink-2); }
.plain strong, .plain a { color: var(--ink); }
.levels { counter-reset: level; }

@media (prefers-reduced-motion: reduce) {
  .in-session .status::before { animation: none; }
}
.h1-long { font-size: clamp(2.4rem, 7.2vw, 6rem); line-height: 0.92; }

/* --- Site navigation (lib/nav.js) -------------------------------------- */
.site-nav { position: relative; z-index: 2; max-width: 1180px; padding: 20px var(--gutter) 0; }
.nav-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; }
.nav-brand { color: var(--ink); font-size: 1.05rem; font-stretch: 125%; font-weight: 800; text-decoration: none; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; padding: 0; list-style: none; }
.site-nav ul a { color: var(--ink-2); font-weight: 600; text-decoration: none; }
.site-nav a:hover, .site-nav ul a[aria-current="page"], .site-nav a.is-here {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--trace);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.site-nav a:focus-visible { outline: 3px solid var(--trace); outline-offset: 3px; }
.hero .hero-text { padding-top: clamp(28px, 7vh, 88px); }

/* --- Recordings -------------------------------------------------------- */
.recording { max-width: 960px; }
.recording h2 { margin-bottom: 6px; }
.recording .when { margin: 0 0 18px; }
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  overflow: hidden;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.recording-links { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 16px 0 0; padding: 0; list-style: none; }
.recording-links a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--trace);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.recording-links a:hover { color: var(--trace); }
