/* THE COVER STORY — foundation: tokens, reset, type, grid, running header, links */

:root {
  --paper: #F6F2EA;
  --paper-deep: #EEE7D9;
  --sand: #E3D7C0;
  --ink: #16130F;
  --ink-2: #3A342C;
  --muted: #5E564B;
  --accent: #1B3A57;
  --rule: rgba(22, 19, 15, .3);
  --rule-soft: rgba(22, 19, 15, .15);

  --f-display: "Instrument Serif", "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-text: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-ui: "Instrument Sans", "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;

  --margin: clamp(20px, 3.6vw, 56px);
  --gutter: clamp(14px, 1.7vw, 28px);
  --header-h: 48px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image: url("assets/grain.svg"); /* faint paper grain */
  color: var(--ink);
  font: 400 1.0625rem/1.62 var(--f-text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
em { font-style: italic; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .28em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }
.on-dark :focus-visible { outline-color: var(--paper); }

.skip {
  position: absolute; left: 12px; top: -64px; z-index: 100;
  padding: 10px 16px; background: var(--ink); color: var(--paper);
  font: 500 13px/1 var(--f-ui); text-decoration: none;
}
.skip:focus { top: 10px; }

.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- layout primitives ---------- */
.wrap { width: 100%; max-width: 1480px; margin-inline: auto; padding-inline: var(--margin); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.section { padding-top: clamp(72px, 10vw, 150px); }

/* ---------- type ---------- */
.display {
  font: 400 clamp(46px, 7.4vw, 116px)/.94 var(--f-display);
  letter-spacing: -.018em;
  text-wrap: balance;
}
.display em, .pq__text em { color: var(--accent); }

.kicker, .runfolio, .note, .slot-label {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  line-height: 1.5;
  text-transform: uppercase;
}
.kicker { color: var(--muted); }
.note {
  max-width: 30ch;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: none;
  font-size: 13px;
  line-height: 1.55;
}

/* running folio: hairline + page number + issue, top of every spread */
.runfolio {
  position: relative;
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 0 0;
  margin-bottom: clamp(36px, 5vw, 72px);
  color: var(--muted);
}
.runfolio::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: var(--ink); transform-origin: left;
}
.runfolio span:first-child { color: var(--ink); }

/* hairline at the foot of a ruled row (motion.css draws it in) */
.draw { position: relative; }
.draw::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--rule); transform-origin: left;
}
.runfolio.draw::after { content: none; }
.runfolio span:last-child { display: none; }
@media (min-width: 640px) { .runfolio span:last-child { display: inline; } }

/* ---------- running header / table of contents ---------- */
.runhead {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: clamp(16px, 3vw, 40px);
  height: var(--header-h);
  padding-inline: var(--margin);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule-soft);
}
.runhead__mark {
  display: none;
  font: 400 22px/1 var(--f-display); letter-spacing: -.01em; text-decoration: none; white-space: nowrap;
}
.runhead__mark em { color: var(--accent); }
.runhead__issue { display: none; font: 500 11px/1 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

.toc { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.toc::-webkit-scrollbar { display: none; }
.toc ol { display: flex; gap: clamp(20px, 2.4vw, 38px); width: max-content; margin-left: auto; padding-right: 8px; }
.toc a {
  display: flex; align-items: baseline; gap: .55em; padding: 14px 0;
  text-decoration: none; white-space: nowrap;
  font: 500 11px/1 var(--f-ui); letter-spacing: .14em; text-transform: uppercase;
  border-bottom: 1px solid transparent;
  transition: color .4s var(--ease);
}
.toc__f { font: italic 400 17px/1 var(--f-display); letter-spacing: 0; color: var(--accent); font-variant-numeric: lining-nums tabular-nums; }
.toc a:hover, .toc a[aria-current="true"] { color: var(--accent); }
.toc a[aria-current="true"] .toc__t { text-decoration: underline; text-underline-offset: 7px; text-decoration-thickness: 1px; }
.toc li:last-child a { color: var(--accent); }

@media (max-width: 639px) {
  .toc { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .toc ol { margin-left: 0; }
}
@media (min-width: 760px) { .runhead__mark { display: block; } }
@media (min-width: 1180px) { .runhead__issue { display: block; } }

/* ---------- buttons, understated links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .8em;
  padding: 15px 22px 14px;
  border: 1px solid var(--ink); border-radius: 0;
  font: 500 12px/1 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; text-decoration: none;
  transition: background .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn span { transition: transform .5s var(--ease); }
.btn:hover span { transform: translateX(4px); }

.num, .yr, .stat__n { font-variant-numeric: lining-nums tabular-nums; }
