/* Positive Primer — site styles
   Palette: parchment, ink, sage, dusty rose, ochre, slate blue.
   Type: Manrope (titles), Public Sans (body), IBM Plex Mono (labels). */

:root {
  --paper: #F6F2EA;
  --card: #FFFDF8;
  --ink: #2B2620;
  --ink-soft: #4A433A;
  --muted: #776E62;
  --line: #E3DBCB;
  --line-strong: #CFC4AF;
  --slate: #5E7388;
  --sage: #7F9172;
  --rose: #C08A82;
  --ochre: #B98935;
  --focus: #5E7388;

  --font-title: "Manrope", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 10px;
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--slate); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-title); line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

.label {
  font: 500 .75rem/1 var(--font-mono);
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}

/* ---------- Header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 26px; height: 20px; border-radius: 3px; background: var(--card);
  border: 2px solid var(--ink); position: relative;
}
.brand-mark::before { /* index-card tab */
  content: ""; position: absolute; left: 3px; top: -7px; width: 10px; height: 6px;
  background: var(--ochre); border: 2px solid var(--ink); border-bottom: 0; border-radius: 2px 2px 0 0;
}
.brand-name { font: 800 1.15rem/1 var(--font-title); letter-spacing: -0.02em; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  font: 600 .95rem/1 var(--font-body); color: var(--ink-soft); text-decoration: none;
  padding: 10px 12px; border-radius: 8px;
}
.site-nav a:hover { background: #EDE6D8; }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-block: 24px 32px; font-size: .9rem; color: var(--muted); }
.footer-inner nav { display: flex; gap: 16px; }
.footer-inner a { color: var(--muted); }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem/1 var(--font-body); padding: 13px 18px; min-height: 46px;
  border-radius: 8px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink);
  text-decoration: none; cursor: pointer; transition: background .15s, transform .1s;
}
.btn:hover { background: #EFE9DC; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #3D362E; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn svg { width: 18px; height: 18px; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 500 .85rem/1 var(--font-mono); letter-spacing: .02em;
  min-width: 40px; height: 38px; padding: 0 12px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--card); color: var(--ink-soft);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none;
}
.chip:hover { border-color: var(--ink-soft); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); }
.chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--paper); }

/* ---------- Home ---------- */
.hero { padding-block: 56px 40px; display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero { grid-template-columns: 1fr 1.05fr; padding-block: 80px 56px; } }
.hero p.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 34ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-card { transform: rotate(-1.5deg); filter: drop-shadow(0 18px 30px rgba(43,38,32,.14)); }
.hero-card .stage { pointer-events: none; }

.section { padding-block: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.year-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.year-grid .chip { height: 48px; min-width: 52px; font-size: .95rem; }

.cat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.cat-card {
  display: block; text-decoration: none; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-top: 6px solid var(--c); border-radius: var(--radius);
  padding: 16px 18px; transition: transform .15s, box-shadow .15s;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(43,38,32,.08); }
.cat-card h3 { margin-bottom: 4px; }
.cat-card p { margin: 0; color: var(--muted); font-size: .95rem; }

.how { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: how; }
.how div { border-top: 1.5px solid var(--ink); padding-top: 14px; }
.how div::before { counter-increment: how; content: "0" counter(how); font: 500 .8rem var(--font-mono); color: var(--muted); display: block; margin-bottom: 6px; }
.how p { color: var(--ink-soft); margin: 0; }

/* ---------- Browse ---------- */
.page-head { padding-block: 40px 8px; }
.page-head p { color: var(--ink-soft); max-width: 60ch; }
.filters { display: grid; gap: 14px; padding: 18px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.filter-row { display: grid; gap: 8px; }
@media (min-width: 720px) { .filter-row { grid-template-columns: 96px 1fr; align-items: center; } }
.search {
  width: 100%; max-width: 520px; height: 48px; padding: 0 16px 0 44px;
  font: 400 1rem var(--font-body); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--card)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23776E62' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 15px center;
}
.search:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(94,115,136,.25); }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.results-bar .label { font-size: .8rem; }

