/* cosmic.css — Qumanity Cosmic Homepage & Mandala Portal (Phase A, 2026-11-03)
   =================================================================================
   Scope: templates/home.html ONLY (loaded nowhere else). Every selector below is either a new
   `.qm-cosmic-*` / `.qm-mandala-*` / `.qm-glass-*` / `.qm-section-*` class added fresh to
   home.html, or a `body.hm { --qm-token: ... }` SCOPED re-declaration of the shared tokens
   style.css/home.css/register.css/poems.css already read via var(--qm-...). Re-declaring a
   custom property inside `body.hm { }` only changes what var() resolves to for elements INSIDE
   body.hm -- every other page keeps style.css's own light-theme values untouched. This file never
   edits style.css/home.css/register.css/poems.css directly, so nothing here can leak into the
   Dashboard, Q-Map, QMail, Family Tree, or any other authenticated/public page.

   Design system: deep-space navy/obsidian ground, restrained gold+saffron light, ivory text.
   Luminous, not neon -- every glow token below is a soft, low-alpha radial/box-shadow, not a
   saturated neon color. */

/* ---------------------------------------------------------------------------------------------
   1. DESIGN TOKENS
   --------------------------------------------------------------------------------------------- */
:root {
  /* Mandatory cosmic tokens (exact values, per spec -- do not rename or replace) */
  --qm-bg-deep: #0a0a1a;
  --qm-bg-mid: #1a1a3a;
  --qm-accent-gold: #d4af37;
  --qm-accent-saffron: #ff9933;
  --qm-text-primary: #f5f5dc;
  --qm-text-muted: #a0a0b0;

  /* Complementary surface/border/highlight tokens (additive, not a replacement for the above) */
  --qm-surface-1: #12122a;
  --qm-surface-2: #1f1f42;
  --qm-cosmic-border: rgba(212, 175, 55, 0.28);
  --qm-cosmic-border-soft: rgba(212, 175, 55, 0.14);
  --qm-cosmic-highlight: rgba(245, 245, 220, 0.08);

  /* Spacing scale */
  --qm-space-1: 0.25rem;
  --qm-space-2: 0.5rem;
  --qm-space-3: 0.75rem;
  --qm-space-4: 1rem;
  --qm-space-6: 1.5rem;
  --qm-space-8: 2rem;
  --qm-space-12: 3rem;
  --qm-space-16: 4rem;
  --qm-space-24: 6rem;

  /* Radius scale */
  --qm-radius-sm: 0.5rem;
  --qm-radius-md: 0.875rem;
  --qm-radius-lg: 1.25rem;
  --qm-radius-xl: 1.75rem;
  --qm-radius-pill: 999px;
  --qm-radius-circle: 50%;

  /* Shadow / glow */
  --qm-shadow-deep: 0 20px 60px rgba(0, 0, 0, 0.45);
  --qm-shadow-gold: 0 0 30px rgba(212, 175, 55, 0.16);
  --qm-glow-gold: 0 0 18px rgba(212, 175, 55, 0.22);
  --qm-glow-saffron: 0 0 22px rgba(255, 153, 51, 0.16);

  /* Typography -- Fraunces (already loaded by home.html) stays the display face; body copy stays
     on the project's existing system-ui stack. No new font dependency introduced. */
  --qm-font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --qm-font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------------------------------------------------------------------------------------------
   2. SCOPED DARK-THEME TOKEN OVERRIDE (body.hm only)
   Re-points the shared tokens style.css/home.css/register.css already use throughout home.html's
   existing markup (panels, buttons, form fields, the stats/globe/founder/final sections, the
   footer) at cosmic-dark equivalents -- zero edits to those files, zero effect on any other page.
   --------------------------------------------------------------------------------------------- */
body.hm {
  --qm-bg: var(--qm-bg-deep);
  --qm-panel-bg: var(--qm-surface-1);
  --qm-text: var(--qm-text-primary);
  --qm-text-dim: var(--qm-text-muted);
  --qm-border: var(--qm-cosmic-border);
  --qm-input-bg: rgba(10, 10, 26, 0.55);
  --qm-input-border: var(--qm-cosmic-border);
  --qm-navy: var(--qm-bg-deep);
  --qm-gold-text: var(--qm-accent-gold);
  --qm-saffron: var(--qm-accent-saffron);
  --qm-gold: var(--qm-accent-gold);
  background:
    radial-gradient(900px 600px at 15% -5%, rgba(255, 153, 51, 0.10), transparent 60%),
    radial-gradient(1000px 700px at 85% 10%, rgba(212, 175, 55, 0.08), transparent 60%),
    linear-gradient(180deg, var(--qm-bg-deep) 0%, var(--qm-bg-mid) 45%, var(--qm-bg-deep) 100%);
  background-attachment: fixed;
}

/* Panels/cards throughout the existing page (stats panel, founder panel, scoreboard,
   sidebar lists, etc.) read var(--qm-panel-bg)/var(--qm-border) already -- they pick up
   the dark-glass treatment automatically. These two rules add the restrained luminous edge the
   brief asks for without touching home.css's own selectors. */
body.hm .hm-panel,
body.hm .hm-sb-details summary,
body.hm .dq-modal-box {
  box-shadow: var(--qm-shadow-deep);
  background-color: var(--qm-surface-1);
}

/* The old light-mode "dark freckle" star field (dark dots meant for a pale hero) is superseded by
   the Canvas particle field (cosmic.js) + the mandala/orbit geometry below -- hide it rather than
   recolor it, so there is exactly one star layer, not two fighting for attention. */
body.hm .hm-hero-stars { display: none; }

/* ---------------------------------------------------------------------------------------------
   3. CANVAS PARTICLE FIELD
   --------------------------------------------------------------------------------------------- */
.qm-cosmic-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}
/* Everything else in body.hm sits above the fixed canvas. main/header/footer already have their
   own backgrounds (the gradient above, or solid panel colors), so the canvas only truly shows
   through intentional gaps -- the hero's own transparent zones and the thin space between
   sections. */
