/* ==========================================================================
   tillics – design tokens  v0.1 (Step 0.1: foundations)
   Flavour: Soft blush + Receipt
     World   = light paper ground, blush panels, wine accents, soft corners, calm motion
     Objects = white till paper: square, torn edge, dashed rules, red stamp
   Contrast ratios (WCAG 2.x) are written next to each text role.
   Rules: Red is never text on Ink and Ink is never text on Red (2.83).
          On Red, text = Paper / Blush only. Faint grey is never text.
   ========================================================================== */

:root {
  /* ---- Brand palette (raw – do not use directly in components) ---- */
  --c-paper:  #FAF7F4;
  --c-white:  #FFFFFF;
  --c-blush:  #F9E1E5;
  --c-blush-light: #FCEEF1;  /* soft panels on paper; ink 15.0 · wine 9.4 */
  --c-blush-deep: #F2CBD2;   /* decorative tint, panels on blush; never text */
  --c-red:    #C60127;
  --c-red-strong: #A8001F;   /* pressed / hover of red */
  --c-wine:   #7D0A20;
  --c-ink:    #1C1A1A;

  /* ---- Surfaces ---- */
  --world:     var(--c-paper);   /* the page ground: LIGHT (client brief) */
  --paper:     var(--c-paper);   /* calm sections, header, forms */
  --surface:   var(--c-white);   /* the receipt / paper object */
  --panel:     var(--c-blush-light); /* soft blush panel on the paper ground */
  --night:     var(--c-ink);     /* rare dark moment (footer edge, stamp ink) */

  /* ---- Text ---- */
  --text:       var(--c-ink);    /* paper 16.2 · white 17.3 · blush 14.0 */
  --text-soft:  #5E5656;         /* paper 6.7 · white 7.1 · blush 5.8 */
  --text-accent: var(--c-wine);  /* paper 10.2 · white 10.9 · blush 8.7 */
  --text-on-red: var(--c-paper); /* 5.7 (blush 4.9) */
  --text-on-dark: var(--c-paper);/* 16.2; accent on dark = blush 14.0 */

  /* ---- Ink scale (back-compat names used by the approved concepts) ---- */
  --ink:    var(--c-ink);
  --ink-2:  var(--text-soft);
  --ink-3:  #6E6565;             /* meta text: paper 5.3 · white 5.7 · blush-light 5.0 · blush 4.6 */
  --ink-faint: #9C9393;          /* 2.8 – borders, icons, dashes. NEVER text */
  --line:   #E7DCD6;             /* hairlines on paper */
  --line-blush: #EBC9D0;         /* hairlines on blush */
  --dash:   #CFC6C0;             /* receipt dashed rules */

  /* ---- Brand roles ---- */
  --red:    var(--c-red);        /* as text: paper 5.7 · white 6.1 · blush 4.9 */
  --blush:  var(--c-blush);
  --wine:   var(--c-wine);
  --action:        var(--c-red);        /* ONE main CTA per view */
  --action-strong: var(--c-red-strong); /* hover / pressed */
  --primary:       var(--c-wine);       /* secondary buttons, links, active states */
  --primary-soft:  var(--c-blush);
  --stamp:         var(--c-red);        /* stamp, −20 %, price cuts */
  --focus:         var(--c-red);

  /* ---- Status (separate from brand) ---- */
  --success: #1E6B45;            /* paper 6.1 · blush 5.2 */
  --success-soft: #DDEFE4;
  --warning: #8A5300;            /* paper 5.9 · blush 5.1 */
  --warning-soft: #F8EBD3;
  --danger:  var(--c-red-strong);/* paper 7.3 · blush 6.3 */
  --danger-soft: var(--c-blush);

  /* ---- Type ---- */
  --font-display: "Alexandria", "Readex Pro", system-ui, sans-serif;
  --font-body:    "Readex Pro", system-ui, "Segoe UI", Tahoma, sans-serif;
  /* No third family: receipt numbers = body font + tabular-nums */
  --num: tabular-nums lining-nums;

  /* Fluid scale 360 → 1440 px */
  --fs-display: clamp(2.6rem, 1.6rem + 4.4vw, 5.25rem);  /* 42 → 84 */
  --fs-h1:      clamp(2.1rem, 1.5rem + 2.7vw, 3.75rem);  /* 34 → 60 */
  --fs-h2:      clamp(1.65rem, 1.3rem + 1.6vw, 2.6rem);  /* 26 → 42 */
  --fs-h3:      clamp(1.25rem, 1.1rem + .6vw, 1.6rem);   /* 20 → 26 */
  --fs-lead:    clamp(1.06rem, 1rem + .35vw, 1.3rem);    /* 17 → 21 */
  --fs-body:    1rem;                                    /* 16 */
  --fs-small:   .875rem;                                 /* 14 */
  --fs-micro:   .75rem;                                  /* 12 – receipt meta */

  --fw-display: 800;
  --fw-heading: 700;
  --fw-body: 400;
  --fw-strong: 600;

  /* Latin line heights; Arabic overrides below */
  --lh-tight: 1.08;
  --lh-heading: 1.18;
  --lh-body: 1.6;
  --tracking-display: -.02em;
  --tracking-label: .08em;

  /* ---- Space (4 px base) ---- */
  --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;
  --section-y: clamp(var(--s-8), 8vw, var(--s-10));

  /* ---- Layout ---- */
  --gutter:    clamp(16px, 4vw, 40px);
  --w-read:    62ch;     /* running text */
  --w-content: 1120px;   /* default container */
  --w-wide:    1320px;   /* full-bleed objects */
  --w-receipt: 380px;    /* the paper object, desktop */
  --tap:       48px;     /* min touch target */
  --header-h:  72px;
  --appbar-h:  56px;     /* mobile bottom bar */
  /* Breakpoints (use in @media literally – vars don't work there):
     sm 600 · md 900 · lg 1200 · xl 1440 */

  /* ---- Radius: world is soft, paper is square ---- */
  --r-paper: 2px;   /* receipts, tickets, stamps */
  --r-sm: 10px;     /* chips, small inputs */
  --r-md: 14px;     /* fields, small cards */
  --r-lg: 22px;     /* panels */
  --r-xl: 28px;     /* section stages */
  --r-pill: 999px;  /* buttons, header, chips (modern pill UI) */
  --r-btn: var(--r-pill);

  /* ---- Elevation (wine-tinted, never grey) ---- */
  --shadow-1: 0 1px 2px rgba(125,10,32,.06), 0 4px 12px -6px rgba(125,10,32,.18);
  --shadow-2: 0 24px 44px -26px rgba(125,10,32,.40);
  --shadow-3: 0 40px 40px -10px rgba(125,10,32,.22), 0 4px 6px rgba(125,10,32,.08); /* the hero object, 3D */
  --shadow-paper: 0 18px 22px rgba(125,10,32,.20);   /* use as drop-shadow() on torn paper */
  --tear: 7px;    /* radius of the torn-edge scallop */
  --tear-step: 18px;

  /* ---- Motion ---- */
  --ease-out:  cubic-bezier(.22,.8,.24,1);   /* UI fades, floats */
  --ease-snap: cubic-bezier(.3,1.5,.5,1);    /* stamp landing, key press */
  --ease-print: steps(1, end);               /* line-by-line receipt print */
  --dur-1: 160ms;   /* hover, press */
  --dur-2: 320ms;   /* panels, toasts */
  --dur-3: 700ms;   /* section entrances */
  --dur-print-line: 140ms;
}

/* Arabic needs taller lines (diacritics) and no negative tracking */
:root:lang(ar), [lang="ar"] {
  --lh-tight: 1.35;
  --lh-heading: 1.45;
  --lh-body: 1.8;
  --tracking-display: 0;
  --tracking-label: 0;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; --dur-print-line: 0ms; }
}
