@charset "utf-8";
/* The photo editing course: a two-colour system. Cream ground, maroon accent, near-black ink. */

:root {
  /* Colours and type borrowed from algebrica.org: warm paper, soft ink, grey labels, no accent colour */
  --ground: #f4efee;
  --ground-2: #e9e3e2;
  --ink: #312f2f;
  --accent: #312f2f;          /* interface emphasis is ink, as on Algebrica */
  --hl: #c4492b;              /* diagrams only: the thing to notice (clipping, the edited curve) */
  --good: #3b8048;            /* diagrams only: a result that is right */
  --muted: #636161;           /* Algebrica's #706e6e, a shade darker so small text passes AA, also on --ground-2 */
  --faint: #9b9998;
  --line: #ded5d4;
  --line-soft: #e9e3e2;
  --line-strong: #c4bab8;
  --accent-wash: rgba(49, 47, 47, 0.05);
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --display: "Geist", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --radius: 6px;
  --gutter: clamp(16px, 3vw, 40px);
  --ease: cubic-bezier(0.2, 0, 0.3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--ground); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img, canvas, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

.mono, .label {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------- Page frame: sidebar + narrow column ---------- */
:root {
  --side: 248px; --text: 640px; --wide: 880px; --max: 1240px; --note: 250px;
  /* side padding that keeps content inside --max while borders run the full width */
  --pad: max(var(--gutter), calc((100% - var(--max)) / 2));
}
.page { min-width: 0; }
@media (min-width: 1100px) { .page { margin-left: var(--side); } }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 40;
  padding: 26px 22px 40px 26px; overflow-y: auto; border-right: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; line-height: 1.45;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar a { text-decoration: none; }
.sidebar__brand { display: block; letter-spacing: 0; font-weight: 500; }
.sidebar__sub { display: block; color: var(--muted); margin: 4px 0 26px; letter-spacing: 0; }
.sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar__ch > a { display: grid; grid-template-columns: 26px 1fr; padding: 4px 0; color: var(--muted); transition: color 0.2s; }
.sidebar__ch > a:hover { color: var(--ink); }
.sidebar__ch > a .n { letter-spacing: 0; }
.sidebar__ch.is-current > a { color: var(--ink); font-weight: 500; }
.sidebar__ch.is-current > a .n { color: var(--accent); }
.sidebar__secs { margin: 4px 0 10px 26px !important; border-left: 1px solid var(--line); }
.sidebar__secs a {
  display: block; padding: 3px 0 3px 12px; margin-left: -1px; border-left: 1px solid transparent;
  color: var(--muted); letter-spacing: 0; transition: color 0.2s, border-color 0.2s;
}
.sidebar__secs a:hover { color: var(--ink); }
.sidebar__secs a.is-active { color: var(--accent); border-left-color: var(--accent); }
@media (max-width: 1099px) { .sidebar { display: none; } }

/* ---------- Top bar (small screens only) ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px var(--gutter); background: var(--ground); border-bottom: 1px solid var(--line);
}
.topbar a, .topbar button { text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.topbar__brand { font-family: var(--mono); font-size: 11px; letter-spacing: 0; font-weight: 500; }
.topbar__brand b { font-weight: 500; color: var(--accent); }
@media (min-width: 1100px) { .topbar { display: none; } }
/* Progress through the lesson: one piece per section, filling as you read */
.progress { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; gap: 3px; height: 4px; background: var(--ground); }
.progress a { flex: 1; position: relative; height: 16px; }
.progress a::before, .progress a i { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.progress a::before { background: var(--line); }
.progress a i { background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }
.progress a:hover::before { background: var(--line-strong); }
@media (min-width: 1100px) { .progress { left: var(--side); } }

/* ---------- Contents overlay (small screens) ---------- */
.toc {
  position: fixed; inset: 0; z-index: 70; background: var(--ground);
  overflow-y: auto; padding: 64px var(--gutter) 48px;
  opacity: 0; visibility: hidden; transition: opacity 0.3s var(--ease), visibility 0.3s;
}
.toc.is-open { opacity: 1; visibility: visible; }
.toc__close { position: fixed; top: 12px; right: var(--gutter); background: none; border: 0; cursor: pointer; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { border-top: 1px solid var(--line); }
.toc li:last-child { border-bottom: 1px solid var(--line); }
.toc a { display: grid; grid-template-columns: 36px 1fr; align-items: baseline; gap: 10px; padding: 9px 0; text-decoration: none; }
.toc a .t { font-size: 20px; font-weight: 600; line-height: 1.2; }
.toc a .d { display: none; }
.toc a[aria-current] .t { color: var(--accent); }

/* ---------- Opener: a quiet chapter header ---------- */
.opener { padding: clamp(84px, 12vh, 128px) var(--pad) 44px; }
.opener__kicker { color: var(--accent); display: block; }
.opener h1 {
  margin: 14px 0 12px; font-size: clamp(34px, 4.4vw, 52px); font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.06; max-width: 16ch;
  animation: rise 0.9s var(--ease) both;
}
.opener__caption { margin: 0; max-width: 40ch; font-size: 19px; line-height: 1.45; color: var(--muted); animation: rise 0.9s 0.12s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Sections: text stays in a narrow column, photo illustrations use the full width ---------- */
.section { display: flow-root; border-top: 1px solid var(--line); padding: clamp(52px, 6.5vw, 84px) var(--pad); }
.section > * { max-width: var(--text); }
.section > .wide, .section > .verdict { max-width: var(--wide); clear: both; }
.section > .wide:has(canvas), .section > .wide.depth, .section > .wide.editor, .section > .wide.mixer { max-width: none; }
.section > .section__head { max-width: none; margin-bottom: 24px; scroll-margin-top: 28px; }
.section__num { color: var(--accent); display: block; margin-bottom: 10px; }
.section h2 { margin: 0; font-size: clamp(25px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.005em; line-height: 1.15; max-width: 30ch; }
.section h3 {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0; text-transform: uppercase; font-weight: 500;
  margin: 44px 0 12px; color: var(--accent);
}
.section p { margin: 0 0 1em; }
.section p.lead { font-size: 20px; line-height: 1.42; font-weight: 500; margin-bottom: 0.9em; }
.section > :last-child { margin-bottom: 0; }
.section ul, .section ol { padding-left: 1.1em; margin: 0 0 1.1em; }
.section li { margin-bottom: 0.45em; }
.section li::marker { color: var(--accent); }
strong { font-weight: 700; }
em { font-style: italic; }
kbd {
  font-family: var(--mono); font-size: 0.78em; border: 1px solid var(--line-strong);
  border-radius: 3px; padding: 0 5px; white-space: nowrap;
}
.num { font-family: var(--mono); font-size: 0.86em; }

/* Side notes: an (i) and a few lines, out in the right margin of the page */
.note {
  position: relative; padding-left: 30px; margin: 4px 0 24px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; color: var(--muted);
}
.note::before {
  content: "i"; position: absolute; left: 0; top: 0; width: 19px; height: 19px; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent); font: 500 12px/18px var(--mono); text-align: center;
}
.note b { color: var(--ink); font-weight: 500; }
@media (min-width: 1280px) {
  /* placed by site.js (layoutNotes): in the right margin, level with the text they belong to */
  .section { position: relative; }
  .section > .note { position: absolute; right: var(--pad); width: var(--note); max-width: none; margin: 0; }
}

figure { margin: 40px 0 48px; }
figcaption { margin-top: 12px; color: var(--muted); font-family: var(--mono); font-size: 12px; line-height: 1.5; max-width: 70ch; }
figcaption b { color: var(--ink); font-weight: 500; }

/* ---------- Verdict: the one filled moment per chapter ---------- */
.verdict {
  background: var(--accent); color: var(--ground);
  margin: 28px 0 40px; padding: clamp(28px, 4vw, 44px);
  position: relative; overflow: hidden;
}
.verdict .label { display: block; opacity: 0.85; margin-bottom: 14px; }
.verdict__big { margin: 0 !important; max-width: 26ch; font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -0.005em; line-height: 1.15; position: relative; }
.verdict__big .ghost { opacity: 0.72; }
.verdict__circle { position: absolute; right: -70px; top: -70px; width: 240px; height: 240px; border: 1px solid rgba(244, 239, 238, 0.35); border-radius: 50%; }

/* ---------- Pro list ---------- */
.practice { list-style: none; padding: 0 !important; counter-reset: p; }
.practice li { border-top: 1px solid var(--line); padding: 16px 0 6px 44px; position: relative; counter-increment: p; }
.practice li::before {
  content: counter(p, decimal-leading-zero); position: absolute; left: 0; top: 19px;
  font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0;
}

/* ---------- Sliders ---------- */
.ctl { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 2px; padding: 9px 0; }
.ctl label { font-family: var(--mono); font-size: 11px; letter-spacing: 0; text-transform: uppercase; font-weight: 500; cursor: pointer; user-select: none; }
.ctl output { font-family: var(--mono); font-size: 12px; text-align: right; min-width: 5ch; font-variant-numeric: tabular-nums; }
.ctl output.is-set { color: var(--accent); }
.ctl input { grid-column: 1 / -1; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0;
  background: transparent; cursor: pointer; --c: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 1px; background:
    linear-gradient(var(--accent), var(--accent)) var(--c) 50% / 1px 9px no-repeat,
    var(--line-strong);
}
input[type="range"]::-moz-range-track { height: 1px; background: var(--line-strong); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--ground); border: 1px solid var(--ink); margin-top: -7px;
  transition: transform 0.2s var(--ease), background 0.2s;
}
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--ground); border: 1px solid var(--ink); }
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:focus-visible::-webkit-slider-thumb { transform: scale(1.25); background: var(--accent); border-color: var(--accent); }
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible { outline: 1px dashed var(--accent); outline-offset: 4px; }

/* Buttons */
.btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0; text-transform: uppercase; font-weight: 500;
  background: transparent; border: 1px solid var(--ink); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--ground); }
