/* Headspace Coffee — POWDER FLAT-LAY tokens (Brand Lab lock 2026-10-20 Asia/Manila)
   SUPERSEDES Conference Mauve (archived: ../archive/conference-mauve-2026-10-20/tokens.css).
   Sampled from Timothy's powder flat-lay ref (powder-flatlay-ref.jpg): mint + forest cards on white plaster powder.
   Drop-in replacement for app/public/tokens.css — SAME role names as live app; every var() keeps working.
   Apple-style type stack. Liquid Glass: .glass-card (kiosk membership card ONLY), tinted with the new forest.
   Texture: plaster / powder grain — --texture-surface → textures/paper-grain.png @ ~4–5% on large surfaces only.
   Contrast: WCAG AA 4.5:1 text / 3:1 UI. Ratios noted inline (computed Brand Lab).
   Mauve #7a5f72 is DEMOTED to optional tertiary (--brand-tertiary) — not a primary role.
   Lime #e6ff55 is BANNED everywhere (Canva legacy) — no lime token exists; do not add one.
   Highlight (Timothy lock 2026-10-20): mint #cddac8 lives on forest/dark grounds and is the status highlight (--color-highlight alias).
*/

:root {
  /* ——— Brand (reference; screens use role tokens below) ——— */
  --brand-forest: #2a3c2e;          /* forest card · PANTONE 5535 C */
  --brand-dark: #1f2e23;            /* deepened forest — dark UI base */
  --brand-surface: #2a3c2e;
  --brand-mint: #cddac8;            /* mint card · PANTONE 5655 C */
  --brand-powder: #d3d2d0;          /* plaster / powder · PANTONE Warm Gray 1 C */
  --brand-paper: #e8e6e2;           /* lighter paper surface */
  --brand-ground: #dddcda;          /* studio ground */
  /* Sand (added 2026-10-20, sampled from Timothy's cream 3D monogram + powder pile refs).
     Primitives only — no role token remaps to these.
     --color-sand-cream: warm cream — face of the 3D mark, cups, packaging, signage letters.
     --color-sand-white: cool near-white — powder highlights, paper stock, light ground.
     Text on sand: ink #1a1f1a (12.4:1 / 12.7:1) or forest #2a3c2e (8.7:1 / 8.9:1).
     Sand as text on forest: 8.7:1 / 8.9:1 (passes AA).
     BANNED: white/cream #f5f5f2 on sand (1.2:1), mint on sand (1.1:1),
     sand as text/border on paper/plaster (≈1.0–1.1:1), mauve text on cream sand (4.18:1). */
  --color-sand-cream: #e6dcd0;
  --color-sand-white: #e4dfdc;
  /* Added 2026-10-20 (Timothy, measured-from-photo chart). Primitives only — no role token remaps.
     --color-powder-warm: warm powder / print ground / packaging shadow tone. PANTONE Warm Gray 1 C.
       Ink #1a1f1a 10.63:1 · logo ink 12.59:1 · forest 7.47:1 on it. BANNED: white 1.57:1 / cream #f5f5f2 1.44:1 / mint 1.08:1 on it.
     --color-logo-ink: near-black for the logo mark + wordmark and print type. PANTONE Black 6 C.
       UI ink stays #1a1f1a (--brand-ink). On mint 13.65 · plaster 13.12 · paper 15.90 · warm powder 12.59 ·
       cream sand 14.64 · white sand 15.00 · cream #f5f5f2 on it 18.15. BANNED: forest on logo ink (1.68:1).
     Print Pantone refs: forest 5535 C · mint 5655 C · plaster Warm Gray 1 C · sands: match to physical chip.
     Photo values read ~5–8% darker than printed stock — pull physical Pantone chips before print approval. */
  --color-powder-warm: #d3cdc8;
  --color-logo-ink: #040c04;
  --brand-cream: #f5f5f2;           /* type on forest */
  --brand-accent: #cddac8;          /* mint */
  --brand-secondary: #2f4a32;       /* forest lift (was mauve) */
  --brand-ink: #1a1f1a;             /* ink on mint */
  --brand-tertiary: #7a5f72;        /* mauve — optional footnote only (chips); not primary */

  /* ——— Color roles (dark cashier / admin — default) ——— */
  --color-bg: #1f2e23;               /* deepened forest */
  --color-surface: #2a3c2e;          /* forest card */
  --color-surface-2: #2f4a32;
  --color-input: #172618;
  --color-chip: #2f4a32;

  --color-fg: #f5f5f2;               /* 13.05:1 on bg · 10.78:1 on surface */
  --color-fg-muted: #b4c2b0;         /* 6.32:1 on surface */
  --color-fg-subtle: #9aab96;        /* 4.84:1 on surface (large/meta only) */

  --color-accent: #cddac8;           /* mint — primary actions on dark */
  --color-accent-hover: #dde8d6;
  --color-accent-pressed: #bccdb2;
  --color-on-accent: #1a1f1a;        /* 11.52:1 on mint (9.97 pressed) */

  --color-ok: #2a6b45;
  --color-on-ok: #f5f5f2;
  --color-bad: #9a453c;
  --color-on-bad: #f5f5f2;
  --color-warn: #8a5a18;
  --color-on-warn: #f5f5f2;

  --color-border: #9aab96;           /* 4.84:1 on surface (UI AA) */
  --color-border-strong: #cddac8;    /* mint strong edge, 8.10:1 */
  --color-focus: #cddac8;
  --color-focus-ring: #cddac8;

  /* Status highlight — NEW semantic alias (2026-10-20). Mint keeps all its existing roles above.
     FOREST / DARK GROUNDS ONLY: "₱30 off today" badge square, active/live dot, today's stamp ring.
     8.10:1 on #2a3c2e · 9.81:1 on #1f2e23. NEVER on paper, plaster, studio ground or sand (1.0–1.2:1). */
  --color-highlight: #cddac8;

  --color-disabled-bg: #2f4a32;
  --color-disabled-fg: #b4c2b0;

  --color-overlay: rgba(16, 26, 17, 0.55);
  --color-scrim: rgba(16, 26, 17, 0.72);

  --state-hover: rgba(205, 218, 200, 0.10);
  --state-pressed: rgba(205, 218, 200, 0.16);
  --state-focus: rgba(205, 218, 200, 0.18);
  --state-selected: rgba(205, 218, 200, 0.22);

  /* Semantic aliases (app uses these) */
  --color-primary: var(--color-accent);
  --color-on-primary: var(--color-on-accent);
  /* Secondary buttons use border+transparent in style.css.
     Secondary fill = forest lift (was mauve). Mauve now only via --brand-tertiary. */
  --color-secondary: #2f4a32;
  --color-on-secondary: #f5f5f2;     /* 8.96:1 */
  --color-tertiary: #7a5f72;         /* optional chip only — demoted mauve */
  --color-on-tertiary: #f5f5f2;      /* 5.19:1 */
  --color-destructive: var(--color-bad);
  --color-on-destructive: var(--color-on-bad);
  --color-success: var(--color-ok);
  --color-danger: var(--color-bad);
  --color-warning: var(--color-warn);

  /* ——— Spacing (4/8 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;

  /* ——— Radii ——— */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* ——— Type (Apple HIG stack; Inter fallback for non-Apple) ——— */
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    Inter, "Helvetica Neue", Arial, sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 17px;                   /* was 16px — Apple body */
  --text-lg: 20px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 34px;
  --text-4xl: 40px;
  --text-display: 48px;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.47;
  --weight-regular: 400;
  --weight-medium: 510;
  --weight-semibold: 600;
  --weight-bold: 700;
  /* App used --weight-medium: 600; keep --weight-semibold for new code; medium stays usable */
  --tracking-display: -0.8px;
  --tracking-title: -0.5px;
  --tracking-body: -0.2px;

  /* ——— Elevation ——— */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.32);
  --shadow-float: 0 8px 28px rgba(0, 0, 0, 0.36);

  /* Legacy glass vars (floating chrome / toasts) — membership CARD uses .glass-card below */
  --glass-bg: rgba(31, 46, 35, 0.72);   /* #1f2e23 @72% */
  --glass-blur: saturate(165%) blur(24px);
  --glass-border: rgba(205, 218, 200, 0.28);

  /* ——— Motion ——— */
  --duration-fast: 120ms;
  --duration-med: 200ms;
  --duration-slow: 320ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1);

  /* ——— Touch targets ——— */
  --target-min: 44px;
  --target-comfortable: 48px;
  --target-counter: 56px;
  --target-counter-lg: 64px;

  /* ——— Focus ring ——— */
  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;
  --focus-ring: 0 0 0 var(--focus-ring-offset) var(--color-bg),
    0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--color-focus-ring);

  /* ——— Layout ——— */
  --content-max: 960px;
  --card-max: 560px;
  --kiosk-max: 720px;
  --member-panel-max: 720px;

  /* ——— Texture: plaster / powder grain (large surfaces only; never under QR / small text) ——— */
  --texture-surface: url("textures/paper-grain.png");
  --texture-opacity: 0.045;
}

