/* /kit/type.css — the site's type system. One mix of families for every page.
   Link it after tokens.css and base.css:   <link rel="stylesheet" href="/kit/type.css">
   Guide: docs/site/type.md · specimen: /lab/type/

   The idea: a Mexican sign shop and its print shop. Five lettering voices from the rótulo and
   lotería references (docs/moodboard.md), each with one job, and one Clarendon text face that
   shares their slab shapes and does all the reading.

     sign    Yellowtail              the names. A short word painted large.
     brush   Mr Dafoe                asides in a brush hand: taglines, "more to come".
     slab    Ultra                   page titles, dates, numerals. Caps and figures only.
     fat     Shrikhand               place names.
     caps    Big Shoulders Display   eyebrows, labels, buttons, section headings (lotería titles).
     text    Besley                  body, forms, small print, long headings. Its bold italic sets the "&".

   A page rarely needs more than four of them. Fonts load only when a page uses them. */

@import url("https://fonts.googleapis.com/css2?family=Besley:ital,wght@0,400..800;1,400..800&family=Big+Shoulders+Display:wght@600..900&family=Mr+Dafoe&family=Shrikhand&family=Ultra&family=Yellowtail&display=swap");

:root {
  /* ---------- families ---------- */
  --type-sign: "Yellowtail", "Mr Dafoe", cursive;
  --type-brush: "Mr Dafoe", "Yellowtail", cursive;
  --type-slab: "Ultra", "Besley", Georgia, serif;
  --type-fat: "Shrikhand", "Ultra", Georgia, serif;
  --type-caps: "Big Shoulders Display", "Oswald", "Arial Narrow", Impact, sans-serif;
  --type-text: "Besley", Georgia, "Times New Roman", serif;

  /* ---------- sizes (phone → desktop) ---------- */
  --type-size-title: clamp(2.6rem, 1.75rem + 4.4vw, 5.25rem);       /* page title */
  --type-size-heading: clamp(1.6rem, 1.38rem + 1.05vw, 2.2rem);     /* section heading */
  --type-size-subhead: clamp(1.14rem, 1.08rem + .32vw, 1.34rem);
  --type-size-lead: clamp(1.14rem, 1.05rem + .48vw, 1.4rem);
  --type-size-body: clamp(1rem, .965rem + .18vw, 1.125rem);         /* 16 → 18 px */
  --type-size-small: clamp(.86rem, .84rem + .1vw, .92rem);          /* never below 13.75 px */
  --type-size-eyebrow: clamp(.84rem, .8rem + .22vw, 1rem);
  --type-size-label: .875rem;
  --type-size-button: .95rem;
  --type-size-script: clamp(1.65rem, 1.35rem + 1.5vw, 2.5rem);
  --type-size-sign: clamp(3.4rem, 2.2rem + 6vw, 7rem);
  --type-size-fat: clamp(1.2rem, 1.08rem + .6vw, 1.6rem);
  --type-size-numeral: clamp(2.5rem, 1.7rem + 4vw, 4.75rem);        /* countdown, big figures */
  --type-size-date: clamp(1.3rem, 1.1rem + 1vw, 1.95rem);           /* 11 · 13 · 2027 */

  /* ---------- colours for type (each passes AA at its role's size on cream, sand and aqua) ---------- */
  --type-ink: var(--moonlit-ocean);
  --type-ink-soft: color-mix(in oklab, var(--moonlit-ocean) 80%, var(--cannoli-cream));
  --type-accent: color-mix(in oklab, var(--baltic-amber) 72%, var(--moonlit-ocean));   /* amber, deepened so text passes */
  --type-paper: var(--cannoli-cream);
  --type-shade: var(--iced-aqua);          /* the offset shadow behind a slab title */
  --type-mid: var(--blue-heaven);          /* second shadow step */
  --type-edge: var(--baltic-amber);        /* last edge of an extrusion; stars, dashes, swashes */

  /* ---------- the older tokens in tokens.css now point at the system ----------
     Rules written against them follow along. --font-display used to be Instrument Serif and
     --font-text Inter: check widths where they were used (Besley is wider than both). */
  --font-text: var(--type-text);
  --font-display: var(--type-text);
  --font-label: var(--type-caps);
  --font-condensed: var(--type-caps);
  --font-sign: var(--type-sign);
  --font-script: var(--type-sign);
  --font-rotulo: var(--type-slab);
  --font-slab: var(--type-slab);
  --font-fat-italic: var(--type-fat);
  --font-didone: var(--type-fat);
  --font-editorial: var(--type-text);
  --font-hand: var(--type-brush);
  --font-tuscan: var(--type-slab);
  --tracking-label: .14em;
}

