/* =====================================================================
   MAIN STYLESHEET — emotional sanctuary base + components.
   ===================================================================== */

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

:root {
  --maxw: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-solid);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* the big soft gradient layer that sits behind everything */
.atmosphere-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  background: var(--bg-grad);
  background-size: 200% 200%;
  animation: gradient-flow 28s ease infinite;
  transition: background 1.4s var(--ease);
}
/* soft floating colour blobs for depth */
.atmosphere-bg::before,
.atmosphere-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: drift 26s ease-in-out infinite;
}
.atmosphere-bg::before {
  width: 46vw; height: 46vw;
  top: -10vw; left: -8vw;
  background: var(--accent-soft);
}
.atmosphere-bg::after {
  width: 40vw; height: 40vw;
  bottom: -12vw; right: -6vw;
  background: var(--accent-2);
  opacity: 0.18;
  animation-duration: 34s;
  animation-direction: reverse;
}

#atmosphere {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

/* ---------- Typography --------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
}
.display { font-family: var(--font-display); }
.serif   { font-family: var(--font-display); font-style: italic; }
.lead    { font-size: clamp(1.05rem, 2.2vw, 1.4rem); color: var(--text-muted); }
.muted   { color: var(--text-muted); }
.faint   { color: var(--text-faint); }
.center  { text-align: center; }

/* ---------- Layout helpers ----------------------------------------- */
.wrap   { width: min(100% - 2.6rem, var(--maxw)); margin-inline: auto; }
.wrap-n { width: min(100% - 2rem, 980px); margin-inline: auto; }
section { padding: clamp(4rem, 9vw, 8rem) 0; position: relative; }
.spacer-sm { height: 1.4rem; }
.spacer    { height: 3rem; }
.grid      { display: grid; gap: 1.6rem; }
.flex      { display: flex; gap: 1rem; }
.between   { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.center-row{ display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* ---------- Eyebrow / kicker --------------------------------------- */
.kicker {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.82rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
  padding: 0.5rem 1.1rem; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--card-border);
}
.kicker::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); animation: breathe 4s ease-in-out infinite;
}

/* ===================================================================
   THEME SELECTOR SCREEN (the emotional gateway)
   =================================================================== */
.theme-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.4rem, 4vw, 3rem);
  overflow-y: auto;
  animation: fade-in 1s ease;
}
.theme-gate.hide {
  opacity: 0;
  transform: scale(1.04);
  filter: blur(14px);
  pointer-events: none;
  transition: opacity 1.3s var(--ease), transform 1.3s var(--ease), filter 1.3s var(--ease);
}
.gate-head { text-align: center; max-width: 760px; margin-bottom: clamp(2rem, 5vw, 3.4rem); }
.gate-head h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  margin: 1rem 0 0.6rem;
}
.gate-head p { color: var(--text-muted); font-size: clamp(1rem, 2vw, 1.2rem); }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.4rem;
  width: min(100%, 1040px);
}

/* each card always shows ITS OWN palette regardless of active theme */
.theme-card {
  --tc-radius: 28px;
  position: relative;
  border-radius: var(--tc-radius);
  padding: 2rem 1.6rem 1.6rem;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  background: #111;
  isolation: isolate;
  transition: transform 0.7s var(--ease), box-shadow 0.7s ease;
  animation: bloom-in 1s var(--ease) backwards;
}
.theme-card:nth-child(1) { animation-delay: 0.15s; }
.theme-card:nth-child(2) { animation-delay: 0.30s; }
.theme-card:nth-child(3) { animation-delay: 0.45s; }
.theme-card:nth-child(4) { animation-delay: 0.60s; }

