/* Possible Minds, illustrated. One sheet of cold-press paper per page, iron-gall ink for type,
   and the wren's haw red as the only accent (links, focus, the active step). */
@font-face { font-family: "Literata"; src: url("../fonts/literata.woff2") format("woff2"); font-weight: 300 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("../fonts/literata-italic.woff2") format("woff2"); font-weight: 300 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Kalam"; src: url("../fonts/kalam-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kalam"; src: url("../fonts/kalam-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ink: oklch(0.2 0.025 295);        /* #16131f, the nib's ink */
  --ink-2: oklch(0.36 0.02 295);      /* secondary text, 9:1 on the ground */
  --ground: oklch(0.955 0.012 92);    /* the table the sheet lies on */
  --sheet: oklch(0.978 0.011 92);     /* #fbf8f0, the cold-press sheet itself */
  --rule: oklch(0.86 0.02 85);
  --haw: oklch(0.5 0.17 25);          /* the haw berries' red: 5.6:1 on the ground */
  --wash: oklch(0.76 0.04 245);       /* the sky wash */
  --hand: "Kalam", "Bradley Hand", "Segoe Print", cursive;
  --book: "Literata", "Iowan Old Style", Charter, Georgia, serif;
  --gutter: clamp(1rem, 3vw, 2.75rem);
  --z-plate: 10; --z-masthead: 20; --z-skip: 30;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1.0625rem/1.66 var(--book); font-optical-sizing: auto; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration-line: underline; text-decoration-color: var(--haw); text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; overflow-wrap: anywhere; }
a:hover { color: var(--haw); }
:focus-visible { outline: 2px solid var(--haw); outline-offset: 3px; border-radius: 2px; }
code { font-size: 0.88em; background: color-mix(in oklch, var(--wash) 28%, transparent); padding: 0.05em 0.3em; border-radius: 2px; }
strong { font-weight: 640; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: var(--z-skip); background: var(--ink); color: var(--sheet); padding: 0.6rem 1rem; text-decoration: none; }
.skip:focus { top: 0.75rem; }

.masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.9rem var(--gutter) 0.4rem; font-family: var(--hand); }
.brand { font-weight: 700; font-size: 1.3rem; text-decoration: none; }
.brand:hover { color: var(--haw); }
.where { color: var(--ink-2); font-size: 1.05rem; }

/* ---------------------------------------------------------------- the explainer: essay left, plate right */
.layout { display: grid; grid-template-columns: minmax(19rem, 5fr) minmax(0, 8fr); gap: clamp(1.5rem, 3.4vw, 4rem); padding: 0 var(--gutter); align-items: start; max-width: 112rem; margin: 0 auto; }
.essay { grid-column: 1; grid-row: 1; padding-bottom: 28vh; min-width: 0; }
.plate { grid-column: 2; grid-row: 1; margin: 0; position: sticky; z-index: var(--z-plate);
  top: max(4rem, calc(50dvh - min(0.615 * (100vw - 2 * var(--gutter)) * 9 / 16, 80dvh) / 2 - 1.5rem)); }
.plate canvas { display: block; width: 100%; max-width: calc(80dvh * 16 / 9); aspect-ratio: 16 / 9; margin-left: auto; background: var(--sheet);
  border-radius: 2px; box-shadow: 0 1px 0 oklch(0.2 0.03 70 / 0.08), 0 22px 44px -28px oklch(0.35 0.05 70 / 0.45); opacity: 0; transition: opacity 400ms cubic-bezier(0.22, 1, 0.36, 1); }
.plate.is-ready canvas, .plate-only .plate canvas, .home .plate canvas { opacity: 1; }
.plate-ui { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-top: 0.7rem; font: 400 1.02rem var(--hand); color: var(--ink-2); }
.plate-ui button { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font: 400 1.2rem var(--book); cursor: pointer; transition: background-color 160ms, color 160ms, transform 120ms; touch-action: manipulation; }
.plate-ui button:hover { background: var(--ink); color: var(--sheet); }
.plate-ui button:active { transform: translateY(1px) scale(0.97); }
.plate-ui [data-step-counter] { min-width: 8.5ch; text-align: center; font-variant-numeric: tabular-nums; }

.step { min-height: 74vh; padding: 10vh 0 2vh; max-width: 36rem; opacity: 0.68; transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1); }
.step.is-active, .step:first-child { opacity: 1; }
.step:first-child { padding-top: 4vh; }
.step p, .step li { text-wrap: pretty; hyphens: manual; }
.step p { margin: 0 0 1em; }
.step ol, .step ul { padding-left: 1.35rem; margin: 0 0 1em; }
.step li { margin-bottom: 0.7em; }
.step li::marker { font-family: var(--hand); color: var(--ink-2); }
.kicker { font: 400 1.15rem var(--hand); color: var(--haw); margin: 0 0 0.4rem; }
h1 { font: 650 clamp(2rem, 1.1rem + 2.3vw, 3.05rem)/1.08 var(--book); letter-spacing: -0.012em; margin: 0 0 1rem; text-wrap: balance; }
.thesis { font-size: 1.17rem; line-height: 1.55; margin: 0 0 1.4rem; }
.meta { display: grid; gap: 0.35rem 1rem; margin: 0 0 1.4rem; font-size: 0.93rem; line-height: 1.45; color: var(--ink-2); }
.meta div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; }
.meta dt { font-family: var(--hand); font-size: 1.02rem; color: var(--ink); }
.meta dd { margin: 0; }
.howto { font: 400 1.08rem/1.45 var(--hand); color: var(--ink-2); }
h2.chapter { font: 650 1.6rem/1.2 var(--book); letter-spacing: -0.005em; margin: 0 0 1rem; text-wrap: balance; scroll-margin-top: 2rem; }
h3, h3.sub { font: 600 1.08rem/1.35 var(--book); margin: 1.4em 0 0.6em; }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; margin: 6rem 0 0; max-width: 36rem; font-family: var(--hand); }
.pager a { text-decoration: none; display: grid; font-size: 1.15rem; line-height: 1.2; }
.pager a span { font-size: 0.92rem; color: var(--ink-2); }
.pager a[rel="next"] { text-align: right; }
.pager a:hover { color: var(--haw); }
.colophon { padding: 2.5rem var(--gutter) 3rem; color: var(--ink-2); font-size: 0.9rem; line-height: 1.5; }
.colophon p { max-width: 70ch; margin: 0; }

