/* ==========================================================================
   STILLPOINT — DESIGN TOKENS & VISUAL SYSTEM
   ========================================================================== */

:root {
  /* Surface & Background */
  --sanctuary-bg: #FBF9F5;
  --sanctuary-surface: #EFECE6;
  --sanctuary-surface-hover: #E4E0D7;
  --sanctuary-card-bg: rgba(239, 236, 230, 0.85);
  --sanctuary-glass-bg: rgba(251, 249, 245, 0.82);

  /* Typography & Foreground */
  --text-main: #2C3038;
  --text-secondary: #5A606D;
  --text-muted: #7A808C;
  --border-subtle: rgba(44, 48, 56, 0.09);
  --border-focus: rgba(124, 139, 122, 0.5);

  /* Semantic Accents */
  --accent-sage: #7C8B7A;
  --accent-clay: #B87D65;
  --accent-amber: #D9A76A;
  --accent-slate: #687282;

  /* Typography Stacks */
  --font-serif: "Newsreader", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Elevation Shadows */
  --shadow-ambient: 0 12px 32px -8px rgba(44, 48, 56, 0.05);
  --shadow-card: 0 16px 40px -12px rgba(44, 48, 56, 0.08);

  /* Motion Curves */
  --ease-breath: cubic-bezier(0.37, 0, 0.63, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Warm Embers Theme (Night / Low Blue Light Mode) */
body[data-theme="embers"] {
  --sanctuary-bg: #1A1C20;
  --sanctuary-surface: #24272E;
  --sanctuary-surface-hover: #2E323A;
  --sanctuary-card-bg: rgba(36, 39, 46, 0.85);
  --sanctuary-glass-bg: rgba(26, 28, 32, 0.85);
  --text-main: #EDEAE4;
  --text-secondary: #B0B5C0;
  --text-muted: #808694;
  --border-subtle: rgba(237, 234, 228, 0.1);
  --border-focus: rgba(217, 167, 106, 0.5);
  --shadow-ambient: 0 12px 32px -8px rgba(0, 0, 0, 0.4);
}

/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--sanctuary-bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
  transition: background-color 0.8s ease, color 0.8s ease;
}

/* Ambient Subtle Daylight Gradient */
.ambient-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.8), transparent 70%),
              radial-gradient(circle at 80% 85%, rgba(239, 236, 230, 0.6), transparent 50%);
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.8s ease;
}

body[data-theme="embers"] .ambient-backdrop {
  background: radial-gradient(circle at 50% 10%, rgba(217, 167, 106, 0.08), transparent 65%),
              radial-gradient(circle at 80% 90%, rgba(184, 125, 101, 0.06), transparent 50%);
}

/* Header */
.sanctuary-header {
  padding: 1.75rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-link {
  background: none;
  border: none;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text-main);
  letter-spacing: -0.02em;
  cursor: pointer;
}

.quick-nav {
  display: flex;
  gap: 1.25rem;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.nav-btn:hover {
  color: var(--text-main);
}

/* Layout & Router Views */
#appContainer {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

.view-section {
  display: none;
  opacity: 0;
  width: 100%;
  padding: 2.5rem 1.5rem;
  transition: opacity 0.6s var(--ease-smooth);
}

.view-section.active {
  display: block;
  opacity: 1;
}

.content-wrapper {
  max-width: 760px;
  margin: 0 auto;
}

.content-wrapper.centered {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Typography Hierarchy */
.display-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 300;
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 300;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.body-lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 580px;
  margin-bottom: 2rem;
}

.body-muted {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.quote-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--text-main);
  line-height: 1.5;
  margin: 1rem 0;
  max-width: 600px;
}

/* Buttons */
.action-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-sans);
  font-size: 0.975rem;
  padding: 0.85rem 1.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.25s var(--ease-smooth);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--sanctuary-surface);
  color: var(--text-main);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-ambient);
}

.btn-primary:hover {
  background: var(--sanctuary-surface-hover);
  border-color: rgba(44, 48, 56, 0.2);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  color: var(--text-main);
  background: var(--sanctuary-surface);
}

.btn-subtle {
  background: transparent;
  color: var(--text-muted);
}

.btn-subtle:hover {
  color: var(--text-main);
}

/* Breath Visualizer */
.breath-visualizer-container {
  width: 240px;
  height: 240px;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.breath-orb {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 139, 122, 0.35) 0%, rgba(239, 236, 230, 0.1) 70%);
  border: 1px solid rgba(124, 139, 122, 0.4);
  box-shadow: 0 0 45px rgba(124, 139, 122, 0.15);
  transition: transform 4s var(--ease-breath), background 4s ease, border-color 4s ease;
  will-change: transform;
}

.breath-orb.inhale {
  transform: scale(2.2);
  background: radial-gradient(circle, rgba(184, 125, 101, 0.35) 0%, rgba(239, 236, 230, 0.1) 70%);
  border-color: rgba(184, 125, 101, 0.5);
}

.breath-orb.hold {
  transform: scale(2.2);
}

.breath-orb.exhale {
  transform: scale(1.0);
  background: radial-gradient(circle, rgba(124, 139, 122, 0.35) 0%, rgba(239, 236, 230, 0.1) 70%);
  border-color: rgba(124, 139, 122, 0.4);
}

.breath-phase-text {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  min-height: 2.25rem;
  font-weight: 300;
}

.breath-phase-subtext {
  font-size: 1rem;
  color: var(--text-secondary);
  min-height: 3rem;
  max-width: 480px;
  margin-top: 0.5rem;
}

.breath-progress-dots {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-subtle);
  transition: background 0.3s ease;
}

