/* ==========================================================================
   tokens.css — THE THEME FILE.

   Theme: "the Compact's workspace". The game is played inside the Harvest
   Compact's own team chat, the kind of app most players already use at work.
   Borrowed from Slack and Discord, not copied:
     - a branded rail with the workspace, one channel and the staff list
     - flat message rows: avatar, name, role tag, then the lines
     - link embeds with a coloured left rule for the briefing cards
     - reaction pills for the numbers that moved
     - presence: at the desk, in the field, talking to you
   Colour: deep field green for the frame, harvest amber for the Director's
   own actions and nothing else, warm neutrals for the content pane.
   Type: Figtree for the interface, Bricolage Grotesque for headlines. Both
   load from Google Fonts in index.html.

   Every colour, font, radius, shadow and spacing value used anywhere in the
   game is declared here and consumed via var(--name) in the other
   stylesheets and in js/ui.js. See docs/theming.md for what each one does.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- Type ---------------------------------------------------------- */
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --text-2xs: 0.6875rem; /* 11 */
  --text-xs: 0.75rem;    /* 12 */
  --text-sm: 0.8125rem;  /* 13 */
  --text-md: 0.9375rem;  /* 15 */
  --text-base: 1rem;     /* 16 */
  --text-lg: 1.125rem;   /* 18 */
  --text-xl: 1.375rem;   /* 22 */
  --text-2xl: 1.75rem;   /* 28 */
  --text-3xl: 2.375rem;  /* 38 */

  /* ---- The frame: rail, phone top bar, welcome backdrop -------------- */
  --rail: #11372a;
  --rail-top: #17463a;
  --rail-sunken: #0c2b20;
  --rail-text: #eef6f1;
  --rail-muted: #a2c3b2;
  --rail-faint: #6e9583;
  --rail-line: rgba(255, 255, 255, 0.08);
  --rail-hover: rgba(255, 255, 255, 0.07);
  --rail-active: rgba(255, 255, 255, 0.13);
  --rail-active-solid: #305146;    /* rail + rail-active, for rings that sit on it */
  --term-empty: rgba(255, 255, 255, 0.1);
  --rail-live: #8ee6b3;            /* "briefing you now" on the rail */
  --hero-text: #fff8ea;            /* the welcome title */
  --glow-warm: rgba(242, 178, 62, 0.30);
  --glow-cool: rgba(34, 183, 176, 0.20);
  /* Two wheat stalks per 72px tile, used as a mask so the colour stays a token. */
  --pattern-wheat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cdefs%3E%3Cg id='w'%3E%3Crect x='11.3' y='7' width='1.4' height='14.5' rx='.7'/%3E%3Cellipse cx='12' cy='4.6' rx='1.8' ry='2.8'/%3E%3Cellipse cx='9.7' cy='8.6' rx='1.6' ry='2.6' transform='rotate(-38 9.7 8.6)'/%3E%3Cellipse cx='14.3' cy='8.6' rx='1.6' ry='2.6' transform='rotate(38 14.3 8.6)'/%3E%3Cellipse cx='9.7' cy='12.4' rx='1.6' ry='2.6' transform='rotate(-38 9.7 12.4)'/%3E%3Cellipse cx='14.3' cy='12.4' rx='1.6' ry='2.6' transform='rotate(38 14.3 12.4)'/%3E%3Cellipse cx='9.7' cy='16.2' rx='1.6' ry='2.6' transform='rotate(-38 9.7 16.2)'/%3E%3Cellipse cx='14.3' cy='16.2' rx='1.6' ry='2.6' transform='rotate(38 14.3 16.2)'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23w' transform='translate(4 6) rotate(-16 12 12)'/%3E%3Cuse href='%23w' transform='translate(40 40) rotate(22 12 12)'/%3E%3C/svg%3E");

  /* ---- The content pane ---------------------------------------------- */
  --surface: #ffffff;
  --surface-2: #f6f6f2;
  --surface-3: #ecece6;
  --embed-bg: #f3f3ee;
  --border: #e6e6e0;
  --border-strong: #d2d3cb;
  --text: #1b1c19;
  --text-2: #3a3c36;
  --text-muted: #686b62;
  --text-faint: #9a9d94;

  /* ---- Accent: the Director's own actions ---------------------------- */
  --accent: #f2b23e;
  --accent-strong: #e39e22;
  --accent-ink: #8c5c05;           /* amber that passes as text on white */
  --accent-soft: rgba(242, 178, 62, 0.14);
  --on-accent: #241803;
  --brand-from: #f8ca66;           /* the wheat mark's tile */
  --brand-to: #e59c20;
  --brand-deep: #c4780f;
  --brand-ink: #123a2c;

  --link: #1264a3;
  --focus-ring: #2f7de1;
  --on-avatar: #ffffff;

  /* ---- Presence ------------------------------------------------------ */
  --presence-online: #2bac6a;
  --presence-away: #f0a92e;

  /* ---- Stat levels --------------------------------------------------- */
  /* critical <= 30, danger < 40, caution < 95, good >= 95.
     Caution is most of the game, so it stays calm and neutral; only the
     bad bands shout and only the goal band celebrates. */
  --stat-critical: #d63a3a;
  --stat-danger: #e0731f;
  --stat-caution: #55594f;
  --stat-good: #1d9e5e;
  --stat-track: #e8e8e2;
  --track-crisis: #f3cfcb;         /* the track below 30 */
  --track-goal: #bfe5cf;           /* the track at 95 and up */
  --trend-up: #17834d;
  --trend-down: #c83131;

  /* ---- Report tiers -------------------------------------------------- */
  --tier-solved: #1d9e5e;
  --tier-progress: #2a7fd4;
  --tier-stalled: #c99712;
  --tier-crisis: #d63a3a;

  /* ---- Staff colours, by role ---------------------------------------- */
  --avatar-1: #5a5fdc;   /* chief */
  --avatar-2: #9d5ae0;   /* field */
  --avatar-3: #0e9c96;   /* policy */
  --avatar-4: #e3663a;   /* logistics */
  --avatar-5: #d74486;   /* liaison */

  /* ---- Charts -------------------------------------------------------- */
  --chart-grid: #ebebe5;
  --chart-text: #8a8d84;

  /* ---- Shape and depth ----------------------------------------------- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 22px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 18, 0.06), 0 1px 1px rgba(20, 22, 18, 0.04);
  --shadow-md: 0 2px 6px rgba(20, 22, 18, 0.06), 0 10px 24px rgba(20, 22, 18, 0.08);
  --shadow-lg: 0 14px 34px rgba(6, 22, 15, 0.22), 0 44px 90px rgba(6, 22, 15, 0.28);
  --shadow-pane: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 4px 18px rgba(0, 0, 0, 0.16);
  --shadow-button:                 /* the amber buttons: a bevel and a lift */
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.14),
    0 1px 2px rgba(0, 0, 0, 0.14);
  --shadow-mark:                   /* the wheat tile */
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-mark-lifted:            /* the wheat tile on the invite card */
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 8px 18px rgba(0, 0, 0, 0.18);
  --avatar-sheen: linear-gradient(150deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 62%);
  --banner-sheen: rgba(255, 255, 255, 0.28);
  --scroll-fade: linear-gradient(to bottom, transparent, #000 14px);   /* a mask: only alpha matters */

  /* ---- Layout -------------------------------------------------------- */
  --rail-width: 268px;
  --pane-inset: 8px;               /* the gutter around the inset pane on wide screens */
  --measure: 44rem;                /* longest line of message text */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* ---- Motion -------------------------------------------------------- */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 120ms;
  --dur-fast: 150ms;
  --dur: 220ms;
  --dur-slow: 320ms;
  --dur-bar: 600ms;
}

