/* Nirvani AI design system
   Purple leads (identity, live state, focus, data). Rose gold is reserved for
   buttons, icons and calls to action. Dark is the signature theme; light is a
   first-class alternative. Every text pair below is WCAG AA in both themes. */

:root {
  /* Amethyst: the lead hue */
  --amethyst-50: #F5F0FF;  --amethyst-100: #EADFFF; --amethyst-200: #D6C1FF;
  --amethyst-300: #BC99FB; --amethyst-400: #A274F2; --amethyst-500: #8A55E3;
  --amethyst-600: #7240C9; --amethyst-700: #5A30A4; --amethyst-800: #43257A;
  --amethyst-900: #2E1A54; --amethyst-950: #1C1036;

  /* Rose gold: buttons, icons, CTAs */
  --rose-50: #FDF4F0;  --rose-100: #F9E5DD; --rose-200: #F2CBBC;
  --rose-300: #E8AE98; --rose-400: #D99178; --rose-500: #C4775F;
  --rose-600: #A65F4A; --rose-700: #844A3A; --rose-800: #63372C;
  --rose-900: #42251E;
  --rose-metal: linear-gradient(135deg, #F6D3C3 0%, #E3A58D 38%, #C98068 62%, #EFC1AE 100%);

  /* Semantic (fixed mapping: success green, error red, partial amber, neutral grey) */
  --ok: #3FB97A;    --ok-soft: rgba(63, 185, 122, .14);   --ok-text: #7BDCA8;
  --err: #E5606B;   --err-soft: rgba(229, 96, 107, .14);  --err-text: #F4A1A8;
  --warn: #E0A43C;  --warn-soft: rgba(224, 164, 60, .14); --warn-text: #F2C97E;
  --idle: #8D8299;  --idle-soft: rgba(141, 130, 153, .16); --idle-text: #C3B9CE;

  /* Type */
  --font-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* Type scale: 1.25 ratio from a 17px body */
  --fs-sm: .875rem; --fs-body: 1.0625rem; --fs-lg: 1.25rem; --fs-xl: 1.5625rem;
  --fs-2xl: 2.25rem; --fs-3xl: clamp(2.6rem, 5vw, 3.5rem); --fs-hero: clamp(3rem, 7.4vw, 5.6rem);

  /* Space, radius, motion */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --wrap: 1180px;

  color-scheme: dark;
  --bg: #100A18; --surface: #170F22; --raised: #1F152D; --sunken: #0C0713;
  --line: #2E2240; --line-strong: #3F3156;
  --text: #F3EDF7; --text-2: #C5B8D3; --muted: #A898BA;
  --lead: var(--amethyst-400); --lead-strong: var(--amethyst-300); --lead-deep: var(--amethyst-700);
  --link: var(--amethyst-300);
  --icon: var(--rose-300); --rose-text: var(--rose-300);
  --aura: rgba(138, 85, 227, .32);
  --focus: 0 0 0 3px var(--bg), 0 0 0 5px var(--amethyst-300);
  --shadow-lift: 0 1px 0 rgba(255,255,255,.04) inset, 0 24px 60px -24px rgba(0,0,0,.7);
}

/* Light theme: follows the OS unless the visitor picked one */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #FBF8FC; --surface: #FFFFFF; --raised: #F4EEF8; --sunken: #EFE7F4;
    --line: #E5DCEC; --line-strong: #D3C5DF;
    --text: #1A1124; --text-2: #4A3D58; --muted: #665777;
    --lead: var(--amethyst-600); --lead-strong: var(--amethyst-700); --lead-deep: var(--amethyst-600);
    --link: var(--amethyst-600);
    --icon: var(--rose-600); --rose-text: var(--rose-700);
    --aura: rgba(138, 85, 227, .18);
    --ok-text: #1E7A4C; --err-text: #B3303C; --warn-text: #8A5A0B; --idle-text: #5E5468;
    --shadow-lift: 0 24px 60px -30px rgba(46, 26, 84, .28);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FBF8FC; --surface: #FFFFFF; --raised: #F4EEF8; --sunken: #EFE7F4;
  --line: #E5DCEC; --line-strong: #D3C5DF;
  --text: #1A1124; --text-2: #4A3D58; --muted: #665777;
  --lead: var(--amethyst-600); --lead-strong: var(--amethyst-700); --lead-deep: var(--amethyst-600);
  --link: var(--amethyst-600);
  --icon: var(--rose-600); --rose-text: var(--rose-700);
  --aura: rgba(138, 85, 227, .18);
  --ok-text: #1E7A4C; --err-text: #B3303C; --warn-text: #8A5A0B; --idle-text: #5E5468;
  --shadow-lift: 0 24px 60px -30px rgba(46, 26, 84, .28);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-body)/1.65 var(--font-body);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--lead-strong); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: var(--amethyst-500); color: #fff; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 720px) { .wrap { padding: 0 var(--s6); } }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.05; letter-spacing: -.01em; margin: 0; color: var(--text); }
h1 { font-size: var(--fs-hero); font-weight: 500; letter-spacing: -.02em; }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); font-weight: 600; }
p { margin: 0 0 var(--s4); max-width: 68ch; }
.lede { font-size: var(--fs-lg); color: var(--text-2); line-height: 1.6; max-width: 56ch; }
.muted { color: var(--muted); }
.num, code, kbd, pre { font-family: var(--font-mono); font-feature-settings: "zero"; }
code { font-size: .9em; background: var(--raised); border: 1px solid var(--line); padding: .1em .4em; border-radius: 6px; }

