/* Suits vs. Toons design tokens. Every colour, size and timing on the site comes from here.
   Light is the default; dark follows prefers-color-scheme unless [data-theme] says otherwise.
   [data-theme="light"|"dark"] also works on any element, so a panel can show the other theme.
   Docs: DESIGN.md. Contrast table: python tools/contrast.py */

@font-face {
  font-family: "Chewy";
  src: url("/fonts/Chewy-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("/fonts/Nunito-VariableFont.woff2") format("woff2-variations"),
       url("/fonts/Nunito-VariableFont.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

/* ---- Theme-independent tokens */
:root {
  /* Brand palette: the game's sign and lettering colours (overrides/tools/make_art.py). */
  --brand-ink: #24141c;          /* the ink outline on every sign and letter */
  --brand-sun: #ffdb1f;          /* title lettering fill */
  --brand-orange: #f26b1a;       /* title lettering rim */
  --brand-gag: #fa6619;          /* gag shop sign */
  --brand-teal: #33d9a0;         /* big gag shop sign */
  --brand-cream: #fff3cc;        /* hillside lettering */
  --brand-grass: #4fd14f;
  --brand-grass-deep: #259925;
  --brand-hill: #8fd1a8;
  --brand-dock: #d9331f;         /* red/gold dock sign */
  --brand-dock-deep: #8c1410;
  --brand-gardens: #fa99d9;      /* pink gardens sign */
  --brand-gardens-deep: #c2479e;
  --brand-melody: #a64ca6;       /* purple melody sign */
  --brand-dream: #4d4db3;        /* indigo dreamland sign */
  --brand-dream-deep: #2e2a80;
  --brand-brrrgh: #bfd9fa;       /* icy brrrgh sign */
  --brand-brrrgh-deep: #3d5cc2;
  --brand-sky: #408cd9;

  /* Spacing: a 4px scale. Use these for every margin, padding and gap. */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius: chunky and toy-like. */
  --radius-sm: 0.5rem;   /* 8px: inputs inside panels, small chips */
  --radius-md: 0.875rem; /* 14px: buttons, inputs, callouts */
  --radius-lg: 1.375rem; /* 22px: plaques and cards */
  --radius-xl: 2rem;     /* 32px: hero panels */
  --radius-pill: 999px;  /* badges, nav pills */

  /* Ink outline and rim widths (the composite outline tokens are below, after the themes). */
  --outline-width: 3px;
  --rim-width: 5px;
  --rim: var(--brand-sun);

  /* Layered title lettering (.toon-title): fill gradient top/bottom and rim. Same recipe as the game's signs:
     top = fill mixed 35% toward white. */
  --toon-fill-top: #ffe86d;
  --toon-fill: var(--brand-sun);
  --toon-rim: var(--brand-orange);
  --toon-ink: var(--brand-ink);

  /* Type */
  --font-display: "Chewy", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Modular scale, ratio 1.25 (major third) from a 17px body. */
  --text-xs: 0.75rem;     /* 12px: fine print only */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1.0625rem; /* 17px: body */
  --text-lg: 1.328rem;    /* 21px: lede */
  --text-xl: 1.66rem;     /* 27px */
  --text-2xl: 2.075rem;   /* 33px */
  --text-3xl: 2.594rem;   /* 42px */
  --text-4xl: 3.242rem;   /* 52px */

  /* Fluid headings: phone size at 360px wide, desktop size by about 1280px. */
  --text-display: clamp(2.75rem, 1.6rem + 5vw, 5rem);
  --text-h1: clamp(2.25rem, 1.65rem + 2.6vw, 3.25rem);
  --text-h2: clamp(1.6rem, 1.38rem + 0.95vw, 2.075rem);
  --text-h3: clamp(1.3rem, 1.2rem + 0.45vw, 1.66rem);

  --leading-tight: 1.1;   /* display and headings */
  --leading-snug: 1.3;    /* UI labels, short lines */
  --leading-body: 1.6;    /* paragraphs */
  --weight-body: 400;
  --weight-strong: 700;
  --weight-ui: 800;       /* buttons, nav, labels */
  --measure: 66ch;        /* longest comfortable line */

  /* Layout */
  --container: 72rem;
  --container-prose: 44rem;
  --gutter: var(--space-4);
  --tap: 44px;            /* minimum touch target */

  /* Motion: small and quick. Durations become 0 under prefers-reduced-motion. */
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1); /* a little overshoot, for hover lifts */
  --lift: -2px;           /* hover raise */
  --wiggle: -2deg;        /* hover tilt for the wordmark and spot art */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
    --lift: 0px;
    --wiggle: 0deg;
  }
}

/* ---- Light theme (default) */
:root,
[data-theme="light"] {
  color-scheme: light;
  --color-bg: #fff8e7;             /* warm paper */
  --color-surface: #fffcf3;        /* plaques, header */
  --color-surface-raised: #ffffff; /* inputs, plaques on plaques */
  --color-text: #24141c;
  --color-text-muted: #5e4a52;
  --color-link: #2a46b0;
  --color-link-hover: #8c1410;
  --color-accent: #fa6619;         /* fills only: primary buttons, highlights */
  --color-on-accent: #24141c;      /* text on --color-accent */
  --color-accent-text: #a83e05;    /* accent used as text on bg/surface */
  --color-sun: #ffdb1f;            /* fills only */
  --color-on-sun: #24141c;
  --color-border: #ead9b5;         /* soft dividers (decorative, not a control edge) */
  --color-outline: #24141c;        /* ink outline */
  --color-field-border: #24141c;   /* input edge, at least 3:1 */
  --color-shadow: rgb(36 20 28 / 0.16);
  --color-focus: #2a46b0;
  --color-success: #1d7a3a;
  --color-success-bg: #e3f6e3;
  --color-warning: #7a4f00;
  --color-warning-bg: #fff1c2;
  --color-danger: #b3261e;
  --color-danger-bg: #fde6e2;
  --color-info: #2a46b0;
  --color-info-bg: #e6eeff;
  --color-sky-top: #9fd3ff;        /* hero sky, fades into bg */
  --color-sky-bottom: #fff8e7;
  --art-filter: none;              /* daylight spot art as drawn */
}

/* ---- Dark theme: dreamland at night */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #16122b;
    --color-surface: #221d40;
    --color-surface-raised: #2e2856;
    --color-text: #fff3e0;
    --color-text-muted: #c9bfd9;
    --color-link: #a7c4ff;
    --color-link-hover: #ffdb1f;
    --color-accent: #fa6619;
    --color-on-accent: #24141c;
    --color-accent-text: #ffb27a;
    --color-sun: #ffdb1f;
    --color-on-sun: #24141c;
    --color-border: #3d3566;
    --color-outline: #0b0814;
    --color-field-border: #a99fc4;
    --color-shadow: rgb(0 0 0 / 0.45);
    --color-focus: #ffdb1f;
    --color-success: #6ee7a0;
    --color-success-bg: #12301f;
    --color-warning: #ffd166;
    --color-warning-bg: #33280c;
    --color-danger: #ff8f80;
    --color-danger-bg: #3a1418;
    --color-info: #a7c4ff;
    --color-info-bg: #1c2550;
    --color-sky-top: #2e2a80;
    --color-sky-bottom: #16122b;
    --art-filter: brightness(0.72) saturate(0.85);
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #16122b;
  --color-surface: #221d40;
  --color-surface-raised: #2e2856;
  --color-text: #fff3e0;
  --color-text-muted: #c9bfd9;
  --color-link: #a7c4ff;
  --color-link-hover: #ffdb1f;
  --color-accent: #fa6619;
  --color-on-accent: #24141c;
  --color-accent-text: #ffb27a;
  --color-sun: #ffdb1f;
  --color-on-sun: #24141c;
  --color-border: #3d3566;
  --color-outline: #0b0814;
  --color-field-border: #a99fc4;
  --color-shadow: rgb(0 0 0 / 0.45);
  --color-focus: #ffdb1f;
  --color-success: #6ee7a0;
  --color-success-bg: #12301f;
  --color-warning: #ffd166;
  --color-warning-bg: #33280c;
  --color-danger: #ff8f80;
  --color-danger-bg: #3a1418;
  --color-info: #a7c4ff;
  --color-info-bg: #1c2550;
  --color-sky-top: #2e2a80;
  --color-sky-bottom: #16122b;
  --art-filter: brightness(0.72) saturate(0.85);
}

/* ---- Outline and shadow composites: the sign look.
   An element draws its ink outline as a border (--border-ink) and its rim as a ring outside it
   (--shadow-rim). Set --rim on the element to recolour the rim. These are declared on every element,
   not on :root, so they resolve against that element's own --rim and theme colours. */
*,
*::before,
*::after {
  --border-ink: var(--outline-width) solid var(--color-outline);
  --shadow-rim: 0 0 0 var(--rim-width) var(--rim);
  --shadow-drop: 0 calc(var(--rim-width) + 5px) 0 var(--rim-width) var(--color-shadow);
  --shadow-plaque: var(--shadow-rim), var(--shadow-drop);
  --shadow-press: 0 4px 0 0 var(--color-outline);      /* chunky key shadow under buttons */
  --shadow-press-up: 0 6px 0 0 var(--color-outline);   /* the same key, hovered */
  --shadow-press-down: 0 1px 0 0 var(--color-outline); /* the same key, pressed */
  --focus-outline: 3px solid var(--color-focus);       /* use as `outline`, with --focus-offset */
}

:root {
  --focus-offset: 3px;
}
