/* Shopfaiz design tokens v3 — "Premium Hybrid". One source for the Mini App and the Web Admin.
   Spec: docs/design/premium-hybrid-redesign-spec.md §6–§8.

   Idea: a clothing shop built like a precise technical product. Photo leads; hierarchy comes from
   a tight grotesk (Inter Display) and hairlines; facts (article, sizes, order numbers, time) are set
   in a mono face; one acid-lime signal; important moments sit on graphite.

   Rules
   - Lime is a signal, never a surface under more than a few words, never text on light (1.2:1).
     It marks the single primary action of a screen, active states, the cart badge, "new/changed".
   - Photos have no radius. Hairlines over shadows; shadows only on floating things.
   - Status is never colour-only: every status has a word (and a dot).
   - Fonts are self-hosted (/web-shared/fonts.css); the fallbacks are metric-matched so text does
     not jump when the files arrive.
   Legacy names (--milk, --surface-2, --fs-*, --t, --r-photo, …) are kept for screens that have not
   been rebuilt yet; new code uses the v3 names. */

:root {
  /* ---- colour: brand ---- */
  --graphite: #121314;
  --charcoal: #1C1D1F;
  --ink-2: #2A2C2F;          /* graphite surfaces: navigation, admin sidebar */
  --ivory: #F4F1EA;          /* app background ("milk") */
  --paper: #FBFAF7;          /* fields, cards, sheets */
  --bone: #E6E1D6;           /* skeletons, inactive tracks */
  --stone: #CFC8BA;          /* photo backdrop while an image loads */
  --lime: #C8F23C;
  --on-lime: #121314;
  --on-ink: #F4F1EA;
  --on-ink-muted: rgba(244, 241, 234, 0.62);
  --milk: var(--ivory);      /* legacy alias */

  /* ---- colour: roles (light) ---- */
  --bg: var(--ivory);
  --surface: var(--paper);
  --surface-2: #EDE9E0;
  --surface-3: var(--bone);
  --text: var(--graphite);
  --muted: #66635C;          /* ≥ 4.5:1 on ivory and paper */
  --faint: #9C988F;          /* decoration only, never body text */
  --line: rgba(18, 19, 20, 0.10);
  --line-strong: rgba(18, 19, 20, 0.22);
  --accent-ink: #3D4A00;     /* lime family readable on light */
  --ok: #2A7038;
  --ok-bg: #E3F0E1;
  --warn: #8A5900;
  --warn-bg: #F6EBD4;
  --bad: #B3261E;
  --bad-bg: #F8E1DE;
  --info: #2C4A7A;
  --info-bg: #E2E8F2;
  --scrim: rgba(18, 19, 20, 0.46);
  --shimmer: linear-gradient(100deg, var(--bone) 30%, var(--paper) 50%, var(--bone) 70%);

  /* ---- type ---- */
  --font: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Display", "Inter Display Fallback", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Mono Fallback", ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --fw-display: 700;
  --fw-display-s: 600;
  --track-display: -0.035em;
  --track-mono: 0.08em;

  --t-hero: clamp(44px, 13vw, 72px);
  --t-h1: 40px;
  --t-h2: 26px;
  --t-h3: 20px;
  --t-body-l: 17px;
  --t-body: 15px;
  --t-caption: 13px;
  --t-mono: 10.5px;

  /* legacy scale (screens not yet rebuilt) */
  --fs-xs: 11px;
  --fs-s: 13px;
  --fs-m: 15px;
  --fs-l: 17px;
  --fs-xl: 22px;
  --fs-2xl: 32px;
  --fs-3xl: 40px;
  --fs-hero: var(--t-hero);
  --lh-tight: 0.95;
  --track-eyebrow: var(--track-mono);
  --track-brand: 0.3em;

  /* ---- space: 4 px grid, 8 px rhythm ---- */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;
  --gutter: 20px;

  /* ---- shape ---- */
  --r-0: 0;          /* photos */
  --r-xs: 4px;       /* mono badges */
  --r-s: 10px;       /* fields, buttons */
  --r: 14px;         /* cards */
  --r-l: 20px;       /* sheets, dialogs */
  --r-pill: 999px;   /* chips */
  --r-photo: var(--r-0);
  --shadow-1: 0 1px 2px rgba(18, 19, 20, 0.06);
  --shadow-2: 0 12px 32px rgba(18, 19, 20, 0.16);
  --shadow-float: 0 12px 32px rgba(18, 19, 20, 0.24), 0 2px 6px rgba(18, 19, 20, 0.12);

  /* ---- motion ---- */
  --d-1: 120ms;      /* presses, hovers */
  --d-2: 220ms;      /* chips, toasts, small reveals */
  --d-3: 320ms;      /* screen transitions, sheets */
  --d-4: 600ms;      /* startup, big moments */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);  /* small elements only */
  --ease-exit: cubic-bezier(.4, 0, 1, 1);          /* things leaving: start slow, go fast */
  --ease: var(--ease-out);
  --t-fast: var(--d-1);
  --t: var(--d-2);
  /* Motion system (docs/design/premium-hybrid-motion.md). Springs are sampled damped springs as
     CSS linear(); browsers without linear() fall back to the cubic curves above. */
  --d-0: 80ms;        /* press feedback */
  --d-spring: 480ms;  /* sheets, shared photo */
  --d-pop: 420ms;     /* icon reactions */
  --spring: var(--ease-out);         /* soft: ~1% overshoot (stiffness 260, damping 26) */
  --spring-pop: var(--ease-spring);  /* lively: ~11% overshoot (stiffness 380, damping 22), icons only */
  --m-shift: 16px;    /* screen slide distance */
  --m-lift: 8px;      /* small reveals, tab switch */
  --m-press: .94;     /* scale while pressed */
  --stagger: 30ms;    /* list items, max 8 */

  /* ---- layers ---- */
  --z-sticky: 5;
  --z-nav: 6;
  --z-toast: 50;
  --z-overlay: 40;

  /* ---- controls ---- */
  --control-h: 52px;
  --control-h-s: 40px;
  --chip-h: 34px;
  --tap: 44px;
}