/* ---------------------------------------------------------------- the index */
.home main { max-width: 100rem; margin: 0 auto; padding: 0 var(--gutter); }
.intro { display: grid; grid-template-columns: minmax(0, 3fr) minmax(18rem, 2fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: center; padding: 1rem 0 3rem; }
.intro .plate { position: static; grid-column: 1; grid-row: 1; }
.intro .plate canvas { max-width: none; }
.intro-text { grid-column: 2; grid-row: 1; }
.lede { font-size: 1.2rem; line-height: 1.55; }
.cast-note { color: var(--ink-2); }
.entries { list-style: none; margin: 0; padding: 0 0 2rem; display: grid; gap: 0; counter-reset: essay; }
.entry { counter-increment: essay; border-top: 1px solid var(--rule); }
.entry > a, .entry > div { display: grid; grid-template-columns: 3rem minmax(0, 18rem) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: clamp(1rem, 2.5vw, 2.25rem); padding: 1.4rem 0; text-decoration: none; align-items: start; }
.entry > a::before, .entry > div::before { content: counter(essay); grid-row: 1 / span 3; font: 700 1.9rem/1 var(--hand); color: var(--ink-2); padding-top: 0.2rem; }
.entry img { grid-row: 1 / span 3; grid-column: 2; width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--sheet); border-radius: 2px; box-shadow: 0 14px 30px -22px oklch(0.35 0.05 70 / 0.5); transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1); }
.entry > div::after { content: ""; grid-row: 1 / span 3; grid-column: 2; aspect-ratio: 16 / 9; border: 1.5px dashed var(--rule); border-radius: 2px; }
.entry .who { grid-column: 3; font: 400 1.1rem var(--hand); color: var(--ink-2); }
.entry .what { grid-column: 3; font: 650 1.55rem/1.2 var(--book); margin: 0.1rem 0 0.4rem; text-wrap: balance; }
.entry .desc { grid-column: 3; max-width: 60ch; color: var(--ink-2); }
.entry > a:hover .what { color: var(--haw); }
.entry > a:hover img { transform: translateY(-2px); }
.entry.is-pending { color: var(--ink-2); }

/* ---------------------------------------------------------------- plate alone (thumbnails, checks) */
.plate-only body { background: var(--sheet); }
.plate-only body > :not(main), .plate-only .essay, .plate-only .plate-ui, .plate-only .intro-text, .plate-only .entries { display: none !important; }
.plate-only .layout, .plate-only .intro { display: block; padding: 0; max-width: none; }
.plate-only .plate { position: static; }
.plate-only .plate canvas { width: 100vw; max-width: none; box-shadow: none; border-radius: 0; }

/* ---------------------------------------------------------------- narrow screens: the plate pins to the top */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .plate { grid-column: 1; grid-row: 1; top: 0; padding: 0.5rem 0 0.4rem; background: var(--ground); }
  .plate canvas { max-width: none; }
  .plate-ui { margin-top: 0.4rem; gap: 0.5rem; }
  .essay { grid-column: 1; grid-row: 2; }
  .step { min-height: 58vh; padding-top: 6vh; max-width: none; }
  .intro { grid-template-columns: minmax(0, 1fr); }
  .intro .plate, .intro-text { grid-column: 1; grid-row: auto; }
  .entry > a, .entry > div { grid-template-columns: 2.2rem minmax(0, 1fr); }
  .entry img, .entry > div::after { grid-column: 2; grid-row: auto; margin-bottom: 0.8rem; }
  .entry .who, .entry .what, .entry .desc { grid-column: 2; }
  .entry > a::before, .entry > div::before { grid-row: 1 / span 4; }
}
@media (prefers-reduced-motion: reduce) {
  .step, .plate canvas, .entry img, .plate-ui button { transition: none; }
}

/* tables from the essays (rank tables, signal tables), kept whole and scrollable */
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; max-width: 100%; }
.table-wrap table { border-collapse: collapse; font-size: 0.86rem; line-height: 1.4; min-width: 32rem; }
.table-wrap th, .table-wrap td { text-align: left; vertical-align: top; padding: 0.45rem 0.6rem 0.45rem 0; border-bottom: 1px solid var(--rule); }
.table-wrap th { font: 400 0.98rem var(--hand); color: var(--ink); border-bottom-width: 1.5px; }
