/* ─────────────────────────────────────────────────────────────
   Naamkaran · base
   Design tokens, reset, backdrop and the brand header shared by
   every page. Page sheets (styles.css, catalog.css) build on this;
   reusable UI lives in components.css.

   This file is the ONLY place a design token (a `--name` custom
   property) is defined. Component sheets consume tokens and never
   write raw colours, sizes or durations; test/tokens.test.mjs
   enforces that. The full reference is docs/design-system.md.

   Palette: aubergine silk night, zari gold, sindoor, marigold
   ───────────────────────────────────────────────────────────── */

:root {
  /* ══ 1. colour ═════════════════════════════════════════════ */

  /* ground */
  --night:    #1a0b1e;
  --night-2:  #2a1130;
  --night-3:  #1f0c24;   /* deepest surface stop */
  --plum:     #2f1235;   /* surface top stop */
  --plum-2:   #3a1440;   /* raised surface top stop */
  --plum-3:   #43163f;   /* card-back brocade */
  --maroon:   #5c1a2e;
  --wine:     #3c1030;   /* epic-tier surface top stop */
  --wine-2:   #240a1c;   /* epic-tier surface bottom stop */

  /* zari gold — anything precious */
  --gold:     #e9b85c;
  --gold-2:   #f6d992;   /* highlight */
  --gold-3:   #c98f35;   /* shade */

  /* emphasis */
  --sindoor:  #e8472e;
  --marigold: #ffa02e;

  /* text */
  --ivory:    #fff3de;
  --catalog-secondary: #d0c1b8;

  /* the two gendered accents used by badges, chips and cards */
  --neel:     #7fb3ff;   /* boy · a soft peacock blue */
  --gulabi:   #ff8fb3;   /* girl · gulabi pink */

  /* holographic foil stops (legendary tier only) */
  --holo-pink: #d052c0;
  --holo-teal: #4fb3a5;

  /* rarity tiers · common → rare → epic → legend */
  --tier-common:   #cdd3e0;
  --tier-common-2: #e6eaf2;
  --tier-rare:     var(--gold);
  --tier-rare-2:   var(--gold-2);
  --tier-epic:     var(--sindoor);
  --tier-epic-2:   #ffb3a1;
  --tier-epic-3:   #ffcdb8;
  --tier-legend:   var(--gold-2);

  /* Auntie's paper: the ivory speech bubble and its ink */
  --paper:           rgba(255, 243, 222, 0.96);
  --paper-ink:       #2c1024;
  --paper-ink-muted: #8c3b2e;

  /* ── alpha ramps ──
     Named by the percentage of the base colour that shows through.
     Reach for the closest step rather than inventing a new alpha. */
  --ivory-04: rgba(255, 243, 222, 0.04);
  --ivory-06: rgba(255, 243, 222, 0.06);
  --ivory-12: rgba(255, 243, 222, 0.12);
  --ivory-35: rgba(255, 243, 222, 0.35);
  --ivory-50: rgba(255, 243, 222, 0.5);
  --ivory-60: rgba(255, 243, 222, 0.6);

  --gold-02:  rgba(233, 184, 92, 0.022);
  --gold-06:  rgba(233, 184, 92, 0.06);
  --gold-10:  rgba(233, 184, 92, 0.1);
  --gold-16:  rgba(233, 184, 92, 0.16);
  --gold-20:  rgba(233, 184, 92, 0.2);
  --gold-25:  rgba(233, 184, 92, 0.25);
  --gold-30:  rgba(233, 184, 92, 0.3);
  --gold-35:  rgba(233, 184, 92, 0.35);
  --gold-40:  rgba(233, 184, 92, 0.4);
  --gold-45:  rgba(233, 184, 92, 0.45);
  --gold-50:  rgba(233, 184, 92, 0.5);
  --gold-60:  rgba(233, 184, 92, 0.6);

  --gold-2-10: rgba(246, 217, 146, 0.1);
  --gold-2-20: rgba(246, 217, 146, 0.2);
  --gold-2-25: rgba(246, 217, 146, 0.25);
  --gold-2-45: rgba(246, 217, 146, 0.45);
  --gold-2-55: rgba(246, 217, 146, 0.55);
  --gold-2-65: rgba(246, 217, 146, 0.65);
  --gold-2-85: rgba(246, 217, 146, 0.85);

  --sindoor-20: rgba(232, 71, 46, 0.2);
  --sindoor-25: rgba(232, 71, 46, 0.25);
  --sindoor-35: rgba(232, 71, 46, 0.35);
  --sindoor-55: rgba(232, 71, 46, 0.55);

  --marigold-20: rgba(255, 160, 46, 0.2);
  --marigold-40: rgba(255, 160, 46, 0.4);
  --marigold-50: rgba(255, 160, 46, 0.5);

  --maroon-55: rgba(92, 26, 46, 0.55);

  --neel-12:   rgba(127, 179, 255, 0.12);
  --neel-20:   rgba(127, 179, 255, 0.2);
  --neel-25:   rgba(127, 179, 255, 0.25);
  --neel-30:   rgba(127, 179, 255, 0.3);
  --gulabi-12: rgba(255, 143, 179, 0.12);
  --gulabi-20: rgba(255, 143, 179, 0.2);
  --gulabi-25: rgba(255, 143, 179, 0.25);
  --gulabi-32: rgba(255, 143, 179, 0.32);

  --holo-pink-16: rgba(208, 82, 192, 0.16);
  --holo-pink-25: rgba(208, 82, 192, 0.25);
  --holo-teal-16: rgba(79, 179, 165, 0.16);

  --tier-common-14: rgba(205, 211, 224, 0.14);
  --tier-common-16: rgba(205, 211, 224, 0.16);
  --tier-common-45: rgba(205, 211, 224, 0.45);

  /* pure white glints for foil and bevels */
  --glint-10: rgba(255, 255, 255, 0.1);
  --glint-16: rgba(255, 255, 255, 0.16);
  --glint-32: rgba(255, 255, 255, 0.32);
  --glint-50: rgba(255, 255, 255, 0.5);

  /* darkness for shadows, crimps and scrims */
  --ink-40: rgba(0, 0, 0, 0.4);
  --ink-45: rgba(0, 0, 0, 0.45);
  --ink-55: rgba(0, 0, 0, 0.55);
  --ink-60: rgba(0, 0, 0, 0.6);
  --ink-65: rgba(0, 0, 0, 0.65);
  --night-60:  rgba(26, 11, 30, 0.6);
  --night-82:  rgba(26, 11, 30, 0.82);
  --night-96:  rgba(26, 11, 30, 0.96);
  --scrim:     rgba(16, 6, 19, 0.78);   /* dialog backdrop */
  --scrim-strong: rgba(16, 6, 19, 0.94); /* intro overlay */
  --vignette-edge: rgba(10, 3, 12, 0.75);

  /* ══ 2. surfaces, lines, shadows ═══════════════════════════ */

  --surface:        linear-gradient(165deg, var(--plum), var(--night-3));
  --surface-2:      linear-gradient(165deg, var(--plum-2), var(--night-2));
  --surface-flat:   rgba(42, 17, 48, 0.72);
  --surface-epic:   linear-gradient(165deg, var(--wine), var(--wine-2));
  --surface-pack:   linear-gradient(160deg, var(--plum-2), var(--maroon) 55%, var(--night-2));
  --surface-brocade: linear-gradient(160deg, var(--plum-3), var(--maroon));
  --gradient-gold:  linear-gradient(175deg, var(--gold-2), var(--gold) 55%, var(--gold-3));
  --gradient-gold-flat: linear-gradient(175deg, var(--gold-2), var(--gold));
  --gradient-ivory-gold: linear-gradient(175deg, var(--ivory), var(--gold-2) 70%, var(--gold));
  --gradient-sindoor: linear-gradient(160deg, var(--sindoor-35), var(--marigold-20));
  --gradient-holo-tag: linear-gradient(90deg, var(--gold-30), var(--holo-pink-25));

  --line:         1px solid var(--gold-30);
  --line-strong:  1px solid var(--gold-45);
  --line-faint:   1px solid var(--ivory-12);
  --line-subtle:  1px solid var(--gold-16);

  --shadow-md:    0 10px 30px var(--ink-40);
  --shadow-lg:    0 18px 44px var(--ink-55);
  --shadow-xl:    0 30px 70px var(--ink-65);
  --shadow-paper: 0 14px 40px var(--ink-45);
  --shadow-gold:  0 10px 34px var(--gold-35);
  --shadow-gold-lg: 0 16px 44px var(--gold-50);
  --shadow-gold-sm: 0 6px 18px var(--gold-35);
  --shadow-gold-soft: 0 10px 30px var(--gold-20);
  --shadow-sindoor: 0 6px 24px var(--sindoor-35);
  --shadow-neel:   0 6px 24px var(--neel-25);
  --shadow-gulabi: 0 6px 24px var(--gulabi-25);
  --bevel:        inset 0 1px 0 var(--glint-50);
  --glow-gold:    0 0 40px var(--gold-2-45);   /* text-shadow on golden display type */
  --glow-marigold: 0 0 24px var(--marigold-40);

  --blur-sm: 6px;
  --blur-md: 10px;

  /* ══ 3. type ═══════════════════════════════════════════════ */

  --display: "Yatra One", cursive;
  --body:    "Karla", sans-serif;
  --dev:     "Tiro Devanagari Hindi", serif;
  --mono:    ui-monospace, SFMono-Regular, Menlo, monospace;

  /* body scale (px) */
  --text-2xs: 9.5px;   /* badge, meta label */
  --text-xs:  11px;    /* eyebrow, fine print, labels */
  --text-sm:  12px;    /* brand, hints, small buttons */
  --text-md:  13px;    /* chips, pagination */
  --text-base: 14px;   /* body, buttons, notes */
  --text-lg:  15px;    /* inputs, lobby chips */
  --text-xl:  17px;    /* primary button, card devanagari */
  --text-2xl: 19px;    /* large primary button, brand devanagari */
  --text-3xl: 24px;    /* card name, dialog devanagari, empty title */
  --text-4xl: 30px;    /* medallion, pack devanagari */

  /* display scale (fluid) */
  --display-title: clamp(30px, 4.6vw, 52px);  /* section titles */
  --display-name:  clamp(34px, 6vw, 48px);    /* a name in a dialog */
  --display-hero:  clamp(38px, 6vw, 72px);    /* page hero, verdict */
  --display-intro: clamp(40px, 7vw, 84px);    /* the intro curtain */
  --dev-hero:      clamp(30px, 4vw, 44px);
  --text-lede:     clamp(14px, 1.6vw, 17px);

  --leading-none:    1;
  --leading-tight:   1.05;
  --leading-snug:    1.2;
  --leading-normal:  1.45;
  --leading-relaxed: 1.6;

  /* uppercase tracking */
  --track-tight:  0.02em;
  --track-normal: 0.06em;
  --track-wide:   0.12em;
  --track-wider:  0.22em;
  --track-widest: 0.32em;

  /* ══ 4. rhythm ═════════════════════════════════════════════ */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* control heights */
  --control-sm: 30px;
  --control-md: 36px;
  --control-lg: 48px;

  /* ══ 5. motion ═════════════════════════════════════════════ */

  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 0.2s;
  --t-med: 0.3s;

  /* ══ 6. layers ═════════════════════════════════════════════ */

  --z-rays:     0;
  --z-vignette: 1;
  --z-page:     5;
  --z-fx:       6;
  --z-dock:     15;
  --z-header:   20;
  --z-crown:    30;
  --z-curtain:  40;

  /* ══ 7. focus ══════════════════════════════════════════════ */

  --focus-ring: 2px solid var(--gold);
  --focus-offset: 3px;
  --focus-glow: 0 0 0 3px var(--gold-16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--body);
  color: var(--ivory);
  background:
    radial-gradient(1200px 700px at 50% 30%, var(--night-2), transparent 70%),
    var(--night);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

a { color: var(--gold-2); }

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--space-1);
}

