/* ============================================================
   Sparkle Suite — Amethyst Design Tokens
   Single source of truth. Theme-switching across kits will
   replace this file's values; structure stays identical.
   ============================================================ */

:root {
  /* ---------- Color: Amethyst palette ---------- */
  --bg:           #E8DFF5;   /* Page background, card surfaces */
  --fg:           #2A1F40;   /* Primary text, headings, icons (NEVER #000) */
  --fg-muted:     #5C576A;   /* Secondary text, placeholders */
  --primary:      #D209E3;   /* CTAs, links, active states */
  --accent:       #480DDF;   /* Hover/pressed, deep emphasis */
  --border:       #C4C1CE;   /* Dividers, input borders, card outlines */

  /* Tinted neutrals derived from palette (for surfaces, hovers) */
  --bg-elevated:  #F2EBFA;   /* Lighter card surface for layered cards */
  --bg-deep:      #DCD0EE;   /* Pressed / selected fill */
  --header-bg:    #1A1230;   /* Slightly deeper than fg for header chrome */

  /* ---------- Type ---------- */
  --font-sans: "Vend Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --fs-hero:    clamp(48px, 6vw, 64px);
  --fs-h1:      clamp(32px, 4vw, 36px);
  --fs-h2:      clamp(24px, 3vw, 28px);
  --fs-h3:      22px;
  --fs-body:    16px;
  --fs-small:   14px;
  --fs-caption: 13px;

  --lh-tight:  1.1;
  --lh-snug:   1.25;
  --lh-normal: 1.5;
  --lh-loose:  1.65;

  --tracking-display: -0.01em;
  --tracking-body:    0;
  --tracking-caps:    0.08em;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;

  /* ---------- Spacing (8px 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;

  /* ---------- Radius ---------- */
  --r-sm:   6px;   /* small chips, inputs */
  --r-md:   8px;   /* buttons */
  --r-lg:   10px;  /* cards (lower bound) */
  --r-xl:   12px;  /* cards (upper bound), modals */
  --r-pill: 999px;

  /* ---------- Shadows (minimal — depth, not drama) ---------- */
  --shadow-1: 0 1px 2px rgba(42, 31, 64, 0.06);
  --shadow-2: 0 4px 12px rgba(42, 31, 64, 0.08);
  --shadow-3: 0 12px 32px rgba(42, 31, 64, 0.12);

  /* ---------- Motion ---------- */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 200ms;
  --dur-base: 300ms;
  --dur-slow: 400ms;
  --dur-card: 400ms; /* per spec: 0.4s ease-in-out for trade card stack */

  /* ---------- Layout ---------- */
  --container-max: 1200px;
  --container-pad: 24px;
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }

html {
  max-width: 100%;
  overflow-x: clip;
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  max-width: 100%;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-display);
  line-height: var(--lh-tight);
  margin: 0;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent); }

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}

img { display: block; max-width: 100%; }

/* ============================================================
   Page chrome for design system reference
   ============================================================ */
.page {
  min-height: 100vh;
  background: var(--bg);
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.system-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(232, 223, 245, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.system-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: var(--container-max);
  margin: 0 auto;
}

.system-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg);
}

.system-mark-glyph {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  transform: rotate(45deg);
  border-radius: 2px;
}

.system-nav {
  display: flex;
  gap: 24px;
  font-size: 13px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.system-nav a { color: var(--fg-muted); font-weight: var(--fw-medium); }
.system-nav a:hover { color: var(--fg); }

/* Section scaffolding for the design system doc */
.ds-section {
  padding: 96px 0 64px;
  border-bottom: 1px solid var(--border);
}
.ds-section:last-child { border-bottom: 0; }

.ds-section-header {
  margin-bottom: 48px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: baseline;
}
.ds-section-num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-muted);
  text-transform: uppercase;
}
.ds-section-title { font-size: 36px; }
.ds-section-desc {
  margin-top: 12px;
  max-width: 680px;
  color: var(--fg-muted);
  font-size: 16px;
  line-height: var(--lh-loose);
}

@media (max-width: 720px) {
  .ds-section-header { grid-template-columns: 1fr; gap: 8px; }
  .ds-section { padding: 64px 0 48px; }
}

/* Variation tile — a labeled box for showing options side-by-side */
.variant-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.variant {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.variant-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 11px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-muted);
}
.variant-tag {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg-deep);
  color: var(--fg);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-size: 10px;
}
.variant-title {
  font-size: 18px;
  font-weight: var(--fw-semi);
  margin-bottom: 8px;
  color: var(--fg);
}
.variant-desc {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 24px;
  line-height: var(--lh-loose);
}
.variant-stage {
  background: var(--bg);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  border: 1px dashed var(--border);
}

/* Slot indicator — marks rep-customizable elements */
.slot {
  position: relative;
  outline: 1px dashed transparent;
  transition: outline-color var(--dur-fast) var(--ease);
}
.slots-on .slot {
  outline-color: var(--primary);
  outline-offset: 4px;
}
.slot::before {
  content: attr(data-slot);
  position: absolute;
  top: -10px;
  left: 0;
  background: var(--primary);
  color: white;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
  pointer-events: none;
  z-index: 5;
}
.slots-on .slot::before { opacity: 1; }

/* Toggle for slot overlay */
.slot-toggle {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 100;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--r-pill);
  padding: 10px 16px;
  font-size: 12px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  font-weight: var(--fw-medium);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--fg);
  transition: all var(--dur-fast) var(--ease);
}
.slot-toggle:hover { background: var(--accent); border-color: var(--accent); }
.slot-toggle .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-muted);
  transition: background var(--dur-fast) var(--ease);
}
.slots-on .slot-toggle .dot { background: var(--primary); box-shadow: 0 0 0 4px rgba(210, 9, 227, 0.2); }
