/* ============================================================
   Mind Journey Lab — hub-specific polish layer.
   Loads after ../shared/app-shell.css so it can extend/override.
   Reuses the shared design tokens (--bg, --bg-card, --accent,
   --font-heading, --radius-lg, etc.) defined in index.html's own
   <style> block — no new palette, no new font.
   ============================================================ */

/* ---------- Wave showcase (home hero carousel) ----------
   Purely decorative, auto-advancing, non-interactive. Sits above the
   catalog list. Full-bleed within the app-shell's own padding, using
   the same negative-margin technique as the shell's screen padding. */
.wave-showcase {
  position: relative;
  width: calc(100% + 40px);
  margin: 8px -20px 6px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 20px 44px -20px rgba(0, 0, 0, 0.65);
}

.wave-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.wave-slide.is-active { opacity: 1; }

/* Same gradient-overlay technique already used by .category-hero and
   .bonus-card .thumb — a bottom-anchored dark fade for text legibility.
   Kept as a single always-on layer (not per-slide) so it never
   double-stacks while two background images are cross-fading. */
.wave-slide-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 38%, rgba(0, 0, 0, 0.86) 100%);
  pointer-events: none;
}

/* A single shared text layer (not one per slide) — its label swaps with a
   quick fade in place, so the outgoing and incoming captions never overlap
   the way the underlying background images intentionally do. */
.wave-slide-content {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 52px;
  z-index: 2;
  transition: opacity 0.25s ease;
}
.wave-slide-content.is-swapping { opacity: 0; }

.wave-slide-hz {
  display: block;
  font-family: var(--font-heading);
  font-size: 3.1rem;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
}

.wave-slide-title {
  display: block;
  margin-top: 8px;
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-2);
}

/* Positions the shared .progress-dots component over the image instead
   of in normal document flow. */
.wave-showcase-dots {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  margin: 0;
  z-index: 3;
}
.wave-showcase-dots span { background: rgba(255, 255, 255, 0.28); }
.wave-showcase-dots span.done { background: var(--accent-2); }

/* ---------- Catalog thumb variants (coming-soon state) ---------- */
.promo-thumb-empty {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  display: flex;
  align-items: center;
  justify-content: center;
}
.promo-badge-static { position: static; }

/* ---------- Detail / preview overlay ---------- */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  overflow-y: auto;
}
.detail-body { padding: 0 20px 60px; }
.topbar-spacer { width: 38px; }

.detail-hero {
  box-shadow: 0 16px 36px -18px rgba(0, 0, 0, 0.6);
}
.detail-title {
  font-family: var(--font-heading);
  margin: 16px 0 4px;
}
.detail-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}
.detail-bullets {
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.7;
  margin: 0 0 20px;
}

.detail-buy-btn { margin-bottom: 10px; }
.detail-link-skip { margin: 0 0 12px; }

.detail-form {
  display: none;
  margin-top: 16px;
}
.detail-payment-element { margin: 0 0 14px; }
.detail-error {
  color: #ff6b6b;
  font-size: 0.8rem;
  text-align: center;
  margin-top: 10px;
  display: none;
}

/* ---------- Intro carousel (3-slide educational crossfade, before the gate) ----------
   Reuses the .wave-slide-content crossfade technique (single shared text
   layer, fade to 0 via .is-swapping, swap the copy underneath, fade back
   in) rather than a per-slide stacked layer — there are no per-slide
   background images here, just text, so the .gate-hero layout doubles as
   the slide frame. Same 0.25s swap timing as .wave-slide-content. */
#intro-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  min-height: calc(100dvh - 140px);
  text-align: center;
}
#intro-screen.active { display: flex; }

/* Each word/letter of the intro title & body is wrapped in a .dissolve-unit
   span and animated individually (see app.js dissolveOut/dissolveIn) — the
   text breaks apart into drifting, fading fragments instead of a flat
   crossfade. --dx/--dy/--rot are set per-unit from JS for organic variance. */
.dissolve-unit {
  display: inline-block;
  will-change: transform, opacity, filter;
}
@keyframes charDissolveOut {
  to {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.5) rotate(var(--rot, 0deg));
    filter: blur(5px);
  }
}
@keyframes charDissolveIn {
  from {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.5) rotate(var(--rot, 0deg));
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

#intro-dots { width: 100%; max-width: 200px; margin: 0 auto 18px; }
#intro-skip {
  margin: 0;
  background: none;
  border: none;
  font-family: var(--font-body);
}

/* ---------- Gate screen (email capture, ambient sound playing) ---------- */
#gate-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  min-height: calc(100dvh - 140px);
  text-align: center;
}
#gate-screen.active { display: flex; }