.theme-card:hover {
  transform: translateY(-10px) scale(1.015);
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.7);
}
.theme-card .tc-orb {
  position: absolute;
  top: -30%; right: -20%;
  width: 180px; height: 180px;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0.85;
  transition: transform 1s var(--ease);
}
.theme-card:hover .tc-orb { transform: scale(1.25) rotate(20deg); }
.theme-card .tc-swatches {
  display: flex; gap: 6px; margin-bottom: 0.8rem;
}
.theme-card .tc-swatches span {
  width: 18px; height: 18px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3);
}
.theme-card h3 { font-size: 1.7rem; margin-bottom: 0.2rem; }
.theme-card .tc-mood { font-size: 0.86rem; opacity: 0.85; }
.theme-card .tc-enter {
  margin-top: 1.1rem;
  font-size: 0.82rem; letter-spacing: 0.16em; text-transform: uppercase;
  opacity: 0.9;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.theme-card .tc-enter span { transition: transform 0.5s var(--ease); }
.theme-card:hover .tc-enter span { transform: translateX(6px); }

/* ---- Card palettes (fixed preview colours) ---- */
.tc-back-to-life {
  background: linear-gradient(150deg, #2F4F4F, #36454F 55%, #563C5C);
}
.tc-back-to-life .tc-orb { background: #FC89AC; }
.tc-back-to-birth {
  background: linear-gradient(150deg, #01796F, #00A550 55%, #563C5C);
  color: #FFFFF0;
}
.tc-back-to-birth .tc-orb { background: #B56917; }
.tc-child-inside {
  background: linear-gradient(135deg, #FB607F, #ED9121 40%, #FDEE00 70%, #50C878);
}
.tc-child-inside .tc-orb { background: #DA70D6; }
.tc-break {
  background: linear-gradient(150deg, #F8F8FF, #F4F0EC 55%, #E5E4E2);
  color: #5b5f6e;
}
.tc-break .tc-orb { background: #91A3B0; opacity: 0.6; }

.gate-foot { margin-top: 2.4rem; color: var(--text-faint); font-size: 0.9rem; }
.gate-foot button {
  background: none; border: none; color: var(--accent);
  font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px;
}

/* ===================================================================
   NAVBAR
   =================================================================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  padding: 1rem 0;
  transition: background 0.6s ease, backdrop-filter 0.6s ease, padding 0.6s ease;
}
.nav.scrolled {
  background: var(--card-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--card-border);
  padding: 0.6rem 0;
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  text-decoration: none; color: var(--text);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--accent-2));
  box-shadow: 0 0 20px -2px var(--accent-glow);
  animation: breathe 5s ease-in-out infinite;
}
.nav-links { display: flex; align-items: center; gap: 0.4rem; }
.nav-links a {
  color: var(--text-muted); text-decoration: none; font-size: 0.95rem;
  padding: 0.5rem 0.9rem; border-radius: 999px;
  transition: color 0.4s ease, background 0.4s ease;
}
.nav-links a:hover { color: var(--text); background: var(--accent-soft); }

/* ===================================================================
   BUTTONS
   =================================================================== */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  font-family: var(--font-body); font-weight: 600; font-size: 1rem;
  padding: 0.95rem 2rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  background: var(--btn-bg); color: var(--btn-fg);
  text-decoration: none;
  transition: transform 0.5s var(--ease), box-shadow 0.5s ease, filter 0.4s ease;
  box-shadow: 0 14px 30px -16px var(--accent-glow);
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 0 34px -4px var(--accent-glow); filter: brightness(1.06); }
.btn:active { transform: translateY(-1px) scale(0.99); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost {
  background: var(--card-bg); color: var(--text);
  border-color: var(--card-border); backdrop-filter: blur(var(--blur));
  box-shadow: none;
}
.btn-ghost:hover { background: var(--card-bg-2); box-shadow: 0 0 30px -8px var(--accent-glow); }
.btn-lg { padding: 1.15rem 2.6rem; font-size: 1.08rem; }
.btn-sm { padding: 0.55rem 1.2rem; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===================================================================
   HERO
   =================================================================== */
.hero {
  min-height: 100vh;
  display: flex; align-items: center;
  padding: 8rem 0 5rem;
  position: relative;
}
.hero h1 {
  font-size: var(--hero-title-size);
  margin: 1.2rem 0;
  max-width: 16ch;
}
.hero h1 .accent { color: var(--accent); }
.hero p.lead { max-width: 56ch; margin-bottom: 2.2rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-scroll {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  color: var(--text-faint); font-size: 0.8rem; letter-spacing: 0.2em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.hero-scroll::after {
  content: ''; width: 1px; height: 40px;
  background: linear-gradient(var(--accent), transparent);
  animation: float-soft 2.4s ease-in-out infinite;
}

/* ===================================================================
   SECTION HEADERS
   =================================================================== */
.section-head { text-align: center; max-width: 720px; margin: 0 auto clamp(2.5rem, 5vw, 4rem); }
.section-head h2 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 1rem 0 0.8rem; }
.section-head p { color: var(--text-muted); font-size: 1.1rem; }

/* ===================================================================
   CARDS / FEATURES
   =================================================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--card-shadow);
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.6rem;
}
.feature {
  padding: 2.2rem 1.9rem;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(var(--blur));
  transition: transform 0.6s var(--ease), box-shadow 0.6s ease, background 0.5s ease;
}
.feature:hover { transform: translateY(-8px); box-shadow: 0 0 40px -10px var(--accent-glow); background: var(--card-bg-2); }
.feature .ico {
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center; margin-bottom: 1.2rem;
  background: var(--accent-soft); color: var(--accent);
  font-size: 1.6rem;
  box-shadow: inset 0 0 0 1px var(--card-border);
}
.feature h3 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.feature p { color: var(--text-muted); font-size: 0.98rem; }

/* ===================================================================
   THEME SHOWCASE STRIP
   =================================================================== */
.mood-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 1.2rem; }
.mood-card {
  border-radius: var(--radius);
  padding: 2rem 1.5rem; min-height: 220px;
  display: flex; flex-direction: column; justify-content: flex-end;
  color: #fff; position: relative; overflow: hidden;
  cursor: pointer; border: 1px solid rgba(255,255,255,0.12);
  transition: transform 0.6s var(--ease), box-shadow 0.6s ease;
}
.mood-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 26px 60px -28px rgba(0,0,0,0.6); }
.mood-card h4 { font-size: 1.5rem; }
.mood-card small { opacity: 0.85; }

/* ===================================================================
   STEPS (how it works)
   =================================================================== */
.steps { counter-reset: step; display: grid; gap: 1.4rem; }
.step {
  display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: start;
  padding: 1.8rem; border-radius: var(--radius);
  background: var(--card-bg); border: 1px solid var(--card-border);
  backdrop-filter: blur(var(--blur));
}
.step .num {
  counter-increment: step;
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--card-border);
}
.step .num::before { content: counter(step, decimal-leading-zero); }
.step h3 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.step p { color: var(--text-muted); }

/* ===================================================================
   FORMS / INPUTS
   =================================================================== */
.field { margin-bottom: 1.2rem; }
.field label {
  display: block; font-size: 0.86rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 0.5rem; letter-spacing: 0.02em;
}
.input, .select, textarea.input {
  width: 100%; padding: 1rem 1.2rem;
  font-family: var(--font-body); font-size: 1rem; color: var(--text);
  background: var(--field-bg); border: 1px solid var(--field-border);
  border-radius: 18px; outline: none;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, background 0.4s ease;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-hint { font-size: 0.8rem; color: var(--text-faint); margin-top: 0.4rem; }

/* segmented control (JOIN / REQUEST) */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem;
  background: var(--field-bg); border: 1px solid var(--field-border);
  padding: 0.4rem; border-radius: 999px; margin-bottom: 1.8rem;
}
.seg button {
  border: none; background: transparent; cursor: pointer;
  padding: 0.8rem; border-radius: 999px; font: inherit; font-weight: 600;
  color: var(--text-muted);
  transition: all 0.5s var(--ease);
}
.seg button.active { background: var(--accent); color: #fff; box-shadow: 0 8px 22px -10px var(--accent-glow); }

/* ===================================================================
   TABS / PANELS
   =================================================================== */
.panel { display: none; animation: bloom-in 0.8s var(--ease); }
.panel.active { display: block; }

/* ===================================================================
   AUTH / JOIN CARD
   =================================================================== */
.auth-card { max-width: 520px; margin-inline: auto; }
.request-note {
  text-align: center; padding: 2rem;
}
.request-note .contact-line {
  display: inline-flex; align-items: center; gap: 0.6rem;
  margin: 0.4rem 0; font-size: 1.05rem;
}
.request-note a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--card-border); }

/* ===================================================================
   FOOTER
   =================================================================== */
.footer {
  padding: 3.5rem 0 2.5rem; margin-top: 2rem;
  border-top: 1px solid var(--card-border);
  background: var(--card-bg); backdrop-filter: blur(var(--blur));
}
.footer .grid { grid-template-columns: 1.5fr 1fr 1fr; }
.footer h4 { font-size: 1.1rem; margin-bottom: 1rem; }
.footer a { color: var(--text-muted); text-decoration: none; display: block; padding: 0.25rem 0; transition: color 0.3s; }
.footer a:hover { color: var(--accent); }
.footer-bottom { text-align: center; color: var(--text-faint); margin-top: 2.5rem; font-size: 0.86rem; }

/* ===================================================================
   TOASTS / MESSAGES
   =================================================================== */
.toast-stack {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200;
  display: flex; flex-direction: column; gap: 0.7rem; max-width: 360px;
}
.toast {
  padding: 1rem 1.2rem; border-radius: 16px;
  background: var(--card-bg-2); backdrop-filter: blur(20px);
  border: 1px solid var(--card-border); color: var(--text);
  box-shadow: var(--card-shadow);
  animation: bloom-in 0.6s var(--ease);
  display: flex; gap: 0.7rem; align-items: flex-start;
}
.toast.ok    { border-left: 3px solid var(--accent); }
.toast.err   { border-left: 3px solid #e57373; }
.toast.info  { border-left: 3px solid var(--accent-2); }
.toast .t-ico { font-size: 1.1rem; }
.toast.hide  { opacity: 0; transform: translateX(20px); transition: all 0.5s ease; }
.toast b { display: block; font-size: 0.92rem; }
.toast small { color: var(--text-muted); }

/* ===================================================================
   LOADING / SPINNER (gentle breathing orb)
   =================================================================== */
.loader-wrap { display: grid; place-items: center; padding: 3rem; }
.loader {
  width: 56px; height: 56px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--accent-2));
  animation: breathe 2s ease-in-out infinite;
  box-shadow: 0 0 30px -4px var(--accent-glow);
}

/* ===================================================================
   DASHBOARD LAYOUT
   =================================================================== */
.dash { padding-top: 7rem; padding-bottom: 4rem; min-height: 100vh; }
.dash-head { margin-bottom: 2.5rem; }
.dash-head h1 { font-size: clamp(2rem, 5vw, 3rem); }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.6rem; align-items: start; }

.classmates { display: grid; gap: 0.8rem; }
.mate {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; border-radius: 18px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  transition: transform 0.4s var(--ease), background 0.4s ease;
}
.mate:hover { transform: translateX(4px); background: var(--card-bg-2); }
.mate .avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-family: var(--font-display);
}
.mate .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #5fd66f; box-shadow: 0 0 10px #5fd66f;
  animation: breathe 3s ease-in-out infinite;
}
.mate .name { font-weight: 600; }
.mate .role { font-size: 0.8rem; color: var(--accent); }
.mate.offline { opacity: 0.5; }
.mate.offline .dot { background: var(--text-faint); box-shadow: none; }

.session-card {
  padding: 1.6rem; border-radius: var(--radius);
  background: var(--card-bg); border: 1px solid var(--card-border);
  margin-bottom: 1rem; transition: transform 0.5s var(--ease), box-shadow 0.5s ease;
}
.session-card:hover { transform: translateY(-4px); box-shadow: 0 0 32px -10px var(--accent-glow); }
.session-card h3 { font-size: 1.3rem; }
.session-card .meta { color: var(--text-muted); font-size: 0.9rem; margin: 0.4rem 0 1rem; }
.session-card.live { border-color: var(--accent); box-shadow: 0 0 24px -10px var(--accent-glow); }

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.3rem 0.8rem; border-radius: 999px;
}
.badge.live { background: var(--accent); color: #fff; }
.badge.soft { background: var(--accent-soft); color: var(--accent); }

.empty-state {
  text-align: center; padding: 3rem 1.5rem; color: var(--text-muted);
}
.empty-state .ico { font-size: 2.4rem; margin-bottom: 0.6rem; opacity: 0.7; }

/* ===================================================================
   MODAL / DIALOG
   =================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(10,10,20,0.4); backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-overlay.show { display: flex; animation: fade-in 0.5s ease; }
.modal {
  width: min(100%, 560px);
  background: var(--bg-solid);
  background-image: var(--bg-grad);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2.4rem;
  box-shadow: var(--card-shadow);
  animation: scale-in 0.7s var(--ease);
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.modal-close {
  float: right; background: none; border: none; cursor: pointer;
  font-size: 1.6rem; color: var(--text-muted); line-height: 1;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 880px) {
  .dash-grid { grid-template-columns: 1fr; }
  .footer .grid { grid-template-columns: 1fr; }
  .nav-links a { display: none; }
  .nav-links a.cta { display: inline-flex; }
}

/* hide the gate when the app shell takes over */
.app-shell { animation: fade-in 1.6s ease; }