body.hm > main,
body.hm > .hm-footer,
body.hm .dq-modal {
  position: relative;
  z-index: 1;
}
/* The nav must stay above <main> (Step 3, 2026-12-02): it used to share the rule above, which
   both cancelled home.css's sticky nav and painted <main> over the nav's drop-down menus (the
   phone burger menu and the About menu opened underneath the hero). */
body.hm > .hm-nav {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ---------------------------------------------------------------------------------------------
   4. GLASS PANELS
   --------------------------------------------------------------------------------------------- */
.qm-glass-panel {
  background: linear-gradient(165deg, rgba(31, 31, 66, 0.55), rgba(10, 10, 26, 0.65));
  border: 1px solid var(--qm-cosmic-border);
  border-radius: var(--qm-radius-xl);
  box-shadow: var(--qm-shadow-deep), inset 0 1px 0 rgba(245, 245, 220, 0.06);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
/* backdrop-filter fallback: a flat, still-dark, still-legible panel */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .qm-glass-panel { background: rgba(14, 14, 32, 0.94); }
}

/* ---------------------------------------------------------------------------------------------
   5. SECTION KICKER / HEADLINE TREATMENT FOR THE NEW JOURNEY SECTIONS
   --------------------------------------------------------------------------------------------- */
.qm-section-cosmic {
  position: relative;
  padding: var(--qm-space-24) 0;
  overflow: hidden;
}
.qm-section-cosmic + .qm-section-cosmic { padding-top: 0; }
.qm-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--qm-space-2);
  margin: 0 0 var(--qm-space-4);
  padding: 6px 14px;
  border-radius: var(--qm-radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--qm-accent-gold);
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--qm-cosmic-border-soft);
}
.qm-section-cosmic h2 {
  margin: 0 0 var(--qm-space-4);
  font-family: var(--qm-font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--qm-text-primary);
}
.qm-section-copy {
  max-width: 620px;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--qm-text-muted);
}
.qm-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--qm-space-16);
}
.qm-section-grid.qm-reverse { direction: rtl; }
.qm-section-grid.qm-reverse > * { direction: ltr; }
.qm-section-visual { position: relative; display: grid; place-items: center; }
.qm-section-visual svg { width: 100%; max-width: 440px; height: auto; }