/* Wordmark: serif name with a rose gold dot, the one gold flourish in the chrome */
.brand { display: inline-flex; align-items: baseline; gap: 2px; text-decoration: none; color: var(--text); font-family: var(--font-display); font-size: 1.65rem; font-weight: 600; letter-spacing: .01em; }
.brand:hover { color: var(--text); }
.brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rose-metal); transform: translateY(-2px); }
.brand small { font-family: var(--font-body); font-size: .8rem; font-weight: 600; color: var(--lead-strong); margin-left: 6px; letter-spacing: .02em; }

/* Header */
.nav { position: sticky; top: 0; z-index: 30; backdrop-filter: saturate(140%) blur(14px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: var(--s4); }
.nav ul { list-style: none; display: flex; gap: var(--s1); margin: 0; padding: 0; }
.nav ul a { display: block; padding: 8px 12px; border-radius: var(--r-pill); color: var(--text-2); text-decoration: none; font-size: .95rem; font-weight: 500; }
.nav ul a:hover, .nav ul a[aria-current="page"] { color: var(--text); background: var(--raised); }
.nav-actions { display: flex; align-items: center; gap: var(--s2); }
.nav .menu-btn { display: none; }
@media (max-width: 860px) {
  .nav ul { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; padding: var(--s3) var(--s4) var(--s5); background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav ul.open { display: flex; }
  .nav ul a { padding: 12px 14px; font-size: 1.05rem; }
  .nav .menu-btn { display: inline-flex; }
  .nav-actions .btn-cta { display: none; }
}

/* Buttons. Rose gold owns every call to action. */
.btn { --h: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: var(--h); padding: 0 22px; border-radius: var(--r-pill); border: 1px solid transparent; font: 600 .98rem/1 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .2s; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.btn-sm { --h: 38px; padding: 0 16px; font-size: .9rem; }
.btn-lg { --h: 56px; padding: 0 30px; font-size: 1.05rem; }

.btn-cta { background: var(--rose-metal); background-size: 180% 180%; background-position: 0% 50%; color: var(--amethyst-950); box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 -1px 0 rgba(66,37,30,.25) inset, 0 10px 30px -12px rgba(201,128,104,.7); }
.btn-cta:hover { color: var(--amethyst-950); background-position: 100% 50%; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 0 0 4px rgba(138,85,227,.28), 0 14px 38px -12px rgba(201,128,104,.85); }
.btn-ghost { background: transparent; color: var(--rose-text); border-color: color-mix(in srgb, var(--rose-400) 55%, transparent); }
.btn-ghost:hover { color: var(--rose-text); background: color-mix(in srgb, var(--rose-400) 12%, transparent); border-color: var(--rose-400); }
.btn-quiet { background: var(--raised); color: var(--text); border-color: var(--line); }
.btn-quiet:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; background: transparent; border: 1px solid var(--line); color: var(--icon); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--rose-400); background: color-mix(in srgb, var(--rose-400) 10%, transparent); }
.icon-btn svg { width: 18px; height: 18px; }
.ic { color: var(--icon); }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: var(--s4); }
.field label { font-size: .9rem; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--sunken); border: 1px solid var(--line); color: var(--text); font: 400 1rem/1.4 var(--font-body); transition: border-color .2s, box-shadow .2s; }
.textarea { resize: vertical; min-height: 120px; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .85; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--lead); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lead) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--err); }
.hint { font-size: .88rem; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Status pills: soft tone, always text plus color */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: .82rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok-text); }
.pill-err { background: var(--err-soft); color: var(--err-text); }
.pill-warn { background: var(--warn-soft); color: var(--warn-text); }
.pill-idle { background: var(--idle-soft); color: var(--idle-text); }
.pill-live { background: color-mix(in srgb, var(--amethyst-500) 18%, transparent); color: var(--lead-strong); }
.pill-live::before { animation: breathe 2.4s var(--ease) infinite; }
@keyframes breathe { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }

/* Surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lift); }
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong) 20%, var(--line-strong) 80%, transparent); border: 0; margin: 0; }

/* Toasts (failures always surface) */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: var(--raised); border: 1px solid var(--line-strong); color: var(--text); font-size: .95rem; box-shadow: var(--shadow-lift); }
.toast.err { border-color: color-mix(in srgb, var(--err) 60%, var(--line)); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }

/* Sections */
.section { padding: var(--s8) 0; }
@media (min-width: 900px) { .section { padding: var(--s9) 0; } }
.section-head { display: grid; gap: var(--s3); margin-bottom: var(--s7); max-width: 720px; }
.section-head p { color: var(--text-2); font-size: var(--fs-lg); margin: 0; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: var(--s7) 0 var(--s6); color: var(--muted); font-size: .92rem; }
.foot .wrap { display: grid; gap: var(--s5); }
@media (min-width: 800px) { .foot .wrap { grid-template-columns: 1.4fr repeat(3, 1fr); } }
.foot h3 { font-family: var(--font-body); font-size: .95rem; font-weight: 600; color: var(--text); margin-bottom: var(--s2); letter-spacing: 0; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot a { color: var(--text-2); text-decoration: none; }
.foot a:hover { color: var(--text); }
.foot .legal { grid-column: 1 / -1; padding-top: var(--s4); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); }

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