/* ==========================================================
   Priceshow Design System — shared tokens
   Dark by default · light theme via [data-theme="light"]
   ========================================================== */

:root,
[data-theme="dark"] {
  /* === Surface === */
  --background: #0a0e1a;
  --foreground: #f8fafc;

  --card: #0f172a;
  --card-foreground: #f8fafc;

  --popover: #0f172a;
  --popover-foreground: #f8fafc;

  /* === Brand === */
  --primary: #fbbf24;          /* gold */
  --primary-foreground: #0a0e1a;
  --primary-hover: #fcd34d;
  --primary-active: #f59e0b;

  --secondary: #1e293b;
  --secondary-foreground: #f8fafc;

  --muted: #1e293b;
  --muted-foreground: #94a3b8;

  --accent: #1e293b;
  --accent-foreground: #f8fafc;

  --destructive: #ef4444;
  --destructive-foreground: #f8fafc;

  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* === Border / Input / Ring === */
  --border: rgba(148, 163, 184, 0.15);
  --border-strong: rgba(148, 163, 184, 0.3);
  --input: rgba(148, 163, 184, 0.2);
  --ring: #fbbf24;

  /* Chart palette (sequential, gold→navy) */
  --chart-1: #fbbf24;
  --chart-2: #f59e0b;
  --chart-3: #10b981;
  --chart-4: #3b82f6;
  --chart-5: #94a3b8;

  /* DS chrome */
  --ds-nav-bg: rgba(10,14,26,0.85);
  --ds-code-bg: #0f172a;
  --ds-code-fg: #cbd5e1;
}

[data-theme="light"] {
  --background: #ffffff;
  --foreground: #0a0e1a;

  --card: #ffffff;
  --card-foreground: #0a0e1a;

  --popover: #ffffff;
  --popover-foreground: #0a0e1a;

  --primary: #d97706;          /* deeper gold for AA on white */
  --primary-foreground: #ffffff;
  --primary-hover: #b45309;
  --primary-active: #92400e;

  --secondary: #f1f5f9;
  --secondary-foreground: #0a0e1a;

  --muted: #f1f5f9;
  --muted-foreground: #64748b;

  --accent: #f1f5f9;
  --accent-foreground: #0a0e1a;

  --destructive: #dc2626;
  --destructive-foreground: #ffffff;

  --success: #059669;
  --warning: #d97706;
  --info: #2563eb;

  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.20);
  --input: rgba(15, 23, 42, 0.15);
  --ring: #d97706;

  --chart-1: #d97706;
  --chart-2: #f59e0b;
  --chart-3: #059669;
  --chart-4: #2563eb;
  --chart-5: #64748b;

  --ds-nav-bg: rgba(255,255,255,0.85);
  --ds-code-bg: #f8fafc;
  --ds-code-fg: #334155;
}

/* === Typography stack === */
:root {
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-display: 'Geist', ui-sans-serif, system-ui, sans-serif;

  /* Type scale (1.250 = major third) */
  --text-xs: 0.75rem;     /* 12 */
  --text-sm: 0.875rem;    /* 14 */
  --text-base: 1rem;      /* 16 */
  --text-lg: 1.125rem;    /* 18 */
  --text-xl: 1.25rem;     /* 20 */
  --text-2xl: 1.5rem;     /* 24 */
  --text-3xl: 1.875rem;   /* 30 */
  --text-4xl: 2.25rem;    /* 36 */
  --text-5xl: 3rem;       /* 48 */
  --text-6xl: 3.75rem;    /* 60 */
  --text-7xl: 4.5rem;     /* 72 */

  /* Spacing — 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;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 0.25rem;
  --radius: 0.5rem;        /* 8px — shadcn default */
  --radius-md: 0.625rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadow — minimal/elevated */
  --shadow-xs: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.15), 0 8px 10px -6px rgba(0,0,0,0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.25);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 120ms;
  --duration: 180ms;
  --duration-slow: 280ms;

  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1440px;
}

/* ==========================================================
   Base reset
   ========================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01';
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
::selection { background: color-mix(in oklab, var(--primary) 35%, transparent); }

/* ==========================================================
   Component primitives
   ========================================================== */

/* --- Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 2.5rem;
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  user-select: none;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--primary-active); }

.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: color-mix(in oklab, var(--secondary) 80%, var(--foreground) 10%); }

.btn-outline { background: transparent; color: var(--foreground); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--accent); }

.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover:not(:disabled) { background: var(--accent); }

.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.btn-destructive:hover:not(:disabled) { background: color-mix(in oklab, var(--destructive) 85%, black 15%); }

.btn-link { background: transparent; color: var(--primary); height: auto; padding: 0; }
.btn-link:hover { text-decoration: underline; }

.btn-sm { height: 2rem; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-lg { height: 2.75rem; padding: 0 var(--space-6); font-size: var(--text-base); }
.btn-icon { width: 2.5rem; height: 2.5rem; padding: 0; }

/* --- Input --- */
.input, .textarea, .select {
  display: flex;
  width: 100%;
  height: 2.5rem;
  padding: 0 var(--space-3);
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  transition: border-color var(--duration), box-shadow var(--duration);
}
.input::placeholder { color: var(--muted-foreground); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 25%, transparent);
}
.textarea { height: auto; min-height: 5rem; padding: var(--space-2) var(--space-3); resize: vertical; }

/* --- Label --- */
.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--foreground);
}
.helper { font-size: var(--text-xs); color: var(--muted-foreground); margin-top: var(--space-2); }