/* Orbital ring decoration reused across the journey sections */
.qm-orbit-ring { fill: none; stroke: var(--qm-accent-gold); stroke-opacity: 0.28; stroke-width: 1; }
.qm-orbit-ring.is-saffron { stroke: var(--qm-accent-saffron); stroke-opacity: 0.22; }
.qm-orbit-dot { fill: var(--qm-accent-gold); }
.qm-orbit-node { fill: var(--qm-text-primary); fill-opacity: 0.7; }
.qm-orbit-line { stroke: var(--qm-accent-gold); stroke-opacity: 0.35; stroke-width: 1; }

.qm-cosmic-spin { transform-origin: center; animation: qm-spin 120s linear infinite; }
.qm-cosmic-spin.is-reverse { animation-direction: reverse; animation-duration: 90s; }
.qm-cosmic-pulse { animation: qm-pulse-soft 4.5s ease-in-out infinite; }
@keyframes qm-spin { to { transform: rotate(360deg); } }
@keyframes qm-pulse-soft { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ---------------------------------------------------------------------------------------------
   6. SCROLL-REVEAL (progressive enhancement; see cosmic.js — content is in normal flow and fully
   visible without JS or with prefers-reduced-motion, this only adds a gentle fade/rise-in)
   --------------------------------------------------------------------------------------------- */
.qm-reveal-el { opacity: 0; transform: translateY(28px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.16, 0.8, 0.3, 1); }
.qm-reveal-el.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .qm-reveal-el { opacity: 1; transform: none; transition: none; }
  .qm-cosmic-spin, .qm-cosmic-pulse { animation: none; }
}

/* ---------------------------------------------------------------------------------------------
   7. HERO: identity (left) + Mandala Portal (right)
   --------------------------------------------------------------------------------------------- */
/* 2026-12-02 (homepage redesign Step 2): a compact headline band across the top, then the live
   map card (left) beside the sign-in card (right). Replaces the old copy-left / portal-right grid
   (.qm-cosmic-hero-grid, .qm-cosmic-hero-copy, .hm-hero-wordmark, .qm-hero-logo-lockup -- all
   removed with their markup). home.css's own .hm-hero-inner is 760px/centered; this scoped
   override (0,2,0 beats 0,1,0) widens it to the page's normal 1200px wrap. */
body.hm .hm-hero { padding-top: var(--qm-space-8); }
body.hm .hm-hero-inner { max-width: 1200px; text-align: left; padding-bottom: var(--qm-space-12); }

.hm-hero-band {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--qm-space-4) var(--qm-space-8);
  margin-bottom: var(--qm-space-6);
}
.hm-hero-band .hm-chip { margin-bottom: var(--qm-space-3); }
body.hm .hm-hero-band h1 { margin: 0 0 var(--qm-space-2); font-size: clamp(2rem, 3.7vw, 3.1rem); line-height: 1.08; }
body.hm .hm-hero-lead { margin: 0; max-width: 60ch; font-size: 1.05rem; line-height: 1.55; color: var(--qm-text-muted); }
.hm-hero-ctas { margin: 0; flex-wrap: wrap; justify-content: flex-end; }
/* Centres the label inside the large pill buttons (qm-btn-lg alone leaves it sitting high). */
.hm-hero-ctas .qm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

.hm-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  align-items: stretch;
  gap: var(--qm-space-6);
}