.btn--solid { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.btn--solid:hover { background: var(--ink); border-color: var(--ink); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Editor ---------- */
.editor { margin: 36px 0 56px; }
.editor__main { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
@media (max-width: 860px) { .editor__main { grid-template-columns: 1fr; } }
.editor__stage { position: relative; user-select: none; touch-action: pan-y; width: fit-content; max-width: 100%; margin: 0 auto; }
.editor__stage canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 72vh; }
.editor__stage canvas.after { position: absolute; inset: 0; }
.editor__stage.is-zoom canvas { image-rendering: pixelated; }
.split { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ground); cursor: ew-resize; touch-action: none; }
.split::before { content: ""; position: absolute; inset: 0 -14px; }
.split__knob {
  position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid var(--ground); display: grid; place-items: center;
  background: rgba(49, 47, 47, 0.25); backdrop-filter: blur(4px);
}
.split__knob svg { width: 14px; color: var(--ground); }
.stage-tag {
  position: absolute; top: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0;
  text-transform: uppercase; color: var(--ground); background: rgba(49, 47, 47, 0.55); padding: 3px 7px; pointer-events: none;
}
.stage-tag--l { left: 10px; } .stage-tag--r { right: 10px; }
.editor__panel { border-top: 1px solid var(--ink); padding-top: 6px; }
.editor__panel .group { font-family: var(--mono); font-size: 10px; letter-spacing: 0; text-transform: uppercase; color: var(--accent); margin: 16px 0 0; }
.editor__panel .btn-row { margin-top: 16px; }
.hist { margin: 8px 0 6px; position: relative; }
.hist canvas { width: 100%; height: 78px; }
.hist__clip { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; letter-spacing: 0; color: var(--muted); margin-top: 4px; text-transform: uppercase; }
.hist__clip .on { color: var(--hl); }
.editor__strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; margin-top: 20px; border-top: 1px solid var(--line); }
.thumb {
  display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 10px 10px 0; cursor: pointer;
}
.thumb img, .thumb .thumb__img { width: 54px; height: 40px; object-fit: cover; filter: grayscale(0.4); transition: filter 0.2s; }
.thumb .mono { font-size: 10px; line-height: 1.35; }
.thumb .mono span { display: block; color: var(--muted); text-transform: none; letter-spacing: 0; }
.thumb[aria-pressed="true"] img, .thumb:hover img, .thumb[aria-pressed="true"] .thumb__img, .thumb:hover .thumb__img { filter: none; }
.thumb[aria-pressed="true"] .mono { color: var(--accent); }
.editor__note {
  margin-top: 20px; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px;
  font-size: 16px; line-height: 1.5; min-height: 3em;
}
.editor__note .label { color: var(--accent); padding-top: 3px; }
.editor__note p { margin: 0 0 0.6em; max-width: 64ch; }
@media (max-width: 860px) { .editor__note { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- Diagrams ---------- */
.diagram { margin: 36px 0 48px; }
.diagram svg { width: 100%; height: auto; overflow: visible; }
.diagram__row { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 36px; align-items: center; }
@media (max-width: 860px) { .diagram__row { grid-template-columns: minmax(0, 1fr); } }
.diagram__controls { border-top: 1px solid var(--ink); padding-top: 4px; }
.diagram__controls .btn-row { margin-top: 12px; }
svg text { font-family: var(--mono); font-size: 11px; letter-spacing: 0; fill: var(--ink); }
svg .t-muted { fill: var(--muted); }
svg .t-accent { fill: var(--hl); }
svg .t-good { fill: var(--good); }
.hair { fill: none; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hair-a { fill: none; stroke: var(--hl); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hair-l { fill: none; stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dash { stroke-dasharray: 3 4; }
.diagram canvas { width: 100%; height: auto; }

/* Curve editor */
.curve-box { position: relative; aspect-ratio: 1; touch-action: none; }
.curve-box svg { width: 100%; height: 100%; }
.curve-box circle.pt { cursor: grab; }

/* ---------- UI map (intro) ---------- */
.uimap a { text-decoration: none; }
.uimap .zone rect { fill: transparent; stroke: var(--line-strong); transition: fill 0.25s, stroke 0.25s; }
.uimap .zone:hover rect, .uimap .zone:focus rect { fill: var(--accent-wash); stroke: var(--ink); }
.uimap .zone:hover text, .uimap .zone:focus text { fill: var(--accent); }

/* ---------- Previous and next chapter ---------- */
.pager { border-top: 1px solid var(--line); padding: 0 var(--pad); display: grid; grid-template-columns: 1fr 1fr; }
.pager a { text-decoration: none; padding: 30px 0 40px; display: block; min-width: 0; }
.pager a + a { border-left: 1px solid var(--line); text-align: right; padding-left: 24px; }
.pager a:first-child { padding-right: 24px; }
.pager .label { color: var(--muted); }
.pager__next .label::after { content: " \2192"; }
.pager__prev .label::before { content: "\2190  "; }
.pager .big { display: block; font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.005em; line-height: 1.15; margin-top: 8px; transition: color 0.25s; }
.pager .big .n { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--accent); margin-right: 12px; vertical-align: 0.5em; }
.pager a:hover .big, .pager a:hover .label { color: var(--accent); }
.pager .empty { display: none; }
.pager a:only-child, .pager .empty + a { grid-column: 1 / -1; border-left: 0; padding-left: 0; }
.pager a:has(+ .empty) { grid-column: 1 / -1; padding-right: 0; }
/* phones keep previous and next side by side, a bit smaller */
@media (max-width: 720px) { .pager a { padding: 24px 0 30px; } .pager a:first-child { padding-right: 14px; } .pager a + a { padding-left: 14px; } .pager .label { font-size: 10px; } .pager .big .n { display: block; margin: 0 0 4px; vertical-align: 0; } }
.colophon { border-top: 1px solid var(--line); padding: 26px var(--pad) 40px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; color: var(--muted); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .opener h1, .opener__caption { animation: none; }
  html { scroll-behavior: auto; }
}

/* Credits table */
.credits { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.credits td { border-top: 1px solid var(--line); padding: 8px 8px 8px 0; vertical-align: top; }

/* Zoomed crops fill the column so individual pixels are visible */
.editor__stage.is-zoom { width: 100%; }
.editor__stage.is-zoom canvas { width: 100%; max-height: none; }

/* ---------- Diagram parts added in the second pass ---------- */
.group-label, .editor__panel .group {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0; text-transform: uppercase;
  color: var(--accent); margin: 18px 0 0; padding-top: 10px; border-top: 1px solid var(--line);
}
.diagram__controls > .group-label:first-child { border-top: 0; padding-top: 0; }
.live-photo { width: 100%; height: auto; display: block; }
.live-photo.is-zoom { image-rendering: pixelated; }
.curve-box.is-readonly { pointer-events: none; }

.map > svg { margin-bottom: 18px; }
.map-row { display: grid; grid-template-columns: 210px minmax(0, 1fr) 210px; gap: 24px; align-items: start; }
.map-photo canvas { cursor: crosshair; touch-action: none; }
.map-readout { margin-top: 8px; font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--muted); min-height: 3em; }
@media (max-width: 860px) {
  .map-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .map-photo { grid-column: 1 / -1; grid-row: 1; }
}
@media (max-width: 520px) { .map-row { grid-template-columns: 1fr; } }

.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); border-top: 1px solid var(--ink); }
.step { text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 10px 10px 0; cursor: pointer; }
.step .label { display: block; color: var(--muted); }
.step b { display: block; font-size: 15px; font-weight: 600; margin-top: 2px; }
.step[aria-pressed="true"] .label, .step[aria-pressed="true"] b { color: var(--accent); }
.step[aria-pressed="true"] { border-bottom-color: var(--accent); }

.unsharp__row { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; align-items: center; margin-top: 22px; }
.unsharp__cropwrap { position: relative; }
.unsharp__crop { width: 100%; height: auto; image-rendering: pixelated; border: 1px solid var(--line-strong); }
.unsharp__foot { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; margin-top: 18px; align-items: start; }
.unsharp__text { font-size: 16px; line-height: 1.5; min-height: 4.5em; margin: 0 0 12px !important; }
@media (max-width: 760px) { .unsharp__row, .unsharp__foot { grid-template-columns: 1fr; } }
.btn:disabled { opacity: 0.35; pointer-events: none; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 28px 22px; }
.gallery__tile { margin: 0; outline: none; }
.gallery__photo { position: relative; }
.gallery__photo canvas { width: 100%; height: auto; display: block; }
.gallery__photo canvas + canvas { position: absolute; inset: 0; transition: opacity 0.35s var(--ease); }
.gallery__photo .stage-tag { opacity: 0; transition: opacity 0.2s; }
/* only hovering the photo itself (not its caption) shows the before */
.gallery__photo:hover canvas + canvas, .gallery__tile:focus .gallery__photo canvas + canvas { opacity: 0; }
.gallery__photo:hover .stage-tag, .gallery__tile:focus .stage-tag { opacity: 1; }
.gallery__body { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; margin-top: 10px; align-items: start; }
.gallery__body .curve-box text { display: none; }
.gallery__body figcaption { margin: 0; font-size: 11.5px; }
.gallery__body figcaption b { display: block; font-family: var(--display); font-size: 15px; font-weight: 600; margin: 2px 0 3px; }
.diagram__controls .btn-row { gap: 6px; }
.diagram__controls .btn { padding: 6px 11px; font-size: 10px; letter-spacing: 0; }
.unsharp .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 520px) { .unsharp .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.unsharp__row { grid-template-columns: minmax(0, 1fr) 280px; }
.unsharp__foot { grid-template-columns: minmax(0, 1fr) 280px; }
@media (max-width: 760px) { .unsharp__row, .unsharp__foot { grid-template-columns: 1fr; } }

/* gallery: four across, mini curve set into the photo's corner */
.gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px 18px; }
@media (max-width: 900px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gallery__photo .curve-box { position: absolute; left: 6px; bottom: 6px; width: 62px; background: rgba(244, 239, 238, 0.92); padding: 4px; z-index: 2; }
.gallery__photo .curve-box text { display: none; }
.gallery__tile figcaption { margin-top: 10px; font-size: 11.5px; }
.gallery__tile figcaption b { display: block; font-family: var(--display); font-size: 15px; font-weight: 600; margin: 2px 0 3px; color: var(--ink); }
.diagram__row--stack { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.diagram__row--stack .diagram__controls { max-width: 440px; }

/* ---------- 3D illustrations ---------- */
.stage3d { position: relative; width: 100%; max-height: min(76vh, 680px); touch-action: pan-y; cursor: grab; }
.stage3d.is-turning { cursor: grabbing; }
.stage3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.stage3d__labels { position: absolute; inset: 0; pointer-events: none; }
.stage3d__label {
  position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 9.5px; letter-spacing: 0;
  color: var(--ink); background: rgba(244, 239, 238, 0.82); padding: 1px 5px; will-change: transform;
}
.stage3d__label.is-accent { color: var(--hl); }
.stage3d__hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px;
  background: var(--ink); color: var(--ground); font-size: 11.5px; transition: opacity 0.4s;
}
.stage3d__hint svg { width: 16px; height: 16px; flex: none; }
.stage3d__hint.is-used { opacity: 0; }
.stage3d__fail { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); margin: 0; padding: 20px; border: 1px solid var(--line); }
.depth__row { align-items: start; }
.depth__readout { margin: 12px 0 0 !important; text-transform: none; letter-spacing: 0; font-size: 11.5px; color: var(--muted); min-height: 3.2em; }
.depth__readout b { color: var(--accent); font-weight: 500; }
.depth__tip { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--muted); margin: 10px 0 14px !important; }

