/* ====== Benehab Design Tokens · v3 (glass + bento) ====== */

:root {
  /* Type */
  --font-sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Instrument Sans", "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --t-micro: 11px;
  --t-label: 12px;
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 14px;
  --t-base: 15px;
  --t-lg: 17px;
  --t-xl: 21px;
  --t-2xl: 26px;
  --t-3xl: 34px;
  --t-4xl: 46px;
  --t-coach: 30px;
  --t-coach-lg: 38px;
  --t-display: 60px;

  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-normal: 1.5;

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px; --s-10: 72px;

  /* Radius — bento boxes are softly rounded */
  --r-1: 6px; --r-2: 10px; --r-3: 14px; --r-4: 20px; --r-5: 26px; --r-pill: 999px;

  /* Layout */
  --nav-w: 236px;
  --tactical-w: 300px;
  --coach-w: 348px;
  --topbar-h: 56px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-snap: cubic-bezier(0.4, 0, 0.1, 1);
  --d-fast: 140ms;
  --d-base: 220ms;
  --d-slow: 380ms;

  /* Glass */
  --glass-blur: 22px;
  --glass-saturation: 1.4;
}

/* =============== DARK — deep navy, violet glow, neon teal =============== */
[data-theme="dark"], :root {
  /* Page background — multi-stop nebula */
  --bg-canvas:
    radial-gradient(900px 600px at 12% -8%, oklch(46% 0.18 285 / 0.55), transparent 60%),
    radial-gradient(800px 700px at 95% 110%, oklch(52% 0.20 200 / 0.42), transparent 60%),
    radial-gradient(700px 500px at 70% 30%, oklch(50% 0.16 320 / 0.30), transparent 60%),
    linear-gradient(180deg, oklch(15% 0.04 270) 0%, oklch(11% 0.05 270) 100%);
  --bg-canvas-solid: oklch(13% 0.04 270);

  /* Glass surfaces */
  --bg-panel:    oklch(20% 0.03 270 / 0.55);
  --bg-panel-2:  oklch(24% 0.04 275 / 0.55);
  --bg-sunken:   oklch(14% 0.03 270 / 0.62);
  --bg-elev:     oklch(28% 0.05 280 / 0.55);
  --bg-elev-2:   oklch(34% 0.06 285 / 0.62);
  --bg-overlay:  oklch(8% 0.03 270 / 0.55);

  /* Glass borders — inner highlight + outer hairline */
  --glass-stroke: oklch(96% 0.02 270 / 0.10);
  --glass-stroke-strong: oklch(96% 0.02 270 / 0.18);
  --glass-highlight: oklch(100% 0 0 / 0.08);

  /* Ink */
  --ink-1: oklch(96% 0.01 270);
  --ink-2: oklch(82% 0.02 270);
  --ink-3: oklch(64% 0.025 275);
  --ink-4: oklch(50% 0.03 275);
  --ink-mute: oklch(40% 0.03 275);
  --ink-on-accent: oklch(14% 0.04 270);
  --ink-on-dark: oklch(96% 0.01 270);

  /* Lines */
  --line-1: oklch(36% 0.04 275 / 0.5);
  --line-2: oklch(44% 0.05 275 / 0.6);
  --line-strong: oklch(58% 0.06 275 / 0.7);

  /* Neon accent — teal/cyan */
  --accent:        oklch(82% 0.16 195);
  --accent-2:      oklch(76% 0.17 200);
  --accent-hover:  oklch(86% 0.17 195);
  --accent-soft:   oklch(38% 0.10 200 / 0.45);
  --accent-softer: oklch(28% 0.07 200 / 0.45);
  --accent-ink:    oklch(88% 0.15 195);
  --accent-glow:   oklch(82% 0.16 195 / 0.45);

  /* Secondary accent — neon violet (bento contrast) */
  --accent-v:        oklch(74% 0.22 305);
  --accent-v-soft:   oklch(38% 0.16 305 / 0.5);
  --accent-v-ink:    oklch(86% 0.20 305);
  --accent-v-glow:   oklch(74% 0.22 305 / 0.45);

  /* Semantic */
  --alert:        oklch(72% 0.20 24);
  --alert-hover:  oklch(78% 0.22 24);
  --alert-soft:   oklch(38% 0.16 24 / 0.5);
  --alert-softer: oklch(28% 0.10 24 / 0.5);
  --alert-ink:    oklch(86% 0.18 24);
  --alert-glow:   oklch(72% 0.20 24 / 0.5);

  --success:        oklch(80% 0.18 158);
  --success-soft:   oklch(36% 0.12 158 / 0.45);
  --success-softer: oklch(26% 0.08 158 / 0.45);
  --success-ink:    oklch(88% 0.16 158);

  --warn:        oklch(82% 0.16 75);
  --warn-soft:   oklch(38% 0.12 70 / 0.45);
  --warn-softer: oklch(28% 0.08 70 / 0.45);
  --warn-ink:    oklch(88% 0.15 75);

  --live: var(--alert);

  /* Shadows — for floating glass */
  --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.2);
  --shadow-2: 0 8px 24px oklch(0% 0 0 / 0.45), 0 2px 6px oklch(0% 0 0 / 0.3);
  --shadow-3: 0 18px 48px oklch(0% 0 0 / 0.55), 0 4px 12px oklch(0% 0 0 / 0.35);
  --shadow-drawer: -16px 0 48px oklch(0% 0 0 / 0.55), -1px 0 0 var(--glass-stroke-strong);
  --shadow-flag:
    0 0 0 1px oklch(72% 0.20 24 / 0.4),
    0 0 32px oklch(72% 0.20 24 / 0.35),
    0 12px 32px oklch(0% 0 0 / 0.45);
  --shadow-coach:
    0 1px 0 var(--glass-highlight) inset,
    0 8px 28px oklch(0% 0 0 / 0.4),
    0 0 24px var(--accent-glow);
  --shadow-glow-cyan:   0 0 32px var(--accent-glow);
  --shadow-glow-violet: 0 0 32px var(--accent-v-glow);
  --shadow-glow-alert:  0 0 32px var(--alert-glow);

  /* Patient color */
  --pt-bg: oklch(48% 0.18 320);
  --pt-fg: oklch(96% 0.06 320);
}

