/* ============================================================================
 * chazon · elements · v27.css
 * Loaded AFTER elements.css + elements-v26.css. Pure additive.
 *
 *   1 · Voice-call countdown ring (player-anchored)
 *   2 · Cost-awareness modal
 *   3 · ProgressRail visited-state enrichment (no separate nav!)
 *   4 · Mobile Phase Pill (replaces the rail under 920px)
 *   5 · Breathing transitions between sections
 *   6 · Reduced-motion fallback
 *
 *   v27a's WhereAmI strip was redundant with the existing rail. Removed
 *   entirely. This file enriches the rail instead of competing with it.
 * ============================================================================ */

/* ============================================================================
 * 1 · VOICE-CALL COUNTDOWN
 * ============================================================================ */

.vc-countdown {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 280ms ease, transform 280ms ease;
  z-index: 6;
}
.vc-countdown.vc-countdown-visible { opacity: 1; transform: scale(1); }
.vc-countdown-ring { width: 100%; height: 100%; display: block; }
.vc-countdown-arc  { transition: stroke-dashoffset 240ms ease-out; }

.vc-countdown-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-gold, #e6b800);
  letter-spacing: -0.02em;
  text-shadow: 0 0 8px rgba(230, 184, 0, 0.4);
}

.vc-countdown-warn .vc-countdown-text { color: #ff8a3d; text-shadow: 0 0 10px rgba(255, 138, 61, 0.6); animation: vcCountdownPulse 0.6s ease-in-out infinite; }
.vc-countdown-warn .vc-countdown-arc  { stroke: #ff8a3d; }

@keyframes vcCountdownPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.08); }
}

/* ============================================================================
 * 2 · COST-AWARENESS MODAL
 * ============================================================================ */

.vc-cost-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}
.vc-cost-modal.vc-cost-show { opacity: 1; pointer-events: auto; }

.vc-cost-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 15, 0.78);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
}

.vc-cost-card {
  position: relative;
  max-width: 420px;
  width: 92vw;
  padding: 2.2rem 1.8rem 1.4rem;
  background: linear-gradient(180deg, rgba(20, 18, 30, 0.96) 0%, rgba(15, 13, 24, 0.96) 100%);
  border: 1px solid rgba(230, 184, 0, 0.22);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 32px rgba(230, 184, 0, 0.08) inset, 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  text-align: center;
  transform: translateY(12px) scale(0.96);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Manrope', system-ui, sans-serif;
}
.vc-cost-modal.vc-cost-show .vc-cost-card { transform: translateY(0) scale(1); }