.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.p-card {
  position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 18px 16px; margin-top: 14px; min-height: 190px;
  transition: transform .15s, box-shadow .15s;
}
.p-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(43,38,32,.10); }
.p-card .tab {
  position: absolute; top: -14px; left: 14px; height: 28px; padding: 0 12px;
  display: flex; align-items: center; border-radius: 6px 6px 0 0;
  background: var(--c); color: #fff; font: 600 .78rem/1 var(--font-title); letter-spacing: .02em;
}
.p-card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.p-card p { color: var(--ink-soft); font-size: .95rem; margin: 0 0 14px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.p-card .meta { display: flex; justify-content: space-between; gap: 8px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.badge { font: 500 .7rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 4px; padding: 3px 6px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
[hidden] { display: none !important; }

/* ---------- Primer page / presenter ---------- */
.present { padding-block: 24px 8px; }
.crumbs { font-size: .9rem; margin-bottom: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.toolbar .spacer { flex: 1; }
.kbd-hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
kbd { font: 500 .78rem var(--font-mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--card); }
.notes { display: grid; gap: 24px; margin-top: 32px; }
@media (min-width: 800px) { .notes { grid-template-columns: 2fr 1fr; } }
.notes dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .95rem; }
.notes dt { font: 500 .75rem/1.9 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.notes dd { margin: 0; }
.random-filters { margin-bottom: 8px; color: var(--ink-soft); font-size: .95rem; }

/* ---------- The slide (16:9) ----------
   Everything inside .slide is sized in em; primer.js sets the slide's font-size to
   width / 64, so the slide scales identically on a laptop, a projector and in PDF. */
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; container-type: inline-size; }
.slide {
  position: absolute; inset: 0; overflow: hidden;
  font-size: 1.5625cqi; /* fallback = 100% / 64 before JS runs */
  background:
    linear-gradient(var(--cat) 0 0) left 0 top 0 / 100% .55em no-repeat,
    var(--card);
  color: var(--ink);
  border-radius: .9em;
  box-shadow: 0 0 0 1px var(--line), 0 .6em 1.6em rgba(43,38,32,.10);
  display: grid; grid-template-rows: auto 1fr auto;
  padding: 2.4em 4.2em 2em;
}
.slide-tab {
  justify-self: start; grid-row: 1; grid-column: 1;
  background: var(--cat); color: #fff; font: 700 1.35em/1 var(--font-title); letter-spacing: .01em;
  display: block; height: 2.1em; line-height: 2.1em; padding: 0 .95em; border-radius: .35em;
}
.slide-years {
  grid-row: 1; grid-column: 1; justify-self: end; align-self: center;
  font: 500 1.05em/1 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.slide-body { grid-row: 2; display: flex; flex-direction: column; justify-content: center; min-height: 0; padding: 1em 0; }
.slide-prompt {
  font: 800 4.2em/1.12 var(--font-title); letter-spacing: -.02em; margin: 0;
  text-wrap: balance; color: var(--ink);
}
.slide-sub { font: 500 1.9em/1.35 var(--font-body); color: var(--ink-soft); margin: .9em 0 0; text-wrap: balance; }
.slide-foot {
  grid-row: 3; display: flex; justify-content: space-between; align-items: baseline;
  border-top: .1em solid var(--line); padding-top: .9em;
  font: 500 .95em/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}

/* Full screen: the stage fills the screen with dark surround, slide fitted 16:9 */
.fs-exit, .fs-next { display: none; }
.stage:fullscreen, .stage.pseudo-fs {
  background: #1E1A16; aspect-ratio: auto; width: 100vw; height: 100vh; display: grid; place-items: center;
}
.stage:-webkit-full-screen { background: #1E1A16; width: 100vw; height: 100vh; }
.stage.pseudo-fs { position: fixed; inset: 0; z-index: 100; height: 100dvh; }
.stage:fullscreen .slide, .stage.pseudo-fs .slide, .stage:-webkit-full-screen .slide {
  position: relative; inset: auto; width: min(100vw, 177.78vh); height: auto; aspect-ratio: 16 / 9; border-radius: 0;
  box-shadow: none;
}
.stage:fullscreen .fs-exit, .stage.pseudo-fs .fs-exit, .stage:-webkit-full-screen .fs-exit,
.stage:fullscreen .fs-next, .stage.pseudo-fs .fs-next, .stage:-webkit-full-screen .fs-next {
  display: block; position: absolute; z-index: 2; border: 0; cursor: pointer;
  font: 600 16px/1 var(--font-body); color: #F6F2EA; background: rgba(30,26,22,.55);
  border-radius: 999px; padding: 12px 16px; opacity: .25; transition: opacity .2s;
}
.fs-exit { top: 14px; right: 14px; }
.fs-next { bottom: 14px; right: 14px; }
.stage:hover .fs-exit, .stage:hover .fs-next, .fs-exit:focus-visible, .fs-next:focus-visible { opacity: 1; }
body.no-scroll { overflow: hidden; }

/* Off-screen copy used to make the PDF at a fixed size */
.pdf-render { position: fixed; left: -10000px; top: 0; width: 1600px; height: 900px; }
.pdf-render .stage { width: 1600px; height: 900px; }
.pdf-render .slide { border-radius: 0; box-shadow: none; }

/* ---------- Prose pages ---------- */
.prose { padding-block: 40px; }
.prose > * { max-width: 68ch; }
.prose h2 { margin-top: 1.4em; }
.prose p, .prose li { color: var(--ink-soft); }

@media (max-width: 520px) {
  .header-inner { height: 58px; gap: 8px; }
  .brand-name { font-size: 1.02rem; }
  .site-nav a { padding: 10px 7px; font-size: .9rem; }
  .toolbar .btn { flex: 1 1 auto; }
  .toolbar .spacer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .hero-card { transform: none; }
}
@media print {
  .site-header, .site-footer, .toolbar, .kbd-hint, .notes, .crumbs { display: none !important; }
}
/* html2canvas draws text lower than the browser does; nudge the tab label up in the PDF copy */
.pdf-render .slide-tab { line-height: 1.75em; padding-bottom: .35em; height: 2.1em; }