:root[data-theme="dark"] {
  --bg: #0F1011;
  --surface: #1A1B1D;
  --surface-2: #232527;
  --surface-3: #2D2F32;
  --text: #F2EFE8;
  --muted: #A29F97;
  --faint: #6C6A64;
  --line: rgba(242, 239, 232, 0.12);
  --line-strong: rgba(242, 239, 232, 0.28);
  --accent-ink: var(--lime);
  --ok: #7BC487;
  --ok-bg: rgba(123, 196, 135, 0.14);
  --warn: #E2B04F;
  --warn-bg: rgba(226, 176, 79, 0.14);
  --bad: #FF8A80;
  --bad-bg: rgba(255, 138, 128, 0.14);
  --info: #9DB8E6;
  --info-bg: rgba(157, 184, 230, 0.14);
  --scrim: rgba(0, 0, 0, 0.62);
  --ink-2: #232527;
  --stone: #232527;
  --shimmer: linear-gradient(100deg, #1E2022 30%, #2A2C2F 50%, #1E2022 70%);
  --shadow-1: none;
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.55);
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.052, 0.172, 0.319, 0.466, 0.6, 0.714, 0.805, 0.875, 0.927, 0.963, 0.986, 1.001, 1.009, 1.013, 1.014, 1.013, 1.011, 1.009, 1.007, 1.005, 1.004, 1.003, 1.002, 1);
    --spring-pop: linear(0, 0.111, 0.353, 0.618, 0.842, 0.998, 1.085, 1.116, 1.109, 1.084, 1.053, 1.025, 1.004, 0.992, 0.987, 0.987, 0.989, 0.993, 0.996, 0.999, 1.001, 1.001, 1.002, 1.001, 1);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --d-0: 0ms; --d-1: 0ms; --d-2: 0ms; --d-3: 0ms; --d-4: 0ms; --d-spring: 0ms; --d-pop: 0ms; --m-shift: 0px; --m-lift: 0px; --m-press: 1; }
}
