/* ==========================================================================
   TYPOGRAPHY - loaded LAST. Visual only: no wording, colour, layout or script is touched here.

   Fredoka      headings and titles (600-700)        -> the --dp-display / --pm-display / --fl-serif font stacks
   Nunito       body text and UI (500-700)           -> the --dp-sans / --pm-sans / --fl-sans font stacks
   Space Mono   timers, badges and puzzle tags only  -> the short list at the bottom of this file

   All three are SIL Open Font Licence (see the *-OFL.txt files in assets/fonts), latin subset, served from this site.
   The font-weight ranges below keep every rule inside the chosen weights: a rule that asks for 400 gets Nunito 500,
   one that asks for 800 gets 700, a heading that asks for 400 / 500 gets Fredoka 600.
   ========================================================================== */

@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 600 700; font-display: swap; src: url("../assets/fonts/fredoka-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 500 700; font-display: swap; src: url("../assets/fonts/nunito-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: italic; font-weight: 500 700; font-display: swap; src: url("../assets/fonts/nunito-latin-wght-italic.woff2") format("woff2"); }
/* Space Mono is a wide face: size-adjust makes it take about the room the body font took, so timers and tags keep their layout. */
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 90%; src: url("../assets/fonts/space-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 700; font-display: swap; size-adjust: 90%; src: url("../assets/fonts/space-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --ty-heading: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
  --ty-body: "Nunito", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --ty-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Headings that were not styled by a family variable: every heading element is Fredoka, whatever page it is on. */
h1, h2, h3 { font-family: var(--ty-heading); }

/* ---- Space Mono, sparingly -------------------------------------------------------------------------------- */

/* timers and times */
.dragon-puzzle .dp-stats dd,
.dragon-puzzle.has-toolbar .dp-toolbar .dp-stats dd,
.dragon-puzzle.has-toolbar .dp-bestline b,
.dp-done-stat dd,
.lb-time, .lb-ptime, .mp-lb-host .lb-time,
.pf-times .pf-t,
.mp-req-left { font-family: var(--ty-mono); }

/* the room code */
.mp-code { font-family: var(--ty-mono); }

/* badges and puzzle tags */
.mp-tag, .mp-toast-badge, .dp-done-badge, .bp-now,
.picker button .pk-count, .gallery-filters .gf-level { font-family: var(--ty-mono); }

/* ---- Dialogs and their buttons: ONE family (Nunito), the same in Dark and Light, compact -------------------------------------
   Covers the solo "Congratulations" card (.dp-done) and the confirmation card (.mp-confirm: "Glowing Mushroom Cottage?", Shuffle, Leave room).
   Only family, size and weight are set here. Colours, layout and wording are untouched. The stats (times, counts) and the "New best time!"
   badge in the Congratulations card use the same family so the card is not a mix of three. */
.dp-done.dp-done, .dp-done.dp-done *,
.mp-confirm.mp-confirm, .mp-confirm.mp-confirm * { font-family: var(--ty-body); }   /* doubled class: beats the Space Mono rules above for the stats and badge */
.dp-done-eyebrow { font-size: 0.68rem; letter-spacing: 0.16em; }
.dp-done-h { font-size: clamp(1.35rem, 3.2vw, 1.7rem); font-weight: 700; line-height: 1.15; letter-spacing: 0; }
.dp-done-p { font-size: 0.88rem; line-height: 1.45; }
.dp-done-badge { font-size: 0.72rem; font-weight: 700; }
.dp-done-stat dt { font-size: 0.64rem; }
.dp-done-stat dd { font-size: 1.15rem; font-weight: 700; }
.dp-done-name { font-size: 0.82rem; }
.mp-confirm-q { font-size: 1rem; font-weight: 700; line-height: 1.35; }
.mp-confirm-sub { font-size: 0.85rem; line-height: 1.4; }
.mp-confirm .mp-btn, .dp-done-btn { font-family: var(--ty-body); font-size: 0.9rem; font-weight: 700; letter-spacing: 0.01em; }

/* ---- Congratulations card: Again / Home with icons ----------------------------------------------------------------------------
   Desktop: icon + text. Phones (and short landscape phones): icon only, the text stays for screen readers (aria-label + title also name it),
   and each button keeps a 48px touch target. */
.dp-done-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 46px; }
.dp-done-ico { flex: none; width: 1.15em; height: 1.15em; }
@media (max-width: 640px), (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .dp-done-actions { gap: 10px; }
  .dp-done-btn { min-width: 48px; min-height: 48px; padding: 0 12px; }
  .dp-done-btn .dp-done-ico { width: 22px; height: 22px; }
  .dp-done-btn-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .dp-done-btn { position: relative; }
}
