/* ==========================================================================
   THE REEL DEAL DECK — base
   --------------------------------------------------------------------------
   Reset, document defaults, layout primitives, typography and utilities.
   Consumes tokens.css only. No hard-coded colors, type sizes or spacing.
   ========================================================================== */

/* --------------------------------------------------------------- reset -- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Sticky-header clearance for #anchor jumps. site.js measures the real
     header and publishes --rdd-header-h; --s-9 is the no-JS fallback. */
  scroll-padding-top: calc(var(--rdd-header-h, var(--s-9)) + var(--s-4));
  background-color: var(--c-bg);
  color-scheme: light dark;
}

body {
  margin: 0;
  min-height: 100svh;
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--t-md);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Quotation marks and hyphens hang into the margin where the engine supports
     it (Safari today). Pure typographic warmth: costs nothing, degrades to
     nothing, and stops a pulled quote from looking bolted on. */
  hanging-punctuation: first last;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; display: block; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }

/* :not([fill]) so line-art SVGs that declare fill="none" keep it — a plain
   `svg { fill: currentColor }` would beat the presentation attribute. */
svg:not([fill]) { fill: currentColor; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button { background: none; border: 0; padding: 0; cursor: pointer; }

a { color: var(--c-accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

hr { border: 0; }

table { border-collapse: collapse; width: 100%; }

[hidden] { display: none !important; }

::selection {
  background-color: color-mix(in oklab, var(--c-egg) 40%, transparent);
  color: var(--c-text);
}

/* Universal focus treatment — every interactive thing gets a real ring. */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* -------------------------------------------------------------- layout -- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--s-4);
}

@media (min-width: 40rem) {
  .wrap { padding-inline: var(--s-6); }
}

.wrap--narrow { max-width: var(--wrap-narrow); }

.section {
  padding-block: var(--s-7);
}

@media (min-width: 48rem) {
  .section { padding-block: var(--s-9); }
}

.section--tight { padding-block: var(--s-6); }

.section--sunk {
  background-color: var(--c-bg-sunk);
}

/* Deep-water band. Re-maps the semantic tokens so anything nested inside
   (cards, pills, buttons, rules, inputs) stays legible without extra classes. */
.section--dark {
  --sec-dark-bg: var(--c-river);
  background-color: var(--sec-dark-bg);

  --c-bg:          var(--sec-dark-bg);
  --c-bg-sunk:     color-mix(in oklab, var(--sec-dark-bg) 82%, var(--c-ink));
  --c-surface:     color-mix(in oklab, var(--sec-dark-bg) 88%, var(--c-ink));
  --c-border:      color-mix(in oklab, var(--sec-dark-bg) 76%, var(--c-paper));
  --c-text:        var(--c-paper);
  /* mixes chosen to hold >=4.5:1 against the river band */
  --c-text-muted:  color-mix(in oklab, var(--c-paper) 84%, var(--sec-dark-bg));
  --c-text-faint:  color-mix(in oklab, var(--c-paper) 70%, var(--sec-dark-bg));
  --c-accent:      color-mix(in oklab, var(--c-egg) 58%, var(--c-paper));
  --c-accent-text: var(--c-ink);
  --c-focus:       var(--c-egg);

  color: var(--c-text);
}

/* The river band sinks further than the page so it reads as a distinct, deeper
   stratum rather than a lighter panel. */
.section--dark { --sec-dark-bg: color-mix(in oklab, var(--c-river) 52%, var(--c-ink)); }

/* ---------------------------------------------------------- typography -- */

.h1, .h2, .h3 {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-tight);
  color: var(--c-text);
  text-wrap: balance;
  /* A display-size heading can hold a word longer than a 320px viewport —
     "multigenerational" at --t-3xl is ~340px. Without this the word pushes the
     whole document sideways. Let it break rather than overflow; hyphens make
     the break read as typography rather than as damage. */
  overflow-wrap: break-word;
  hyphens: auto;
}

.h1 { font-size: var(--t-3xl); }
.h2 { font-size: var(--t-2xl); line-height: var(--lh-tight); }
.h3 { font-size: var(--t-xl);  line-height: var(--lh-snug); }

/* Optical correction. --ls-tight (-0.02em) is drawn for the 4.5rem end of the
   display clamp; at the 2.5rem phone end the same tracking closes the serif
   counters up and the headline reads cramped. Ease it off on small screens
   and let tight lines breathe a touch more. */
@media (max-width: 47.9375rem) {
  .h1 { letter-spacing: -0.012em; line-height: 1.14; }
  .h2 { letter-spacing: -0.012em; line-height: 1.16; }
  .h3 { letter-spacing: -0.008em; }
}

/* ---- the corner index -------------------------------------------------- */
/* The site's repeating motif is a playing card's corner index. Every eyebrow
   on the site is already set in index tracking and small caps; giving it the
   suit pip makes that resemblance deliberate rather than accidental, and it
   costs no markup. The pip is decorative — aria-hidden is impossible on a
   pseudo-element, but a lone "♦" is announced as a symbol, not as content,
   and it is inside a label that already reads as a kicker. */
.eyebrow {
  display: block;
  font-family: var(--f-body);
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-index);
  text-transform: uppercase;
  color: var(--c-text-faint);
  text-wrap: pretty;
}

.eyebrow::before {
  content: "\2666";
  /* the pip is a glyph, not a letter — index tracking would float it away */
  letter-spacing: 0;
  margin-inline-end: 0.6em;
  color: var(--c-accent);
}

/* Nested eyebrows inside a chip-like element would double the mark. */
.pill .eyebrow::before,
.btn .eyebrow::before { content: none; margin: 0; }