/* =============== LIGHT — frosted lavender day =============== */
[data-theme="light"] {
  --bg-canvas:
    radial-gradient(900px 600px at 12% -8%, oklch(86% 0.08 285 / 0.7), transparent 60%),
    radial-gradient(800px 700px at 95% 110%, oklch(88% 0.08 200 / 0.7), transparent 60%),
    radial-gradient(700px 500px at 70% 30%, oklch(90% 0.06 320 / 0.6), transparent 60%),
    linear-gradient(180deg, oklch(96% 0.02 270) 0%, oklch(94% 0.025 270) 100%);
  --bg-canvas-solid: oklch(95% 0.02 270);

  --bg-panel:    oklch(99% 0.005 270 / 0.55);
  --bg-panel-2:  oklch(97% 0.01 270 / 0.6);
  --bg-sunken:   oklch(95% 0.015 270 / 0.55);
  --bg-elev:     oklch(99% 0.005 270 / 0.7);
  --bg-elev-2:   oklch(100% 0 0 / 0.85);
  --bg-overlay:  oklch(40% 0.04 270 / 0.30);

  --glass-stroke: oklch(40% 0.04 270 / 0.10);
  --glass-stroke-strong: oklch(40% 0.04 270 / 0.18);
  --glass-highlight: oklch(100% 0 0 / 0.55);

  --ink-1: oklch(20% 0.03 270);
  --ink-2: oklch(36% 0.03 270);
  --ink-3: oklch(52% 0.03 275);
  --ink-4: oklch(64% 0.03 275);
  --ink-mute: oklch(74% 0.025 275);
  --ink-on-accent: oklch(20% 0.03 270);
  --ink-on-dark: oklch(96% 0.01 270);

  --line-1: oklch(40% 0.04 275 / 0.18);
  --line-2: oklch(40% 0.04 275 / 0.28);
  --line-strong: oklch(40% 0.04 275 / 0.42);

  --accent:        oklch(56% 0.14 195);
  --accent-2:      oklch(50% 0.16 200);
  --accent-hover:  oklch(50% 0.15 195);
  --accent-soft:   oklch(88% 0.06 200 / 0.7);
  --accent-softer: oklch(94% 0.03 200 / 0.7);
  --accent-ink:    oklch(40% 0.13 195);
  --accent-glow:   oklch(56% 0.14 195 / 0.30);

  --accent-v:        oklch(58% 0.20 305);
  --accent-v-soft:   oklch(90% 0.07 305 / 0.7);
  --accent-v-ink:    oklch(40% 0.18 305);
  --accent-v-glow:   oklch(58% 0.20 305 / 0.30);

  --alert:        oklch(56% 0.20 26);
  --alert-hover:  oklch(50% 0.20 26);
  --alert-soft:   oklch(92% 0.06 26 / 0.7);
  --alert-softer: oklch(96% 0.03 26 / 0.7);
  --alert-ink:    oklch(40% 0.18 26);
  --alert-glow:   oklch(56% 0.20 26 / 0.28);

  --success:        oklch(54% 0.13 158);
  --success-soft:   oklch(92% 0.06 158 / 0.7);
  --success-softer: oklch(96% 0.03 158 / 0.7);
  --success-ink:    oklch(38% 0.12 158);

  --warn:        oklch(70% 0.14 70);
  --warn-soft:   oklch(94% 0.06 70 / 0.7);
  --warn-softer: oklch(97% 0.03 70 / 0.7);
  --warn-ink:    oklch(50% 0.13 65);

  --live: var(--alert);

  --shadow-1: 0 1px 2px oklch(20% 0.03 270 / 0.06);
  --shadow-2: 0 8px 24px oklch(20% 0.03 270 / 0.10), 0 2px 6px oklch(20% 0.03 270 / 0.06);
  --shadow-3: 0 18px 48px oklch(20% 0.03 270 / 0.14), 0 4px 12px oklch(20% 0.03 270 / 0.08);
  --shadow-drawer: -16px 0 48px oklch(20% 0.03 270 / 0.18), -1px 0 0 var(--glass-stroke-strong);
  --shadow-flag:
    0 0 0 1px oklch(56% 0.20 26 / 0.32),
    0 0 28px oklch(56% 0.20 26 / 0.20),
    0 12px 28px oklch(20% 0.03 270 / 0.10);
  --shadow-coach:
    0 1px 0 var(--glass-highlight) inset,
    0 8px 24px oklch(20% 0.03 270 / 0.10),
    0 0 20px var(--accent-glow);
  --shadow-glow-cyan:   0 0 24px var(--accent-glow);
  --shadow-glow-violet: 0 0 24px var(--accent-v-glow);
  --shadow-glow-alert:  0 0 24px var(--alert-glow);

  --pt-bg: oklch(82% 0.10 320);
  --pt-fg: oklch(28% 0.16 320);
}