.dot.active {
  background: var(--accent-sage);
}

/* Card Grid (Somatic Settling) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
  text-align: left;
}

.interactive-card {
  background: var(--sanctuary-card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}

.interactive-card:hover, .interactive-card:focus-visible {
  border-color: var(--accent-sage);
  transform: translateY(-2px);
  outline: none;
}

.card-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.interactive-card h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.interactive-card p {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Wayfinding Intent Matrix */
.intent-matrix {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 620px;
  margin: 2rem auto 0;
}

.intent-pill {
  background: var(--sanctuary-card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s var(--ease-smooth);
}

.intent-pill:hover, .intent-pill:focus-visible {
  background: var(--sanctuary-surface-hover);
  border-color: rgba(44, 48, 56, 0.2);
  transform: translateX(4px);
  outline: none;
}

.intent-icon {
  font-size: 1.2rem;
  color: var(--accent-sage);
}

/* Canvas Container Rooms */
.room-canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.room-overlay {
  position: relative;
  z-index: 1;
}

/* Ephemeral Canvas (The Window) */
.ephemeral-input-container {
  width: 100%;
  max-width: 580px;
  margin-top: 1.5rem;
}

.ephemeral-textarea {
  width: 100%;
  background: var(--sanctuary-card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.25rem;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.6;
  resize: vertical;
  backdrop-filter: blur(8px);
  transition: opacity 1.8s var(--ease-smooth), filter 1.8s var(--ease-smooth), border-color 0.3s ease;
}

.ephemeral-textarea:focus {
  border-color: var(--border-focus);
  outline: none;
}

.ephemeral-textarea.dissolving {
  opacity: 0;
  filter: blur(12px);
  pointer-events: none;
}

.feedback-msg {
  font-size: 0.9rem;
  color: var(--accent-sage);
  min-height: 1.5rem;
  margin-top: 0.75rem;
}

/* Grounding Step Box */
.grounding-step-box {
  background: var(--sanctuary-card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 500px;
  margin-top: 1.5rem;
}

.step-counter {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-clay);
  margin-bottom: 0.75rem;
}

.step-heading {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 300;
  margin-bottom: 0.75rem;
}

.step-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Hearth Warmth Slider & Glow */
.hearth-glow-container {
  width: 180px;
  height: 180px;
  margin: 2rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hearth-ember {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-amber) 0%, rgba(184, 125, 101, 0.2) 70%);
  filter: blur(12px);
  transition: all 0.5s ease;
}

.custom-slider {
  width: 100%;
  max-width: 320px;
  accent-color: var(--accent-clay);
  margin-top: 0.75rem;
}

/* Return Steps */
.return-steps-card {
  background: var(--sanctuary-card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  text-align: left;
  max-width: 520px;
  margin-top: 1.5rem;
}

.return-list {
  padding-left: 1.2rem;
  line-height: 1.9;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Global Bottom HUD */
.sanctuary-hud {
  padding: 1.25rem 2.5rem;
  background: var(--sanctuary-glass-bg);
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.hud-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.hud-status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.hud-status-indicator.active {
  background: var(--accent-sage);
}

.hud-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Support Dialog */
.crisis-dialog {
  margin: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: var(--sanctuary-bg);
  color: var(--text-main);
  padding: 2.25rem;
  max-width: 480px;
  box-shadow: var(--shadow-card);
}

.crisis-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

.resource-block {
  margin-top: 1.25rem;
  background: var(--sanctuary-surface);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.resource-block ul {
  padding-left: 1.2rem;
  margin-top: 0.5rem;
}

/* Reduced Motion Fallbacks */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
  .breath-orb {
    transform: none !important;
  }
}
/* Smooth color transition for ambient background */
.ambient-backdrop {
  transition: background 1.2s ease, opacity 0.8s ease;
}

/* Room 1: The Quiet Room (Cool Slate / Mist) */
body[data-active-room="room-quiet"] .ambient-backdrop {
  background: radial-gradient(circle at 50% 20%, rgba(225, 235, 245, 0.9), transparent 70%),
              radial-gradient(circle at 80% 80%, rgba(104, 114, 130, 0.25), transparent 50%);
}

/* Room 2: The Grounding Room (Warm Earth / Terracotta) */
body[data-active-room="room-grounding"] .ambient-backdrop {
  background: radial-gradient(circle at 50% 20%, rgba(252, 242, 234, 0.9), transparent 70%),
              radial-gradient(circle at 80% 80%, rgba(184, 125, 101, 0.22), transparent 50%);
}

/* Room 3: The Window (Dusty Rose / Dawn Horizon) */
body[data-active-room="room-window"] .ambient-backdrop {
  background: radial-gradient(circle at 50% 20%, rgba(252, 242, 246, 0.9), transparent 70%),
              radial-gradient(circle at 80% 80%, rgba(166, 124, 133, 0.22), transparent 50%);
}

/* Room 4: The Garden (Muted Herbal Sage) */
body[data-active-room="room-garden"] .ambient-backdrop {
  background: radial-gradient(circle at 50% 20%, rgba(238, 248, 238, 0.9), transparent 70%),
              radial-gradient(circle at 80% 80%, rgba(124, 139, 122, 0.22), transparent 50%);
}

/* Room 5: The Hearth (Glowing Amber) */
body[data-active-room="room-hearth"] .ambient-backdrop {
  background: radial-gradient(circle at 50% 20%, rgba(254, 244, 230, 0.95), transparent 70%),
              radial-gradient(circle at 80% 80%, rgba(217, 167, 106, 0.28), transparent 50%);
}