.lede {
  font-size: var(--t-lg);
  line-height: var(--lh-snug);
  color: var(--c-text-muted);
  max-width: var(--measure);
  text-wrap: pretty;
}

/* A three-line lede at --lh-snug on a 375px screen sets as a solid block.
   Relax it where the line count is highest. */
@media (max-width: 47.9375rem) {
  .lede { line-height: var(--lh-body); }
}

.text-muted { color: var(--c-text-muted); }
.text-faint { color: var(--c-text-faint); }
.text-center { text-align: center; }
.measure { max-width: var(--measure); }
.mx-auto { margin-inline: auto; }

/* ------------------------------------------------------------- .prose --- */

.prose {
  max-width: var(--measure);
  color: var(--c-text-muted);
  font-size: var(--t-md);
  line-height: var(--lh-body);
}

.prose > * + * { margin-block-start: var(--s-4); }

.prose p { text-wrap: pretty; }

.prose h2,
.prose h3 {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-snug);
  color: var(--c-text);
  text-wrap: balance;
}

.prose h2 { font-size: var(--t-xl); margin-block-start: var(--s-7); }
.prose h3 { font-size: var(--t-lg); margin-block-start: var(--s-6); }
.prose h2 + p,
.prose h3 + p { margin-block-start: var(--s-3); }

.prose strong { color: var(--c-text); font-weight: 650; }

.prose em { font-style: italic; }

/* :not(.btn) matters. A button inside prose is a button, not a link in a
   sentence, and this rule outranks .btn's own color — (0,1,1) against (0,1,0).
   It was repainting every .btn in an article the accent color, which on
   .btn--primary means accent text on an accent background: the order button in
   blog posts was green on green, with a prose underline to match. */
.prose a:not(.btn) {
  color: var(--c-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.prose a:not(.btn):hover { text-decoration-thickness: 2px; }

.prose ul,
.prose ol {
  padding-inline-start: var(--s-5);
  display: grid;
  gap: var(--s-2);
}

.prose li { list-style: revert; }
.prose ul li::marker { color: var(--c-accent); }
.prose ol li::marker { color: var(--c-text-faint); font-variant-numeric: tabular-nums; }

/* Card-corner index as a list marker — the repeating motif. */
.prose ul.list-index,
ul.list-index {
  padding-inline-start: 0;
  display: grid;
  gap: var(--s-3);
}
ul.list-index > li {
  list-style: none;
  position: relative;
  padding-inline-start: var(--s-6);
}
ul.list-index > li::before {
  content: "\2666";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  font-size: var(--t-sm);
  line-height: var(--lh-body);
  color: var(--c-accent);
}

/* ---- pulled quote, set as the deck's own info card ---------------------- */
/* The 56th card in the deck is Ken and Audrey's printed note. When their words
   appear on the site they should look like that card: paper stock, a green
   keyline down the binding edge, the copy in the display serif, and the corner
   index repeated bottom-right the way a real face does it. This is the one
   place on the site where warmth is the point, so it gets the treatment. */

.prose blockquote,
blockquote.rdd-cardnote {
  position: relative;
  margin: 0;
  padding: var(--s-5) var(--s-6) var(--s-5) var(--s-5);
  border: 1px solid var(--c-border);
  border-inline-start: 3px solid var(--c-accent);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  background-color: var(--c-surface);
  box-shadow: var(--shadow-1);
  font-family: var(--f-display);
  font-size: var(--t-lg);
  line-height: var(--lh-snug);
  color: var(--c-text);
  text-wrap: pretty;
}

/* The mirrored corner index. Rotated 180deg, faint, bottom-right — you only
   notice it on the second look, which is the intention. */
.prose blockquote::after,
blockquote.rdd-cardnote::after {
  content: "\2666";
  position: absolute;
  inset-inline-end: var(--s-3);
  inset-block-end: var(--s-3);
  transform: rotate(180deg);
  font-size: var(--t-sm);
  line-height: 1;
  color: color-mix(in oklab, var(--c-accent) 45%, transparent);
  pointer-events: none;
}

.prose blockquote > * + *,
blockquote.rdd-cardnote > * + * { margin-block-start: var(--s-4); }

.prose blockquote cite,
blockquote.rdd-cardnote cite {
  display: block;
  margin-block-start: var(--s-4);
  font-family: var(--f-body);
  font-size: var(--t-sm);
  font-style: normal;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--c-text-faint);
}

.prose code {
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  background-color: var(--c-bg-sunk);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 0 var(--s-1);
}

.prose hr {
  height: 1px;
  background-color: var(--c-border);
  margin-block: var(--s-7);
}

/* ----------------------------------------------------------- utilities -- */

.visually-hidden:not(:focus):not(:active) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--s-4);
  top: 0;
  z-index: 200;
  transform: translateY(-140%);
  padding: var(--s-3) var(--s-4);
  background-color: var(--c-accent);
  color: var(--c-accent-text);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline-offset: -4px;
}

/* Owl selector — vertical rhythm without touching children directly. */
.stack { display: block; }
.stack > * + * { margin-block-start: var(--gap, var(--s-4)); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap, var(--s-3));
}

.rule {
  display: block;
  width: 100%;
  height: 1px;
  border: 0;
  margin: 0;
  background-color: var(--c-border);
}

.rule--index {
  height: auto;
  background: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-4);
  color: var(--c-text-faint);
}
.rule--index::before,
.rule--index::after {
  content: "";
  height: 1px;
  background-color: var(--c-border);
}
