/* Wordnest – design tokens, themes, font-face, element defaults. Layout lives in layout.css. */

/* Nunito variable (wght 200–1000), SIL OFL 1.1 – see ../fonts/OFL.txt */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/Nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../fonts/Nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Theme-independent tokens ---------- */
:root {
  --font: "Nunito", system-ui, sans-serif;

  /* type scale (px-based rem, 1rem = 16px) */
  --fs-xs: 0.75rem;   /* 12 – fine print */
  --fs-sm: 0.875rem;  /* 14 – captions, stats */
  --fs-md: 1rem;      /* 16 – body */
  --fs-lg: 1.125rem;  /* 18 – Match me boxes, buttons (min for play text) */
  --fs-xl: 1.5rem;    /* 24 – headings */
  --fs-2xl: 2rem;     /* 32 – wrap-up headline */
  --fs-3xl: 2.5rem;   /* 40 – wordmark */
  --lh-tight: 1.15;
  --lh: 1.45;

  --fw-regular: 400;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-heavy: 800;    /* grid letters */
  --fw-black: 900;    /* wordmark */

  /* 8px spacing grid (4px half step) */
  --space-0-5: 4px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* sizes */
  --tap: 44px;              /* minimum touch target */
  --statusbar-h: 48px;
  --box-min-h: 56px;        /* Match me boxes */
  --gap-box: 12px;
  --max-w: 480px;           /* desktop centered column */
  --focus-ring: 3px;

  /* motion */
  --dur-fast: 150ms;
  --dur: 300ms;
  --dur-slow: 600ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Light palette (default) ---------- */
:root,
[data-theme="light"] {
  color-scheme: light;
  --c-bg: #F7F5EF;
  --c-surface: #FFFFFF;
  --c-text: #1F2430;
  --c-text-muted: #5B6270;
  --c-border: #DDD8CC;
  --c-selected: #2563EB;
  --c-on-selected: #FFFFFF;
  --c-found: #187D55;
  --c-found-strong: #0E5E3E;  /* cells shared by two found words */
  --c-on-found: #FFFFFF;
  --c-error: #DC2626;
  --c-on-error: #FFFFFF;
  --c-accent: #F5A524;
  --c-on-accent: #1F2430;
  --c-shell: #FFF7E6;
  --c-shell-outline: #1F2430;
  --c-focus: #3B82F6;
  --shadow: 0 1px 2px rgb(31 36 48 / 0.08), 0 4px 12px rgb(31 36 48 / 0.08);
}

/* ---------- Dark palette ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --c-bg: #14171C;
    --c-surface: #222831;
    --c-text: #ECEFF4;
    --c-text-muted: #A3AAB8;
    --c-border: #343B46;
    --c-selected: #60A5FA;
    --c-on-selected: #14171C;
    --c-found: #34D399;
    --c-found-strong: #059669;
    --c-on-found: #14171C;
    --c-error: #F87171;
    --c-on-error: #14171C;
    --c-accent: #FBBF24;
    --c-on-accent: #14171C;
    --c-shell: #FFF7E6;
    --c-shell-outline: #1F2430;
    --c-focus: #60A5FA;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 12px rgb(0 0 0 / 0.3);
  }
}
/* explicit override; keep in sync with the media block above */
[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #14171C;
  --c-surface: #222831;
  --c-text: #ECEFF4;
  --c-text-muted: #A3AAB8;
  --c-border: #343B46;
  --c-selected: #60A5FA;
  --c-on-selected: #14171C;
  --c-found: #34D399;
  --c-found-strong: #059669;
  --c-on-found: #14171C;
  --c-error: #F87171;
  --c-on-error: #14171C;
  --c-accent: #FBBF24;
  --c-on-accent: #14171C;
  --c-shell: #FFF7E6;
  --c-shell-outline: #1F2430;
  --c-focus: #60A5FA;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 12px rgb(0 0 0 / 0.3);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[data-theme] {
  color: var(--c-text);
  background: var(--c-bg);
}

h1, h2, h3, p {
  margin: 0;
}

h1, h2, h3 {
  line-height: var(--lh-tight);
  font-weight: var(--fw-heavy);
}

img, svg {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: var(--focus-ring) solid var(--c-focus);
  outline-offset: 2px;
}

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

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur: 0ms;
    --dur-slow: 0ms;
  }
}
