/* ==========================================================================
   tokens.css — design tokens for Card Games.
   One token sheet everything else reads: a fluid type scale, motion and
   elevation as variables. The direction is an open-house card table seen from
   above: a cream vinyl tablecloth printed with peonies, red stools, white card
   stock, a red banner across the top. It mirrors entropicsoftwarelabs.com/
   card-games so the playsite stops sharing the dark-and-green look of the
   OffBridge site.
   Colour comes from the print, not from lighting: surfaces are flat, shadows
   are the only depth, and the one gradient is the light fade under each hand
   (a bottom-up scrim in table.css .dock /
   big2.css .b2-dock) so the fan reads against the cloth. Light is the only
   theme — a tablecloth does not have a dark mode.
   All other CSS reads only these vars.
   ========================================================================== */

/* --- Font: Bricolage Grotesque (self-hosted; SIL OFL, see assets/fonts/) -- */
/* One variable file covers every weight and width the app asks for, so the
   installed PWA keeps its face offline. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../assets/fonts/bricolage-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ----- Cloth: the vinyl the whole site sits on ----- */
  --cloth: #F4F1EA;
  --cloth-texture: url("../assets/textures/tablecloth.svg");
  /* Page and menu background: the cloth under a sand veil, darker than the
     table's, so the cream menu cards stand off it instead of blending in. */
  --cloth-surface:
    linear-gradient(rgba(226, 214, 195, 0.80), rgba(226, 214, 195, 0.80)),
    var(--cloth-texture) 0 0 / 360px 360px,
    var(--cloth);
  /* The table is the same cloth, quietened under a veil so cards read over the
     print; the vignette (an inset box-shadow, not a gradient) darkens the rim. */
  --table-surface:
    linear-gradient(rgba(244, 241, 234, 0.70), rgba(244, 241, 234, 0.70)),
    var(--cloth-texture) 0 0 / 360px 360px,
    var(--cloth);
  --table-vignette: inset 0 0 120px rgba(90, 40, 30, 0.16);

  /* ----- Brand palette ----- */
  --stock: #FFFDF8;
  --white: #FFFFFF;
  --hairline: #E3DCCF;
  --hairline-strong: #BFB3A3;

  --text: #2B2622;
  --text-secondary: #5A4A40;
  --text-tertiary: #6B5B4E;
  /* Decorative only (disabled controls, rules): 2.9:1 on the cloth, so never
     for text a player has to read. */
  --text-faint: #9A8B7C;
  --ink: #2B2622;

  --red: #C8102E;
  --red-hover: #A50D25;
  --red-deep: #9E1328;
  --peony: #D9283C;
  --red-tint: #FDEEF0;
  --on-red: #FFFDF8;
  /* A cream outline on the red bar. */
  --on-red-line: rgba(255, 253, 248, 0.6);

  --leaf: #2E8B57;
  /* The leaf green is 3.8:1 on the cloth, fine for a ring, too pale for text. */
  --leaf-ink: #236C44;

  /* A coin stays a coin on any background. */
  --coin: #E3B93F;
  --coin-edge: #9C6F12;

  --selection: #FBD3D9;
  --row-hover: rgba(200, 16, 46, 0.06);

  /* ----- Surfaces: flat card stock on the cloth ----- */
  --panel: rgba(255, 253, 248, 0.85);
  --panel-solid: var(--stock);
  /* Raised menu cards keep the same fill on hover; the border turns red. */
  --card-ui-bg: var(--stock);
  --card-ui-bg-hover: var(--stock);
  --hud-bg: var(--stock);
  --pill-bg: var(--stock);
  --plate-bg: var(--stock);
  --controls-bg: rgba(255, 253, 248, 0.94);
  --input-bg: #FFFFFF;
  /* Light fade under each hand so the fan reads against the cloth. */
  --scrim-light: linear-gradient(to top, rgba(244, 241, 234, 0.92), rgba(244, 241, 234, 0));

  /* ----- Semantic ----- */
  --ok: var(--leaf-ink);
  --danger: #B42318;
  --warning: #9A5B00;
  --danger-line: rgba(180, 35, 24, 0.45);

  /* ----- Type -----
     Bricolage Grotesque for headings, buttons, labels and numbers; the system
     sans for running text. The Chinese titles take the sans CJK faces after the
     display face, since Bricolage has no Han glyphs. */
  --font-display: "Bricolage Grotesque", "PingFang SC", "Noto Sans CJK SC",
    "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;

  /* ----- Type scale (fluid) ----- */
  --t-display: clamp(1.9rem, 1.2rem + 3.2vw, 2.6rem);
  --t-h1: clamp(1.6rem, 1.2rem + 1.9vw, 2.4rem);
  --t-h2: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem);
  --t-h3: 1.2rem;
  --t-lead: 1.0625rem;
  --t-body: 1.0625rem;  /* 17px */
  --t-small: 0.9375rem; /* 15px */
  --t-caption: 0.8125rem;
  --t-label: 0.75rem;   /* smallest caption size */

  /* ----- Radius ----- */
  --card-radius: 6px;   /* printed card corner; --r-xs is for chrome, not cards */
  --r-xs: 3px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-pill: 999px;
  /* Menus and pickers are raised cards, so they take rounder corners than the
     card stock above; --r-btn is for buttons and pill buttons inside them. */
  --r-ui: 14px;
  --r-btn: 12px;

  /* ----- Spacing (4px rhythm) ----- */
  --s-2: 2px;
  --s-4: 4px;
  --s-6: 6px;
  --s-8: 8px;
  --s-12: 12px;
  --s-16: 16px;
  --s-20: 20px;
  --s-26: 26px;
  --s-34: 34px;
  --s-48: 48px;

  --container-max: 1080px;
  --gutter: clamp(14px, 3vw, 28px);
  /* Same inset as the entropicsoftwarelabs.com header, so the two bars line up. */
  --bar-gutter: clamp(16px, 5vw, 48px);

  /* ----- Motion ----- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-std: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-med: 160ms;
  --dur-slow: 220ms;

  /* ----- Elevation: warm shadows, tinted toward the stool red ----- */
  --shadow-paper: 0 14px 28px -14px rgba(90, 20, 20, 0.35), 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-1: 0 3px 6px -3px rgba(60, 20, 20, 0.35);
  --shadow-3: var(--shadow-paper);
  --shadow-8: 0 26px 40px -18px rgba(70, 15, 20, 0.45), 0 6px 10px rgba(0, 0, 0, 0.12);
  --shadow-btn: 0 8px 14px -8px rgba(150, 10, 30, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  --shadow-bar: 0 6px 14px -10px rgba(90, 20, 20, 0.5);

  /* ----- Z-index (semantic; keep ordered) ----- */
  --z-hud: 20;
  --z-overlay: 40;
  --z-rotate-gate: 90;

  /* Focus: leaf green on cloth and stock; the red top bar swaps in --on-red. */
  --ring: 0 0 0 3px var(--leaf);
  --focus-outline: 3px solid var(--leaf);

  /* ----- Playing cards -----
     Cream stock, red and ink suits, gold rules and cloud corners, and a
     deep-red dragon-scale back. Read by the SVG cardart.js builds through
     style="fill:var(--x)" (a presentation attribute would not resolve inside
     the <use> shadow tree), by both card styles. */
  --face: #FFF6E5;            /* cream card stock */
  --face-edge: #C9A227;       /* gold outer edge */
  --card-gold: #C9A227;       /* rules, cloud corners */
  --card-gold-light: #F4D27A; /* emblem on back */
  --suit-red: #C8102E;
  --suit-black: #2B2622;
  --seal-text: #FFF6E5;       /* letters on the bold joker tile */
  --back: #8E1020;            /* back field */
  --back-frame: #B71C2C;      /* thick frame around the back */
  --back-line: #E8C55A;       /* scale pattern and emblem ring */
  --card-shadow: 0 3px 6px -3px rgba(60, 20, 20, 0.35);

  /* Bomb cards in a hand: a gold wash over the lower half of the face (multiplied
     into the stock, so the index stays ink) and a red badge carrying a black bomb.
     Gold, not red, so it cannot be read as the selected or hinted state. */
  --bomb-gold-top: rgba(244, 210, 122, 0);   /* gild fades in just under the suit pip */
  --bomb-gold-mid: #F5C842;  /* saturated: multiplied over cream it still has to read as gold */
  --bomb-gold-low: #E39B1E;
  --bomb-badge: #9E1328;     /* badge disc */
  --bomb-badge-ring: #F4D27A;
  --bomb-body: #2B2622;
  --bomb-fuse: #C9A227;
  --bomb-spark: #FFB703;
  --bomb-shine: rgba(255, 246, 229, 0.7);

  color-scheme: light;
}

/* --- Global reduced-motion guard ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