/* Light / plaster theme — signup + kiosk + public benefits page */
[data-theme="light"] {
  --color-bg: #e8e6e2;               /* paper surface */
  --color-surface: #f4f3f0;          /* cards */
  --color-surface-2: #d3d2d0;        /* powder / plaster */
  --color-input: #ffffff;
  --color-chip: #cddac8;             /* mint chip; ink type 11.52:1 */

  --color-fg: #1a1f1a;               /* 13.43:1 on paper */
  --color-fg-muted: #4a5448;         /* 6.35:1 paper · 5.24:1 powder */
  --color-fg-subtle: #4e5a4c;        /* AA on every light ground: 4.5+ on warm powder #d3cdc8, plaster #d3d2d0 and #dbdad8, both sands, paper. Was #5a6658 (failed on plaster) */

  /* Primary CTA on paper = forest card + cream type */
  --color-accent: #2a3c2e;
  --color-accent-hover: #2f4a32;
  --color-accent-pressed: #1f2e23;
  --color-on-accent: #f5f5f2;        /* 10.78:1 */

  --color-ok: #2a6b45;
  --color-on-ok: #f5f5f2;
  --color-bad: #9a453c;
  --color-on-bad: #f5f5f2;
  --color-warn: #8a5a18;
  --color-on-warn: #f5f5f2;

  --color-border: #6a7a66;           /* 3.67:1 on paper (UI AA) */
  --color-border-strong: #2a3c2e;
  --color-focus: #2a3c2e;
  --color-focus-ring: #2a3c2e;

  --color-disabled-bg: #d3d2d0;
  --color-disabled-fg: #505c4e; /* 4.66:1 on #d3d2d0 (AA); was #5a6658 4.32:1 */

  --color-secondary: #cddac8;        /* mint fill */
  --color-on-secondary: #1a1f1a;
  --color-tertiary: #7a5f72;
  --color-on-tertiary: #f5f5f2;

  --state-hover: rgba(42, 60, 46, 0.06);
  --state-pressed: rgba(42, 60, 46, 0.12);
  --state-focus: rgba(42, 60, 46, 0.14);
  --state-selected: rgba(205, 218, 200, 0.55);

  --glass-bg: rgba(31, 46, 35, 0.72);
  --glass-border: rgba(42, 60, 46, 0.14);
  --shadow-1: 0 1px 2px rgba(42, 60, 46, 0.08);
  --shadow-2: 0 4px 16px rgba(42, 60, 46, 0.12);
  --focus-ring: 0 0 0 var(--focus-ring-offset) var(--color-bg),
    0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--color-focus-ring);

  --texture-opacity: 0.035;
}

