/* Gild & Grid design tokens. The one file that defines a `--` token (scripts/theme-tokens.test.mjs
   holds that line). studio.css holds component rules only and reads these.

   Layout, the same as the approved design guide (mockups/brand/gild-grid-design-guide.html):
   the bare :root carries the complete DARK set, and one `:root[data-gg-theme="light"]` block
   redefines the same names for light. Only token values change between themes, never a component
   rule. Dark is the resting state: the shells stamp nothing, so a first visit is dark, and the
   pre-paint script in each shell (and public/theme.js, the switcher) stamps data-gg-theme="light"
   only when the reader has chosen it.

   The attribute is data-gg-theme, never data-theme: the claude.ai artifact host and the ops portal
   shell both write data-theme. There is no prefers-color-scheme block; the operating system does
   not get a vote. The reader's choice is remembered under the localStorage key gg.theme.

   Customer brand colors (a post, a slide, a brand profile swatch) arrive as data and are never
   themed. Nothing here, and nothing in studio.css, may restyle them.

   color-scheme is set per theme below (it moves native controls, scrollbars and the canvas
   color). The <meta name="color-scheme"> and <meta name="theme-color"> in the two HTML shells are
   the two values the pre-paint script and the switcher update with the theme: theme-color is the
   header surface, which is --surface in the active set (light #FFFFFF, dark #1D2028). */

