/* ==========================================================================
   emma · base · type, layout primitives, focus, motion, reflow
   Depends on tokens.css. No component styling here.
   ========================================================================== */

/* ---- fonts: vendored, self-hosted, SIL OFL 1.1 (licences in fonts/) ------ */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("fonts/fraunces-normal-latin.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 300 700; font-display: swap; src: url("fonts/fraunces-italic-latin.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("fonts/sourcesans-normal-latin.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: italic; font-weight: 300 700; font-display: swap; src: url("fonts/sourcesans-italic-latin.woff2") format("woff2"); }

/* ---- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 100%; scroll-padding-top: var(--s-6); }
body {
  margin: 0; min-height: 100vh;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-text); font-size: var(--fs-md); line-height: var(--lh-text);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: var(--s-6) 0; }
ul, ol { margin: 0; padding-left: 1.25em; }
li + li { margin-top: var(--s-2); }
p { margin: 0; }
p + p { margin-top: var(--s-3); }
strong, b { font-weight: 600; }
small, .small { font-size: var(--fs-sm); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
abbr[title] { text-decoration: none; }
figure { margin: 0; }
dl, dd { margin: 0; }
table { border-collapse: collapse; }

/* ---- type ----------------------------------------------------------------- */
h1, h2, h3, h4, .display {
  margin: 0; color: var(--ink);
  font-family: var(--font-display); font-weight: 500;
  font-variation-settings: var(--display-soft); font-optical-sizing: auto;
  letter-spacing: var(--tracking-display); line-height: var(--lh-snug);
  text-wrap: balance; hyphens: manual; overflow-wrap: normal;
  font-variant-numeric: lining-nums proportional-nums;
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
.display-xl { font-size: var(--fs-4xl); line-height: 1.05; }
.lede { font-size: var(--fs-lg); line-height: 1.5; color: var(--cocoa); text-wrap: pretty; max-width: var(--measure); }
.eyebrow { font-size: var(--fs-xs); line-height: 1.3; font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
.caption { font-size: var(--fs-sm); line-height: 1.45; color: var(--muted); }
.muted { color: var(--cocoa); }
.measure { max-width: var(--measure); }
.quote { font-family: var(--font-display); font-style: italic; font-weight: 400; font-variation-settings: "SOFT" 80, "WONK" 0; font-size: 1.1em; line-height: 1.5; quotes: "\201C" "\201D" "\2018" "\2019"; }
.quote::before { content: open-quote; }
.quote::after { content: close-quote; }
.tnum { font-variant-numeric: tabular-nums lining-nums; }
.nowrap { white-space: nowrap; }
.token { font-family: var(--font-mono); font-size: 0.92em; overflow-wrap: anywhere; } /* emails, filenames, codes: the only place a word may break */
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; text-decoration-color: var(--line-strong); border-radius: var(--r-xs); }
a:hover { text-decoration-color: currentColor; }
.link-coral { color: var(--coral-ink); text-decoration-color: currentColor; }

/* ---- focus: a real outline, so it survives forced-colors ----------------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.on-dark :focus-visible, .on-dark:focus-visible { outline-color: var(--focus-on-dark); }
.btn-primary:focus-visible { outline-color: var(--focus-on-coral); outline-offset: 3px; }
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid CanvasText; }
  .btn, .chip, .state, .check, .input { forced-color-adjust: auto; border: 1px solid CanvasText; }
}

/* ---- skip link, visually hidden ------------------------------------------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s-4); top: var(--s-4); z-index: 60; background: var(--raised); color: var(--ink); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); box-shadow: var(--sh-2); text-decoration: none; font-weight: 600; }
.skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; box-shadow: none; }

/* ---- layout primitives ----------------------------------------------------- */
.wrap { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-app { max-width: var(--app-max); }
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-8); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; min-width: 0; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.grid-2, .grid-3 { display: grid; gap: var(--s-6); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid-2 > *, .grid-3 > *, .row > *, .stack > * { min-width: 0; }
.split { display: grid; gap: var(--s-8); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } .split-even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.split > * { min-width: 0; }
section { min-width: 0; }
.section { padding-block: var(--s-16); }
.section + .section { border-top: 1px solid var(--hairline); }
.section-head { margin-bottom: var(--s-8); max-width: var(--measure); }
.section-head .eyebrow { margin-bottom: var(--s-3); }
.section-head p { margin-top: var(--s-3); }

/* ---- reflow: 320px at 200% text ------------------------------------------- */
/* No container may clip overflow to pass a width test. Content wraps instead. */
body { overflow-wrap: break-word; }   /* last resort only: a word breaks when it alone cannot fit a line. Never `anywhere`, which shrinks min-content and breaks words early. */
@media (max-width: 420px) {
  /* display sizes follow the viewport, so a single word always fits the column even at 200% text */
  h1, .display-xl { font-size: clamp(1.25rem, 9vw, 2.375rem); }
  h2 { font-size: clamp(1.125rem, 7.5vw, 1.875rem); }
  h3 { font-size: clamp(1rem, 6.5vw, 1.5rem); }
  h4 { font-size: clamp(1rem, 6vw, 1.25rem); }
  h1, h2, h3, .display { hyphens: auto; }
  .btn { white-space: normal; text-align: center; }
  .wrap { padding-inline: 16px; }  /* px: the 16px gutter must not double with the text size */
}

/* ---- utilities -------------------------------------------------------------- */
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); } .mt-12 { margin-top: var(--s-12); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); } .mb-8 { margin-bottom: var(--s-8); }
.gap-2 { gap: var(--s-2); } .gap-4 { gap: var(--s-4); } .gap-6 { gap: var(--s-6); }
.ta-c { text-align: center; }
.w-full { width: 100%; }