/* Micro-accent on light pages (badges / chips) — not for large body text on paper */
/* Mint focus on light fails 3:1 (1.17:1) — keep forest focus on paper. Legacy .accent-teal maps to forest. */
[data-theme="light"] .accent-teal {
  --color-focus: #2a3c2e;
  --color-focus-ring: #2a3c2e;
}

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

.hs-focusable:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hs-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Optional texture overlay helper — large panels only */
.hs-textured {
  position: relative;
  isolation: isolate;
}
.hs-textured::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--texture-surface);
  background-repeat: repeat;
  background-size: 256px 256px;
  opacity: var(--texture-opacity);
  pointer-events: none;
  mix-blend-mode: soft-light;
  border-radius: inherit;
  z-index: 0;
}
.hs-textured > * { position: relative; z-index: 1; }

/* ——— Liquid Glass (WWDC25 regular) — kiosk membership card ONLY ———
   Floating layer over content. No glass-on-glass.
   Never put QR, member number, or small text on glass — use .glass-card__solid.
   Tint 72% of --color-bg (dark #1f2e23) so cream #f5f5f2 passes ≥4.5:1 even over white/paper underlay.
   RULE: only --color-fg is allowed as text on .glass-card. Muted #b4c2b0 drops to ~3.1–3.6:1 over light underlays. No muted, disabled, or mint text on glass.
*/
.glass-card {
  position: relative;
  isolation: isolate;
  background: color-mix(in srgb, var(--color-bg) 72%, transparent);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  border-radius: var(--radius-xl);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.38) inset,
    1px 0 0 rgba(255, 255, 255, 0.16) inset,
    0 -1px 0 rgba(255, 255, 255, 0.05) inset;
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.42) 0%,
    rgba(255, 255, 255, 0.10) 28%,
    rgba(255, 255, 255, 0.00) 52%
  );
  opacity: 0.85;
  mix-blend-mode: soft-light;
  z-index: 1;
}
.glass-card > * { position: relative; z-index: 2; }
.glass-card__solid {
  background: color-mix(in srgb, var(--color-bg) 92%, #000);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card {
    background: color-mix(in srgb, var(--color-bg) 88%, var(--color-surface));
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .glass-card {
    background: var(--color-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
@media (prefers-contrast: more) {
  .glass-card {
    background: var(--color-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-2);
  }
  .glass-card::before { display: none; }
}