/* --- Card --- */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.card-header { padding-bottom: var(--space-4); }
.card-title { font-size: var(--text-lg); font-weight: 600; margin: 0 0 var(--space-1) 0; letter-spacing: -0.01em; }
.card-description { font-size: var(--text-sm); color: var(--muted-foreground); margin: 0; }

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.25;
}
.badge-default { background: var(--primary); color: var(--primary-foreground); }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); border-color: var(--border); }
.badge-outline { background: transparent; color: var(--foreground); border-color: var(--border-strong); }
.badge-destructive { background: color-mix(in oklab, var(--destructive) 15%, transparent); color: var(--destructive); border-color: color-mix(in oklab, var(--destructive) 30%, transparent); }
.badge-success { background: color-mix(in oklab, var(--success) 15%, transparent); color: var(--success); border-color: color-mix(in oklab, var(--success) 30%, transparent); }
.badge-warning { background: color-mix(in oklab, var(--warning) 15%, transparent); color: var(--warning); border-color: color-mix(in oklab, var(--warning) 30%, transparent); }

/* --- Switch / checkbox / radio (visual) --- */
.switch {
  position: relative;
  width: 2.5rem; height: 1.375rem;
  background: var(--input);
  border-radius: var(--radius-full);
  transition: background var(--duration);
  flex: none;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 1.125rem; height: 1.125rem;
  background: var(--background);
  border-radius: var(--radius-full);
  transition: transform var(--duration) var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(1.125rem); }

.checkbox {
  width: 1rem; height: 1rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--background);
  flex: none;
}
.checkbox.checked { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }

/* --- Tabs --- */
.tabs-list {
  display: inline-flex;
  background: var(--muted);
  padding: 0.25rem;
  border-radius: var(--radius);
  gap: 0.25rem;
}
.tab {
  padding: var(--space-2) var(--space-3);
  border-radius: calc(var(--radius) - 0.125rem);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--duration);
}
.tab[aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }

/* --- Alert --- */
.alert {
  display: flex; gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.alert-icon { flex: none; color: var(--primary); margin-top: 2px; }
.alert-title { font-weight: 600; font-size: var(--text-sm); margin: 0 0 var(--space-1) 0; }
.alert-description { font-size: var(--text-sm); color: var(--muted-foreground); margin: 0; }

/* --- Avatar --- */
.avatar {
  width: 2.5rem; height: 2.5rem;
  border-radius: var(--radius-full);
  background: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--muted-foreground);
  flex: none;
}

/* --- Table --- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-weight: 500;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: color-mix(in oklab, var(--accent) 50%, transparent); }

/* --- Code block --- */
.code, code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--ds-code-bg);
  color: var(--ds-code-fg);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
pre.code-block {
  font-family: var(--font-mono);
  background: var(--ds-code-bg);
  color: var(--ds-code-fg);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: var(--text-xs);
  line-height: 1.6;
  margin: 0;
}
pre.code-block code { background: transparent; border: none; padding: 0; }

/* ==========================================================
   DS shell — page chrome shared across all DS docs
   ========================================================== */

.ds-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.ds-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--ds-nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.ds-nav-inner {
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 3.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-6);
}
.ds-brand { display: flex; align-items: center; gap: var(--space-3); font-weight: 600; letter-spacing: -0.01em; text-decoration: none; color: var(--foreground); }
.ds-brand-mark { width: 1.75rem; height: 1.75rem; }
.ds-nav-links { display: flex; gap: var(--space-1); align-items: center; }
.ds-nav-link {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--duration);
  white-space: nowrap;
}
.ds-nav-link:hover { color: var(--foreground); background: var(--accent); }
.ds-nav-link[aria-current="page"] { color: var(--foreground); background: var(--accent); }

.theme-toggle {
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 2.25rem; padding: 0 var(--space-3);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration);
}
.theme-toggle:hover { background: var(--accent); }

.ds-page { max-width: var(--container-2xl); margin: 0 auto; padding: var(--space-12) var(--space-6); width: 100%; }
.ds-hero { margin-bottom: var(--space-12); padding-bottom: var(--space-12); border-bottom: 1px solid var(--border); }
.ds-eyebrow { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.16em; color: var(--primary); font-weight: 600; margin-bottom: var(--space-3); }
.ds-h1 { font-size: var(--text-5xl); font-weight: 600; letter-spacing: -0.025em; margin: 0 0 var(--space-4) 0; line-height: 1.05; }
.ds-lede { font-size: var(--text-lg); color: var(--muted-foreground); max-width: 60ch; margin: 0; line-height: 1.5; }

.ds-section { margin-bottom: var(--space-16); }
.ds-section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-6); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.ds-h2 { font-size: var(--text-3xl); font-weight: 600; letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
.ds-h3 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 var(--space-3) 0; }
.ds-h4 { font-size: var(--text-base); font-weight: 600; margin: 0 0 var(--space-2) 0; }
.ds-text { color: var(--muted-foreground); font-size: var(--text-sm); line-height: 1.6; }

/* Demo container for component examples */
.demo {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card);
}
.demo-stage {
  padding: var(--space-8);
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  align-items: center;
  min-height: 7rem;
}
.demo-stage.column { flex-direction: column; align-items: stretch; }
.demo-caption { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); background: var(--muted); font-size: var(--text-xs); color: var(--muted-foreground); display: flex; justify-content: space-between; align-items: center; }

/* Token grids */
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }
.token-swatch {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--card);
}
.token-swatch-color { height: 4.5rem; }
.token-swatch-meta { padding: var(--space-3); }
.token-name { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--foreground); }
.token-value { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted-foreground); margin-top: 2px; }

/* Utility */
.row { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--space-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.muted { color: var(--muted-foreground); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }

/* ==========================================================
   Logo marks
   ========================================================== */
.mark { display: inline-flex; align-items: center; justify-content: center; }
.mark svg { width: 100%; height: 100%; }
