/* ===== Experiencia inmersiva — estilo agencia / Apple ===== */

.page-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #030105;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}
.page-veil.is-on {
  opacity: 1;
  pointer-events: auto;
}

body.is-immersive {
  overflow: hidden;
  height: 100dvh;
}
body.is-immersive .bg-glow,
body.is-immersive .stars {
  opacity: 0.35;
}
body.is-immersive .page {
  padding: 0;
  max-width: none;
  min-height: 100dvh;
}
body.is-immersive .page.has-app-nav,
body.is-immersive-page {
  padding-bottom: 0 !important;
}
body.is-immersive .ani-helper {
  display: none !important;
}

/* Chrome flotante (minimal) */
.imm-chrome {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    max(1.1rem, env(safe-area-inset-top, 0px))
    max(1.1rem, env(safe-area-inset-right, 0px))
    max(1.1rem, env(safe-area-inset-bottom, 0px))
    max(1.1rem, env(safe-area-inset-left, 0px));
}
.imm-chrome a,
.imm-chrome button,
.imm-chrome .imm-cta {
  pointer-events: auto;
}
.imm-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.imm-back {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.35s ease;
}
.imm-back:hover { color: #fff; }
.imm-meta {
  text-align: right;
}
.imm-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent-glow);
  font-weight: 600;
  margin: 0 0 0.35rem;
}
.imm-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 400;
  color: #fff;
  margin: 0;
  line-height: 1.15;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.imm-sub {
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.45);
  max-width: 28ch;
  margin-left: auto;
}

.imm-hint-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  animation: immFloat 3.2s ease-in-out infinite;
}
@keyframes immFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.imm-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.imm-progress {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}
.imm-cta {
  appearance: none;
  border: 0;
  background: #fff;
  color: #0a0714;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  transition: transform 0.45s var(--ease-out-expo), box-shadow 0.45s ease, opacity 0.35s ease;
}
.imm-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
}
.imm-cta[hidden] { display: none !important; }

/* Cap wrap inmersivo: ocupa TODO el viewport (sin max-width 720px) */
body.is-immersive .cap-wrap {
  position: relative;
  width: 100%;
  max-width: none !important;
  min-height: 100dvh;
  margin: 0 !important;
  padding: 0;
  animation: none;
}
body.is-immersive .cap-wrap > .back-link,
body.is-immersive .cap-wrap > .cap-header,
body.is-immersive .cap-wrap > .ani-helper {
  display: none !important;
}
body.is-immersive .cap-stage {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100dvh;
}

/* ===== Puerta fullscreen ===== */
body.is-immersive-puerta .door-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  border-radius: 0;
}
body.is-immersive-puerta .door-front {
  min-height: 100%;
  width: 100%;
  padding: 0 1.25rem 18vh;
}
body.is-immersive-puerta .door-panel {
  transition: transform 2s var(--ease-door);
}
body.is-immersive-puerta .reward-box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: min(620px, 94vw);
  max-height: min(92vh, 880px);
  margin: 0;
  padding: 1.2rem 1.25rem 1.35rem;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 40px 100px rgba(40, 20, 60, 0.28);
}
body.is-immersive-puerta .reward-box .reward-img {
  aspect-ratio: auto;
  width: 100%;
  max-height: min(68vh, 580px);
  height: auto;
  object-fit: contain;
  object-position: center;
  margin: 0.7rem 0 0.35rem;
  animation: none;
  transform: none;
}
body.is-immersive-puerta .reward-box.pop-in {
  animation: immRewardIn 0.9s var(--ease-out-expo) both;
}
@keyframes immRewardIn {
  from { opacity: 0; transform: translate(-50%, -42%) scale(0.96); filter: blur(8px); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: none; }
}

/* Footer CTA: siempre centrado abajo */
body.is-immersive .imm-footer {
  width: 100%;
  justify-content: center;
  gap: 1rem;
}
body.is-immersive .imm-footer .imm-hint-pill {
  position: absolute;
  left: max(1.1rem, env(safe-area-inset-left, 0px));
  bottom: max(1.1rem, env(safe-area-inset-bottom, 0px));
}
body.is-immersive .imm-cta {
  margin: 0 auto;
}

/* Placeholders premium (sin fotos aún) */
.slot-premium {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  min-height: min(42vh, 360px);
  border-radius: 1.15rem;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.55), rgba(226,209,240,0.75)),
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.9), transparent 55%);
  color: rgba(61, 47, 79, 0.55);
  text-align: center;
  padding: 1.5rem 1rem;
  overflow: hidden;
  position: relative;
}
.slot-premium::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,0.45) 50%, transparent 60%);
  animation: slotShine 3.8s ease-in-out infinite;
}
.slot-premium strong {
  position: relative;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
}
.slot-premium span {
  position: relative;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}
@keyframes slotShine {
  0% { transform: translateX(-30%) rotate(12deg); }
  100% { transform: translateX(30%) rotate(12deg); }
}

