/* ═══════════════════════════════════════════════════════════════
   TBQ Space — Design Tokens v3 (áo "menu quán cà phê", 21/10/2026)
   Source of truth for TBQ. Load BEFORE components.css.

   Rules
   • Components read only semantic tokens (--bg, --ink, --accent-text…),
     never the palette (--palette-*) directly.
   • Dark sections do not restyle components — they set
     data-surface="dark" and the semantic tokens remap.
   • Every text/background pair below meets WCAG AA (4.5:1) at body size.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Palette (raw — do not use in components) ─────────────── */
  /* */
  --palette-paper:      #f4f1ea;   /* giấy */
  --palette-paper-2:    #ebe5d8;   /* nền phụ */
  --palette-paper-3:    #ebe5d8;
  --palette-ink:        #2b2118;   /* mực */
  --palette-ink-2:      #6b5d4f;   /* chữ phụ */
  --palette-line:       #d6cdbd;   /* kẻ */
  --palette-terracotta: #b5532e;   /* đất nung — điểm nhấn duy nhất */
  --palette-lienhe:       #0068ff;   /* */
  --palette-colophon:   #2b2118;   /* dải tối = nền mực */

  /* ── Surfaces ─────────────────────────────────────────────── */
  --bg:        var(--palette-paper);
  --surface:   var(--palette-paper);
  --wash:      var(--palette-paper-2);

  /* ── Text (contrast vs --bg) ──────────────────────────────── */
  --ink:       var(--palette-ink);       /* 13.96:1 */
  --ink-2:     var(--palette-ink-2);     /*  5.63:1 */
  --ink-3:     var(--palette-ink-2);
  --ink-disabled: color-mix(in srgb, var(--palette-ink) 38%, transparent);   /* non-text only */

  /* ── Lines ────────────────────────────────────────────────── */
  --border:        var(--palette-line);
  --border-strong: var(--palette-ink-2);  /* inputs, controls — 5.6:1 */

  /* ── Accent: đất nung cho nút đặc, nét, icon, chữ lớn; chữ nhỏ dùng mực ── */
  --accent-line:  var(--palette-terracotta);
  --accent-icon:  var(--palette-terracotta);
  --accent-text:  var(--palette-ink);
  --accent-hover: var(--palette-ink);
  --accent-fill:  var(--palette-terracotta);
  --on-accent:    #ffffff;                 /* 4.95:1 */
  --accent-bg:    var(--palette-paper-2);
  --kicker:       var(--palette-ink-2);

  /* ── Status (không thêm màu: trạng thái bằng chữ + nét) ── */
  --success:     var(--palette-ink);
  --success-text:var(--palette-ink);
  --success-bg:  var(--palette-paper-2);
  --warning:     var(--palette-terracotta);
  --warning-text:var(--palette-ink);
  --warning-bg:  var(--palette-paper-2);
  --danger:      var(--palette-terracotta);
  --danger-text: var(--palette-ink);
  --danger-bg:   var(--palette-paper-2);

  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-icon);

  /* ── Typography ───────────────────────────────────────────── */
  /* Font CŨ của web (anh chốt 21/10/2026 "giữ font chữ cũ"): Cormorant Garamond tiêu đề, Lora chữ thường */
  --font-display: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-body:    'Lora', Georgia, 'Times New Roman', serif;
  --font-brand:   'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-mono:    'Lora', Georgia, serif;                                   /* không dùng chữ mono: số dùng tabular-nums */

  /* 10-step scale (was ~45 distinct sizes, incl. 10.5/11.5/12.5/13.5/14.5/15.5/16.5/17.5) */
  --text-2xs: 11px;   /* legal, micro-badges */
  --text-xs:  12px;   /* kickers, labels (uppercase) */
  --text-sm:  13px;   /* meta, captions */
  --text-md:  14px;   /* controls, secondary body */
  --text-base:16px;   /* body */
  --text-lg:  18px;   /* lead, prices */
  --text-xl:  20px;   /* thang menu 56/40/28/20/16/14 */
  --text-2xl: 28px;
  --text-3xl: clamp(28px, 3.6vw, 40px);  /* section titles */
  --text-4xl: clamp(40px, 5vw, 56px);    /* hero */
  --text-mark: clamp(180px, 30vw, 480px);/* decorative watermark (№1) */

  --leading-tight: 1.1;   /* display */
  --leading-snug:  1.3;   /* headings, controls */
  --leading-body:  1.65;  /* running text */

  --tracking-display: -0.01em;
  --tracking-kicker:   0.12em;  /* uppercase labels — one value (was .08/.1/.12/.14) */

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semi:    600;  /* ceiling for body font; display font stays 400–500 */

  /* ── Space (4px grid) ─────────────────────────────────────── */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-24: 96px;

  --container: 1080px;
  --measure: 640px;   /* cột chữ */
  --gutter: var(--space-6);
  --section-y: clamp(var(--space-16), 9vw, 128px);
  --header-h: 64px;

  /* ── Shape ────────────────────────────────────────────────── */
  --radius-sm:    2px;    /* áo menu: bo ≤ 4px ở mọi chỗ */
  --radius:       4px;
  --radius-card:  4px;
  --radius-pill:  4px;
  --radius-round: 50%;    /* chỉ hình tròn nhỏ (chấm) */
  --hairline: 1px;

  /* ── Elevation (used sparingly — Classical prefers lines) ── */
  --shadow-sm: none;   /* áo menu: không bóng — phân lớp bằng nét kẻ 1px */
  --shadow-md: none;
  --scrim:     color-mix(in srgb, var(--palette-ink) 45%, transparent);

  /* ── Motion (was 8 durations, 23 transition combos) ───────── */
  --dur-fast: 150ms;   /* color, border, background */
  --dur-base: 250ms;   /* transform, accordions, drawers */
  --dur-slow: 450ms;   /* page/section reveal */
  --ease:     cubic-bezier(.2, .8, .2, 1);

  /* ── Layers (was 11 ad-hoc values 850–1300) ───────────────── */
  --z-sticky:   100;  /* header */
  --z-dropdown: 200;  /* search results */
  --z-fab:      300;  /* */
  --z-overlay:  900;  /* scrims */
  --z-drawer:  1000;  /* cart */
  --z-modal:   1100;
  --z-toast:   1200;
}

/* ── Dark surface: nền mực (CTA cuối, dải tiêu đề trang) ── */
[data-surface="dark"] {
  --bg:       var(--palette-colophon);
  --surface:  var(--palette-colophon);
  --wash:     var(--palette-colophon);

  --ink:      var(--palette-paper);
  --ink-2:    var(--palette-line);   /* 9.99:1 trên mực */
  --ink-3:    var(--palette-line);
  --ink-disabled: color-mix(in srgb, var(--palette-paper) 30%, transparent);

  --border:        color-mix(in srgb, var(--palette-paper) 18%, transparent);
  --border-strong: var(--palette-line);

  --accent-line:  var(--palette-terracotta);
  --accent-icon:  var(--palette-paper);
  --accent-text:  var(--palette-paper);
  --accent-hover: var(--palette-paper);
  --kicker:       var(--palette-line);

  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-icon);

  background: var(--bg);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
}
