/* ============================================================
   Eva Doc — Design Tokens (Lunara-aligned)
   Dark is canonical; light is deliberate, not inverted.
   ============================================================ */

:root,
[data-theme="dark"] {
  /* Chrome neutrals — warm near-black */
  --bg: #1D1A15;
  --bg-deep: #0A0805;
  --surface: #26231E;
  --surface-raised: #2D2A24;
  --surface-warm: #1A1208;
  --border: #2D2A26;
  --border-strong: #3A362E;
  --border-gold: rgba(176, 141, 85, 0.16);
  --hairline: rgba(255, 255, 255, 0.04);

  /* Gold — brand signal */
  --gold: #B08D55;
  --gold-strong: #8C734F;
  --gold-dim: #634D2B;
  --gold-muted: #3A2A10;
  --gold-label: #8C6B3D;

  /* Text */
  --text: #F1F5F8;
  --text-strong: #FFFBEB;
  --text-body: #CBD5E1;
  --text-muted: #A8A29E;
  --text-subtle: #64748B;
  --text-quote: #E2E8F0;

  /* Phase (harmonized, earth-toned) */
  --phase-menstrual: #D48B7E;
  --phase-follicular: #9FC1AE;
  --phase-ovulation: #E09A5D;
  --phase-luteal: #AD9FC2;

  /* Semantic */
  --info: #7FA8D8;
  --attention: #D9A85A;
  --concern: #CF6679;

  /* Auth gradient */
  --welcome-center: #5C3D10;
  --welcome-mid: #2B1D07;
  --welcome-edge: #0F0A03;

  /* Button gradient */
  --btn-start: #B08D55;
  --btn-end: #8A6020;

  /* Elevation */
  --inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-1: 0 1px 0 var(--border);
  --shadow-2: 0 4px 16px -6px rgba(0, 0, 0, 0.4);
  --shadow-3: 0 24px 48px -16px rgba(0, 0, 0, 0.55);

  /* Radii */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Grid */
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-grid-strong: rgba(255, 255, 255, 0.10);
}

[data-theme="light"] {
  --bg: #FAF7F2;
  --bg-deep: #F3EEE5;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --surface-warm: #FBF6EC;
  --border: #EDE7DB;
  --border-strong: #D9D0BF;
  --border-gold: rgba(140, 115, 79, 0.20);
  --hairline: rgba(0, 0, 0, 0.04);

  --gold: #8C734F;
  --gold-strong: #634D2B;
  --gold-dim: #8A6A3A;
  --gold-muted: #F2E9D4;
  --gold-label: #8C6B3D;

  --text: #1A1612;
  --text-strong: #0F0C08;
  --text-body: #3A332C;
  --text-muted: #78716C;
  --text-subtle: #A8A29E;
  --text-quote: #4A423A;

  --phase-menstrual: #B5675A;
  --phase-follicular: #7A9B88;
  --phase-ovulation: #C97A3E;
  --phase-luteal: #8A7A9E;

  --info: #4A7FB8;
  --attention: #B8883A;
  --concern: #B04040;

  --inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --shadow-1: 0 1px 0 var(--border);
  --shadow-2: 0 4px 16px -6px rgba(26, 22, 18, 0.06);
  --shadow-3: 0 24px 48px -16px rgba(26, 22, 18, 0.12);

  --chart-grid: rgba(26, 22, 18, 0.06);
  --chart-grid-strong: rgba(26, 22, 18, 0.10);
}

/* Phase variant palettes (exposed via Tweaks) */
[data-phase-palette="cool"] {
  --phase-menstrual: #C26B7E;
  --phase-follicular: #8AB5C5;
  --phase-ovulation: #D89265;
  --phase-luteal: #9C8FBE;
}
[data-phase-palette="mono"] {
  --phase-menstrual: #C9A57B;
  --phase-follicular: #9F8A5E;
  --phase-ovulation: #E0B878;
  --phase-luteal: #77633E;
}

/* ------------------------------------------------------------
   Base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; }

/* Density toggle */
[data-density="compact"] { --row-h: 40px; --pad-y: 8px; --pad-x: 12px; --gap: 12px; }
[data-density="comfortable"] { --row-h: 52px; --pad-y: 14px; --pad-x: 18px; --gap: 20px; }