:root {
  /* ===== Theme-invariant: the same in both themes. Everything above the marker below. ===== */

  /* Primitives: Gild & Grid guide, Graphite & Vermilion pairing (mockups/brand/guide/build.py). */
  --graphite-50:#F4F5F7; --graphite-100:#E7E9ED; --graphite-200:#CDD1D8; --graphite-300:#ADB2BC; --graphite-400:#9097A6;
  --graphite-500:#697080; --graphite-600:#535966; --graphite-700:#3B404C; --graphite-800:#2A2E37; --graphite-900:#1D2028; --graphite-950:#121419;
  --vermilion-50:#FFF2EE; --vermilion-100:#FFE1D9; --vermilion-200:#FFC1B1; --vermilion-300:#FF9880; --vermilion-400:#FF6E52;
  --vermilion-500:#FF4A26; --vermilion-600:#D7300C; --vermilion-700:#B4280A; --vermilion-800:#8E200B; --vermilion-900:#651A0D; --vermilion-950:#3D0E05;
  --paper-0:#FFFFFF; --paper-50:#FAF9F7; --paper-100:#F3F0EB; --paper-200:#E6E2DB; --paper-300:#D2CDC4; --paper-400:#ADA79D;
  --paper-500:#868076; --paper-600:#66615A; --paper-700:#4A4641; --paper-800:#302D2A; --paper-900:#1E1C1A;

  --font-display:'Bricolage Grotesque','Helvetica Neue',Arial,sans-serif;
  --font-sans:'Instrument Sans',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --font-mono:'IBM Plex Mono',ui-monospace,'SF Mono',SFMono-Regular,Menlo,Consolas,monospace;

  --space-0:0; --space-1:2px; --space-2:4px; --space-3:8px; --space-4:12px; --space-5:16px; --space-6:20px;
  --space-7:24px; --space-8:32px; --space-9:40px; --space-10:48px; --space-11:64px; --space-12:80px; --space-13:96px;
  --radius-xs:4px; --radius-sm:6px; --radius-md:8px; --radius-lg:12px; --radius-xl:16px; --radius-full:999px;
  --border-width:1px; --border-width-control:1.5px; --focus-width:2px; --focus-offset:2px; --content-max:1240px;
  --dur-instant:80ms; --dur-fast:140ms; --dur-base:200ms; --dur-slow:320ms; --dur-mark:560ms;
  /* Motion, Premium archetype (motion-design skill): one easing, 350 to 600 ms, no overshoot. The
     reveal runs 480 ms with a 55 ms step, and the script caps the step index so a whole stagger
     stays under 500 ms. */
  --ease-premium:cubic-bezier(.4,0,.2,1); --rv-dur:480ms; --rv-step:55ms;
  --ease-standard:cubic-bezier(.2,0,0,1); --ease-enter:cubic-bezier(0,0,.2,1); --ease-exit:cubic-bezier(.4,0,1,1); --ease-slide:cubic-bezier(.16,1,.3,1);

  /* Text and rules that sit ON an overlay, a photograph (the crop frame) or a platform's own color
     are white in both themes. --on-primary turns dark in the dark set, so it cannot stand in for this. */
  --on-overlay:#FFFFFF;
  /* The black a video letterboxes onto. Customer footage, never themed. */
  --video-matte:#000000;

  /* Platform marks: each network's own brand color on the small .pf square. Third-party colors,
     never themed. The two near-black marks (x, tiktok) take --ring-mark below so they stay
     visible on a dark ground. */
  --platform-li:#0A66C2; --platform-ig:#C13584; --platform-fb:#1877F2; --platform-yt:#E02020; --platform-bs:#1185FE;
  --platform-rd:#FF4500; --platform-wa:#1FA855; --platform-dc:#5865F2; --platform-xx:#0C1917; --platform-tt:#111827;

  /* Pattern strokes inside the design sample thumbnails (.design .th-*): drawn illustration, the same
     in both themes, with an alpha the primitives above do not carry. */
  --thumb-vermilion-strong:rgba(255,74,38,.55); --thumb-vermilion-faint:rgba(255,74,38,.16); --thumb-grid-line:rgba(255,255,255,.08);

  /* Gild's graffiti wall (a secret): a painted scene, the same in both themes, like the fox art. */
  --wall-brick:#8A4A3A; --wall-mortar:#5E2F25; --wall-shadow:rgba(0,0,0,.35); --wall-gold:#F2CF73; --wall-sea:#5FB3A8;

  /* The caption look picker on New brief (.capframe): a placeholder clip with an example caption on it.
     It stands for the customer's footage, so it is drawn the same in both themes, and the caption's
     white-on-dark edge must read on either. */
  --cap-clip-a:#4A3F36; --cap-clip-b:#262A35; --cap-clip-c:#14161C;
  --cap-ink:#FFFFFF; --cap-edge:#000000; --cap-lit:#FFD84D; --cap-shadow:rgba(0,0,0,.5);
  --cap-brand-hi:rgba(255,255,255,.7); --cap-brand-lo:rgba(255,255,255,.38);

  /* Platform marks on the Connections cards (public/brand-marks.js): each platform's own colors, the same in both themes. */
  /* The mark for "several colors" in the style guide's not-saved list (.gl-multi): three fixed hues, the same in both themes. */
  --gl-multi-a:#7A6E5A; --gl-multi-b:#C9B27C; --gl-multi-c:#5E7C6B;

  --bm-glyph:#FFFFFF;
  --bm-g1:#4285F4; --bm-g2:#34A853; --bm-g3:#FBBC05; --bm-g4:#EA4335;
  --bm-analytics-hi:#F9AB00; --bm-analytics-lo:#E37400;
  --bm-facebook:#0866FF; --bm-linkedin:#0A66C2; --bm-bluesky:#0085FF;

  /* The mark reads these; fills go through classes, never presentation attributes. */
  --p:var(--logo-p); --a:var(--logo-a); --d:var(--logo-d); --ink:var(--logo-ink);

  /* ===== THEMED: dark is the bare :root. Every name below the marker is redefined in the light block. ===== */
  --bg:#121419; --surface:#1D2028; --surface-raised:#2A2E37; --surface-sunken:#0D0F13; --surface-inverse:#F4F5F7;
  --text:#F3F4F6; --text-muted:#A9AFBB; --text-subtle:#9097A6; --text-inverse:#1D2028;
  --border:#363940; --border-strong:#767C8B;
  --primary:#E7E9ED; --primary-hover:#FFFFFF; --primary-active:#CDD1D8; --on-primary:#1D2028;
  --accent:#FF4A26; --accent-hover:#FF6E52; --on-accent:#121419; --accent-text:#FF6E52; --accent-tint:#3D2628;
  --focus:#FF6E52;
  --success:#7AA7FF; --success-tint:#283042; --warning:#FFB070; --warning-tint:#383131;
  --danger:#FF85A8; --danger-tint:#3D2E3A; --on-danger:#121419; --info:#C4C9D2; --info-tint:#2E3139;
  --overlay:rgba(5,6,8,.72);
  --logo-p:#9097A6; --logo-a:#FF4A26; --logo-d:#5E6574; --logo-ink:#F3F4F6;
  --shadow-1:0 1px 2px rgba(0,0,0,.40);
  --shadow-2:0 2px 4px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.40);
  --shadow-3:0 6px 12px rgba(0,0,0,.40), 0 22px 52px rgba(0,0,0,.55);
  /* The neutral stage behind a customer's post, slide or file (the post preview, the file viewer, the
     design example dialog). Never --accent-tint, which is a vermilion wash that would tint the
     customer's own colors. */
  --stage:#0D0F13;
  /* A hairline around the near-black platform marks, which would melt into a dark surface. */
  --ring-mark:#767C8B;
  /* The knob of an ON toggle, sitting on the --accent track. */
  --knob-on:#121419;
  /* The admin console's on/off switch (views/Switch.jsx): green is on, red is off, which the brand
     scale has no hue for. Track against --surface: on 5.36, off 4.16. Thumb against the track: on 3.04,
     off 3.91. The On and Off words (--switch-on-text, --switch-off-text) read 8.68 and 7.20. */
  --switch-on:#2FA866; --switch-off:#E5484D; --switch-thumb:#FFFFFF; --switch-on-text:#5FD38D; --switch-off-text:#FF8A8E;
  /* The color a glass surface is tinted with: white on a dark ground, graphite on a light one. */
  --glass-tint:var(--paper-0);
  /* The lane label on a topic: social is vermilion, articles is graphite, a highlight on the label only. */
  --lane-social-bg:color-mix(in srgb, var(--vermilion-500) 22%, transparent); --lane-social-fg:var(--vermilion-200);
  --lane-article-bg:var(--graphite-600); --lane-article-fg:var(--graphite-50);
  /* Dark runs the reveal about 15 percent gentler than light. */
  --rv-shift:8px;
  color-scheme: dark;
}