/* ---- The live map card ---- */
.hm-map-card {
  display: flex;
  flex-direction: column;
  gap: var(--qm-space-3);
  min-width: 0;
  padding: var(--qm-space-4) var(--qm-space-6);
  border-radius: 20px;
  border: 1px solid var(--qm-cosmic-border);
  background: linear-gradient(165deg, rgba(31, 31, 66, 0.62), rgba(10, 10, 26, 0.72));
  box-shadow: var(--qm-shadow-deep);
}
.hm-map-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--qm-space-2) var(--qm-space-4); }
.hm-map-title { margin: 0; display: inline-flex; align-items: center; gap: var(--qm-space-3); font-family: var(--hm-display); font-weight: 600; font-size: 1.3rem; color: var(--qm-text-primary); }
.hm-live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--qm-cosmic-border); font-family: Inter, system-ui, sans-serif; font-size: 0.75rem; font-weight: 600; color: var(--qm-text-muted); }
.hm-scope { display: inline-flex; align-items: center; gap: var(--qm-space-2); font-size: 0.9rem; color: var(--qm-text-muted); }
.hm-scope select {
  min-height: 40px;
  padding: 6px 34px 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--qm-accent-gold);
  background: rgba(10, 10, 26, 0.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23d4af37' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px;
  color: var(--qm-text-primary);
  font: 600 0.95rem Inter, system-ui, sans-serif;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.hm-scope select option { background: #14173a; color: var(--qm-text-primary); }
.hm-scope select:focus-visible { outline: 3px solid rgba(255, 153, 51, 0.5); outline-offset: 2px; }

.hm-map { position: relative; height: 300px; border-radius: 14px; overflow: hidden; }
body.hm .hm-map.leaflet-container { background: radial-gradient(ellipse at 50% 40%, #151a40 0%, #0b0d22 75%); font-family: Inter, system-ui, sans-serif; }
.hm-map[aria-busy="true"] { opacity: 0.75; transition: opacity 0.2s; }
.hm-map-tip { background: #14173a; color: var(--qm-text-primary); border: 1px solid var(--qm-cosmic-border); border-radius: 8px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); font-size: 0.85rem; line-height: 1.4; }
.hm-map-tip b { color: var(--qm-accent-gold); }
.hm-map-tip::before { display: none; }

.hm-map-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.82rem; color: var(--qm-text-muted); }
.hm-map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.hm-map-legend i { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.35); }
.hm-map-legend span { color: var(--qm-text-primary); font-weight: 600; }

.hm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--qm-space-2); }
.hm-tile { padding: 10px 14px; border-radius: 12px; background: rgba(10, 10, 26, 0.6); border: 1px solid var(--qm-cosmic-border-soft); min-width: 0; }
.hm-tile b { display: block; font-family: var(--hm-display); font-weight: 700; font-size: 1.55rem; line-height: 1.15; color: var(--qm-accent-gold); white-space: nowrap; }
.hm-tile span { display: block; font-size: 0.8rem; color: var(--qm-text-muted); }
.hm-tile-main b { color: var(--qm-accent-saffron); }
.hm-tile b.is-loading { opacity: 0.35; }
.hm-tile-error { grid-column: 1 / -1; margin: 0; font-size: 0.9rem; color: var(--qm-text-muted); }

.hm-map-foot { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--qm-space-4); font-size: 0.8rem; color: var(--qm-text-muted); }
.hm-map-foot a { color: var(--qm-accent-gold); font-weight: 600; text-decoration: none; white-space: nowrap; }
.hm-map-foot a:hover { text-decoration: underline; }
.hm-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- The sign-in card beside it (same mandala panel, now stretched to the map card's height) ---- */
.qm-mandala-portal-wrap { position: relative; display: flex; min-width: 0; }
.hm-hero-grid .qm-mandala-panel { width: 100%; display: flex; }
.hm-hero-grid .hm-signin-panel { display: flex; flex-direction: column; width: 100%; }
.hm-signin-trust { margin: auto 0 0; padding-top: var(--qm-space-4); border-top: 1px solid var(--qm-cosmic-border-soft); flex-direction: column; align-items: flex-start; gap: 6px; }
body.hm .hm-signin-panel .hm-signin-actions { margin-bottom: var(--qm-space-4); }

/* ---- The hero's former lead paragraph, now opening the Journey ---- */
.hm-intro { padding: var(--qm-space-12) 0 0; }
.hm-intro-line { max-width: 760px; margin: 0 auto; text-align: center; font-size: 1.15rem; line-height: 1.7; color: var(--qm-text-primary); }

/* ---------------------------------------------------------------------------------------------
   8. MANDALA GEOMETRY + GLASS LOGIN PANEL
   --------------------------------------------------------------------------------------------- */
.qm-mandala-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 0;
}
.qm-mandala-rings svg { width: 128%; max-width: 620px; height: auto; }