[data-density="compact"] body { font-size: 13px; }
[data-density="comfortable"] body { font-size: 14px; }

/* ------------------------------------------------------------
   Typography primitives
   ------------------------------------------------------------ */
.sans { font-family: 'Inter', ui-sans-serif, sans-serif; }
.satoshi { font-family: 'Satoshi', 'Inter', ui-sans-serif, sans-serif; }

.tabular { font-variant-numeric: tabular-nums lining-nums; }

/* Section label — the signature uppercase motif */
.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.8px;
  text-transform: uppercase;
  color: var(--gold-label);
}

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
}

/* Italic editorial titles */
.display-italic {
  font-family: 'Satoshi', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: -0.5px;
  color: var(--text-strong);
}
.section-title {
  font-family: 'Satoshi', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.3px;
  color: var(--text-strong);
}
.card-title {
  font-family: 'Satoshi', sans-serif;
  font-weight: 400;
  font-style: italic;
  font-size: 22px;
  line-height: 1.15;
  color: var(--text);
}
.quote {
  font-family: 'Satoshi', serif;
  font-weight: 400;
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-quote);
}

/* Brand wordmark */
.wordmark-eva {
  font-family: 'Satoshi', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--gold);
}
.wordmark-doc {
  font-family: 'Satoshi', sans-serif;
  font-weight: 300;
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--text-muted);
}

/* Data metrics */
.metric-value {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 28px;
  letter-spacing: -0.4px;
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
}
.metric-label {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-label);
}

/* ------------------------------------------------------------
   Surfaces
   ------------------------------------------------------------ */
.surface {
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--r-lg);
  box-shadow: var(--inset-top);
}
.surface-raised {
  background: var(--surface-raised);
  border: 1px solid var(--border-gold);
  border-radius: var(--r);
  box-shadow: var(--shadow-2), var(--inset-top);
}
.hairline { background: var(--border); height: 1px; width: 100%; }

/* ------------------------------------------------------------
   Buttons & chips
   ------------------------------------------------------------ */
.btn {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 160ms cubic-bezier(.2,.8,.2,1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}
.btn:hover { border-color: var(--gold-dim); color: var(--text-strong); }

.btn-primary {
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 12px;
  color: #1A1208;
  background: linear-gradient(180deg, var(--btn-start) 0%, var(--btn-end) 100%);
  border: none;
  padding: 11px 22px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 8px 24px -12px rgba(176,141,85,0.5);
}
.btn-primary:hover { filter: brightness(1.05); }

.btn-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--hairline); color: var(--text); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border: 1px solid var(--border-gold);
  color: var(--text-muted);
  background: var(--hairline);
  line-height: 1.2;
  white-space: nowrap;
}
.chip-gold { color: var(--gold); border-color: var(--border-gold); background: rgba(176,141,85,0.06); }
.chip-menstrual { color: var(--phase-menstrual); border-color: color-mix(in oklab, var(--phase-menstrual) 30%, transparent); background: color-mix(in oklab, var(--phase-menstrual) 10%, transparent); }
.chip-follicular { color: var(--phase-follicular); border-color: color-mix(in oklab, var(--phase-follicular) 30%, transparent); background: color-mix(in oklab, var(--phase-follicular) 10%, transparent); }
.chip-ovulation { color: var(--phase-ovulation); border-color: color-mix(in oklab, var(--phase-ovulation) 30%, transparent); background: color-mix(in oklab, var(--phase-ovulation) 10%, transparent); }
.chip-luteal { color: var(--phase-luteal); border-color: color-mix(in oklab, var(--phase-luteal) 30%, transparent); background: color-mix(in oklab, var(--phase-luteal) 10%, transparent); }

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}

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

/* ------------------------------------------------------------
   Scrollbar (subtle)
   ------------------------------------------------------------ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ------------------------------------------------------------
   Utility
   ------------------------------------------------------------ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes glow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.65; }
}

.fade-in { animation: fadeIn 280ms cubic-bezier(.2,.8,.2,1) both; }

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