/* Smirktag design tokens: direction "The Flip", light-first (production foundation).
   Shared by site/next/*.html and, later, the extension (popup, pill, panel).
   Read-only for page builders: add page-specific values in your own CSS file, not here.

   COLOUR RULE: this file is the ONLY place a hex/rgb/hsl value may appear in the whole build.
   Everything else uses var(--tt-*). JS/canvas read colours with getComputedStyle(el).getPropertyValue('--tt-…').
   Inline SVG uses fill="currentColor"/stroke="currentColor" or CSS (fill: var(--tt-…)); SVG presentation
   attributes cannot take var().

   The colour block between BEGIN COLOUR and END COLOUR is the decided palette (docs/design/COLOUR_DECISION.md).
   A future palette change replaces only that block. Do not depend on a hue, only on the role names.
   Tints, hairlines and shadow colours are derived with color-mix() so a swap leaves nothing stale.

   Contrast: WCAG 2.x formula, computed by script on 2026-11-25 for the Orchid + Citron values.
   Ratios: on --tt-bg / on --tt-surface (white). */

/* ================= BEGIN COLOUR (Orchid + Citron, docs/design/COLOUR_DECISION.md) ================= */
:root {
  color-scheme: light;

  /* Surfaces: orchid-tinted paper, never grey, never black */
  --tt-bg:        #FBF7FD;   /* page */
  --tt-surface:   #FFFFFF;   /* cards, popup body, panels */
  --tt-surface-2: #F4E9FA;   /* inset, hover, pressed, chart well */

  /* Text: deep aubergine, not black */
  --tt-ink:   #24103F;       /* 16.24 / 17.20 */
  --tt-ink-2: #4E3B66;       /* 9.26 / 9.81  secondary copy */
  --tt-ink-3: #6A5680;       /* 6.09 / 6.45 (5.49 on surface-2)  meta only, >= 12px */

  /* Brand: orchid, hue 282. The thread, the eyelet ring, the strike, the one primary action.
     Never darken towards PhonePe #5F259F or redden past ~290 (Meesho). */
  --tt-brand:      #9B1FD1;  /* 5.65 / 5.98 as text; white on it 5.98 */
  --tt-brand-hi:   #8317B5;  /* hover / pressed (white on it 7.62) */
  --tt-brand-ink:  #FFFFFF;  /* text and icons ON --tt-brand */
  --tt-brand-tint: #F1E1FA;  /* stage wall, chips; ink on it 13.83, brand on it 4.81 */

  /* Accent: citron, hue 71. The truth moment only (highlighter, real-low chip, eyelet, catch reveal).
     A FILL. Never text on a light surface (1.2:1). Text on it is --tt-accent-ink (13.86).
     As a fill next to white, give it --tt-accent-edge (3.96 vs white). On the orchid tag it may be text (4.82). */
  --tt-accent:      #D4F53C;
  --tt-accent-ink:  #24103F;
  --tt-accent-edge: #6E8A00;

  /* Smirktag's side of the tag: a physical object, the same saturated orchid in both themes. */
  --tt-tag:       #9B1FD1;
  --tt-tag-ink:   #FFFFFF;   /* 5.98 */
  --tt-tag-ink-2: #F3E3FB;   /* 4.90 secondary text on the tag */
  /* A false-claim flag ON the orchid tag or pill. Red fails on orchid (fake 1.53, fake-ink 1.06), so flags there
     are an opaque rose chip, and the M.R.P. line is a light coral. Same in both themes. */
  --tt-flag-chip:     #FFE6E3; /* 5.04 against the tag */
  --tt-flag-chip-ink: #A4231C; /* 6.23 on the chip */
  --tt-flag-line:     #FFB3AB; /* dotted M.R.P. line on the tag, 3.50 (non-text) */
  /* Other verdict stamps ON the tag: an opaque white chip with light-theme inks, same in both themes. */
  --tt-tag-chip:      #FFFFFF; /* 5.98 against the tag */
  --tt-tag-chip-real: #0F6E4F; /* 6.24 on white */
  --tt-tag-chip-thin: #9A5B00; /* 5.43 on white */

  /* Verdict roles. Each has a FILL (icons, chart marks, bars, soft backgrounds) and an -INK for text.
     Colour never carries meaning alone: always icon + word. Fake and thin collapse under deuteranopia,
     so they also differ by form: fake = filled rose chip + flag icon, thin = dashed outline chip + its own icon. */
  --tt-real:      #12805C;   /* verified saving, genuine low. As text 4.64 / 4.92 */
  --tt-real-ink:  #0F6E4F;   /* text on tints (5.89 on bg) */
  --tt-fake:      #E5484D;   /* false claim. FILL ONLY: 3.69 as text fails */
  --tt-fake-ink:  #B3262C;   /* text for false claims: 6.14 / 6.50; 4.81 on fake-soft over surface-2 */
  --tt-thin:      #B26A00;   /* thin data. FILL ONLY: 4.00 */
  --tt-thin-ink:  #8A5200;   /* text: 6.03 / 6.39; 4.75 on thin-soft over surface-2 */

  /* The shop's own printed tag (front face, mock shop pages). Depicts a physical object, same in both themes. */
  --tt-paper:      #F2EBDC;  /* bone tag card */
  --tt-paper-ink:  #1A1712;  /* 15.05 on paper */
  --tt-paper-ink-2:#5E574B;  /* 6.02 on paper */
  --tt-shop-red:   #B3261E;  /* the shop's sale badge, 5.51 on paper. Only inside the shop's claim */

  /* Shadow base colour: aubergine, so shadows are tinted, not grey */
  --tt-shadow-base: #24103F;
}
[data-theme="dark"] {
  color-scheme: dark;
  --tt-bg: #160B20; --tt-surface: #20122D; --tt-surface-2: #2B1A3B;
  --tt-ink: #FAF3FF;   /* 17.53 / 16.30 */
  --tt-ink-2: #D8C6E6; /* 11.91 / 11.08 */
  --tt-ink-3: #AE98C2; /* 7.32 / 6.81 */
  --tt-brand: #D9A6F2; --tt-brand-hi: #E6C2F7; --tt-brand-ink: #24103F; /* 9.69 on bg; ink on brand 8.75 */
  --tt-brand-tint: #1D0D29; /* the stage: tag 3.07 against it, brand 9.36 on it */
  --tt-accent: #D4F53C; --tt-accent-ink: #24103F; --tt-accent-edge: #D4F53C;
  --tt-real: #4FCB97; --tt-real-ink: #4FCB97;   /* 9.36 */
  --tt-fake: #FF7A7E; --tt-fake-ink: #FF7A7E;   /* 7.56 */
  --tt-thin: #F0A43C; --tt-thin-ink: #F0A43C;   /* 9.14 */
  --tt-shadow-base: #000000;
  /* --tt-tag* and --tt-paper* stay as in light: they are physical objects */
}
/* ================= END COLOUR ================= */