/* =============== Reset / base =============== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--t-md);
  line-height: var(--lh-normal);
  color: var(--ink-1);
  background: var(--bg-canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.serif { font-family: var(--font-display); }
.label-sm {
  font-size: var(--t-xs); color: var(--ink-3); font-weight: 500;
  letter-spacing: -0.005em;
}
.eyebrow {
  font-size: 11px; letter-spacing: 0.06em; color: var(--ink-3);
  font-weight: 500;
  text-transform: uppercase;
}
.hairline { background: var(--line-1); height: 1px; width: 100%; }

/* Reusable glass surface */
.glass {
  background: var(--bg-panel);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  border: 1px solid var(--glass-stroke);
  border-radius: var(--r-4);
  box-shadow: 0 1px 0 var(--glass-highlight) inset, var(--shadow-2);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-2);
}

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

/* =============== Animations =============== */
@keyframes pulse-success {
  0%   { box-shadow: 0 0 0 0 oklch(80% 0.18 158 / 0.0); }
  35%  { box-shadow: 0 0 0 4px oklch(80% 0.18 158 / 0.30); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes pulse-alert {
  0%, 100% { box-shadow: var(--shadow-flag); }
  50%      { box-shadow: 0 0 0 1px var(--alert) inset, 0 0 36px var(--alert-glow), 0 12px 32px oklch(0% 0 0 / 0.4); }
}
@keyframes blink-dot {
  0%, 60% { opacity: 1; transform: scale(1); }
  80%     { opacity: 0.4; transform: scale(0.85); }
  100%    { opacity: 1; transform: scale(1); }
}
@keyframes coach-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes drawer-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes wave {
  0%, 100% { transform: scaleY(0.3); }
  50%      { transform: scaleY(1); }
}
@keyframes spike-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--alert-glow); }
  50%      { box-shadow: 0 0 0 8px var(--alert-glow); }
}