/* ── backdrop layers ─────────────────────────────────────── */

.rays {
  position: fixed;
  inset: -50%;
  z-index: var(--z-rays);
  background: repeating-conic-gradient(
    from 0deg at 50% 42%,
    var(--gold-02) 0deg 6deg,
    transparent 6deg 12deg
  );
  animation: rays-turn 240s linear infinite;
  pointer-events: none;
}

@keyframes rays-turn { to { transform: rotate(360deg); } }

.vignette {
  position: fixed;
  inset: 0;
  z-index: var(--z-vignette);
  background: radial-gradient(120% 90% at 50% 45%, transparent 40%, var(--vignette-edge) 100%);
  pointer-events: none;
}

/* ── brand header ────────────────────────────────────────── */

.brand {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: 14px;
  padding:
    calc(18px + env(safe-area-inset-top))
    calc(26px + env(safe-area-inset-right))
    18px
    calc(26px + env(safe-area-inset-left));
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: var(--text-sm);
  color: var(--ivory-60);
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-dev {
  font-family: var(--dev);
  font-size: var(--text-2xl);
  text-transform: none;
  letter-spacing: 0;
  color: var(--gold);
}

.brand-rule {
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

/* page links in the header; the ceremony's mute button sits after them */
.brand-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-nav a {
  color: var(--ivory-60);
  text-decoration: none;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.brand-nav a:hover { color: var(--gold-2); border-color: var(--gold-30); }

.brand-nav a[aria-current="page"] {
  color: var(--gold-2);
  background: var(--ivory-06);
  border-color: var(--gold-30);
}

@media (max-width: 760px) {
  .brand {
    padding:
      calc(14px + env(safe-area-inset-top))
      calc(16px + env(safe-area-inset-right))
      14px
      calc(16px + env(safe-area-inset-left));
  }
  .brand-en, .brand-rule { display: none; }
  .brand-nav a { padding: 6px 9px; font-size: 10px; letter-spacing: 0.08em; }
}

@media (prefers-reduced-motion: reduce) {
  .rays { animation: none; }
}
