/* ==========================================================================
   AURUM CASINO — DESIGN SYSTEM
   --------------------------------------------------------------------------
   A dependency-free, token-driven design system for the product.
   Layers: 1) Tokens  2) Reset  3) Base  4) Primitives  5) Components
   All colors meet WCAG AA contrast on their intended surfaces.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette */
  --color-ink:        #0d0d14;   /* page background */
  --color-surface:    #16161f;   /* card / panel */
  --color-surface-2:  #20202b;   /* elevated panel */
  --color-surface-3:  #2a2a37;   /* hover / active */
  --color-line:       #343442;   /* borders */
  --color-line-soft:  #262631;

  --color-gold:       #e8c36a;   /* primary accent / wins */
  --color-gold-deep:  #b98f2f;
  --color-gold-soft:  #f7e4b4;
  --color-cream:      #f5f0e6;   /* primary text */
  --color-muted:      #a8a5b5;   /* secondary text */
  --color-burgundy:   #8b2635;   /* secondary accent / losses */
  --color-burgundy-soft: #f0c9cf;

  /* Semantic tokens */
  --color-text:        var(--color-cream);
  --color-text-muted:  var(--color-muted);
  --color-bg:          var(--color-ink);
  --color-bg-surface:  var(--color-surface);
  --color-accent:      var(--color-gold);
  --color-accent-strong: var(--color-gold-deep);
  --color-win:         var(--color-gold-soft);
  --color-loss:        var(--color-burgundy-soft);

  /* Typography */
  --font-display: Georgia, "Times New Roman", "Songti SC", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.375rem;  /* 22px */
  --text-2xl:  1.75rem;   /* 28px */
  --text-3xl:  2.5rem;    /* 40px */
  --text-4xl:  clamp(2.75rem, 6vw, 4.25rem);

  --leading-tight: 1.15;
  --leading-snug:  1.35;
  --leading-base:  1.65;
  --tracking-wide: 0.06em;

  /* Spacing scale (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Shadows & elevation */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 8px 24px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 18px 48px rgb(0 0 0 / 0.55);
  --shadow-glow: 0 0 0 1px rgb(232 195 106 / 0.35), 0 12px 40px rgb(232 195 106 / 0.12);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur-base: 240ms;
  --dur-slow: 520ms;

  /* Layout */
  --container: 1140px;
  --nav-height: 72px;
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* --------------------------------------------------------------------------
   3. BASE
   -------------------------------------------------------------------------- */
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
p { color: var(--color-text-muted); }
::selection { background: var(--color-gold); color: var(--color-ink); }

/* Focus visibility — accessibility */
:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Screen-reader only utility */
.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;
}

/* Skip link */
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--color-gold); color: var(--color-ink);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-sm);
  font-weight: 700; transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--space-4); }

/* --------------------------------------------------------------------------
   4. PRIMITIVES
   -------------------------------------------------------------------------- */
.container {
  width: min(100% - 2 * var(--space-6), var(--container));
  margin-inline: auto;
}
.section { padding-block: var(--space-20); }
.section--tight { padding-block: var(--space-12); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--color-gold);
  margin-bottom: var(--space-4);
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: currentColor;
}
.lead { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 62ch; }
.text-gold { color: var(--color-gold); }
.text-muted { color: var(--color-text-muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   5. COMPONENTS
   -------------------------------------------------------------------------- */

/* Buttons */
.btn {
  --btn-bg: var(--color-gold);
  --btn-fg: var(--color-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: var(--space-3) var(--space-6);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 700; font-size: var(--text-sm); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--secondary {
  --btn-bg: transparent; --btn-fg: var(--color-cream);
  border-color: var(--color-line);
}
.btn--secondary:hover { background: var(--color-surface-2); border-color: var(--color-gold); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--color-gold); }
.btn--ghost:hover { background: rgb(232 195 106 / 0.1); box-shadow: none; }
.btn--block { width: 100%; }
.btn--lg { min-height: 52px; padding-inline: var(--space-8); font-size: var(--text-base); }

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.card--elevated { background: var(--color-surface-2); box-shadow: var(--shadow-md); }
.card--interactive {
  transition: transform var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.card--interactive:hover {
  transform: translateY(-4px);
  border-color: rgb(232 195 106 / 0.45);
  box-shadow: var(--shadow-md);
}

/* Badges & chips */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 600;
}
.badge--gold { border-color: rgb(232 195 106 / 0.4); color: var(--color-gold); background: rgb(232 195 106 / 0.08); }
.badge--dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-gold); box-shadow: 0 0 0 3px rgb(232 195 106 / 0.15);
}

/* Balance chip */
.balance {
  display: inline-flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: 1px solid rgb(232 195 106 / 0.35);
  border-radius: var(--radius-pill);
  background: rgb(232 195 106 / 0.07);
  font-size: var(--text-sm);
}
.balance__label { color: var(--color-text-muted); font-size: var(--text-xs); }
.balance__value { color: var(--color-gold); font-weight: 700; font-family: var(--font-mono); }

/* Stat */
.stat__value { display: block; font-family: var(--font-display); font-size: var(--text-2xl); color: var(--color-gold); }
.stat__label { display: block; font-size: var(--text-xs); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); }

/* Divider */
.divider { height: 1px; background: var(--color-line-soft); border: 0; margin-block: var(--space-8); }

/* Table (accessible, for design system docs) */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td {
  text-align: left; padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-line-soft);
}
.table th { color: var(--color-gold); font-weight: 700; }
.table td { color: var(--color-text-muted); }

/* Swatches for design system page */
.swatch { border-radius: var(--radius-md); border: 1px solid var(--color-line); aspect-ratio: 4 / 3; }
.swatch__meta { margin-top: var(--space-2); font-size: var(--text-xs); }
.swatch__meta strong { display: block; color: var(--color-cream); }
.swatch__meta code { color: var(--color-text-muted); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