/* ===== Galaxia fullscreen ===== */
body.is-immersive-galaxia .g3d-stage {
  position: absolute;
  inset: 0;
  left: 0;
  right: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
}
body.is-immersive-galaxia .cap-stage > .game-hint,
body.is-immersive-galaxia .cap-stage > .hotspot-count,
body.is-immersive-galaxia .g3d-drag-hint {
  display: none;
}
body.is-immersive-galaxia .reward-box#galaxyFinale {
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 35;
  width: min(560px, 94vw);
  margin: 0;
  text-align: center;
  background: rgba(10, 7, 20, 0.55);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}
body.is-immersive-galaxia .reward-box#galaxyFinale .reward-img {
  max-height: min(48vh, 420px);
}
body.is-immersive-galaxia .reward-box#galaxyFinale .frase-magica {
  color: #fff;
}
body.is-immersive-galaxia .reward-box#galaxyFinale .eyebrow {
  color: var(--accent-glow);
}

/* Modal cine (recuerdo) */
.mem-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(3, 1, 5, 0.55);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s var(--ease-out-expo), visibility 0.45s;
}
.mem-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.mem-card {
  width: min(560px, 94vw);
  background: rgba(18, 12, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.4rem;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.55s var(--ease-out-expo);
}
.mem-modal.is-open .mem-card {
  transform: none;
}
.mem-close {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.3s ease, transform 0.3s ease;
}
.mem-close:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.05);
}
.mem-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(42vh, 320px);
  max-height: min(58vh, 480px);
  background: #0a0612;
  overflow: hidden;
}
.mem-media img {
  width: 100%;
  height: auto;
  max-height: min(58vh, 480px);
  object-fit: contain;
  object-position: center center;
  display: block;
  margin: 0 auto;
  animation: none;
  transform: none;
}
@keyframes memKen {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
.mem-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 0.35rem;
  background:
    radial-gradient(circle at 50% 40%, rgba(217, 186, 255, 0.25), transparent 55%),
    linear-gradient(160deg, #1a1228, #0a0714);
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 1rem;
}
.mem-ph strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  color: #fff;
}
.mem-ph span {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
}
.mem-copy {
  padding: 1.35rem 1.4rem 1.5rem;
}
.mem-copy h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 400;
  color: #fff;
  margin: 0 0 0.55rem;
}
.mem-copy p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.55);
}

/* ===== Sol fullscreen ===== */
body.is-immersive-sol .sky-scene {
  position: absolute;
  inset: 0;
  min-height: 100%;
  margin: 0;
  border-radius: 0;
  z-index: 1;
}
body.is-immersive-sol .clouds {
  position: absolute;
  inset: 0;
  z-index: 6;
}
body.is-immersive-sol .cloud-btn {
  z-index: 7;
  font-size: clamp(2.8rem, 6vw, 4rem);
}
body.is-immersive-sol .sol-play-hint {
  z-index: 9;
  top: 46%;
  width: min(90vw, 28rem);
  padding: 1.25rem 1.5rem 1.35rem;
}
body.is-immersive-sol .sol-play-hint-txt {
  font-size: clamp(1.25rem, 4.5vw, 1.7rem);
}
body.is-immersive-sol .sky-msg {
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  z-index: 5;
  max-width: min(92vw, 40rem);
  margin-left: auto;
  margin-right: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(92vw, 40rem);
}
body.is-immersive-sol .sol-reward {
  display: none !important;
}
body.is-immersive-sol .sol-reward.sol-reward-minimal:not(:empty) {
  display: none !important;
}
/* La escena de flores toma TODA la pantalla como un segundo acto:
   de cielo soleado a un prado nocturno florecido. */
body.is-immersive-sol .flores-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  border-radius: 0;
  z-index: 12;
  opacity: 0;
}
body.is-immersive-sol .flores-scene:not(.is-paused) {
  animation: floresSceneReveal 1.2s var(--ease-out-expo) both;
}
@keyframes floresSceneReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
body.is-immersive-sol .flores-scene .flowers {
  transform: scale(0.58);
  margin-bottom: 0;
}
body.is-immersive-sol .flores-message {
  top: calc(5.5rem + env(safe-area-inset-top, 0px));
  z-index: 40;
  max-width: min(90vw, 440px);
}
@media (max-width: 480px) {
  body.is-immersive-sol .flores-scene .flowers { transform: scale(0.36); }
  body.is-immersive-sol .flores-message {
    top: calc(7rem + env(safe-area-inset-top, 0px));
    max-width: min(92vw, 360px);
    font-size: 0.9rem;
  }
}

/* Home: hover con foto (fallback en home.php) */

@media (max-width: 720px) {
  .imm-top { flex-direction: column; align-items: flex-start; gap: 0.65rem; }
  .imm-meta { text-align: left; }
  .imm-sub { display: none; }
  .imm-title { font-size: clamp(1.3rem, 6.5vw, 1.75rem); }
  .imm-back {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
  }
  body.is-immersive-puerta .reward-box {
    width: min(94vw, 420px);
    max-height: min(78dvh, 640px);
    padding: 0.95rem 1rem 1.1rem;
    top: 48%;
  }
  body.is-immersive-puerta .reward-box .reward-img {
    max-height: min(42dvh, 320px);
  }
  body.is-immersive .imm-footer {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mem-media img,
  .song-photos img {
    max-height: min(42vh, 320px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .imm-hint-pill,
  .slot-premium::before,
  .mem-media img { animation: none !important; }
  .page-veil { transition: none; }
}
