/* beile.info — design tokens. See docs/DESIGN-SYSTEM.md.
   Static values below = default accent #6D5BFF (dark UI). /assets/accent.js overrides every
   accent/surface/text token inline on <html> from ONE hex (any colour). Names are a stable contract.
   Rules: no backdrop-filter anywhere; translucent cards via --glass; use tokens, never hard-coded colours. */
:root {
  --accent: #7b6aff;
  --accent-rgb: 123 106 255;
  --accent-2: #dd79ff;
  --accent-2-rgb: 221 121 255;
  --accent-grad: linear-gradient(135deg, #7b6aff 0%, #dd79ff 100%);
  --accent-soft: rgb(123 106 255 / .16);
  --accent-glow: rgb(123 106 255 / .35);
  --accent-line: rgb(123 106 255 / .55);
  --accent-hover: #9b8eff;
  --accent-contrast: #0b0b10;

  --surface-0: #0a0a0d;
  --surface-1: #131219;
  --surface-2: #1b1a23;
  --surface-3: #24222f;
  --glass: rgb(19 18 25 / .78);
  --glass-2: rgb(27 26 35 / .78);
  --text: #f0f0f5;
  --text-muted: #b5b3c1;
  --text-faint: #9391a1;
  --border: rgb(255 255 255 / .09);
  --border-strong: rgb(255 255 255 / .22);
  --overlay: rgb(0 0 0 / .55);

  --danger: #ff6b6b;
  --ok: #3ddc84;
  --warn: #ffc53d;

  --radius-s: 12px;
  --radius-m: 20px;
  --radius-l: 28px;
  --radius-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --tap: 44px;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-text: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-1: 0 1px 2px rgb(0 0 0 / .35), 0 2px 8px rgb(0 0 0 / .25);
  --shadow-2: 0 2px 6px rgb(0 0 0 / .3), 0 10px 24px rgb(0 0 0 / .35);
  --shadow-accent: 0 4px 14px var(--accent-glow);

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 380ms;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --accent: #1c00ff; --accent-rgb: 28 0 255; --accent-2: #b200f0; --accent-2-rgb: 178 0 240;
  --accent-grad: linear-gradient(135deg, #1c00ff 0%, #b200f0 100%);
  --accent-soft: rgb(28 0 255 / .16); --accent-glow: rgb(28 0 255 / .35); --accent-line: rgb(28 0 255 / .55);
  --accent-hover: #1800db; --accent-contrast: #ffffff;
  --surface-0: #f2f2f5; --surface-1: #fefefe; --surface-2: #ebebef; --surface-3: #e3e2e9;
  --glass: rgb(254 254 254 / .82); --glass-2: rgb(235 235 239 / .82);
  --text: #151320; --text-muted: #535167; --text-faint: #504e5f;
  --border: rgb(0 0 0 / .1); --border-strong: rgb(0 0 0 / .26); --overlay: rgb(20 18 30 / .45);
  --danger: #c62828; --ok: #12803f; --warn: #8a5a00;
  --shadow-1: 0 1px 2px rgb(20 18 30 / .08), 0 2px 8px rgb(20 18 30 / .06);
  --shadow-2: 0 2px 6px rgb(20 18 30 / .08), 0 10px 24px rgb(20 18 30 / .12);
  color-scheme: light;
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0.01ms; --dur-2: 0.01ms; --dur-3: 0.01ms; }
}

/* ---- shared helpers (opt-in) ---- */
.glass { background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-m); }
.glass-2 { background: var(--glass-2); border: 1px solid var(--border); border-radius: var(--radius-m); }
.accent-text { color: var(--accent); }
.accent-bg { background: var(--accent); color: var(--accent-contrast); }
.accent-grad { background: var(--accent-grad); color: var(--accent-contrast); }

/* ---- accent picker (accent-picker.js) ---- */
.ap-backdrop { position: fixed; inset: 0; z-index: 2147483000; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity var(--dur-2) var(--ease-out); }
.ap-backdrop.on { opacity: 1; }
.ap-sheet { width: min(100%, 440px); max-height: 92vh; overflow: auto; background: var(--surface-1); color: var(--text); font-family: var(--font-text); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius-l) var(--radius-l) 0 0; padding: var(--space-4) var(--space-4) calc(var(--space-4) + var(--safe-bottom)); box-shadow: var(--shadow-2); transform: translateY(24px); transition: transform var(--dur-3) var(--ease-out); }
.ap-backdrop.on .ap-sheet { transform: none; }
@media (min-width: 560px) { .ap-backdrop { align-items: center; } .ap-sheet { border-bottom: 1px solid var(--border); border-radius: var(--radius-l); } }
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.ap-head h2 { margin: 0; font: 700 1.1rem/1.2 var(--font-text); }
.ap-x { min-width: var(--tap); min-height: var(--tap); border: 0; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.2rem; cursor: pointer; }
.ap-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-2); }
.ap-sw { position: relative; min-height: var(--tap); aspect-ratio: 1; border-radius: var(--radius-pill); border: 2px solid transparent; cursor: pointer; padding: 0; background-clip: padding-box; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .18); }
.ap-sw[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface-1) inset; }
.ap-sw:focus-visible, .ap-x:focus-visible, .ap-btn:focus-visible, .ap-hex:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-row { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-4); }
.ap-color { flex: none; width: var(--tap); height: var(--tap); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-s); background: none; cursor: pointer; }
.ap-hex { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 var(--space-3); border-radius: var(--radius-s); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: 600 1rem var(--font-mono); text-transform: uppercase; }
.ap-hex[aria-invalid="true"] { border-color: var(--danger); }
.ap-btn { min-height: var(--tap); padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: 700 .9rem var(--font-text); cursor: pointer; }
.ap-prev { margin-top: var(--space-4); height: 44px; border-radius: var(--radius-s); background: var(--accent-grad); color: var(--accent-contrast); display: grid; place-items: center; font: 700 .9rem var(--font-text); }
.ap-inline, .ap-body { min-width: 0; max-width: 100%; }
.ap-inline .ap-grid { grid-template-columns: repeat(6, minmax(0, 44px)); justify-content: space-between; }
.ap-sw { min-width: 0; }