/* ---------- Teaching furniture: facts under the title, glossary, guided steps, recap ---------- */
.glance { display: flex; flex-wrap: wrap; gap: 10px 40px; margin: 26px 0 0; animation: rise 0.9s 0.2s var(--ease) both; }
.glance div { min-width: 0; }
.glance dt { color: var(--accent); margin-bottom: 3px; }
.glance dd { margin: 0; font-size: 15px; line-height: 1.35; max-width: 26ch; }

.term { border-bottom: 1px dotted var(--accent); cursor: help; }
.term:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }
.tip {
  position: absolute; z-index: 90; max-width: 300px; padding: 10px 12px; background: var(--ink); color: var(--ground);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5; pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity 0.18s, transform 0.18s; left: -999px; top: 0;
}
.tip.is-on { opacity: 1; transform: none; }

.section ol.try { list-style: none; padding: 12px 0 0; margin: 4px 0 30px; counter-reset: t; border-top: 1px solid var(--line-strong); position: relative; font-size: 15px; line-height: 1.5; }
.section ol.try::before { content: "Try this"; font-family: var(--mono); font-size: 10px; letter-spacing: 0; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 10px; }
.section ol.try li { counter-increment: t; position: relative; padding-left: 30px; margin-bottom: 0.5em; }
.section ol.try li::before {
  content: counter(t); position: absolute; left: 0; top: 0.18em; width: 19px; height: 19px; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent); font-family: var(--mono); font-size: 11px; line-height: 18px; text-align: center;
}
.section .wide + ol.try { margin-top: -18px; }

.keys { list-style: none; padding: 0 !important; margin: 0 0 28px !important; }
.keys li { border-top: 1px solid var(--line); padding: 12px 0 8px 30px; margin: 0; position: relative; }
.keys li::before { content: ""; position: absolute; left: 2px; top: 20px; width: 12px; height: 1px; background: var(--accent); }
.quiz { border: 1px solid var(--ink); padding: 0; margin: 0 0 20px; }
.quiz summary { cursor: pointer; padding: 16px 44px 16px 18px; list-style: none; position: relative; font-weight: 600; }
.quiz summary::-webkit-details-marker { display: none; }
.quiz summary .label { display: block; color: var(--accent); margin-bottom: 6px; font-weight: 500; }
.quiz summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 18px; color: var(--accent); }
.quiz[open] summary::after { content: "\2212"; }
.quiz summary:hover { background: var(--accent-wash); }
.quiz > div { padding: 0 18px 16px; border-top: 1px solid var(--line); }
.quiz > div p { margin: 14px 0 0; }
.quiz + .quiz { margin-top: -21px; }