/* ---------- Derived colour roles (do not hard-code; these follow the block above) ---------- */
:root, [data-theme="dark"] {
  --tt-line:   color-mix(in oklab, var(--tt-ink) 10%, transparent);  /* hairline, decorative only */
  --tt-line-2: color-mix(in oklab, var(--tt-ink) 20%, transparent);  /* stronger rule, ghost-button border */
  --tt-brand-soft:  color-mix(in oklab, var(--tt-brand) 12%, transparent);
  --tt-brand-line:  color-mix(in oklab, var(--tt-brand) 45%, transparent);
  --tt-accent-soft: color-mix(in oklab, var(--tt-accent) 35%, transparent);
  --tt-real-soft:   color-mix(in oklab, var(--tt-real) 12%, transparent);
  --tt-fake-soft:   color-mix(in oklab, var(--tt-fake) 12%, transparent);
  --tt-thin-soft:   color-mix(in oklab, var(--tt-thin) 12%, transparent);
  --tt-highlight:   color-mix(in oklab, var(--tt-brand-ink) 30%, transparent); /* inset top edge on solid buttons */

  /* The hanging tag (hero). Front = the shop's paper. Back = Smirktag's brand card. */
  --tt-tag-front:     var(--tt-paper);
  --tt-tag-front-ink: var(--tt-paper-ink);
  --tt-tag-back:      var(--tt-tag);
  --tt-tag-back-ink:  var(--tt-tag-ink);
  --tt-tag-back-ink-2: var(--tt-tag-ink-2); /* 4.90 on the tag */
  --tt-tag-back-accent: var(--tt-accent);  /* citron: the one place it may be TEXT (4.82 on the tag) */
  --tt-tag-back-mrp:    var(--tt-flag-line); /* use instead of --tt-chart-mrp on the tag */
  --tt-thread:  var(--tt-brand);
  --tt-strike:  var(--tt-tag);         /* Smirktag's strike over a false claim (on paper): 5.04 in both themes */
  --tt-stage:   var(--tt-brand-tint);  /* the wall the tag hangs against: gives the bone tag an edge */

  /* Chart */
  --tt-chart-line: var(--tt-ink);      /* the real price step line (on the back face: --tt-tag-back-ink) */
  --tt-chart-fill: color-mix(in oklab, var(--tt-ink) 6%, transparent);
  --tt-chart-grid: var(--tt-line);
  --tt-chart-mrp:  var(--tt-fake);     /* dotted line at M.R.P.: the price nobody was charged */
  --tt-chart-low:  var(--tt-accent);   /* the real low marker (ring in --tt-ink so it reads on light) */

  /* Elevation: depth from soft light, not borders */
  --shadow-1: 0 0 0 1px color-mix(in oklab, var(--tt-shadow-base) 6%, transparent), 0 1px 2px color-mix(in oklab, var(--tt-shadow-base) 8%, transparent);
  --shadow-2: 0 0 0 1px color-mix(in oklab, var(--tt-shadow-base) 5%, transparent), 0 12px 28px -12px color-mix(in oklab, var(--tt-shadow-base) 22%, transparent);
  --shadow-float: 0 0 0 1px color-mix(in oklab, var(--tt-shadow-base) 6%, transparent), 0 30px 60px -24px color-mix(in oklab, var(--tt-shadow-base) 30%, transparent);
  --shadow-tag: 0 1px 0 color-mix(in oklab, var(--tt-shadow-base) 8%, transparent), 0 34px 50px -26px color-mix(in oklab, var(--tt-shadow-base) 40%, transparent);
  --tt-cast: color-mix(in oklab, var(--tt-brand-hi) 30%, transparent); /* tag's cast shadow on the stage wall */
  --tt-lamp: color-mix(in oklab, var(--tt-surface) 70%, transparent);  /* the light pool on the stage */
  --tt-ring: 0 0 0 4px var(--tt-brand-soft);                            /* status dot halo */
}