.qm-mandala-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: var(--qm-space-8) var(--qm-space-8);
  text-align: left;
}
.qm-mandala-badge {
  display: flex;
  justify-content: center;
  margin-bottom: var(--qm-space-4);
}
.qm-mandala-badge img { width: 56px; height: 56px; filter: drop-shadow(var(--qm-glow-gold)); }
.hm-signin-title.qm-mandala-title {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: var(--qm-space-6);
  color: var(--qm-text-primary);
}
.qm-mandala-panel .qm-field span { color: var(--qm-text-muted); letter-spacing: 0.04em; }
.qm-mandala-panel .qm-field input {
  background: rgba(10, 10, 26, 0.55);
  border-color: var(--qm-cosmic-border);
  color: var(--qm-text-primary);
}
.qm-mandala-panel .qm-field input::placeholder { color: rgba(245, 245, 220, 0.35); }
.qm-mandala-panel .qm-field input:focus {
  border-color: var(--qm-accent-saffron);
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.18);
}
.qm-mandala-panel .qm-btn-primary {
  background: linear-gradient(90deg, var(--qm-accent-saffron), var(--qm-accent-gold));
  box-shadow: var(--qm-glow-gold);
}
.qm-mandala-panel .qm-btn-ghost {
  background: rgba(245, 245, 220, 0.05);
  border-color: var(--qm-cosmic-border);
  color: var(--qm-text-primary);
}
.qm-mandala-panel .qm-btn-ghost:hover { background: rgba(212, 175, 55, 0.12); }
.qm-mandala-panel .hm-signin-forgot-btn { color: var(--qm-text-muted); }
.qm-mandala-panel .hm-signin-forgot-btn:hover { color: var(--qm-accent-gold); }
.qm-mandala-panel .hm-signin-forgot-links a { color: var(--qm-accent-gold); }
.qm-mandala-panel .qm-summary-error { color: #ff8a80; }

/* ---------------------------------------------------------------------------------------------
   9. "WAYS TO CONTRIBUTE" HERO STRIP + MARQUEE (poems) — restrained cosmic touch-up only
   --------------------------------------------------------------------------------------------- */
body.hm .hm-marquee {
  background: rgba(10, 10, 26, 0.5);
  border-top-color: var(--qm-cosmic-border-soft);
}
body.hm .hm-marquee span {
  background: rgba(31, 31, 66, 0.5);
  border-color: var(--qm-cosmic-border-soft);
  color: var(--qm-text-muted);
}

/* ---------------------------------------------------------------------------------------------
   10. RESPONSIVE
   --------------------------------------------------------------------------------------------- */
@media (max-width: 980px) {
  /* Stacks in the phone order: headline, map, then sign-in. */
  .hm-hero-band { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hm-hero-ctas { justify-content: flex-start; }
  .hm-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .qm-mandala-portal-wrap { justify-content: center; }
  .hm-hero-grid .qm-mandala-panel { max-width: 460px; }
  .hm-map { height: 280px; }
  .qm-section-grid { grid-template-columns: 1fr; gap: var(--qm-space-8); text-align: center; }
  .qm-section-grid.qm-reverse { direction: ltr; }
  .qm-section-visual { order: -1; }
  .qm-section-copy { max-width: none; margin: 0 auto; }
  .qm-section-copy .hm-cta-row { justify-content: center; }
}
@media (max-width: 620px) {
  .qm-section-cosmic { padding: var(--qm-space-16) 0; }
  body.hm .hm-hero { padding-top: var(--qm-space-6); }
  .hm-hero-band { margin-bottom: var(--qm-space-6); }
  .hm-map-card { padding: var(--qm-space-3) var(--qm-space-4); border-radius: 16px; }
  .hm-map { height: 240px; }
  .hm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-tile b { font-size: 1.3rem; }
  .hm-tile-main { grid-column: 1 / -1; }
  .qm-mandala-rings svg { width: 100%; max-width: 340px; }
  .qm-mandala-panel { padding: var(--qm-space-6); }
  .qm-section-visual svg { max-width: 260px; }
}

/* ---------------------------------------------------------------------------------------------
   11. REDUCED MOTION (page-wide, for anything new in this file not already covered above)
   --------------------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .qm-cosmic-canvas { opacity: 0.6; }
}

/* =================================================================================================
   PHASE A COMPLETION (2026-11-03) — extends the same design system to About, Dashboard, Register.
   Same technique as the homepage section above: a scoped `{ --qm-token: ... }` re-declaration on
   each page's own body class, so style.css/about.css/dashboard.css/register.css's existing
   `var(--qm-...)` usage repaints dark automatically, with zero edits to those three files beyond
   the handful of genuinely hardcoded (non-token) colors patched individually below. None of this
   section can affect Q-Map, QMail, or any other page, because none of them load this stylesheet.
   ================================================================================================= */

/* ---------------------------------------------------------------------------------------------
   12. SHARED SCOPED DARK-THEME TOKEN OVERRIDE (About / Dashboard / Register / Login)
   --------------------------------------------------------------------------------------------- */
body.qm-about,
body.qm-cosmic-dashboard,
body.qm-cosmic-register,
body.qm-cosmic-login {
  --qm-bg: var(--qm-bg-deep);
  --qm-panel-bg: var(--qm-surface-1);
  --qm-text: var(--qm-text-primary);
  --qm-text-dim: var(--qm-text-muted);
  --qm-border: var(--qm-cosmic-border);
  --qm-input-bg: rgba(10, 10, 26, 0.55);
  --qm-input-border: var(--qm-cosmic-border);
  --qm-navy: var(--qm-bg-deep);
  --qm-gold-text: var(--qm-accent-gold);
  --qm-saffron: var(--qm-accent-saffron);
  --qm-gold: var(--qm-accent-gold);
  background:
    radial-gradient(900px 600px at 15% -5%, rgba(255, 153, 51, 0.08), transparent 60%),
    radial-gradient(1000px 700px at 85% 10%, rgba(212, 175, 55, 0.06), transparent 60%),
    linear-gradient(180deg, var(--qm-bg-deep) 0%, var(--qm-bg-mid) 45%, var(--qm-bg-deep) 100%);
  background-attachment: fixed;
  color: var(--qm-text-primary);
  /* 2026-11-09: style.css's global `html, body { height: 100% }` caps body's painted box at the
     viewport height; on any page taller than one screen (every cosmic page, registration most
     visibly), the overflow below that point falls through to <html>'s own background
     (var(--qm-bg), the original light cream) instead of this gradient -- the reported "white
     background at the bottom". `min-height: 100vh` with `height: auto` lets body grow to its
     real content height again so this gradient actually covers all of it; verified live
     (body.offsetHeight went from one viewport's worth to the full scrollHeight, confirmed by
     scrolling to the bottom and screenshotting -- no cream area left). html's own background is
     intentionally left untouched: with body now full-height, it is never visible regardless of
     its color, so this is the one targeted fix, not a second one layered on top. */
  height: auto;
  min-height: 100vh;
}

/* ---------------------------------------------------------------------------------------------
   12b. DASHBOARD / LOGIN HEADER — dark universe (Admin request, 2026-11-29): the dedicated
   --qm-header-* tokens above were introduced to keep .qm-header light sitewide (see style.css's
   own "lightened sitewide" comment) -- this scopes them back to dark, but ONLY for the Dashboard
   and the Login page, so About, Register and every other page keep the light header exactly as
   it is today.
   --------------------------------------------------------------------------------------------- */
body.qm-cosmic-dashboard,
body.qm-cosmic-login {
  --qm-header-bg: var(--qm-bg-deep);
  --qm-header-border: var(--qm-cosmic-border);
  --qm-header-text: var(--qm-text-primary);
  --qm-header-text-dim: var(--qm-text-muted);
  --qm-header-input-bg: rgba(10, 10, 26, 0.55);
  --qm-header-hover-bg: rgba(212, 175, 55, 0.12);
  --qm-header-gold-text: var(--qm-accent-gold);
}

body.qm-about .ab-card,
body.qm-about .ab-stats > div,
body.qm-cosmic-dashboard .qm-dash-card,
body.qm-cosmic-dashboard .dq-modal-box,
body.qm-cosmic-dashboard .bd,
body.qm-cosmic-register .qm-panel {
  box-shadow: var(--qm-shadow-deep);
}

/* ---------------------------------------------------------------------------------------------
   13. DASHBOARD — the handful of genuinely hardcoded (non-token) colors in dashboard.css, all in
   the `.bd-*` board/chat-feed component (templates/dashboard.html's `.bd` container -- the main
   Board feed, Family Tree chat panel, and Personal/group chats all reuse this one component).
   --------------------------------------------------------------------------------------------- */
body.qm-cosmic-dashboard .bd-feed,
body.qm-cosmic-dashboard .bd-foot { background: rgba(10, 10, 26, 0.35); }
body.qm-cosmic-dashboard .bd-empty-prompt {
  background: rgba(212, 175, 55, 0.06);
  border-color: var(--qm-cosmic-border);
  color: var(--qm-text-muted);
}
body.qm-cosmic-dashboard .bd-post,
body.qm-cosmic-dashboard .bd-msg {
  background: var(--qm-surface-2);
  border-color: var(--qm-cosmic-border-soft);
  color: var(--qm-text-primary);
}
body.qm-cosmic-dashboard .bd-post.is-mine,
body.qm-cosmic-dashboard .bd-msg.is-mine {
  background: rgba(255, 153, 51, 0.16);
  border-color: rgba(255, 153, 51, 0.3);
}
body.qm-cosmic-dashboard .bd-toggle {
  background: rgba(212, 175, 55, 0.14);
  color: var(--qm-accent-gold);
  border-color: var(--qm-accent-saffron);
}
body.qm-cosmic-dashboard .bd-toggle:hover { background: var(--qm-accent-saffron); color: var(--qm-bg-deep); }
/* .bd-sec (the sticky "OPEN FOR LIVE VOTING"/category header inside a board feed) was a near-
   solid cream band (rgba(250,247,241,0.95)) -- not caught by the hex-only sweep above since it's
   written as rgba(), found instead during live browser verification. */
body.qm-cosmic-dashboard .bd-sec { background: rgba(10, 10, 26, 0.92); border-color: var(--qm-cosmic-border-soft); }
body.qm-about .ab-toc { background: rgba(10, 10, 26, 0.92); }

/* The dash-tab bar (.qm-dash-tabs) already ships dark (#2A3441, gold active underline) --
   left as-is; this just adds the same restrained luminous edge every other cosmic surface has. */
body.qm-cosmic-dashboard .qm-dash-tabs { box-shadow: var(--qm-shadow-deep); border: 1px solid var(--qm-cosmic-border-soft); }
body.qm-cosmic-dashboard .qm-dash-tab.is-active { text-shadow: 0 0 12px rgba(255, 215, 0, 0.35); }

/* Family Tree: .ft-unit-rect/.ft-single-rect/.ft-card text etc. already read var(--qm-panel-bg)/
   var(--qm-text)/var(--qm-border) (dashboard.css) -- they repaint dark automatically. This adds
   only the restrained glow the brief asks for on the viewer's own node. */
body.qm-cosmic-dashboard .ft-single-rect.is-viewer,
body.qm-cosmic-dashboard .ft-unit-rect.is-self { filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.45)); }
body.qm-cosmic-dashboard .ft-svg-wrap { background: rgba(10, 10, 26, 0.25); border-radius: var(--qm-radius-lg); }