/* ---------- defaults for the base classes (base.css) ---------- */
body { font-family: var(--type-text); font-size: var(--type-size-body); line-height: 1.6; font-variant-numeric: lining-nums; }
.label {
  font-family: var(--type-caps); font-weight: 700; font-size: var(--type-size-label);
  line-height: 1.2; letter-spacing: .14em; text-transform: uppercase;
}
.btn, .t-button {
  font-family: var(--type-caps); font-weight: 800; font-size: var(--type-size-button);
  line-height: 1.1; letter-spacing: .12em; text-transform: uppercase;
}
.display { font-family: var(--type-text); }

/* ---------- roles ---------- */

/* Page title. One per page. Caps, short (one to three words). */
.t-title {
  font-family: var(--type-slab); font-weight: 400; font-size: var(--type-size-title);
  line-height: .98; letter-spacing: .012em; text-transform: uppercase; text-wrap: balance;
  color: var(--type-ink); margin: 0;
}
/* Section heading: a lotería card's title. */
.t-heading {
  font-family: var(--type-caps); font-weight: 800; font-size: var(--type-size-heading);
  line-height: 1.04; letter-spacing: .035em; text-transform: uppercase; text-wrap: balance;
  color: var(--type-ink); margin: 0;
}
/* A heading inside a section, or any heading long enough to be a sentence. */
.t-subhead {
  font-family: var(--type-text); font-weight: 700; font-size: var(--type-size-subhead);
  line-height: 1.25; letter-spacing: 0; text-wrap: balance; color: var(--type-ink); margin: 0;
}
/* The small line above a title. */
.t-eyebrow {
  --type-track: .24em;
  font-family: var(--type-caps); font-weight: 800; font-size: var(--type-size-eyebrow);
  line-height: 1.2; letter-spacing: var(--type-track); text-transform: uppercase;
  color: var(--type-ink); margin: 0;
}
/* Field labels, table heads, captions, tags. */
.t-label {
  --type-track: .14em;
  font-family: var(--type-caps); font-weight: 700; font-size: var(--type-size-label);
  line-height: 1.2; letter-spacing: var(--type-track); text-transform: uppercase; color: var(--type-ink);
}
/* The names, or one word painted large. Never caps, never small. */
.t-sign {
  font-family: var(--type-sign); font-weight: 400; font-size: var(--type-size-sign);
  line-height: 1; letter-spacing: 0; text-transform: none; color: var(--type-ink); margin: 0;
}
/* An aside in a brush hand. Six words or fewer. */
.t-script {
  font-family: var(--type-brush); font-weight: 400; font-size: var(--type-size-script);
  line-height: 1.1; letter-spacing: 0; text-transform: none; color: var(--type-accent); margin: 0;
}
/* A place name. */
.t-fat {
  font-family: var(--type-fat); font-weight: 400; font-size: var(--type-size-fat);
  line-height: 1.16; letter-spacing: 0; text-transform: none; color: var(--type-ink); margin: 0;
}
/* Big figures: the countdown, a card's number. */
.t-numeral {
  font-family: var(--type-slab); font-weight: 400; font-size: var(--type-size-numeral);
  line-height: 1; letter-spacing: .02em; font-variant-numeric: lining-nums tabular-nums;
  color: var(--type-ink); margin: 0;
}
/* A date set in figures: 11 · 13 · 2027. */
.t-date {
  font-family: var(--type-slab); font-weight: 400; font-size: var(--type-size-date);
  line-height: 1.15; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
  font-variant-numeric: lining-nums; color: var(--type-ink); margin: 0;
}
/* Reading text. */
.t-body { font-family: var(--type-text); font-weight: 400; font-size: var(--type-size-body); line-height: 1.6; letter-spacing: 0; text-transform: none; color: var(--type-ink); }
.t-lead { font-family: var(--type-text); font-weight: 400; font-size: var(--type-size-lead); line-height: 1.45; text-wrap: pretty; color: var(--type-ink); margin: 0; }
.t-small { font-family: var(--type-text); font-weight: 400; font-size: var(--type-size-small); line-height: 1.5; letter-spacing: 0; text-transform: none; color: var(--type-ink-soft); }
.t-quote { font-family: var(--type-text); font-style: italic; font-weight: 400; font-size: var(--type-size-lead); line-height: 1.45; color: var(--type-ink); }

