/* ============================================================
   THE LIGHT SYSTEM — Cellular Wellness Technology
   ============================================================ */

:root {
  --bg-deep: #06060e;
  --bg-surface: #0d0d1a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text-primary: #e8e6f0;
  --text-secondary: rgba(232, 230, 240, 0.55);
  --text-muted: rgba(232, 230, 240, 0.3);
  --accent: #b8a0e8;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Cormorant Garamond', serif; font-weight: 300; }
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; }
input[type="range"] { cursor: pointer; }

/* ---- SCREENS ---- */
.screen {
  position: fixed; inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.screen.active { opacity: 1; pointer-events: all; }

/* ---- SITE NAV TABS ---- */
.site-nav {
  display: flex;
  gap: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 calc(-1 * clamp(16px, 4vw, 48px));
  padding: 0 clamp(16px, 4vw, 48px);
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.site-nav a:hover {
  color: var(--text-primary);
}
.site-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.site-nav a svg {
  opacity: 0.7;
}
.site-nav a.active svg,
.site-nav a:hover svg {
  opacity: 1;
}

/* ============================================================
   SELECTION SCREEN
   ============================================================ */
#selection-screen {
  overflow-y: auto;
  padding: 0 clamp(16px, 4vw, 48px) 40px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
#selection-screen::-webkit-scrollbar { width: 6px; }
#selection-screen::-webkit-scrollbar-track { background: transparent; }
#selection-screen::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.sel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 24px;
}
.sel-header-inner { display: flex; flex-direction: column; gap: 2px; }
.logo-title {
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #c9b8f0, #8ecae6, #c9b8f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-subtitle {
  font-size: 13px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.sel-intro {
  max-width: 720px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 20px;
}

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.filter-tag {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  background: transparent;
  transition: var(--transition);
}
.filter-tag:hover { border-color: rgba(255,255,255,0.15); color: var(--text-primary); }
.filter-tag.active {
  background: rgba(184, 160, 232, 0.12);
  border-color: rgba(184, 160, 232, 0.3);
  color: var(--accent);
}

/* ---- PROGRAM GRID ---- */
.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.program-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.program-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.program-card.hidden { display: none; }

.card-glow {
  height: 100px;
  position: relative;
  overflow: hidden;
}
.card-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--bg-card));
}

.card-body { padding: 16px 18px 18px; }
.card-body h3 {
  font-size: 20px;
  margin-bottom: 4px;
  font-weight: 400;
}
.card-body .card-desc {
  font-size: 14px;
  color: #d0cede;
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card-tag {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(215,215,220,0.82);
  color: #111;
  letter-spacing: 0.03em;
}

.card-freq {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 3px 10px;
  border-radius: 10px;
  -webkit-font-smoothing: antialiased;
}

/* ---- FOOTER ---- */
.sel-footer {
  text-align: center;
  padding: 24px 0 16px;
  border-top: 1px solid var(--border-subtle);
}
.sel-footer p {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---- ICON BUTTON ---- */
.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: var(--transition);
}
.icon-btn:hover { border-color: rgba(255,255,255,0.2); color: var(--text-primary); }

/* ============================================================
   SESSION SCREEN
   ============================================================ */
#session-screen { background: #000; }

#main-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- SCROLLING TEXT OVERLAY ---- */
.scroll-text-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 6;
  pointer-events: none;
  display: none;
}
.scroll-text-overlay.active { display: block; }
.scroll-text-track {
  position: absolute;
  left: 0;
  width: 100%;
  will-change: transform;
}
.scroll-text-line {
  width: 100%;
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.4;
  box-sizing: border-box;
}

/* ---- AFFIRMATION OVERLAY ---- */
.affirmation-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  padding: 20%;
}
.affirmation-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(18px, 3.5vw, 36px);
  font-weight: 300;
  font-style: italic;
  text-align: center;
  color: rgba(255, 255, 255, 0);
  line-height: 1.5;
  text-shadow: 0 0 40px currentColor;
  transition: color 3s ease, opacity 3s ease;
  letter-spacing: 0.03em;
}
.affirmation-text.visible {
  color: rgba(255, 255, 255, 0.55);
}

/* ---- SESSION CONTROLS ---- */
.session-controls {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 60%, transparent);
  backdrop-filter: blur(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.session-controls.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* ---- GUIDED OVERLAY ---- */
.guided-overlay {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 88%;
  max-width: 680px;
  background: rgba(4, 6, 18, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(192, 200, 224, 0.1);
  border-radius: 16px;
  padding: 24px 30px 18px;
  z-index: 10;
  display: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.guided-overlay.active { display: block; }
.guided-overlay.visible { opacity: 1; }
.guided-step-indicator {
  text-align: center;
  margin-bottom: 10px;
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(192, 200, 224, 0.4);
}
.guided-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(15px, 2.2vw, 19px);
  font-weight: 300;
  line-height: 1.75;
  color: rgba(192, 200, 224, 0.85);
  text-align: center;
  min-height: 80px;
  transition: opacity 0.8s ease;
}
.guided-text.fading { opacity: 0; }
.guided-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}
.guided-nav-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(192, 200, 224, 0.15);
  color: rgba(192, 200, 224, 0.4);
  background: none;
  cursor: pointer;
  transition: var(--transition);
}
.guided-nav-btn:hover { border-color: rgba(192, 200, 224, 0.35); color: rgba(192, 200, 224, 0.8); }
.guided-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.guided-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(192, 200, 224, 0.15);
  transition: background 0.4s ease, transform 0.4s ease;
}
.guided-dot.active {
  background: rgba(192, 200, 224, 0.6);
  transform: scale(1.3);
}

.ctrl-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  transition: var(--transition);
  flex-shrink: 0;
}
.ctrl-btn:hover { border-color: rgba(255,255,255,0.3); color: #fff; }
.ctrl-btn.active { border-color: rgba(184, 160, 232, 0.4); color: var(--accent); }

.ctrl-program-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 100px;
}
.ctrl-name {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ctrl-timer {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.ctrl-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.4);
  margin-left: auto;
}

/* ---- RANGE SLIDER ---- */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid rgba(0,0,0,0.3);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid rgba(0,0,0,0.3);
  cursor: pointer;
}

/* ============================================================
   INFO MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  position: relative;
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 36px 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.modal h2 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--accent);
}
.modal p, .modal li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 8px;
}
.modal ul { padding-left: 20px; margin-bottom: 16px; }
.modal li { margin-bottom: 6px; }
.modal strong { color: var(--text-primary); font-weight: 500; }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-pillars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 24px;
}
.pillar {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
}
.pillar h3 {
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.pillar p { font-size: 12px; margin-bottom: 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .program-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card-glow { height: 70px; }
  .card-body { padding: 10px 12px 14px; }
  .card-body h3 { font-size: 16px; }
  .modal-pillars { grid-template-columns: 1fr; }
  .ctrl-volume { display: none; }
  .filter-bar { gap: 5px; }
  .filter-tag { font-size: 11px; padding: 4px 10px; }
}

@media (max-width: 400px) {
  .program-grid { grid-template-columns: 1fr; }
}
