/* PuzzleDuo — base.css
   Reset, document defaults, typography, focus, motion. Structure only.
   Components live in site.css / create.css / play.css. */

*, *::before, *::after { box-sizing: border-box; }
/* `hidden` must win over any display rule: several components are inline-flex,
   which would otherwise defeat the attribute. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--paper-1);
  color: var(--ink-700);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Paper grain. Behind all content (negative z-index) so paper-0 cards sit clean
   on top of it, exactly as §4 requires: grain on paper-1 / paper-2 only. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(var(--grain-a) 1px, transparent 1.2px),
    radial-gradient(var(--grain-b) 1px, transparent 1.2px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink-900);
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 30, "WONK" 0;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-head); letter-spacing: var(--ls-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
h3, h4 {
  font-family: var(--font-ui);
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-h3);
  font-weight: 700;
}

p { margin: 0 0 var(--s4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--clay-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--clay-600); }

ul, ol { margin: 0 0 var(--s4); padding-left: 1.25em; }
li { margin-bottom: var(--s2); }

img, svg, canvas, video { display: block; max-width: 100%; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

strong, b { font-weight: 700; color: var(--ink-900); }

code, kbd, samp, .mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-mono);
}

hr {
  border: 0;
  border-top: 1px solid var(--line-100);
  margin: var(--s8) 0;
}

::selection {
  background: var(--clay-100);
  color: var(--ink-900);
}

/* Focus is never removed. 2px ring + 2px paper offset, everywhere. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---- layout helpers ------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--inner { max-width: var(--w-inner); }
.prose { max-width: var(--w-prose); }
.prose p { max-width: 68ch; }

.section { padding-block: var(--s12); }
@media (min-width: 768px) { .section { padding-block: var(--s16); } }
@media (min-width: 1024px) { .section { padding-block: var(--s24); } }

.stack > * + * { margin-top: var(--s4); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s4);
  top: var(--s4);
  z-index: 300;
  transform: translateY(-160%);
  background: var(--paper-0);
  color: var(--ink-900);
  border: 1px solid var(--line-300);
  border-radius: var(--r-btn);
  padding: 10px 16px;
  font-size: var(--fs-small);
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--e2);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); outline-offset: 3px; }

/* ---- type utilities ------------------------------------------------------ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--clay-100);
  color: var(--clay-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--clay-600);
  flex: none;
}

.label {
  display: block;
  font-size: var(--fs-label);
  line-height: 1.2;
  letter-spacing: var(--ls-label);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 0;
}

.lede {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body-lg);
  color: var(--ink-700);
  max-width: 46ch;
}

.muted { color: var(--ink-500); }
.small { font-size: var(--fs-small); line-height: var(--lh-small); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: var(--ls-mono); }

/* Fraunces italic carries exactly one word per headline, in clay. */
.wonk {
  font-style: italic;
  color: var(--clay-600);
  font-variation-settings: "SOFT" 30, "WONK" 1;
}

@media (max-width: 480px) {
  :root {
    --fs-h1: 2.25rem;
    --fs-h2: 1.625rem;
    --fs-h3: 1.125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body::after { display: none; }
}

/* ============================================================ safety net ===
   Added during acceptance. Two classes of problem, both measured in the
   browser rather than guessed at:
   1. decorative overflow (hero ghost layer, gallery bleed) must not create a
      horizontal scrollbar — the page is a poster, not a canvas.
   2. grid/flex children default to min-width:auto, so one long row of pieces
      can inflate a track far past its column. Every scrollable region below
      opts out explicitly. */
html, body { overflow-x: clip; }

/* nested paper sizes must STACK, not queue: four grid items, one cell */
.pf-sizes__nest > * { grid-area: 1 / 1; }