/* ---------------------------------------------------------------------------------------------
   14. REGISTRATION — the handful of genuinely hardcoded "white card" colors in register.css
   (.qm-dropdown-row, .qm-private-col, the Global/Private screen's own field backgrounds and
   section-header text colors, all pre-dating this theme and written for a light page).
   --------------------------------------------------------------------------------------------- */
body.qm-cosmic-register .qm-dropdown-row,
body.qm-cosmic-register .qm-private-col,
body.qm-cosmic-register #screen-global .qm-dropdown-field select,
body.qm-cosmic-register #screen-private .qm-field input,
body.qm-cosmic-register #screen-private .qm-field select {
  background: var(--qm-input-bg);
  border-color: var(--qm-cosmic-border);
  color: var(--qm-text-primary);
}
body.qm-cosmic-register #screen-global .qm-panel-subhead,
body.qm-cosmic-register #screen-private .qm-form-section-title,
body.qm-cosmic-register #screen-private .qm-field > span {
  color: var(--qm-text-primary);
}
body.qm-cosmic-register #screen-private .qm-field input::placeholder,
body.qm-cosmic-register .qm-pin-hint { color: var(--qm-text-muted); }
body.qm-cosmic-register .qm-step-index { border-color: var(--qm-cosmic-border); color: var(--qm-text-muted); }
body.qm-cosmic-register .qm-step.is-active .qm-step-index {
  border-color: var(--qm-accent-gold); background: var(--qm-accent-gold); color: var(--qm-bg-deep);
  box-shadow: var(--qm-glow-gold);
}
body.qm-cosmic-register .qm-steps { background: rgba(10, 10, 26, 0.4); border-bottom: 1px solid var(--qm-cosmic-border-soft); }
/* "Can't find my Tehsil/Village?" confirmation message -- register.css's own #6a5200 (dark
   brown, written for a light page) is nearly unreadable against this theme's dark background;
   confirmed live (rendered at rgb(106, 82, 0) over a transparent/dark ancestor). Everything else
   in this panel (the search input, the match list, the note) already inherits readable cosmic
   colors with no override needed -- checked live, not assumed -- so this is the one line that
   needs it. */