.px-swatch { width: 100%; max-width: 150px; aspect-ratio: 1; border: 1px solid var(--ink); margin: 12px 0 14px; }
.px-nums { list-style: none; padding: 0 !important; margin: 0 !important; text-transform: none; letter-spacing: 0; font-size: 12.5px; max-width: none; }
.px-nums li { display: grid; grid-template-columns: 52px minmax(0, 1fr) 30px; gap: 10px; align-items: center; margin: 0; padding: 6px 0; border-top: 1px solid var(--line); }
.px-nums b { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.px-bar { height: 7px; background: var(--line); }
.px-bar i { display: block; height: 100%; background: currentColor; }
.c-r { color: #a8261f; } .c-g { color: #26702c; } .c-b { color: #2148a8; }
.stage3d__label.is-num { font-size: 12px; font-weight: 500; padding: 1px 4px; }
.stage3d__label.is-num[data-k="0"] { color: #a8261f; } .stage3d__label.is-num[data-k="1"] { color: #26702c; } .stage3d__label.is-num[data-k="2"] { color: #2148a8; }
.depth__legend { list-style: none; padding: 0 !important; margin: 8px 0 0 !important; font-size: 14px; }
.depth__legend li { display: flex; align-items: center; gap: 9px; margin: 0 0 5px; }
.depth__legend i { width: 11px; height: 11px; flex: none; }
.mixer__row { display: grid; grid-template-columns: 220px minmax(0, 360px); gap: 44px; align-items: start; }
@media (max-width: 700px) { .mixer__row { grid-template-columns: 1fr; gap: 20px; } .mixer__swatch { max-width: 200px; } }
.mixer__swatch { aspect-ratio: 1; border: 1px solid var(--ink); display: grid; place-items: end start; }
.mixer__swatch span { background: var(--ground); border-top: 1px solid var(--ink); border-right: 1px solid var(--ink); padding: 3px 8px; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.mixer__text { margin: 10px 0 0 !important; text-transform: none; letter-spacing: 0; font-size: 12.5px; min-height: 3.2em; }
.mixer .ctl.c-r label { color: #a8261f; } .mixer .ctl.c-g label { color: #26702c; } .mixer .ctl.c-b label { color: #2148a8; }

/* ---------- Legibility pass: nothing smaller than 11px, muted text passes AA ---------- */
.mono, .label { font-size: 11.5px; }
.sidebar { font-size: 12px; }
figcaption { font-size: 13px; }
.ctl label { font-size: 11.5px; } .ctl output { font-size: 12.5px; }
.btn { font-size: 11.5px; }
.diagram__controls .btn { font-size: 11px; padding: 6px 11px; }
.stage3d__label { font-size: 11px; }
.stage-tag, .hist__clip, .group-label, .editor__panel .group, .thumb .mono { font-size: 11px; }
.map-readout, .depth__readout { font-size: 12.5px; }
.gallery__tile figcaption, .gallery__body figcaption { font-size: 12.5px; }
.section ol.try::before { font-size: 11px; }
.depth__tip { font-size: 12px; }
.credits { font-size: 12.5px; }
.editor__note { font-size: 17px; }
.unsharp__text { font-size: 17px; }

.stage3d__label.is-badge { width: 22px; height: 22px; border-radius: 50%; padding: 0; text-align: center; line-height: 21px; font-size: 11.5px; background: var(--ink); color: var(--ground); }
.depth__legend--num { margin: 10px 0 4px !important; }
.depth__legend--num li { align-items: start; font-size: 13.5px; line-height: 1.4; margin-bottom: 8px; }
.depth__legend--num i { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--ground); font: 500 11px/20px var(--mono); text-align: center; font-style: normal; margin-top: 1px; }

.stage-tag { background: rgba(49, 47, 47, 0.86); }
.btn:disabled { opacity: 0.55; }
.note sup { font-size: 11px; }
.map-row { grid-template-columns: 250px minmax(0, 1fr) 220px; }
@media (max-width: 860px) { .map-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 520px) { .map-row { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .stage3d__labels { overflow: hidden; } .verdict__circle { right: -120px; } }
.verdict { overflow: hidden; }

/* wide drawings keep a readable size on phones and scroll sideways */
.scrollx { min-width: 0; }
figure.wide { overflow-x: auto; }
@media (max-width: 700px) {
  .scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .scrollx > * { min-width: 640px; }
  .scrollx--s > * { min-width: 520px; }
  figure.wide > svg { min-width: 640px; }
  .scrollx::after, figure.wide::before { content: "Swipe sideways to see all of it \2192"; display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); position: sticky; left: 0; padding-top: 6px; }
  figure.wide::before { padding: 0 0 6px; }
  .scrollx--end::after { content: "\2190  Swipe sideways to see all of it"; }
}

.stage3d:focus-visible { outline: 1px dashed var(--accent); outline-offset: 4px; }

/* ---------- Homepage ---------- */
.hero { position: relative; isolation: isolate; padding: 64px 0 18px; }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 60%; z-index: -1; background: linear-gradient(to bottom, transparent, var(--ground)); pointer-events: none; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to right, color-mix(in srgb, var(--ground) 88%, transparent) 15%, transparent 70%); pointer-events: none; }
.hero + main > .section:first-child { border-top: 0; }
.hero .hero__lede { color: var(--ink); }
.hero__inner { width: fit-content; max-width: 100%; }
.hero__foot { display: flex; align-items: center; gap: 14px 7px; margin-top: 64px; width: 0; min-width: 100%; }
.apps { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0; }
@media (max-width: 700px) { .hero__foot { flex-wrap: wrap; } .apps { flex-basis: 100%; } }
.apps__label, .apps__list li { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: normal; text-transform: uppercase; color: var(--muted); }
.apps__label { flex: none; }
.apps__track { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); }
.apps__belt { display: flex; width: max-content; animation: apps-scroll 54s linear infinite; }
.apps__track:hover .apps__belt { animation-play-state: paused; }
.hero .apps__list { display: flex; list-style: none; margin: 0; padding: 0 28px 0 0; gap: 28px; }
.hero .apps__list li { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; line-height: 1; }
.apps__list img { width: 11px; height: 11px; object-fit: contain; filter: grayscale(1) brightness(0.7) contrast(1.3); opacity: 0.85; }
.apps__mono { display: grid; place-items: center; width: 11px; height: 11px; border-radius: 2px; background: #3a3838; color: var(--ground); font-size: 8px; line-height: 1; opacity: 0.85; }
@keyframes apps-scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .apps__belt { animation: none; } }
.hero__text { padding: 0 var(--pad); }
/* a tab hanging from the top edge of the hero, centred */
.hero .hero__kicker { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 1; display: inline-block; padding: 7px 14px 6px; border-radius: 0 0 6px 6px; font-size: 11px; font-weight: 600; letter-spacing: normal; white-space: nowrap;
  color: #b13f27; text-shadow: none; background-color: #f7d3c4;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 60%), linear-gradient(115deg, #fadccf 0%, #f6cfbf 50%, #f2c4b2 100%);
  box-shadow: inset 0 -1px 0 rgba(160, 60, 35, 0.12), 0 1px 2px rgba(90, 20, 50, 0.08), 0 3px 6px -3px rgba(190, 80, 50, 0.18); }
.hero .hero__meta { display: block; flex: none; margin: 0; color: var(--muted); letter-spacing: normal; }
.hero h1 {
  margin: 18px 0 20px; font-size: clamp(42px, 7vw, 92px); font-weight: 700; letter-spacing: -0.02em; line-height: 1;
  max-width: 13ch; text-wrap: balance; animation: rise 0.9s var(--ease) both;
}
.hero__lede { margin: 0; max-width: 46ch; font-size: clamp(19px, 1.7vw, 22px); line-height: 1.45; color: var(--muted); animation: rise 0.9s 0.12s var(--ease) both; }
.hero__cta { margin-top: 60px; gap: 16px; }
.hero__cta .btn, .intro__cta .btn { text-decoration: none; padding: 12px 20px; }
:is(.hero .hero__cta .btn--solid, .intro__cta .btn--solid, .tour .tour__go) { border: 0; padding: 12px 19px; color: #fff; text-shadow: 0 1px 1px rgba(90, 10, 15, 0.35); background-color: #e55c38;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 50%), radial-gradient(80% 150% at 12% 110%, rgba(250, 130, 60, 0.4), rgba(250, 130, 60, 0) 70%), linear-gradient(115deg, #ec6a3a 0%, #e65d38 50%, #dc4e36 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(90, 10, 15, 0.28), 0 1px 2px rgba(90, 20, 50, 0.3), 0 6px 16px -4px rgba(225, 80, 40, 0.5);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), filter 0.15s; }
:is(.hero .hero__cta .btn--solid, .intro__cta .btn--solid, .tour .tour__go):hover { transform: translateY(-1px); filter: saturate(1.08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(90, 10, 15, 0.28), 0 2px 3px rgba(90, 20, 50, 0.3), 0 10px 22px -6px rgba(225, 80, 40, 0.55); }
:is(.hero .hero__cta .btn--solid, .intro__cta .btn--solid, .tour .tour__go):active { transform: translateY(1px); box-shadow: inset 0 2px 3px rgba(70, 10, 60, 0.3), 0 1px 2px rgba(90, 20, 50, 0.3); }
.hero .hero__cta .btn:not(.btn--solid) { color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.6); backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: none; transition: background 0.2s; }
.hero .hero__cta .btn:not(.btn--solid):hover { background: rgba(255, 255, 255, 0.45); }
.hero__photo { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; max-height: none; margin: 0; object-fit: cover; object-position: 50% 18%; }
@media (prefers-reduced-motion: reduce) { .hero h1, .hero__lede { animation: none; } }

.examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin: 28px 0 8px; max-width: none !important; }
.examples figure { margin: 0; border-top: 1px solid var(--ink); padding-top: 16px; }
.examples svg { width: 100%; height: auto; }
.examples figcaption { font-family: var(--display); font-size: 15px; line-height: 1.45; color: var(--ink); }
.examples figcaption b { font-weight: 600; }
@media (max-width: 860px) { .examples { grid-template-columns: 1fr; max-width: 420px !important; } }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; margin: 4px 0 28px; }
.facts div { border-top: 1px solid var(--line); padding: 16px 0 18px; }
.facts dt { color: var(--accent); margin-bottom: 6px; }
.facts dd { margin: 0; font-size: 17px; line-height: 1.5; max-width: 44ch; }
@media (max-width: 700px) { .facts { grid-template-columns: 1fr; } }

.chapter-list { list-style: none; padding: 0 !important; margin: 0 !important; }
.chapter-list li { margin: 0; border-top: 1px solid var(--line); }
.chapter-list li:last-child { border-bottom: 1px solid var(--line); }
.chapter-list a { display: grid; grid-template-columns: 44px minmax(0, 250px) minmax(0, 1fr); gap: 4px 16px; align-items: baseline; padding: 14px 0; text-decoration: none; }
.chapter-list .n { color: var(--accent); }
.chapter-list .t { font-size: 19px; font-weight: 600; line-height: 1.25; }
.chapter-list .d { color: var(--muted); font-size: 16px; line-height: 1.4; }
.chapter-list a:hover .t { color: var(--accent); }
@media (max-width: 700px) { .chapter-list a { grid-template-columns: 36px minmax(0, 1fr); } .chapter-list .d { grid-column: 2; } }


