/* ============================================================
   SPURLUNA — design tokens
   Tasteful cyberpunk for daily mental-health use.
   Mood spectrum: calibrated teal→amber, no red/green cliché.
   ============================================================ */

:root {
  /* ---- Typography ---- */
  --font-sans: 'General Sans', 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'General Sans', 'Söhne', -apple-system, sans-serif;

  /* ---- Mood spectrum (shared across themes) ---- */
  --mood-great:    oklch(82% 0.14 190);   /* calm teal */
  --mood-good:     oklch(86% 0.12 160);   /* mint */
  --mood-notgreat: oklch(82% 0.14 75);    /* warm amber */
  --mood-rough:    oklch(72% 0.14 30);    /* warm coral */

  --mood-great-deep:    oklch(58% 0.15 190);
  --mood-good-deep:     oklch(62% 0.14 160);
  --mood-notgreat-deep: oklch(62% 0.16 75);
  --mood-rough-deep:    oklch(55% 0.17 30);

  /* ---- Accents (aurora) ---- */
  --accent:       oklch(78% 0.14 220);   /* primary aurora blue */
  --accent-warm:  oklch(78% 0.14 50);    /* warm signal */
  --accent-deep:  oklch(48% 0.18 280);   /* deep violet glow */

  /* ---- Episode severity colors ---- */
  --severity-mild:     oklch(82% 0.10 190);
  --severity-moderate: oklch(80% 0.13 75);
  --severity-severe:   oklch(72% 0.15 30);

  /* ---- Motion ---- */
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:  160ms;
  --dur-med:   280ms;
  --dur-slow:  520ms;

  /* ---- Radii ---- */
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  22px;
  --r-xl:  32px;
  --r-pill: 999px;
}

/* ---- Dark (default) ---- */
:root, [data-theme="dark"] {
  --bg:            oklch(14% 0.02 265);
  --bg-elev:       oklch(18% 0.025 265);
  --bg-elev-2:     oklch(22% 0.03 265);
  --bg-aurora-1:   oklch(22% 0.08 280);
  --bg-aurora-2:   oklch(20% 0.06 200);

  --surface:       oklch(20% 0.025 265 / 0.65);
  --surface-solid: oklch(20% 0.025 265);
  --surface-hi:    oklch(26% 0.03 265 / 0.8);

  --border:        oklch(45% 0.03 265 / 0.25);
  --border-hi:     oklch(60% 0.05 265 / 0.4);
  --border-accent: oklch(70% 0.12 220 / 0.5);

  --text:          oklch(96% 0.01 265);
  --text-dim:      oklch(78% 0.02 265);
  --text-muted:    oklch(62% 0.02 265);

  --glow:          0 0 40px oklch(70% 0.12 220 / 0.15);
  --glow-strong:   0 0 60px oklch(70% 0.15 220 / 0.28);
  --shadow-card:   0 1px 0 oklch(100% 0 0 / 0.04) inset,
                   0 20px 40px -20px oklch(0% 0 0 / 0.5);
}

/* ---- Light — warm paper ---- */
[data-theme="light"] {
  --bg:            oklch(98% 0.008 80);
  --bg-elev:       oklch(100% 0 0);
  --bg-elev-2:     oklch(96% 0.01 80);
  --bg-aurora-1:   oklch(94% 0.04 220);
  --bg-aurora-2:   oklch(94% 0.04 40);

  --surface:       oklch(100% 0 0 / 0.7);
  --surface-solid: oklch(100% 0 0);
  --surface-hi:    oklch(98% 0.008 80);

  --border:        oklch(60% 0.02 265 / 0.18);
  --border-hi:     oklch(50% 0.03 265 / 0.3);
  --border-accent: oklch(55% 0.12 220 / 0.4);

  --text:          oklch(22% 0.02 265);
  --text-dim:      oklch(42% 0.02 265);
  --text-muted:    oklch(58% 0.02 265);

  --glow:          0 0 40px oklch(70% 0.12 220 / 0.08);
  --glow-strong:   0 0 60px oklch(70% 0.15 220 / 0.12);
  --shadow-card:   0 1px 2px oklch(0% 0 0 / 0.04),
                   0 20px 40px -20px oklch(0% 0 0 / 0.12);

  --mood-great:    oklch(72% 0.13 190);
  --mood-good:     oklch(76% 0.12 160);
  --mood-notgreat: oklch(74% 0.14 75);
  --mood-rough:    oklch(64% 0.15 30);
}

/* ============================================================
   Base reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-sans);
  font-feature-settings: 'ss01', 'cv11';
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Aurora ambient */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(ellipse 50% 40% at 15% 10%, var(--bg-aurora-1) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 90%, var(--bg-aurora-2) 0%, transparent 60%);
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
  animation: aurora-drift 40s var(--ease-soft) infinite alternate;
}

@keyframes aurora-drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(-3%, 2%); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Shared primitives (used across pages)
   ============================================================ */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: var(--shadow-card);
}

.surface-hi {
  background: var(--surface-hi);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: var(--shadow-card), var(--glow);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { border-color: var(--border-hi); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 140%);
  color: oklch(98% 0.005 265);
  border-color: var(--border-accent);
  box-shadow: var(--glow);
}
.btn-primary:hover { box-shadow: var(--glow-strong); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface); border-color: var(--border); color: var(--text); }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

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

/* Page header shared */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── 12-column dashboard grid (shared across pages) ── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.dash-card { padding: 22px 24px; }
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
@media (max-width: 980px) {
  .col-8, .col-6, .col-4 { grid-column: span 12; }
}

/* ── Utility classes ── */
.hidden          { display: none; }
.text-center     { text-align: center; }
.text-right      { text-align: right; }
.fw-medium       { font-weight: 500; }
.capitalize      { text-transform: capitalize; }
.ml-auto         { margin-left: auto; }
.mt-1            { margin-top: 4px; }
.mt-2            { margin-top: 8px; }
.mt-3            { margin-top: 14px; }
.mt-4            { margin-top: 16px; }
.mt-5            { margin-top: 20px; }
.mb-2            { margin-bottom: 8px; }
.mb-5            { margin-bottom: 18px; }
.btn-full        { width: 100%; justify-content: center; }
.btn-compact     { padding: 6px 10px; }
.flex-col-gap    { display: flex; flex-direction: column; gap: 8px; }
.flex-end-gap    { display: flex; align-items: flex-end; gap: 8px; }
.flex-between    { display: flex; justify-content: space-between; align-items: center; }
.chart-container { position: relative; height: 220px; }
.chart-fill      { width: 100%; height: 100%; }
.emoji-hero      { font-size: 48px; margin-bottom: 16px; line-height: 1; }
.success-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.note-btn-row    { display: flex; gap: 10px; }
a.btn            { text-decoration: none; }