body.qm-cosmic-register .qm-provisional-confirm-msg { color: var(--qm-accent-gold); }

/* ---------------------------------------------------------------------------------------------
   16. FALLBACK: unstyled form controls. A real, non-hypothetical gap found during browser
   verification -- dozens of inputs/selects/textareas across the Dashboard (election-history
   dropdowns, the Family Tree wizard's many name fields, board/announcement/report text areas,
   the Qmail username field, etc.) and a few in Register's family/spouse fields carry NO class at
   all, so they render with the plain browser-default white background and black text. That was
   barely noticeable against the old warm-paper light page; against the dark page it's a glaring
   white rectangle. Rather than hunt down and individually class ~70 scattered fields across
   dashboard.html/register.html (far riskier -- touching that many lines of a functional,
   untouched-on-purpose template), one low-specificity, element-type fallback themes anything
   that isn't already styled by a more specific rule. Every already-styled input/select/textarea
   in this codebase is reached through at least one class selector (`.qm-field input`, `#screen-
   private .qm-field select`, etc.), which is equal-or-higher specificity and always wins
   regardless of this rule's position in the cascade -- confirmed by inspecting every such rule in
   dashboard.css/register.css before adding this. */
body.qm-cosmic-dashboard input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
body.qm-cosmic-dashboard select,
body.qm-cosmic-dashboard textarea,
body.qm-cosmic-register input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
body.qm-cosmic-register select,
body.qm-cosmic-register textarea {
  background: var(--qm-input-bg);
  border: 1px solid var(--qm-input-border);
  border-radius: var(--qm-radius-sm);
  color: var(--qm-text-primary);
  font-family: inherit;
  padding: 8px 10px;
}
body.qm-cosmic-dashboard input::placeholder,
body.qm-cosmic-dashboard textarea::placeholder,
body.qm-cosmic-register input::placeholder,
body.qm-cosmic-register textarea::placeholder { color: var(--qm-text-muted); opacity: 1; }
body.qm-cosmic-dashboard select option,
body.qm-cosmic-register select option { color: #0a0a1a; }

/* ---------------------------------------------------------------------------------------------
   17. RESPONSIVE spot-fixes for the three newly-themed pages (desktop/tablet already inherit
   correctly from each page's own existing breakpoints; these only correct contrast/overflow
   details specific to the dark re-theme).
   --------------------------------------------------------------------------------------------- */
@media (max-width: 620px) {
  body.qm-cosmic-register .qm-steps { overflow-x: auto; }
}

/* Section 18 (religion-aware identity symbol: Shivalinga/Cross/Crescent/Dharma Wheel next to the
   hero chip) was removed 2026-11-08 -- owner legal decision, Gita Press denied permission for the
   Hindi Vinaya Patrika translation and the owner chose to discontinue the entire Poems Marquee
   and every public religion-based identity symbol along with it, not just that one collection.
   See docs/HANDOVER.md / docs/MASTER_STATUS.md for the current-state record. No replacement
   symbol was added -- the existing Qumanity brand mark (logo + wordmark) is the only identity
   element in the hero now.*/
