/* Dark mode for the panel and the friendly marketing pages (home, login, waitlist). Loaded last.
   theme.js sets <html data-theme="dark">. The light styles name their colours through tokens that fall back to the
   light value (var(--warn-bg, #fbefc9), rgba(var(--tint, 27, 36, 64), .04), ...), so dark mode is mostly the token
   values below. Deep navy, never pure black, with the same gold accent. Also includes the theme toggle button. */

/* ---------- The toggle (both themes) ---------- */
.theme-btn {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface, var(--card)); color: var(--text-2, var(--ink-2));
  box-shadow: var(--sh-1); cursor: pointer; transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, color .15s;
}
.theme-btn:hover { color: var(--text, var(--fg, var(--ink))); box-shadow: var(--sh-2); transform: translateY(-1px) rotate(-12deg); }
.theme-btn:active { transform: scale(.94); }
.theme-btn svg { display: block; }
body.home .theme-btn { width: 40px; height: 40px; background: var(--card); color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .theme-btn, .theme-btn:hover { transition: none; transform: none; } }

/* ---------- Shared dark tokens ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --tint: 220, 228, 245;        /* subtle washes: light on dark instead of navy on light */
  --glass-rgb: 24, 33, 59;
  --good-bg: #163728; --good-line: #22553e; --good-ink: #6fe0a5;
  --warn-bg: #38301a; --warn-line: #5a4a1f; --warn-ink: #f7cf5a;
  --bad-bg: #42201f;  --bad-line: #6a2f2b;  --bad-ink: #ff9b8f;
  --sel-bg: #1d3253;  --sel-line: #2f5486;  --sel-ink: #8cbcff;
  --vio-bg: #2c2750;  --vio-line: #463d7d;  --vio-ink: #b9a8ff;
  --off-bg: #232c47; --track: #2a3454; --faint: #4a5576;
  --ink-fill: #2c3863;          /* the navy buttons, bubbles and toasts, lifted off the dark page */
  --sky-fill: #1b2259;          /* behind the pixel worlds before they draw (their night sky) */
}

/* ---------- Panel ---------- */
:root[data-theme="dark"] body.panel {
  --bg: #10172b; --bg-2: #0d1426;
  --surface: #18213b; --surface-2: #1e2846; --surface-3: #263152;
  --line: #273253; --line-2: #35426a;
  --side: #141c33; --glass: rgba(16, 23, 43, .82);
  --text: #e6eaf3; --text-2: #b3bcd1; --muted: #8590ab;
  --accent-2: #6fb0f0; --good: #3ddc97; --warn: #ffc24b; --bad: #ff7b72;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px -8px rgba(0, 0, 0, .55);
  --sh-2: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 36px -14px rgba(0, 0, 0, .7);
  --mint: #173a2c;   --mint-ink: #5fd99a;
  --sky: #1b3252;    --sky-ink: #7fb5ff;
  --butter: #3a3117; --butter-ink: #f7cf5a;
  --peach: #432a20;  --peach-ink: #ff9d78;
  --lilac: #2c2750;  --lilac-ink: #b4a3ff;
  --rose: #432237;   --rose-ink: #ff8db6;
  --aqua: #153b3d;   --aqua-ink: #5ad3d3;
  --slate: #242e4a;  --slate-ink: #b3bcd1;
  --paper: var(--surface);
  --frost: rgba(24, 33, 59, .94);  /* wizard cards over the (night) world */
  color-scheme: dark;
  background: radial-gradient(1100px 520px at 75% -12%, rgba(90, 130, 255, .12), transparent 70%), var(--bg);
}
:root[data-theme="dark"] body.panel .side { border-color: var(--line); }
:root[data-theme="dark"] body.panel .overlay { background: rgba(4, 7, 16, .6); }
:root[data-theme="dark"] body.panel :focus-visible { outline-color: rgba(127, 181, 255, .6); }
/* New server wizard: a dark halo behind the question instead of a light one, dark pills */
:root[data-theme="dark"] body.panel .create-glow { background: radial-gradient(closest-side, rgba(16, 23, 43, .8), rgba(16, 23, 43, .45) 55%, rgba(16, 23, 43, 0)); }
:root[data-theme="dark"] body.panel :is(.wiz-note, .wiz-form .wiz-note) { background: var(--frost); }
/* The terminal-style islands sit a step darker than the cards around them */
:root[data-theme="dark"] body.panel :is(.con-out, .code, .pc-detail) { background: #0b1121; box-shadow: inset 0 0 0 1px var(--line); }
:root[data-theme="dark"] body.panel .meter { background: rgba(var(--tint), .1); }

/* ---------- Home, login and waitlist ---------- */
:root[data-theme="dark"] body.home {
  --bg: #10172b;
  --card: #18213b; --card-2: #1e2846;
  --glass: rgba(24, 33, 59, .9);
  --fg: #e6eaf3; --ink-2: #aab3c9;
  --line: #2a3556;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
  --sh-2: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 60px -18px rgba(0, 0, 0, .65);
  color-scheme: dark;
}
:root[data-theme="dark"] body.home .wl-light { --text: #e6eaf3; --text-2: #b3bcd1; --muted: #8590ab; --line: #2a3556; --line-2: #35426a; --accent-2: #6fb0f0; }
:root[data-theme="dark"] body.home .try { border-color: var(--line); }
/* A dark halo behind the hero text over the night world, instead of a light one */
:root[data-theme="dark"] body.home .hero-glow { background: radial-gradient(closest-side, rgba(16, 23, 43, .82), rgba(16, 23, 43, .5) 55%, rgba(16, 23, 43, 0)); }
:root[data-theme="dark"] .friendly :is(.auth-card .card, .wl-card .card, .reserve-card) {
  border-color: var(--line); box-shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 30px 60px -24px rgba(0, 0, 0, .7);
}