/* ---------- Extension surfaces follow the OS ----------
   Pages with data-surface="ext" (popup, mock pill pages) run this inline in <head>, before CSS paints:
   <script>try{if(!document.documentElement.dataset.theme&&matchMedia('(prefers-color-scheme: dark)').matches)document.documentElement.dataset.theme='dark'}catch(e){}</script>
   The website itself is light; dark is a secondary preview via data-theme="dark".
   The shadow-DOM pill copies the [data-theme="dark"] block onto :host([data-theme="dark"]) at build time. */

:root {
  /* ---------- Type families ----------
     Bricolage Grotesque (D11): site headlines and the popup verdict sentence. No italic; never below 20 px.
     Inter: everything else, every price in a row, table, chart, popup or pill (use .tt-num).
     JetBrains Mono: small uppercase labels and coupon codes only. It has no ₹: never prices. */
  --f-display: "Bricolage TT", "Inter TT", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-ui:      "Inter TT", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono:    "JetBrains Mono TT", "Inter TT", ui-monospace, "SFMono-Regular", monospace;

  /* ---------- Type scale: website (fluid, rem) ---------- */
  --t-hero:  clamp(2.75rem, 1.2rem + 5.2vw, 6rem);    /* h1, Bricolage 760 */
  --t-h2:    clamp(2rem, 1.2rem + 2.6vw, 3.5rem);     /* section headline, Bricolage 720 */
  --t-h3:    1.375rem;                                /* 22px, Inter 600 */
  --t-lede:  1.125rem;                                /* 18px */
  --t-body:  1.0625rem;                               /* 17px */
  --t-small: 0.875rem;                                /* 14px */
  --t-label: 0.75rem;                                 /* 12px mono uppercase */
  --t-figure: clamp(3rem, 1.6rem + 4.4vw, 5.5rem);    /* big loss figure "₹200", Inter 300 tnum */

  /* ---------- Type scale: extension (px only: shadow DOM, host may change rem) ----------
     12 / 13 / 15 / 20 / 28. Nothing a user must read below 12px. */
  --x-12: 12px;  --x-13: 13px;  --x-15: 15px;  --x-20: 20px;  --x-28: 28px;
  --x-lh-tight: 1.2;  --x-lh: 1.45;

  --w-light: 300; --w-book: 400; --w-medium: 520; --w-semi: 600; --w-bold: 680;
  --track-label: .14em;
  --track-display: -.035em;

  /* ---------- Spacing (4px scale, px so it works in shadow DOM) ---------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 144px;
  --gutter: clamp(16px, 4vw, 56px);       /* page side padding: 16px on phones */
  --section-y: clamp(88px, 11vw, 168px);  /* vertical rhythm between site sections */
  --container: 1240px;
  --measure: 34rem;                       /* max paragraph width */

  /* ---------- Radii (use few) ---------- */
  --r-1: 8px;      /* controls, inputs, chips, stamps */
  --r-2: 16px;     /* cards, the panel, the popup verdict tag */
  --r-3: 28px;     /* section stages (the tinted wall behind the tag, game board) */
  --r-pill: 999px; /* the in-page pill, buttons */
  --tag-chamfer: 14%; /* clip-path chamfer of the hanging tag's top corners */

  /* ---------- Motion ----------
     One spring for physical objects, two curves for everything else.
     Only transform and opacity animate. Nothing loops while off-screen. */
  --ease-out:   cubic-bezier(.16, 1, .3, 1);   /* arrivals, reveals */
  --ease-inout: cubic-bezier(.65, 0, .35, 1);  /* state changes, scrubbed beats */
  --ease-in:    cubic-bezier(.7, 0, .84, 0);   /* exits only */
  --ease-pop:   cubic-bezier(.34, 1.56, .64, 1); /* the catch reveal / stamp landing: one small overshoot */
  --d-instant: 100ms;  /* pressed state */
  --d-fast: 160ms;     /* hover, popup verdict fade (max entrance in the extension: 200ms) */
  --d-mid: 420ms;      /* reveals, panel slide, stamp land */
  --d-flip: 520ms;     /* a tag turn driven by a button or key (not drag) */
  --d-slow: 900ms;     /* thread draw, chart draw */
  --d-celebrate: 1200ms; /* catch reveal total (highlighter swipe + stamp + count), site and popup */
  --d-loader: 800ms;   /* preloader ceiling, once per session */
  --stagger: 80ms;

  /* Spring constants (read by JS via getComputedStyle; unitless) */
  --spring-spin-k: 70;   --spring-spin-c: 9.5;  /* one overshoot */
  --spring-swing-k: 46;  --spring-swing-c: 7.5; /* flat within ~600ms of landing */
  --swing-max-deg: 4;    /* intro swing amplitude ceiling while text is visible */

  /* ---------- Layers ---------- */
  --z-stage-bg: -1; --z-base: 1; --z-stage: 2; --z-sticky: 15; --z-nav: 20; --z-loader: 50;
}

/* ---------- Reduced motion: calm but complete ----------
   Durations collapse; pages must still show every final state (the back face of the tag,
   the finished demo, all steps, the game answers on request). Builders: also gate JS motion on matchMedia. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --d-instant: 0ms; --d-fast: 0ms; --d-mid: 0ms; --d-flip: 0ms; --d-slow: 0ms; --d-loader: 0ms;
    --d-celebrate: 0ms; --stagger: 0ms; --swing-max-deg: 0;
  }
}