:root[data-gg-theme="light"] {
  --bg:#FAF9F7; --surface:#FFFFFF; --surface-raised:#FFFFFF; --surface-sunken:#F3F0EB; --surface-inverse:#1D2028;
  /* --text-subtle was #697080 (graphite-500), 4.37:1 on --surface-sunken. graphite-600 is the next
     step down the guide's neutral scale and reads 6.18:1 there. */
  --text:#1D2028; --text-muted:#535966; --text-subtle:#535966; --text-inverse:#F4F5F7;
  --border:#E2E3E7; --border-strong:#848B99;
  --primary:#3B404C; --primary-hover:#2A2E37; --primary-active:#1D2028; --on-primary:#FFFFFF;
  --accent:#FF4A26; --accent-hover:#FF6E52; --on-accent:#121419; --accent-text:#B4280A; --accent-tint:#FFF2EE;
  --focus:#D7300C;
  --success:#2160CC; --success-tint:#EEF3FD; --warning:#9E4A05; --warning-tint:#FFF3E6;
  --danger:#B42050; --danger-tint:#FDEEF3; --on-danger:#FFFFFF; --info:#3B404C; --info-tint:#F4F5F7;
  --overlay:rgba(18,20,25,.55);
  --logo-p:#3B404C; --logo-a:#FF4A26; --logo-d:#9AA0AC; --logo-ink:#1D2028;
  --shadow-1:0 1px 2px rgba(29,32,40,.06), 0 1px 3px rgba(29,32,40,.08);
  --shadow-2:0 2px 4px rgba(29,32,40,.05), 0 6px 16px rgba(29,32,40,.09);
  --shadow-3:0 4px 8px rgba(29,32,40,.06), 0 18px 44px rgba(29,32,40,.16);
  /* Kept at today's value so this change moves no pixel. The dark set is already neutral; whether the
     light stage should be the sunken sand (#F3F0EB) instead of this vermilion-50 wash is an owner call
     made with the switcher, not here. */
  --stage:#FFF2EE;
  --ring-mark:transparent;
  --knob-on:#FFFFFF;
  /* Track against --surface: on 4.38, off 5.07. Thumb against the track: on 4.38, off 5.07. The words read 6.16 and 6.53. */
  --switch-on:#1E8A4C; --switch-off:#D02F36; --switch-thumb:#FFFFFF; --switch-on-text:#14703B; --switch-off-text:#B4232A;
  --glass-tint:var(--graphite-900);
  --lane-social-bg:var(--vermilion-100); --lane-social-fg:var(--vermilion-800);
  --lane-article-bg:var(--graphite-200); --lane-article-fg:var(--graphite-900);
  --rv-shift:10px;
  color-scheme: light;
}

/* Cover style previews (views/cover-style-picker.js): drawings of each layout that stand for the
   customer's own pictures, so they are the same in both themes and sit on the bare :root only. */
:root {
  --cs-sky-a:#E9C9A4; --cs-sky-b:#F4E4CE; --cs-hill-a:#6C7A63; --cs-hill-b:#47524A; --cs-hill-c:#2C342E;
  --cs-sun:#FFF3D6; --cs-photo-a:#FFB88A; --cs-photo-b:#7E5A6B; --cs-photo-c:#1E2233; --cs-bokeh:rgba(255,238,210,.55);
  --cs-flat-bg:#F3F0EB; --cs-flat-ink:#1D2028; --cs-flat-hot:#FF4A26; --cs-flat-soft:#ADB2BC;
  --cs-paper:#FAF9F7; --cs-ink:#2A2E37; --cs-scrim:rgba(18,20,25,.88); --cs-title:#FFFFFF;
  --cs-color:#FF4A26; --cs-color-ink:#121419;
  --cs-edge:rgba(255,255,255,.7); --cs-glass-a:rgba(255,255,255,.2); --cs-glass-b:rgba(255,255,255,.04);
  --cs-shadow:rgba(0,0,0,.4); --cs-vignette:rgba(0,0,0,.45);
}

/* Animated video background previews (views/video-pattern-picker.js): a drawing of each pattern on the dark ground the
   finished video has, the same in both themes, so they sit on the bare :root only. */
:root { --vp-ground:#0D1B19; --vp-ink:#8FD9D0; }
