/* ============================================================================
   Coherence Circle — Cosmic Bee Theme
   ----------------------------------------------------------------------------
   Single source of truth for design tokens + shared components.
   Palette: dark purple / black / gold, with a purple accent.
   Referenced by: index.html, views/*.html
   See handoff/ARCHITECTURE.md for how the shell + views fit together.
   ========================================================================== */

:root {
  /* Core palette */
  --gold:        #d4af37;   /* primary gold */
  --bright-gold: #ffe58a;   /* highlight gold (text, glow) */
  --purple:      #9b6dff;   /* accent purple */
  --royal:       #220033;   /* mid purple */
  --deep:        #13001f;   /* deep background purple */
  --black:       #08000d;   /* near-black */

  /* Derived surfaces / lines */
  --line:   rgba(212, 175, 55, 0.34);   /* gold hairline */
  --line-2: rgba(155, 109, 255, 0.36);  /* purple hairline */
  --panel:  rgba(18, 0, 28, 0.90);      /* card / panel fill */
  --panel-2:rgba(10, 0, 18, 0.62);      /* translucent bar fill */

  /* Text */
  --text:  #fff8da;   /* warm ivory body text */
  --muted: #c8bfe0;   /* muted lavender */

  /* Type */
  --font:  'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;

  /* Motion / shape */
  --radius: 16px;
  --radius-lg: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Shared app background (cosmic gradient) */
  --bg:
    radial-gradient(900px 520px at 50% -8%, rgba(155, 109, 255, 0.22), transparent 60%),
    linear-gradient(135deg, var(--deep), var(--royal) 52%, var(--black));
}

/* --- Reset-ish base ------------------------------------------------------- */
* { box-sizing: border-box; }
button { font: inherit; cursor: pointer; border: 0; }
input, textarea, select { font: inherit; }
.hidden { display: none !important; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  color: #1a001f;
  background: linear-gradient(180deg, #fff0a9, var(--gold));
  transition: filter 140ms var(--ease), transform 140ms var(--ease);
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }

.btn.ghost {
  color: var(--text);
  background: rgba(155, 109, 255, 0.14);
  border: 1px solid var(--line-2);
}
.btn.gold-outline {
  color: var(--bright-gold);
  background: rgba(212, 175, 55, 0.10);
  border: 1px solid var(--line);
}

/* --- Cards / panels ------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

/* --- Progress bar (used by POD grid + map milestones) --------------------- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--bright-gold));
  transition: width 300ms var(--ease);
}

/* --- Utility text --------------------------------------------------------- */
.serif { font-family: var(--serif); }
.gold  { color: var(--bright-gold); }
.muted { color: var(--muted); }

/* ============================================================================
   Cosmic starscape
   ----------------------------------------------------------------------------
   Shared across every page that links this file. The feel: entering the aether,
   becoming the universe. Deep purple/black base (via --bg on each page's body),
   a drifting starfield (body::before), and a slow golden nebula glow
   (body::after). Both layers sit behind content (z-index:-1) and never capture
   clicks. Respects prefers-reduced-motion.
   ========================================================================== */
body::before {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: -1;
  pointer-events: none;
  /* Layered stars: small white + gold points, plus a few brighter ones. */
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, #ffffff, transparent 60%),
    radial-gradient(1.2px 1.2px at 78% 14%, rgba(255,229,138,.95), transparent 60%),
    radial-gradient(1px 1px   at 33% 61%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1.6px 1.6px at 61% 44%, #fff, transparent 60%),
    radial-gradient(1px 1px   at 89% 71%, rgba(201,168,255,.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 8% 83%, rgba(255,229,138,.9), transparent 60%),
    radial-gradient(1px 1px   at 47% 9%,  rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.3px 1.3px at 70% 88%, #fff, transparent 60%),
    radial-gradient(1px 1px   at 24% 37%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.1px 1.1px at 95% 33%, rgba(255,229,138,.85), transparent 60%);
  background-repeat: repeat;
  background-size: 320px 320px, 420px 420px, 300px 300px, 500px 500px, 360px 360px,
                   380px 380px, 340px 340px, 460px 460px, 280px 280px, 440px 440px;
  animation: cc-drift 180s linear infinite;
  opacity: .9;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* Aether: soft purple + gold nebulae that breathe. */
  background:
    radial-gradient(60% 45% at 50% -10%, rgba(155,109,255,.20), transparent 70%),
    radial-gradient(45% 40% at 12% 78%, rgba(212,175,55,.10), transparent 70%),
    radial-gradient(50% 45% at 88% 30%, rgba(155,109,255,.12), transparent 70%);
  animation: cc-breathe 26s ease-in-out infinite;
}
@keyframes cc-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-320px, -180px, 0); }
}
@keyframes cc-breathe {
  0%, 100% { opacity: .8; }
  50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}

/* --- Lucide icon defaults ------------------------------------------------- */
/* Lucide renders inline <svg>; keep them sized to the surrounding text. */
[data-lucide], .lucide, svg.lucide {
  width: 1.05em;
  height: 1.05em;
  stroke-width: 2;
  vertical-align: -0.14em;
  flex: none;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* --- Shared modal --------------------------------------------------------- */
.cc-modal {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: flex-start; justify-content: center; padding: 20px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(4,0,10,.62); backdrop-filter: blur(4px);
}
.cc-modal.show { display: flex; }
/* margin:auto centers the card when it fits, and stays scroll-reachable (top and
   bottom) when it is taller than the viewport, because the overlay itself scrolls. */
.cc-modal .card { width: 100%; max-width: 440px; padding: 24px; margin: auto; }
.cc-modal h2 { font-family: var(--serif); color: var(--bright-gold); margin: 0 0 4px; }
.cc-modal p.hint { color: var(--muted); font-size: .84rem; margin: 0 0 14px; line-height: 1.45; }
.cc-modal label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bright-gold); margin: 12px 0 5px; }
.cc-modal input, .cc-modal textarea {
  width: 100%; background: rgba(4,0,10,.6); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); padding: 10px 12px; outline: none;
}
.cc-modal textarea { resize: vertical; min-height: 80px; }
.cc-modal .row { display: flex; gap: 10px; margin-top: 18px; }
.cc-modal .row .btn { flex: 1; }

/* --- Shared toast --------------------------------------------------------- */
.cc-toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px);
  opacity: 0; background: var(--panel); border: 1px solid var(--line); color: var(--bright-gold);
  padding: 10px 16px; border-radius: 999px; z-index: 320; transition: all .2s var(--ease); pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}
.cc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
