/*
 * ToySetFox design tokens: "Tag" (owner decision, 25 September 2026).
 *
 * Warm paper, near-black ink and one fox orange. Orange is for the mark,
 * deal labels and key graphics; text in orange uses --ember (AA). Ink
 * carries type, the wordmark and the fox's back ear. Bricolage Grotesque
 * for display, Figtree for everything else, round corners and pill
 * controls that echo the tag's rounded back.
 *
 * Components read these custom properties only.
 * The @font-face rules live in base.html so font URLs carry content hashes.
 */

/* Metric-matched fallbacks so the font swap barely moves the layout. */
@font-face {
  font-family: "Bricolage Grotesque Fallback";
  src: local("Arial");
  size-adjust: 102%;
  ascent-override: 92%;
  descent-override: 24%;
}

/* Figtree Fallback: measured against the self-hosted Figtree 400 (scripts/build-site-fonts.py). */
@font-face {
  font-family: "Figtree Fallback";
  src: local("Arial"), local("ArialMT");
  size-adjust: 99.16%;
  ascent-override: 95.8%;
  descent-override: 25.21%;
  line-gap-override: 0%;
}

:root {
  color-scheme: light;

  /* ── Colour: paper, ink and fox ────────────────────────────────────── */
  --paper: #fff8f1; /* page */
  --paper-soft: #f4e8db; /* "Oat": bands, image fields, table stripes */
  --paper-card: #ffffff; /* cards and product photo fields */
  --paper-raised: #ffffff; /* popovers, menus */
  --paper-input: #f4e8db; /* search and form fields at rest */
  --paper-2: #ecdccb; /* hover and selected rows on a surface */

  --ink: #1f1b19;
  --text: #1f1b19; /* 16.2:1 on paper */
  --text-body: #3a322d; /* 11.9:1 on paper */
  --text-muted: #6a5b50; /* 6.2:1 on paper, 5.4:1 on --paper-soft */

  --line: #eadbcb;
  --line-strong: #d6c2ad;

  /* The accent. --fox is for graphics and large text (3.3:1 on paper);
     text in orange uses --ember (5.7:1 on paper, 6.0:1 on white). */
  --fox: #ee5a24;
  --ember: #b23a0c;
  --fox-tint: #fde9dd; /* best-price row, deal box: ink 14.5:1, ember 5.1:1 */

  /* Deal label: ink on fox is 5.0:1 (AA at any size). */
  --deal-bg: var(--fox);
  --deal-text: var(--ink);
  --deal-ring: var(--ink);

  --link: var(--ember);
  --focus: #1f1b19;

  --button-bg: var(--ink);
  --button-text: var(--paper);

  /* Functional states only (forms, account): never decoration. */
  --danger: #a3261b; /* 7.0:1 on paper */
  --success: #2f6b3f; /* 6.1:1 on paper */

  /* ── Type ──────────────────────────────────────────────────────────── */
  --font-display: 'Bricolage Grotesque', 'Bricolage Grotesque Fallback', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Figtree', 'Figtree Fallback', ui-sans-serif, system-ui, sans-serif;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-display: 700; /* headings */
  --fw-price: 800; /* prices and deal labels */

  /* A 1.25 scale from 16 px, fluid for display sizes. */
  --text-display: clamp(2.75rem, 1.6rem + 4.2vw, 4.75rem);
  --text-h1: clamp(2rem, 1.5rem + 2.2vw, 3rem);
  --text-h2: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem);
  --text-h3: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
  --text-h4: 1.25rem;
  --text-price-lg: clamp(2.5rem, 2rem + 1.8vw, 3.25rem);
  --text-price: 1.1875rem;
  --text-lead: 1.1875rem;
  --text-body-lg: 1.0625rem;
  --text-body: 1rem;
  --text-ui: 0.9375rem;
  --text-sm: 0.875rem;
  --text-xs: 0.8125rem;
  --text-caption: 0.75rem;

  --tracking-display: -0.025em;
  --tracking-snug: -0.01em;
  --tracking-eyebrow: 0.06em;

  --leading-title: 1.06;
  --leading-snug: 1.3;
  --leading-body: 1.55;

  /* ── Space: 4px canon ──────────────────────────────────────────────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  --container-max: 1440px;
  --measure: 64ch;
  --touch: 44px;
  --gutter: var(--space-12);
  --section-y: var(--space-20);

  /* ── Geometry: the tag's rounded back ──────────────────────────────── */
  --radius-sm: 6px; /* inputs' inner parts, small chips */
  --radius: 14px; /* cards, image fields, deal box */
  --radius-lg: 20px; /* hero panels */
  --radius-pill: 999px; /* search, buttons, tabs */
  --shadow: 0 1px 2px rgb(31 27 25 / 5%), 0 18px 40px -16px rgb(31 27 25 / 18%);

  --dur-fast: 160ms;
  --dur: 260ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ── Dark: night brown, cream text, the fox a shade lighter ───────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1a1614;
    --paper-soft: #2e2723;
    --paper-card: #241f1c;
    --paper-raised: #2e2723;
    --paper-input: #2e2723;
    --paper-2: #3a322d;
    --ink: #fbefe3;
    --text: #fbefe3; /* 15.9:1 on night */
    --text-body: #e6d7c8; /* 12.8:1 */
    --text-muted: #bdaa9a; /* 8.0:1 */
    --line: #3a322d;
    --line-strong: #52473f;
    --fox: #f26b39; /* 5.9:1 on night */
    --ember: #ff8a5c; /* 7.8:1 on night: orange text */
    --fox-tint: #3a2418;
    --deal-bg: #f26b39;
    --deal-text: #1a1614; /* 5.9:1 */
    --deal-ring: #1a1614;
    --focus: #fbefe3;
    --button-bg: #fbefe3;
    --button-text: #1a1614;
    --danger: #ff8f84;
    --success: #7fc491;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 18px 40px -16px rgb(0 0 0 / 60%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1a1614;
  --paper-soft: #2e2723;
  --paper-card: #241f1c;
  --paper-raised: #2e2723;
  --paper-input: #2e2723;
  --paper-2: #3a322d;
  --ink: #fbefe3;
  --text: #fbefe3;
  --text-body: #e6d7c8;
  --text-muted: #bdaa9a;
  --line: #3a322d;
  --line-strong: #52473f;
  --fox: #f26b39;
  --ember: #ff8a5c;
  --fox-tint: #3a2418;
  --deal-bg: #f26b39;
  --deal-text: #1a1614;
  --deal-ring: #1a1614;
  --focus: #fbefe3;
  --button-bg: #fbefe3;
  --button-text: #1a1614;
  --danger: #ff8f84;
  --success: #7fc491;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 18px 40px -16px rgb(0 0 0 / 60%);
}

@media (max-width: 768px) {
  :root {
    --gutter: var(--space-5);
    --section-y: var(--space-12);
  }
}

@media (max-width: 480px) {
  :root {
    --gutter: var(--space-4);
    --section-y: var(--space-10);
  }
}