/* =====================================================================
   Algebrica style (2026-11-18): serif headings and reading text, Geist for
   the interface, small spaced Geist Mono labels in grey, 6px corners.
   ===================================================================== */
body { font-size: 16px; }
:root { --text: 700px; }

/* labels: grey, like Algebrica's breadcrumbs */
.mono, .label { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.section__num, .opener__kicker, .hero__kicker, .glance dt, .facts dt, .group-label, .editor__panel .group,
.editor__note .label, .quiz summary .label, .section ol.try::before, .section h3, .pager .label, .pager .big .n,
.chapter-list .n, .sidebar__ch.is-current > a .n, .topbar__brand b { color: var(--muted); }
.section__num { margin-bottom: 18px; }
.section li::marker, .practice li::before { color: var(--muted); }

/* headings */
.opener h1, .hero h1, .section h2, .verdict__big, .pager .big, .toc a .t, .chapter-list .t {
  font-family: var(--serif); font-weight: 400; letter-spacing: 0;
}
.opener h1 { font-size: clamp(36px, 4.2vw, 48px); line-height: 1.12; margin: 20px 0 18px; max-width: 20ch; }
.hero h1 { font-size: clamp(44px, 6.4vw, 80px); line-height: 1.04; max-width: 26ch; text-wrap: balance; }
.section h2 { font-size: clamp(26px, 2.5vw, 30px); line-height: 1.2; }
.pager .big { font-size: clamp(24px, 2.4vw, 30px); }
@media (max-width: 720px) { .pager .big { font-size: 21px; } }
.chapter-list .t { font-size: 21px; }
.section__head { margin-bottom: 26px; }

/* reading text in Garamond, sized up because its letters run small */
.section > p, .section > ul:not(.keys):not(.depth__legend) > li, .section > ol:not(.try):not(.practice) > li, .practice li,
.keys li, .quiz > div p, .opener__caption, .hero__lede, .facts dd, .chapter-list .d {
  font-family: var(--serif); font-size: 20px; line-height: 1.5;
}
.section p { margin-bottom: 0.95em; }
.section p.lead { font-family: var(--serif); font-size: 23px; line-height: 1.38; font-weight: 400; }
.opener__caption, .hero__lede { font-size: 22px; line-height: 1.42; color: var(--muted); }
.facts dd { font-size: 19px; }
.chapter-list .d { font-size: 18px; }
.quiz summary { font-family: var(--serif); font-size: 21px; font-weight: 500; line-height: 1.3; }
.section ol.try { font-size: 15px; }
.term { border-bottom-color: var(--ink); }
a { text-underline-offset: 4px; }

/* sidebar: Geist, like Algebrica's right-hand column */
.sidebar { font-family: var(--display); font-size: 14px; line-height: 1.4; }
.sidebar__brand { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.sidebar__sub { font-size: 13px; letter-spacing: 0; margin-bottom: 24px; }
.sidebar__ch > a { grid-template-columns: 30px 1fr; padding: 5px 0; }
.sidebar__ch > a .n { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0; padding-top: 1px; }
.sidebar__ch.is-current > a { font-weight: 600; }
.sidebar__secs { margin-left: 30px !important; border-left-color: var(--line); }
.sidebar__secs a { font-size: 13.5px; letter-spacing: 0; }
.sidebar__secs a.is-active { color: var(--ink); border-left-color: var(--ink); font-weight: 500; }
.sidebar { border-right-color: var(--line-soft); }
.section, .pager, .colophon, .opener::after { border-color: var(--line-soft); }
.pager a + a { border-left-color: var(--line-soft); }

/* buttons: 6px corners, sentence case Geist */
.btn, .diagram__controls .btn, .hero__cta .btn {
  font-family: var(--display); font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none;
  border-radius: var(--radius); border-color: var(--line-strong); padding: 8px 14px;
}
.diagram__controls .btn { font-size: 13px; padding: 6px 11px; }
.hero__cta .btn, .intro__cta .btn { font-size: 15px; padding: 11px 18px; }
.btn:hover { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.btn--solid { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.btn--solid:hover { background: #000; border-color: #000; }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.stage3d__hint { border-radius: var(--radius); font-family: var(--display); font-size: 13px; letter-spacing: 0; text-transform: none; }

/* controls */
.ctl label { font-family: var(--display); font-size: 13.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.ctl output { font-family: var(--mono); font-size: 12.5px; }
.ctl output.is-set { color: var(--ink); font-weight: 600; }
.diagram__controls, .editor__panel { border-top-color: var(--line); }

/* cards and call-outs: hairline boxes with soft corners */
.quiz { border-color: var(--line); border-radius: var(--radius); }
.quiz > div { border-top-color: var(--line-soft); }
.verdict { background: var(--ground-2); color: var(--ink); border-radius: var(--radius); }
.verdict .label { color: var(--muted); opacity: 1; }
.verdict__big .ghost { opacity: 0.6; }
.verdict__circle { display: none; }
.note::before { border-color: var(--muted); color: var(--muted); }
.section ol.try { border-top-color: var(--line); }
.section ol.try li::before { border-color: var(--line-strong); color: var(--muted); }
.keys li, .practice li, .facts div, .chapter-list li, .credits td, .toc li { border-color: var(--line); }
.chapter-list li:last-child, .toc li:last-child { border-bottom-color: var(--line); }

/* photos get the same soft corners as Algebrica's video */
.editor__stage { border-radius: var(--radius); overflow: hidden; }
.stage-tag { font-family: var(--mono); font-weight: 500; letter-spacing: 0; border-radius: 3px; }
.progress a i { background: var(--ink); }
.progress a::before { background: var(--line); }
figcaption, .note, .depth__tip, .map-readout, .depth__readout, .mixer__text { font-family: var(--display); letter-spacing: 0; }
figcaption { font-size: 14px; }
.note { font-size: 14px; line-height: 1.5; }
.depth__tip, .mixer__text, .map-readout, .depth__readout { font-size: 13.5px; text-transform: none; }
.editor__note { font-family: var(--serif); font-size: 19px; }
.tip { font-family: var(--display); font-size: 13.5px; border-radius: var(--radius); }
.examples figure { border-top-color: var(--line); }
.examples figcaption { font-size: 15px; }
::selection { background: var(--ink); color: var(--ground); }

/* ---------- Colour grading wheels ---------- */
.cw-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 4px; }
.cw { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cw__label { font-family: var(--display); font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.cw__disc {
  position: relative; border-radius: 50%; cursor: crosshair; touch-action: none; max-width: 100%;
  background:
    radial-gradient(closest-side, var(--ground) 0%, rgba(244, 239, 238, 0.6) 50%, rgba(244, 239, 238, 0.15) 100%),
    conic-gradient(from 90deg, #e04a3f, #d14fb4 60deg, #4a63d6 120deg, #36b3c4 180deg, #4caf50 240deg, #e3c53a 300deg, #e04a3f 360deg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.cw__disc:focus-visible { outline: 1px dashed var(--ink); outline-offset: 3px; }
.cw__cross { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; transform: translate(-50%, -50%); pointer-events: none;
  background: linear-gradient(var(--muted), var(--muted)) center / 1px 100% no-repeat, linear-gradient(var(--muted), var(--muted)) center / 100% 1px no-repeat; }
.cw__dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--ground); border: 2px solid var(--ink); pointer-events: none; box-shadow: 0 0 0 1px var(--ground); }
.cw__out { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.cw__out.is-set { color: var(--ink); }
.cw__hint { font-family: var(--display); font-size: 12.5px; line-height: 1.4; color: var(--muted); margin: 8px 0 2px !important; }
.grade-photo { margin-top: 18px; }
.grade-photo canvas { width: 100%; max-width: 440px; height: auto; display: block; border-radius: var(--radius); }
.gallery__photo .mini-wheel { position: absolute; left: 6px; bottom: 6px; width: 66px; height: 66px; padding: 3px; background: rgba(244, 239, 238, 0.92); border-radius: 50%; z-index: 2; }
.mini-wheel__disc { width: 100%; height: 100%; }
.mini-wheel__disc svg { width: 100%; height: 100%; overflow: visible; }
.gallery__key { font-family: var(--display); font-size: 13.5px; color: var(--muted); margin: 18px 0 0 !important; max-width: 70ch; }
@media (max-width: 700px) { .gallery__photo .mini-wheel { width: 46px; height: 46px; padding: 2px; left: 4px; bottom: 4px; } }
.intro .examples { margin-top: 0; gap: 40px; }
.intro .examples figcaption b { display: block; margin-bottom: 4px; font-size: 18px; }
/* sidebar foot: credits pinned to the bottom of the sidebar */
@media (min-width: 1100px) { .sidebar { display: flex; flex-direction: column; } }
.sidebar__foot { margin-top: auto; padding-top: 28px; display: flex; flex-direction: column; gap: 4px; font-family: var(--display); font-size: 13px; line-height: 1.4; color: var(--muted); }
.sidebar__foot a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; transition: color 0.2s; }
.sidebar__foot a:hover { color: var(--ink); }
.toc .sidebar__foot { margin-top: 28px; padding-top: 0; }
.section.intro { padding-top: 8px; }
/* Homepage previews that play themselves */
.intro .examples { gap: 24px; }
.intro .examples figure.card { display: flex; flex-direction: column; gap: 22px; margin: 0; padding: 22px 22px 20px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.45); }
.intro .examples figure.card figcaption { margin: 0; }
.demo-slot { height: 350px; display: flex; flex-direction: column; min-height: 0; }
.demo-slot > .stage3d { flex: 1; min-height: 0; }
.demo-slot .demo__photo { flex: 1; min-height: 0; }
/* the tools float on a small rounded panel over the bottom of the picture */
.demo-slot > .demo__panel { position: relative; z-index: 2; flex: none; margin: -52px 14px 0; padding: 10px 14px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(250, 247, 246, 0.82); -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4); }
.demo-slot > .demo__panel--curve { align-self: center; padding: 8px 10px; }
/* photo cards: the photo keeps one height and the panel sits on the bottom edge, so both photos match */
.demo-slot { position: relative; }
.demo-slot .demo__photo { flex: none; height: 256px; }
.demo-slot > .demo__photo + .demo__panel { position: absolute; left: 14px; right: 14px; bottom: 0; margin: 0; }
.demo-slot > .demo__photo + .demo__panel--curve { left: 50%; right: auto; transform: translateX(-50%); }
.demo__panel--curve .hair-a { stroke: var(--ink); }
.demo__panel--curve .curve-box { width: 136px; max-width: none !important; }
.demo__panel--curve .curve-box svg { display: block; width: 100%; height: auto; }
.demo__panel--curve .curve-box text { display: none; }
.demo-slot .demo__panel .diagram__controls { margin-top: 0; padding-top: 0; border-top: 0; }
.demo-slot .demo__panel .ctl { padding-top: 0; }
.intro .examples .demo-slot { margin: auto 0 0; }
.demo-slot .demo__panel .hist { margin: 0 0 8px; }
.demo-slot .demo__panel .hist canvas { height: 36px; }
.demo-slot > .stage3d { aspect-ratio: auto !important; max-height: none; }
.demo-slot .demo__photo .live-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.demo { position: relative; }
.demo .diagram__controls { margin-top: 10px; }
.demo__photo { position: relative; }
.demo__photo .live-photo { border-radius: 4px; }
.demo__photo .curve-box { position: absolute; right: 8px; bottom: 8px; width: 42%; max-width: none !important; padding: 4px; border-radius: 4px; background: rgba(244, 239, 238, 0.9); }
.demo__photo .curve-box text { display: none; }
.demo .hist { margin: 10px 0 0; }
.demo .hist canvas { width: 100%; height: 64px; display: block; }
.demo .stage3d__hint { display: none; }
.demo__cursor { position: absolute; left: 0; top: 0; width: 17px; height: 23px; z-index: 6; pointer-events: none; transition: opacity 0.3s; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.35)); }
.demo__cursor svg { width: 100%; height: 100%; display: block; transform-origin: 1.5px 1.5px; transition: transform 0.12s; }
.demo__cursor path { fill: #fff; stroke: #312f2f; stroke-width: 1.2; stroke-linejoin: round; }
.demo__cursor.is-down svg { transform: scale(0.86); }
.demo__cursor.is-off { opacity: 0; }
/* the 3D landscape runs to the card's edges */
.intro .examples figure.card { overflow: hidden; }
#demo-exposure > .stage3d { margin: 0 -22px; width: calc(100% + 44px); transform: translateY(-36px); }
/* Why I made this */
.hero + main > .section.why, .section.why { border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding-top: clamp(32px, 4vw, 48px); padding-bottom: clamp(32px, 4vw, 48px); }
.section.why + .section.intro { border-top: 0; padding-top: 24px; }
/* the cards' heading reads as a small label, set like "15 chapters" in the hero */
.section.intro > .section__head { margin-bottom: 24px; }
.section.intro > .section__head h2 { font-family: var(--mono); font-size: 12px; font-weight: 600; line-height: 1.5; letter-spacing: 0; text-transform: uppercase; color: var(--muted); }
.why > .why__card { max-width: 820px; margin: 0 auto; text-align: left; }
.why__quote { margin: 0 auto; font-family: "IM Fell English", "EB Garamond", Georgia, serif; font-style: italic; font-weight: 400; font-size: 27px; line-height: 1.5; color: var(--ink); }
.why__quote p { margin: 0 0 0.7em; text-align: left; }
.why__quote p:first-child::before { content: "\201C"; }
.why__quote p:last-child::after { content: "\201D"; }
.why .why__sign { margin: 14px 0 0; display: inline-flex; align-items: center; gap: 12px; text-align: left; font-family: var(--display); font-size: 14px; color: var(--muted); }
.why__photo { width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover; object-position: 50% 45%; display: block; }
.why__sign a { color: var(--ink); font-weight: 500; }
@media (max-width: 700px) { .why__quote { font-size: 21px; } }

/* sidebar progress: a line runs down the chapters with a dot for each one.
   Chapters before this one are filled in, this one is orange, the rest are hollow. */
.sidebar__ch { position: relative; padding-left: 22px; }
.sidebar__ch::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.sidebar__ch:first-child::before { top: 15px; }
.sidebar__ch:last-child::before { bottom: auto; height: 15px; }
.sidebar__ch:first-child:last-child::before { display: none; }
.sidebar__ch.is-done::before { background: var(--ink); }
.sidebar__ch.is-current::before { background: linear-gradient(var(--ink) 15px, var(--line) 15px); }
.sidebar__ch:first-child.is-current::before { background: var(--line); }
.sidebar__ch::after { content: ""; position: absolute; left: 0; top: 10.5px; width: 9px; height: 9px; box-sizing: border-box; border: 1.5px solid #a59d9b; border-radius: 50%; background: var(--ground); }
.sidebar__ch.is-done::after { border-color: var(--ink); background: var(--ink); }
.sidebar__ch.is-current::after { border-color: #e65d38; background: #e65d38; }
.sidebar__ch.is-done > a { color: var(--ink); }

/* call to action under the three demo cards */
.section > .intro__cta { display: flex; justify-content: center; margin-top: 48px; max-width: none; }
.section.intro { padding-bottom: 0; }
.section.intro + .section { border-top: 0; padding-top: 72px; }
@media (max-width: 860px) { .section > .intro__cta { max-width: 420px; } }

/* a warm glow from the right edge pulls the eye to the next chapter */
.pager:has(.pager__next) { background: radial-gradient(ellipse 360px 170px at 100% 100%, rgba(230, 93, 56, 0.24), rgba(230, 93, 56, 0.1) 45%, rgba(230, 93, 56, 0.03) 75%, rgba(230, 93, 56, 0)); }
.pager .label { font-weight: 400; }

/* 3D labels: no box behind them, an outline around the letters keeps them readable over the scene */
.stage3d__label:not(.is-badge) { background: none; font-weight: 400;
  --halo: var(--ground);
  text-shadow: 1px 0 0 var(--halo), -1px 0 0 var(--halo), 0 1px 0 var(--halo), 0 -1px 0 var(--halo),
    1px 1px 0 var(--halo), -1px -1px 0 var(--halo), 1px -1px 0 var(--halo), -1px 1px 0 var(--halo),
    0 0 3px var(--halo), 0 0 3px var(--halo); }

/* side notes: a thin vertical bar the height of the note instead of the "i" icon */
.note { padding-left: 16px; }
.note::before { content: ""; top: 3px; bottom: 3px; height: auto; width: 2px; border: 0; border-radius: 1px; background: var(--line); }

/* a caption split in two, each half under its own diagram (the svg's right half starts at 480 of 900) */
figcaption.cap2 { display: grid; grid-template-columns: 480fr 420fr; max-width: none; }
figcaption.cap2 > span { padding-right: 32px; }
@media (max-width: 640px) { figcaption.cap2 { grid-template-columns: 1fr; gap: 10px; } }

/* numbers in the practice list sit in the first line of text, so they share its baseline */
.practice li::before { position: static; display: inline-block; width: 44px; margin-left: -44px; vertical-align: baseline; }

/* hovering the next chapter link warms the glow: a stronger copy of it fades in on top */
.pager:has(.pager__next) { position: relative; isolation: isolate; }
.pager:has(.pager__next)::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.35s var(--ease);
  background: radial-gradient(ellipse 420px 190px at 100% 100%, rgba(236, 98, 52, 0.42), rgba(236, 98, 52, 0.18) 45%, rgba(236, 98, 52, 0.05) 75%, rgba(236, 98, 52, 0));
}
.pager:has(.pager__next:hover)::before, .pager:has(.pager__next:focus-visible)::before { opacity: 1; }

/* section labels link to their own section, for sharing */
.section__link { color: inherit; text-decoration: none; }
.section__link:hover { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.section__head { scroll-margin-top: 24px; }

/* the flat photo under a 3D landscape's controls */
.depth__flat { display: block; width: 100%; height: auto; margin-top: 20px; border-radius: 6px; }

/* the pixel ruler diagram: keep the whole thing within one screen, at the diagram width */
.section > .wide.map { max-width: var(--wide); }
.map > svg { margin-bottom: 12px; }
.map-row { grid-template-columns: 190px minmax(0, 1fr) 190px; gap: 20px; }
@media (max-width: 860px) { .map-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 520px) { .map-row { grid-template-columns: 1fr; } }

/* recap dashes sit at the middle of the first line of text */
.keys li::before { top: calc(12px + 0.55lh); }

/* photo strip under the editors: no line under the thumbnails */
.thumb { border-bottom: 0; }

/* tone curve intro: a small graph with the three zones, next to the list that describes them */
.section > .zones { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 28px; align-items: start; margin: 0 0 24px; }
.zones__graph { width: 100%; height: auto; display: block; }
.zones__list { margin: 0 !important; }
@media (max-width: 560px) { .section > .zones { grid-template-columns: 1fr; } .zones__graph { max-width: 220px; } }

/* when the graph can be edited (tone curve), it gets the room and the photo shrinks */
.map-row--curve { grid-template-columns: 264px minmax(0, 1fr) 180px; }
@media (max-width: 860px) { .map-row--curve { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 520px) { .map-row--curve { grid-template-columns: 1fr; } }

/* curve graphs: dragging a point never selects the axis labels */
.curve-box { user-select: none; -webkit-user-select: none; }

/* colour grading with curves: the photo, then a red, a green and a blue curve */
.chan-photo canvas { display: block; width: 100%; max-width: 560px; height: auto; border-radius: 6px; }
.chan-row { display: grid; grid-template-columns: repeat(3, minmax(0, 200px)); gap: 28px; margin: 20px 0 16px; }
.chan .label { margin-bottom: 8px; }
.chan--r .label { color: #a8261f; } .chan--g .label { color: #26702c; } .chan--b .label { color: #2148a8; }
.chan--r .curve-box .hair-a { stroke: #c8352e; } .chan--g .curve-box .hair-a { stroke: #3f9a45; } .chan--b .curve-box .hair-a { stroke: #3565cc; }
@media (max-width: 560px) { .chan-row { gap: 12px; } }
.chan .curve-box text { display: none; }

/* a side note that should start higher than the text it sits next to (wide screens only) */

/* editors with a point curve: a wider panel so the curve is easy to read and drag */
.editor__main--curve { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 860px) { .editor__main--curve { grid-template-columns: 1fr; } }

/* guided steps (tour.js): one card at a time, beside the part of the diagram it's about */
.try--toured { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tour__restart { margin: 4px 0 24px; }
.tour {
  position: absolute; z-index: 60; width: 300px; padding: 14px 16px 16px;
  background: rgba(244, 239, 238, 0.72); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(49, 47, 47, 0.18); border-radius: 10px; box-shadow: 0 12px 32px -14px rgba(49, 47, 47, 0.45);
  font-size: 15px; line-height: 1.5; color: var(--ink);
}
.tour.is-docked { position: fixed; left: 12px !important; right: 12px; bottom: 12px; top: auto !important; width: auto; }
.tour__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tour__head .label { color: var(--muted); }
.tour__close { border: 0; background: none; font-size: 20px; line-height: 1; padding: 0 2px; cursor: pointer; color: var(--muted); }
.tour__close:hover { color: var(--ink); }
.tour__text { margin: 0 0 14px; }
.tour__btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.tour__skip { margin-right: auto; }

/* guided step cards stand out: an orange edge and halo, an orange label, the orange main button,
   and a gentle rise and one pulse when a tour starts */
.tour {
  width: 320px; border: 1px solid rgba(230, 93, 56, 0.35);
  box-shadow: 0 0 0 4px rgba(230, 93, 56, 0.10), 0 20px 44px -16px rgba(49, 47, 47, 0.55);
  animation: tour-in 0.4s var(--ease) both, tour-pulse 1.6s 0.4s ease-out 1;
}
.tour__head .label { color: #c4492b; }
.tour .btn--solid { padding: 9px 18px; }
@keyframes tour-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes tour-pulse {
  0% { box-shadow: 0 0 0 4px rgba(230, 93, 56, 0.10), 0 20px 44px -16px rgba(49, 47, 47, 0.55); }
  40% { box-shadow: 0 0 0 10px rgba(230, 93, 56, 0.22), 0 20px 44px -16px rgba(49, 47, 47, 0.55); }
  100% { box-shadow: 0 0 0 4px rgba(230, 93, 56, 0.10), 0 20px 44px -16px rgba(49, 47, 47, 0.55); }
}
@media (prefers-reduced-motion: reduce) { .tour { animation: none; } }

/* colour grading idea diagram: readout and photo side by side under the graph */
.grade-under { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.grade-under .depth__readout { flex: 1 1 auto; }
.grade-under .grade-photo { flex: 0 0 auto; width: min(440px, 55%); }
@media (max-width: 700px) { .grade-under { flex-direction: column; } .grade-under .grade-photo { width: 100%; } }

/* blur-and-subtract diagram: text under the step tabs, graph under it, photo and sliders together on the right */
.unsharp__row { align-items: start; }
.unsharp .unsharp__text { min-height: 0; margin: 4px 0 18px !important; font-size: 16px; }
.unsharp__nav { margin-top: 14px; }
.unsharp__side .diagram__controls { margin-top: 16px; }
.unsharp .unsharp__row { align-items: center; margin-top: 0; }

/* the layer stack: the restart button sits close under it */
.wide.unsharp { margin-bottom: 12px; }

/* tour cards can be dragged around */
.tour:not(.is-docked) { cursor: grab; touch-action: none; }
.tour.is-dragging { cursor: grabbing; user-select: none; }
.tour :is(button, a, .term) { cursor: pointer; }

/* small graphs of the picked row under each label of the layer stack */
.stack-graph { display: block; margin-top: 6px; overflow: visible; }
.stack-graph__line { fill: none; stroke: var(--hl); stroke-width: 1.3; stroke-linejoin: round; }
.stack-graph__ghost { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0.3; }
.stack-graph__zero { stroke: currentColor; stroke-width: 1; opacity: 0.3; stroke-dasharray: 2 2; }
.stack-graph__band { fill: var(--hl); opacity: 0.12; }
.stage3d canvas.stack-strip { display: block; position: static; width: 160px !important; height: 10px !important; margin-top: 6px; image-rendering: pixelated; outline: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.unsharp__pick { display: block; margin-bottom: 8px; }

/* a photo you click to pick a row of pixels; the red line marks the row */
.row-pick { position: relative; cursor: crosshair; }
.row-pick__line { position: absolute; left: 0; right: 0; height: 3px; margin-top: -1.5px; background: var(--hl); pointer-events: none; }

/* the row-of-pixels graph: its words are page text, not drawn in the canvas */
.signal__head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.signal__key { display: flex; gap: 18px; }
.signal__key .is-before { opacity: 0.55; }
.signal__key .is-after { color: var(--hl); }
.signal canvas { display: block; }
.signal__foot { margin-top: 6px; }

/* the mask stack: a vertical slider beside the layers spreads them apart (top) or merges them (bottom) */
.vspread { position: absolute; right: 8px; top: 12%; bottom: 18%; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 2; }
.vspread__track { position: relative; flex: 1; width: 28px; cursor: ns-resize; touch-action: none; }
.vspread__track::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line-strong); }
.vspread__knob { position: absolute; left: 50%; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%; background: var(--ground); border: 1px solid var(--ink); transition: transform 0.2s var(--ease), background 0.2s; }
.vspread__track:hover .vspread__knob, .vspread__knob:focus-visible { transform: scale(1.25); background: var(--accent); border-color: var(--accent); outline: none; }

/* editor panels with every tool: each group folds away under its title */
.egroup > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.egroup > summary::-webkit-details-marker { display: none; }
.egroup > summary::after { content: '+'; font-family: var(--mono, 'Geist Mono', monospace); font-size: 14px; color: var(--muted); transition: transform 0.2s var(--ease); }
.egroup[open] > summary::after { content: '−'; }
.egroup > summary:hover { color: var(--accent); }
.egroup__body { padding-bottom: 8px; }

/* the photo stays in view while you scroll down a tall panel of controls */
@media (min-width: 760px) {
  .editor__view { position: sticky; top: 16px; align-self: start; }
}

/* an on/off switch (Show mask) */
.toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 2px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.toggle__track { position: relative; width: 30px; height: 18px; border-radius: 9px; background: var(--line-strong); transition: background 0.2s var(--ease); flex: none; }
.toggle__track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ground); transition: transform 0.2s var(--ease); }
.toggle[aria-checked="true"] .toggle__track { background: var(--hl); }
.toggle[aria-checked="true"] .toggle__track::after { transform: translateX(12px); }
.toggle:focus-visible { outline: 1px dashed var(--accent); outline-offset: 3px; }

/* the last section of the guide: centred, with an orange glow, so the ending stands out */
.section.finale { text-align: center; background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(230, 93, 56, 0.16), rgba(230, 93, 56, 0) 70%); }
.finale .section__head, .finale > p { margin-left: auto; margin-right: auto; }
.finale .section__num { color: var(--hl); }
.finale h2 { color: var(--hl); }
.finale h2 { margin-left: auto; margin-right: auto; max-width: none; }
/* the congratulations line uses the same type as the quote on the home page */
.finale .finale__big { font-family: "IM Fell English", "EB Garamond", Georgia, serif; font-style: italic; font-weight: 400; font-size: 27px; line-height: 1.5; color: var(--ink); margin-bottom: 24px; }
@media (max-width: 700px) { .finale .finale__big { font-size: 21px; } }
.finale > p:not(.finale__big) { text-align: left; }

/* phones: the photo sits behind the whole width of the hero text, so the light wash covers more of it */
@media (max-width: 700px) {
  .hero::before { background: linear-gradient(to bottom, color-mix(in srgb, var(--ground) 86%, transparent) 0%, color-mix(in srgb, var(--ground) 70%, transparent) 45%, transparent 75%); }
}

/* phones: the guide card docks at the bottom, so keep it short to leave room for the diagram */
.tour.is-docked { left: 8px !important; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 10px 12px 12px; font-size: 14px; line-height: 1.45; }
.tour.is-docked .tour__head { margin-bottom: 2px; }
.tour.is-docked .tour__text { margin-bottom: 10px; }
.tour.is-docked .btn { padding: 6px 12px; font-size: 14px; }
.tour.is-docked .btn--solid { padding: 7px 16px; }
.tour.is-docked.is-away { opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity 0.2s, transform 0.2s, visibility 0s 0.2s; }
.tour.is-docked { transition: opacity 0.2s, transform 0.2s; }

/* phones: the layer stack keeps its names but drops the small graphs and pixel strips, which don't fit */
@media (max-width: 700px) {
  .stage3d .stack-graph, .stage3d canvas.stack-strip { display: none !important; }
}
.toc .sidebar__foot a { display: inline; padding: 0; }
/* histogram builder: the axis words sit under the canvas so they stay readable when it shrinks */
.hist-axis { display: flex; justify-content: space-between; margin-top: -2.2%; color: var(--ink); }
/* phone layouts of the wide drawings: a slightly bigger type size, since the drawing is shown smaller */
svg.svg-narrow text { font-size: 12.5px; }
/* the Contents button in the phone top bar, with a menu icon */
.topbar__menu { display: inline-flex; align-items: center; gap: 8px; color: inherit; }
.topbar__menu svg { width: 14px; height: 10px; display: block; }
.topbar__menu path { stroke: currentColor; stroke-width: 1.5; fill: none; }
/* phones: the photo picker is one row under the sliders that scrolls sideways */
@media (max-width: 860px) {
  .editor > .editor__strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; gap: 0 14px; margin-top: 24px; padding-bottom: 6px; border-top: 1px solid var(--line); scrollbar-width: thin; }
  .editor > .editor__strip { gap: 0 10px; padding: 14px 6px 8px; scroll-padding-inline: 6px; }
  .editor > .editor__strip .thumb { flex: 0 0 auto; display: block; width: auto; padding: 0; border: 0; scroll-snap-align: start; }
  .editor > .editor__strip .thumb .mono { display: none; }
  .editor > .editor__strip .thumb img, .editor > .editor__strip .thumb .thumb__img { width: 96px; height: 68px; display: block; border-radius: 3px; outline: 2px solid transparent; outline-offset: 2px; }
  .editor > .editor__strip .thumb[aria-pressed="true"] img, .editor > .editor__strip .thumb[aria-pressed="true"] .thumb__img { outline-color: var(--accent); }
}
/* phones: the try-it editors skip the histogram so the photo and the sliders sit closer together */
@media (max-width: 860px) { .editor__panel > .editor__hist-label, .editor__panel > .hist { display: none; } }
/* a drawing with its own phone version: show one or the other, and no sideways scrolling */
figure.wide.fit .only-narrow { display: none; }
@media (max-width: 700px) {
  figure.wide.fit::before { content: none; }
  figure.wide.fit .only-wide { display: none; }
  figure.wide.fit .only-narrow { display: block; min-width: 0; width: 100%; }
}
/* phones: the graph and the photo share a row under the drawing, the sliders go below */
@media (max-width: 700px) {
  .map-row, .map-row--curve { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center; }
  .map-row > .map-graph { grid-column: 1; grid-row: 1; }
  .map-row > .map-photo { grid-column: 2; grid-row: 1; }
  .map-row > .diagram__controls { grid-column: 1 / -1; }
}
/* the last section of the guide has no number label; it stays in the HTML so the sidebar still lists it as "Next" */
.section.finale .section__num { display: none; }
/* the sidebar opens with the course name, set like the page titles */
.sidebar__title { display: block; font-family: var(--mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: normal; line-height: 18px; white-space: nowrap; color: var(--muted); margin: 0 0 28px; }
/* "like a pro" can cross the dark hill on some screens: a thin, half-see-through outline in the page
   colour keeps it readable and takes on the tint of the photo behind it */
.hero h1 em {
  --o: color-mix(in srgb, var(--ground) 50%, transparent);
  text-shadow: 1px 0 0 var(--o), -1px 0 0 var(--o), 0 1px 0 var(--o), 0 -1px 0 var(--o);
}
.sidebar__title { text-decoration: none; transition: color 0.2s; }
.sidebar__title:hover { color: var(--accent); }
.sidebar__title { text-align: center; }
/* a rule under the title that runs the full width of the sidebar */
.sidebar__title { margin: 0 -22px 24px -26px; padding: 0 22px 20px 26px; border-bottom: 1px solid var(--line-soft); }
.topbar__brand { text-transform: uppercase; font-weight: 600; color: var(--ink); }
/* hovering the sidebar title warms it with the same orange glow as the "next chapter" link */
.sidebar__title { position: relative; isolation: isolate; margin-top: -26px; padding-top: 26px; }
.sidebar__title::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.35s var(--ease);
  background: radial-gradient(ellipse 220px 90px at 50% 0%, rgba(236, 98, 52, 0.34), rgba(236, 98, 52, 0.14) 45%, rgba(236, 98, 52, 0.04) 75%, rgba(236, 98, 52, 0));
}
.sidebar__title:hover::before, .sidebar__title:focus-visible::before { opacity: 1; }

/* analytics consent: a small card at the bottom left, with Decline and Accept given equal weight */
.consent {
  position: fixed; left: 16px; bottom: 16px; z-index: 60; width: min(380px, calc(100vw - 32px));
  background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 10px 30px rgba(40, 20, 15, 0.12); font-family: var(--display); font-size: 14px; line-height: 1.5; color: var(--ink);
}
@media (min-width: 1100px) { .consent { left: calc(var(--side) + 16px); } }
.consent__text { margin: 0 0 12px; }
.consent__text a { color: inherit; }
.consent__btns { display: flex; gap: 8px; }
.consent__btns .btn { flex: 1; justify-content: center; }
/* a docked guide card on a phone sits above the banner while it's open */
.tour.is-docked { margin-bottom: var(--consent-h, 0px); }
/* the privacy page: short headed sections, and "Cookie settings" written inline as a link */
.privacy h3 { margin: 1.6em 0 0.4em; }
.privacy code { font-family: var(--mono); font-size: 0.8em; }
.privacy__cookies { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.privacy__cookies:hover { color: var(--accent); }
.sidebar__links { white-space: nowrap; }

/* the end of the guide: the text to share, then one button per network */
.share { max-width: 620px; margin: 36px auto 0; text-align: center; }
.share__label { color: var(--hl); margin: 0 0 12px; }
.share__text { margin: 0 0 18px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--ground) 70%, #fff); font-family: var(--serif); font-size: 19px; line-height: 1.5; text-align: left; }
.share__url { color: var(--muted); word-break: break-all; }
.share__btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.share__note { min-height: 1.5em; margin: 12px auto 0; font-size: 14px; color: var(--muted); text-align: center !important; }
.finale > p.share__back { text-align: center; margin-top: 18px; font-size: 15px; }