/* Long text: a comfortable measure and rhythm. */
.t-prose { font-family: var(--type-text); font-size: var(--type-size-body); line-height: 1.6; color: var(--type-ink); max-width: 36em; text-wrap: pretty; }
.t-prose > * { margin-block: 0; }
.t-prose > * + * { margin-top: .85em; }
.t-prose > .t-heading, .t-prose > h2 { margin-top: 1.5em; }
.t-prose > .t-subhead, .t-prose > h3 { margin-top: 1.3em; }
.t-prose strong, .t-body strong, .t-lead strong { font-weight: 700; }
.t-prose a, a.t-link {
  color: inherit; text-decoration-line: underline; text-decoration-color: var(--type-edge);
  text-decoration-thickness: .09em; text-underline-offset: .2em;
}
.t-prose a:hover, a.t-link:hover { text-decoration-color: currentColor; }
.t-prose ul, .t-prose ol { padding-left: 1.2em; }
.t-prose li + li { margin-top: .35em; }
.t-prose li::marker { color: var(--type-accent); font-weight: 700; }
.t-tabular { font-variant-numeric: lining-nums tabular-nums; }

/* The ampersand between the names: the text face's bold italic, wherever it appears. */
.t-amp { font-family: var(--type-text); font-style: italic; font-weight: 800; letter-spacing: 0; text-transform: none; }

/* ---------- finishes: how the sign painter fills the letters ---------- */
/* one hard offset in a second colour (the default for a title on cream) */
.t-pop { text-shadow: .05em .058em 0 var(--type-shade); }
/* cream letters, ink outline, two stepped shadows: the names */
.t-double {
  color: var(--type-paper); -webkit-text-stroke: .018em var(--moonlit-ocean); paint-order: stroke fill;
  text-shadow: .04em .045em 0 var(--moonlit-ocean), .08em .09em 0 var(--type-mid);
}
/* cream letters with a solid ink side and a last amber edge: the date (28 px or larger) */
.t-extrude {
  color: var(--type-paper); -webkit-text-stroke: .03em var(--moonlit-ocean); paint-order: stroke fill;
  text-shadow:
    .015em .015em 0 var(--moonlit-ocean), .03em .03em 0 var(--moonlit-ocean), .045em .045em 0 var(--moonlit-ocean),
    .06em .06em 0 var(--moonlit-ocean), .075em .075em 0 var(--moonlit-ocean), .1em .1em 0 var(--type-edge);
}

/* ---------- accents ---------- */
/* — eyebrow — */
.t-dashes { display: inline-flex; align-items: center; gap: .6em; }
.t-dashes::before, .t-dashes::after { content: ""; flex: none; width: 1.6em; height: .12em; border-radius: 1em; background: var(--type-edge); }
/* a brush stroke under a script line */
.t-swash { position: relative; display: inline-block; padding-bottom: .12em; }
.t-swash::after {
  content: ""; position: absolute; left: 4%; right: -2%; bottom: -.06em; height: .26em; background: var(--type-swash, var(--type-ink));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M2 15 C 45 4, 130 1, 198 6 C 150 8, 95 11, 40 15 C 22 16.5, 10 17, 2 15 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M2 15 C 45 4, 130 1, 198 6 C 150 8, 95 11, 40 15 C 22 16.5, 10 17, 2 15 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
/* the hand-painted lean */
.t-tilt { display: inline-block; rotate: -3.5deg; }
/* a four-point star: <span class="t-star" aria-hidden="true"></span> */
.t-star {
  display: inline-block; flex: none; width: .5em; aspect-ratio: 1; vertical-align: .12em; background: var(--type-edge);
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
}
/* centre a tracked line (the tracking after the last letter would push it left) */
.t-center { text-align: center; padding-left: var(--type-track, 0em); }

/* ---------- other grounds ---------- */
.t-on-aqua {
  --type-shade: var(--cannoli-cream);
  --type-ink-soft: color-mix(in oklab, var(--moonlit-ocean) 88%, var(--iced-aqua));
  --type-accent: color-mix(in oklab, var(--baltic-amber) 52%, var(--moonlit-ocean));
}
.t-on-dark {
  --type-ink: var(--cannoli-cream);
  --type-ink-soft: color-mix(in oklab, var(--cannoli-cream) 84%, var(--moonlit-ocean));
  --type-accent: var(--iced-aqua);
  --type-shade: var(--blue-heaven);
  --type-mid: var(--iced-aqua);
  --type-edge: var(--iced-aqua);
  --type-swash: var(--iced-aqua);
  color: var(--cannoli-cream);
}

@media (prefers-reduced-motion: no-preference) {
  .t-star--twinkle { animation: t-twinkle 3.6s ease-in-out infinite; }
  @keyframes t-twinkle { 0%, 100% { transform: scale(.8) rotate(0deg); opacity: .65; } 50% { transform: scale(1.08) rotate(14deg); opacity: 1; } }
}
html[data-motion="paused"] .t-star--twinkle, .rm .t-star--twinkle { animation: none; }