.gate-hero { max-width: 360px; margin: 0 auto 28px; }
.gate-hero .eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.gate-hero h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin: 12px 0 8px;
}
.gate-hero p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}
/* El intro se lee de un vistazo y en movimiento, con las letras todavía
   materializándose: necesita más cuerpo que la pantalla del correo, donde el
   texto está quieto y hay un campo que mirar. Se sube solo aquí para no tocar
   la pantalla del correo, que comparte la clase .gate-hero. */
.intro-slide-content h2 { font-size: 1.85rem; }
.intro-slide-content p { font-size: 1.02rem; line-height: 1.6; }

.gate-form { width: 100%; max-width: 360px; margin: 0 auto; }
.gate-form .detail-error { display: none; }

/* ---------- Gate confirmation (post-submit sub-state within #gate-screen) ---------- */
.gate-confirm { max-width: 360px; margin: 0 auto; }
.gate-confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
}
.gate-confirm-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  line-height: 1.4;
  margin: 0 0 12px;
}
.gate-confirm-email {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}
.gate-confirm-email strong { color: var(--text); }

/* ---------- Library top player (prominent, plays the same shared free clip as the mini-player) ---------- */
.library-player { margin-bottom: 6px; }

/* Overlaid on the video itself (not the center-play button, which stays free
   for the tap) so the headphone reminder is seen before anyone presses play —
   the audio never autoplays, this is just a heads-up while it's paused. */
.player-hero-notice {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 2;
  text-align: center;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

/* ---------- Home hero copy (rewritten: full program lives inside the app) ---------- */
.home-hero-copy {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 6px 0 0;
}

/* ---------- Wave swipe carousel (swipeable, replaces the old auto-crossfade showcase) ---------- */
.wave-swipe {
  display: flex;
  gap: 12px;
  margin: 16px -20px 4px;
  padding: 0 20px 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wave-swipe::-webkit-scrollbar { display: none; }
.wave-swipe-slide {
  position: relative;
  flex: 0 0 78%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  scroll-snap-align: center;
  box-shadow: 0 16px 34px -18px rgba(0, 0, 0, 0.6);
}
.wave-swipe-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, 0.85) 100%);
}
.wave-swipe-label {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
}
.wave-swipe-label .hz {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}
.wave-swipe-label .name {
  margin-top: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-2);
}

/* ---------- Library screen ---------- */
/* Room for both fixed bars (offer + mini-player) so the last rows and the
   in-flow unlock button never sit underneath them. */
#library-screen { padding-bottom: calc(180px + var(--safe-bottom)); }

.library-stat {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-2);
  letter-spacing: 0.02em;
}

.quiz-entry-card {
  display: block;
  width: 100%;
  margin: 16px 0 4px;
  aspect-ratio: auto;
}
.quiz-entry-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.quiz-entry-emoji { font-size: 1.6rem; flex-shrink: 0; }
.quiz-entry-text { text-align: left; }
.quiz-entry-text strong { display: block; font-size: 0.92rem; }
.quiz-entry-text span { font-size: 0.78rem; color: var(--text-muted); }

/* Locked library rows — showcase only, nothing here is playable pre-purchase */
.track-row.locked {
  cursor: pointer;
  opacity: 0.85;
}
.track-row.locked .play-dot {
  border-color: var(--border);
  color: var(--text-muted);
}
.track-row.locked .play-dot svg { width: 15px; height: 15px; }

/* ---------- Differentiator strip ---------- */
.diff-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 28px 0 20px;
  padding: 16px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.diff-strip .diff-item { text-align: center; }
.diff-strip .diff-item .diff-icon { font-size: 1.3rem; margin-bottom: 6px; }
.diff-strip .diff-item .diff-label { font-size: 0.68rem; color: var(--text-muted); line-height: 1.35; }

/* ---------- Sticky offer bar (persistent, sits above the mini-player) ----------
   Its `bottom` is set from app.js to the mini-player's measured height, so the
   two stack instead of overlapping whether or not the player is showing. */
.offer-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 16px;
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  cursor: pointer;
  z-index: 36;
  font-family: var(--font-body);
  box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, 0.7);
  transition: filter 0.15s ease;
}
.offer-bar[hidden] { display: none; }
.offer-bar:hover { filter: brightness(1.06); }
.offer-bar:active { filter: brightness(0.96); }
.offer-bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.offer-bar-text strong { font-size: 0.86rem; font-weight: 800; }
.offer-bar-text span { font-size: 0.72rem; opacity: 0.85; }
.offer-bar-cta {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-contrast) 88%, transparent);
  color: var(--text);
}

/* ---------- Mini-player (persistent, sibling of .screen) ---------- */
.mini-player {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + var(--safe-bottom));
  z-index: 35;
}
.mini-player[hidden] { display: none; }
.mini-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mini-player-title {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-player-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-player-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.mini-player-play svg { width: 16px; height: 16px; }
.mini-player-play:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.mini-player-play:active { transform: scale(0.9); }