.vc-cost-sigil  { font-family: 'Cormorant Garamond', serif; font-size: 2.6rem; color: var(--accent-gold, #e6b800); margin-bottom: 0.4rem; text-shadow: 0 0 24px rgba(230, 184, 0, 0.4); }
.vc-cost-title  { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 1.5rem; color: var(--text-bright, #f8f4e8); margin-bottom: 0.9rem; letter-spacing: 0.005em; }
.vc-cost-body   { font-size: 0.96rem; color: var(--text-muted, #c8c0b0); line-height: 1.55; margin-bottom: 1.6rem; }
.vc-cost-actions { display: flex; gap: 0.6rem; justify-content: center; margin-bottom: 1.2rem; }

.vc-cost-btn {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.62rem 1.1rem;
  border-radius: 10px;
  border: 1px solid;
  cursor: pointer;
  transition: transform 180ms ease, background 220ms ease, border-color 220ms ease, color 220ms ease;
  -webkit-tap-highlight-color: transparent;
}
.vc-cost-btn:hover { transform: translateY(-1px); }
.vc-cost-btn:active { transform: translateY(0); }
.vc-cost-primary   { background: linear-gradient(180deg, rgba(230, 184, 0, 0.95), rgba(192, 144, 0, 0.95)); border-color: rgba(230, 184, 0, 0.7); color: #1a1408; }
.vc-cost-primary:hover { background: linear-gradient(180deg, rgba(244, 198, 12, 1), rgba(208, 158, 6, 1)); }
.vc-cost-secondary { background: transparent; border-color: rgba(200, 192, 176, 0.22); color: var(--text-muted, #c8c0b0); }
.vc-cost-secondary:hover { border-color: rgba(200, 192, 176, 0.5); color: var(--text-bright, #f8f4e8); }
.vc-cost-fineprint { font-size: 0.78rem; color: rgba(200, 192, 176, 0.55); line-height: 1.5; padding-top: 0.9rem; border-top: 1px solid rgba(200, 192, 176, 0.08); }

/* ============================================================================
 * 3 · PROGRESS RAIL · VISITED STATE
 *
 *   The rail already has hue, hover-tooltip, active glow, bookmark spinner,
 *   audio-pulse. We add ONE state — visited — for tiefenpsychologisches
 *   "you've been here". Visited dots get a soft inner ring + slight bright-
 *   boost on the base hue. Subtle, present.
 *
 *   Don't add new colors — use the dot's own --dot-hue so it stays harmonic
 *   with the rainbow.
 * ============================================================================ */

#progress-rail .prog-dot.visited {
  /* Same color as base, but slightly brighter and a faint inner ring */
  background: hsl(var(--dot-hue), 85%, 68%);
  box-shadow:
    0 0 0 1px hsla(var(--dot-hue), 95%, 80%, 0.55),
    0 0 0 3px hsla(var(--dot-hue), 80%, 65%, 0.12),
    0 0 10px hsla(var(--dot-hue), 95%, 65%, 0.7);
}

/* Active dot keeps its dominance (existing rail CSS); visited just slightly
 * brightens. The active rule already wins via specificity (1 class +
 * existing `.active` selector). */

/* ============================================================================
 * 4 · MOBILE PHASE PILL
 *
 *   Only appears on screens ≤ 920 px (where the rail is hidden). One small
 *   surface bottom-left: roman numeral + section name + search icon hint.
 *   Tap → opens CommandPalette. Reuses the rainbow hue of the active
 *   section so it color-shifts as the user moves through.
 * ============================================================================ */

.phase-pill {
  --pill-hue: 45;
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 88;
  display: none;                     /* hidden by default — only mobile shows */
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  max-width: calc(100vw - 28px);
  background: rgba(15, 13, 24, 0.72);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid hsla(var(--pill-hue), 70%, 60%, 0.32);
  border-radius: 22px;
  font-family: 'Manrope', system-ui, sans-serif;
  color: var(--text-bright, #f8f4e8);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 320ms ease, transform 320ms ease, border-color 360ms ease, box-shadow 360ms ease;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    0 0 18px hsla(var(--pill-hue), 80%, 60%, 0.08);
  -webkit-tap-highlight-color: transparent;
}
.phase-pill.phase-pill-visible {
  opacity: 1;
  transform: translateY(0);
}
.phase-pill:active { transform: translateY(0) scale(0.98); }

.phase-pill-num {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: hsl(var(--pill-hue), 80%, 72%);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  text-shadow: 0 0 12px hsla(var(--pill-hue), 90%, 60%, 0.35);
}

.phase-pill-name {
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
  color: var(--text-bright, #f8f4e8);
}

.phase-pill-icon {
  margin-left: 4px;
  font-size: 0.95rem;
  color: rgba(200, 192, 176, 0.55);
  flex-shrink: 0;
}

@media (max-width: 920px) {
  .phase-pill { display: inline-flex; }
}

/* On very narrow phones, drop the name to just the number so the pill
 * doesn't dominate. Tap-to-CommandPalette still gives the full nav. */
@media (max-width: 400px) {
  .phase-pill-name { max-width: 38vw; font-size: 0.8rem; }
}

/* ============================================================================
 * 5 · BREATHING TRANSITIONS
 *
 *   Each section's top edge carries a soft warm-gold aura, slightly stronger
 *   when the section first becomes active (SectionLife marks .s-active).
 *   The animation runs once per activation — never on idle.
 *
 *   This is the "threshold between rooms" — episodic-memory encoding cue.
 * ============================================================================ */

body.breathing-on section[id] {
  position: relative;
}
/* Static baseline aura at the top of every section */
body.breathing-on section[id]::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 64px;
  background: linear-gradient(180deg,
              rgba(230, 184, 0, 0.045) 0%,
              transparent 100%);
  pointer-events: none;
  z-index: 0;
  /* DO NOT trigger animation here — only on .s-active */
}

/* Inhale animation triggers when SectionLife marks active */
body.breathing-on section[id].s-active::before {
  animation: breathInhale 1100ms ease-out 1;
}
@keyframes breathInhale {
  0%   { background: linear-gradient(180deg, rgba(230,184,0,0.18) 0%, rgba(230,184,0,0.04) 100%); }
  100% { background: linear-gradient(180deg, rgba(230,184,0,0.045) 0%, transparent          100%); }
}

/* Sections that have their own complex top-stacks (videos, canvases) skip
 * the aura entirely so it doesn't fight their backgrounds */
body.breathing-on section#phone::before,
body.breathing-on section#body::before,
body.breathing-on section#earth-explorer::before,
body.breathing-on section#quantum::before {
  display: none;
}

/* ============================================================================
 * 6 · REDUCED-MOTION FALLBACK
 * ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  .vc-countdown-warn .vc-countdown-text { animation: none !important; }
  body.breathing-on section[id]::before { animation: none !important; }
  .vc-cost-modal,
  .vc-cost-card { transition-duration: 100ms !important; }
}