/* "Night desk" */
:root[data-theme="dark"] {
  color-scheme: dark;

  --rail: #0b2018;
  --rail-top: #10291f;
  --rail-sunken: #081710;
  --rail-text: #e3ede7;
  --rail-muted: #91af9f;
  --rail-faint: #5f7e70;
  --rail-hover: rgba(255, 255, 255, 0.06);
  --rail-active: rgba(255, 255, 255, 0.11);
  --rail-active-solid: #263831;
  --hero-text: #fff6e3;
  --glow-warm: rgba(242, 178, 62, 0.22);
  --glow-cool: rgba(34, 183, 176, 0.14);

  --surface: #1a1c1e;
  --surface-2: #222528;
  --surface-3: #2b2f32;
  --embed-bg: #24272a;
  --border: #2c3033;
  --border-strong: #3d4246;
  --text: #e9ebe8;
  --text-2: #c8ccc7;
  --text-muted: #9ba09b;
  --text-faint: #6b716d;

  --accent: #f4b94a;
  --accent-strong: #ffc960;
  --accent-ink: #f4c46a;
  --accent-soft: rgba(244, 185, 74, 0.11);
  --on-accent: #231703;

  --link: #70b5f3;
  --focus-ring: #6aaeff;

  --presence-online: #3cc27c;
  --presence-away: #f2b23e;

  --stat-critical: #f25b5b;
  --stat-danger: #f39046;
  --stat-caution: #b7bbb5;
  --stat-good: #3fcc85;
  --stat-track: #2f3336;
  --track-crisis: #4a2b2b;
  --track-goal: #1f4a35;
  --trend-up: #58d496;
  --trend-down: #ff7a7a;

  --tier-solved: #3fcc85;
  --tier-progress: #5aa9f5;
  --tier-stalled: #e8bb3c;
  --tier-crisis: #f25b5b;

  --avatar-1: #7176ec;
  --avatar-2: #b07aee;
  --avatar-3: #20b4ad;
  --avatar-4: #f07f52;
  --avatar-5: #e8619f;

  --chart-grid: #2c3033;
  --chart-text: #80867f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 10px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.45), 0 44px 90px rgba(0, 0, 0, 0.5);
  --shadow-pane: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 4px 18px rgba(0, 0, 0, 0.45);
}
