/* Un Altar Donde Tú Estés · escena 2.5D persistente + pantallas encima. Un solo look nocturno. */
:root {
  --noche: #0b0806;
  --crema: #f4ebdb;
  --crema-2: #cbbfa9;
  --tenue: #a99d88;
  --oro: #d9a441;
  --oro-claro: #f0c46a;
  --linea: rgba(217, 164, 65, 0.5);
  --f-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --f-ui: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--noche); color: var(--crema); font-family: var(--f-ui); overflow: hidden; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app {
  position: relative; height: 100%; max-width: 480px; margin-inline: auto;
  overflow: hidden; background: var(--noche); isolation: isolate;
}
@media (min-width: 520px) {
  body { display: grid; place-items: center; }
  .app { height: min(100%, 900px); aspect-ratio: 390 / 844; width: auto; border-radius: 28px; box-shadow: 0 0 0 1px rgba(244,235,219,0.08), 0 40px 120px rgba(0,0,0,0.6); }
}

/* ---------- Escena ---------- */
.scene { position: absolute; inset: 0; z-index: 0; transition: transform 1.6s cubic-bezier(.2,.7,.2,1); }
.app[data-screen="espera"] .scene,
.app[data-screen="resultado"] .scene,
.app[data-screen="error"] .scene { transform: scale(1.06); }
.layer { position: absolute; inset: 0; will-change: transform; pointer-events: none; }
.layer img { position: absolute; display: block; max-width: none; user-select: none; -webkit-user-drag: none; }

.bg { inset: -5% -6%; width: 112%; height: 110%; object-fit: cover; object-position: 50% 80%; }
.humo { left: 18%; bottom: 14%; width: 60%; opacity: 0.22; mix-blend-mode: screen; filter: blur(1px); }
.vela-lejana { left: 6%; bottom: 31%; width: 17%; filter: blur(2.2px) brightness(0.8); }
.velas { right: -4%; bottom: 20%; width: 50%; }
.monarca { right: 4%; top: 17%; width: 21%; filter: drop-shadow(0 10px 18px rgba(0,0,0,0.55)); }
.papel { left: -16%; top: -12%; width: 132%; transform: rotate(-2.5deg); filter: blur(0.6px) drop-shadow(0 14px 20px rgba(0,0,0,0.45)); }
.flor { left: -17%; top: 43%; width: 34%; filter: blur(5px) brightness(0.85); opacity: 0.9; }
.ramo { left: -28%; bottom: -9%; width: 100%; filter: blur(3.2px) brightness(0.72); }
.petalo { position: absolute; left: 0; top: 0; will-change: transform; pointer-events: none; }
.solo-inicio { transition: opacity .8s ease; }
.solo-inicio img { transition: opacity .8s ease; }
.app:not([data-screen="inicio"]) .solo-inicio img { opacity: 0; }

.brillo {
  position: absolute; right: -10%; bottom: 14%; width: 90%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(240,164,70,0.34) 0%, rgba(240,164,70,0.10) 38%, rgba(240,164,70,0) 68%);
  mix-blend-mode: screen; animation: respirar 7s ease-in-out infinite;
}
.velo {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(75% 24% at 50% 36%, rgba(11,8,6,0.78) 0%, rgba(11,8,6,0.45) 55%, rgba(11,8,6,0) 100%),
    radial-gradient(120% 70% at 50% 40%, rgba(11,8,6,0) 45%, rgba(11,8,6,0.55) 100%),
    linear-gradient(180deg, rgba(11,8,6,0) 52%, rgba(11,8,6,0.78) 76%, rgba(11,8,6,0.96) 100%);
}
.velo-pantalla { position: absolute; inset: 0; background: var(--noche); opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.app[data-screen="espera"] .velo-pantalla { opacity: 0.5; }
.app[data-screen="resultado"] .velo-pantalla,
.app[data-screen="error"] .velo-pantalla { opacity: 0.62; }
@keyframes respirar { 0%, 100% { opacity: 0.72; } 50% { opacity: 1; } }

/* ---------- Entradas ---------- */
.entra { animation: entra 1.8s cubic-bezier(.2,.7,.2,1) both; }
@keyframes entra { from { opacity: 0.35; filter: blur(8px); } to { opacity: 1; filter: blur(0); } }
.d1 { animation-delay: .05s } .d2 { animation-delay: .25s } .d3 { animation-delay: .45s } .d4 { animation-delay: .65s }
.screen { animation: aparece .7s ease both; }
@keyframes aparece { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- UI común ---------- */
.ui { position: relative; z-index: 2; height: 100%; will-change: transform; }
.screen {
  container-type: size; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  height: 100%; display: flex; flex-direction: column; align-items: center;
  padding: calc(19% + env(safe-area-inset-top, 0px)) 24px calc(24px + env(safe-area-inset-bottom, 0px));
}
.marca {
  position: relative; display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 8px 18px;
}
.marca::before {
  content: ""; position: absolute; inset: -18px -34px; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(11,8,6,0.85), rgba(11,8,6,0.55) 60%, rgba(11,8,6,0));
}
.marca img { display: block; width: 168px; height: auto; filter: drop-shadow(0 1px 6px rgba(0,0,0,0.8)); }
.eyebrow { margin-top: 24px; font-size: 11.5px; font-weight: 500; letter-spacing: 0.26em; color: var(--oro); text-shadow: 0 1px 10px rgba(0,0,0,0.8); }
h1 {
  margin: 12px 0 0; font-family: var(--f-display); font-weight: 350; font-size: clamp(40px, 12vw, 50px);
  line-height: 1.02; letter-spacing: -0.01em; text-align: center; text-wrap: balance;
  font-variation-settings: "opsz" 144; text-shadow: 0 2px 30px rgba(0,0,0,0.6);
}
h1 em, .h2 em { font-style: italic; color: var(--oro-claro); }
.h2 {
  margin: 10px 0 0; font-family: var(--f-display); font-weight: 350; font-size: clamp(21px, 6.4vw, 26px); line-height: 1.2;
  text-align: center; white-space: nowrap; text-shadow: 0 2px 24px rgba(0,0,0,0.7);
  transition: opacity .4s ease;
}
.lead {
  margin: 16px 0 0; max-width: 28ch; font-size: 17px; line-height: 1.5; text-align: center;
  color: var(--crema); text-shadow: 0 1px 2px rgba(0,0,0,0.9), 0 0 18px rgba(0,0,0,0.85);
}
.acciones { margin-top: auto; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 56px; border-radius: 999px; font-family: var(--f-ui); font-size: 16px; cursor: pointer; text-decoration: none;
  transition: transform .2s ease, background-color .3s ease, opacity .3s ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible, .link:focus-visible, .consent input:focus-visible, .visita:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 3px; }
.btn-1 { border: 0; background: var(--oro); color: #1a120b; font-weight: 700; box-shadow: 0 10px 40px rgba(217,164,65,0.35); }
.btn-1:hover { background: var(--oro-claro); }
.btn-2 { height: 52px; border: 1px solid var(--linea); background: rgba(11,8,6,0.4); color: var(--crema); font-weight: 500; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.oculto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pasos { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pasos li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12px; line-height: 1.3; color: var(--crema); text-shadow: 0 1px 8px rgba(0,0,0,0.9); }
.pasos svg { width: 26px; height: 26px; fill: none; stroke: var(--oro); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tip { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--tenue); text-align: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--oro); text-decoration: underline; cursor: pointer; }
.consent { display: flex; gap: 10px; align-items: flex-start; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--oro); flex: none; }
.consent label { font-size: 12px; line-height: 1.45; color: var(--tenue); }
.visita { margin-top: 4px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--oro); text-decoration: none; }
.visita span { color: var(--tenue); }
.aviso-app { margin-top: 18px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--linea); background: rgba(11,8,6,0.7); text-align: center; font-size: 13px; }
.aviso-app p { margin: 0 0 6px; }

/* ---------- Espera ---------- */
/* Contenido centrado en vertical, igual que el resultado */
.s-espera { padding-top: calc(12% + env(safe-area-inset-top, 0px)); }
.s-espera > .eyebrow:first-child { margin-top: auto; }
.s-espera > .dato:last-child { margin-bottom: auto; }
.marco-espera {
  position: relative; flex: none; margin-top: max(56px, 9cqh); height: min(42cqh, 380px); aspect-ratio: 3 / 4; max-width: 70%; border-radius: 16px;
  box-shadow: 0 0 0 1px var(--linea), 0 24px 60px rgba(0,0,0,0.6), 0 0 80px rgba(240,164,70,0.18);
}
.marco-espera > img:first-child { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; filter: saturate(0.75) brightness(0.8); display: block; }
.barrido {
  position: absolute; inset: 0; border-radius: 16px; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, rgba(240,196,106,0) 0%, rgba(240,196,106,0.28) 48%, rgba(255,230,180,0.5) 50%, rgba(240,196,106,0.28) 52%, rgba(240,196,106,0) 100%);
  background-size: 100% 260%; mix-blend-mode: screen; animation: barrer 3.2s ease-in-out infinite;
}
@keyframes barrer { from { background-position: 0 100%; } to { background-position: 0 0; } }
.monarca-posada { position: absolute; right: 2%; top: -21%; width: 36%; filter: drop-shadow(0 8px 14px rgba(0,0,0,0.6)); }
.progreso { margin-top: 18px; width: min(60%, 240px); height: 3px; border-radius: 3px; background: rgba(244,235,219,0.15); overflow: hidden; }
.progreso-barra { height: 100%; width: 0; background: var(--oro); border-radius: 3px; transition: width .4s linear; }
.nota { margin: 8px 0 0; font-size: 12.5px; color: var(--tenue); }
.dato {
  margin-top: 28px; width: 100%; max-width: 380px; padding: 14px 18px; border-radius: 18px;
  background: rgba(11,8,6,0.62); border: 1px solid rgba(217,164,65,0.28);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: opacity .5s ease;
}
.dato-titulo { font-size: 11px; font-weight: 700; letter-spacing: 0.22em; color: var(--oro); }
.dato-texto { margin: 6px 0 0; font-family: var(--f-display); font-size: 17px; line-height: 1.4; }
.dato.cambia { opacity: 0; }

/* ---------- Resultado ---------- */
/* Contenido centrado en vertical: el aire sobrante se reparte arriba y abajo */
.s-resultado { padding-top: calc(10% + env(safe-area-inset-top, 0px)); gap: 18px; }
.s-resultado > .eyebrow:first-child { margin-top: auto; }
.s-resultado > :last-child { margin-bottom: auto; }
.marco-resultado {
  position: relative; flex: none; height: min(56cqh, 520px); aspect-ratio: 9 / 16; max-width: 100%; border-radius: 18px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--linea), 0 30px 80px rgba(240,164,70,0.22), 0 20px 50px rgba(0,0,0,0.6);
}
.marco-resultado img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.marco-resultado .despues { clip-path: inset(100% 0 0 0); -webkit-touch-callout: default; user-select: auto; }
.luz-revelado {
  position: absolute; left: 0; right: 0; height: 22%; top: 100%; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,214,140,0) 0%, rgba(255,214,140,0.55) 50%, rgba(255,214,140,0) 100%);
  mix-blend-mode: screen; opacity: 0;
}
.marco-resultado.revelar .despues { animation: revelar 1.9s cubic-bezier(.45,.05,.25,1) .3s forwards; }
.marco-resultado.revelar .luz-revelado { animation: luz 1.9s cubic-bezier(.45,.05,.25,1) .3s forwards; }
.marco-resultado.revelado .despues { clip-path: inset(0); animation: none; }
.marco-resultado.revelado .luz-revelado { display: none; }
@keyframes revelar { to { clip-path: inset(0 0 0 0); } }
@keyframes luz { 0% { top: 100%; opacity: 1; } 90% { opacity: 1; } 100% { top: -22%; opacity: 0; } }
.s-resultado .acciones { margin-top: 4px; gap: 10px; max-width: 380px; }
.invitacion {
  display: flex; flex-direction: column; gap: 2px; margin-top: 2px; padding: 10px 16px; border-radius: 16px;
  border: 1px solid var(--linea); background: rgba(11,8,6,0.6); text-decoration: none; color: var(--crema); text-align: center;
}
.inv-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.22em; color: var(--oro); }
.inv-titulo { font-family: var(--f-display); font-size: 18px; line-height: 1.25; text-wrap: balance; }
.inv-dir { margin-top: 2px; font-size: 11.5px; line-height: 1.5; color: var(--tenue); text-wrap: balance; }
.inv-dir .sep { opacity: 0.6; }
.inv-dir a { color: var(--oro); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.inv-dir a:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 2px; border-radius: 2px; }
.inv-texto { font-size: 12.5px; line-height: 1.45; color: var(--crema-2); }
.inv-cta { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--oro); text-decoration: underline; text-underline-offset: 3px; }
.invitacion:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 3px; }

/* ---------- Error ---------- */
.s-error { padding-top: calc(34% + env(safe-area-inset-top, 0px)); }
.s-error .h2 { font-size: 32px; white-space: normal; text-wrap: balance; }

/* ---------- Hoja de privacidad ---------- */
.hoja { position: absolute; inset: 0; z-index: 10; background: rgba(5,4,3,0.7); display: flex; align-items: flex-end; animation: aparece .3s ease both; }
.hoja-panel {
  width: 100%; max-height: 85%; overflow-y: auto; padding: 26px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  background: #17100b; border-top: 1px solid var(--linea); border-radius: 22px 22px 0 0;
}
.hoja-panel h3 { margin: 0 0 12px; font-family: var(--f-display); font-weight: 400; font-size: 24px; }
.hoja-panel p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--crema-2); }
.hoja-panel .btn { margin-top: 8px; }

@container (max-height: 760px) {
  .s-inicio { padding-top: calc(15% + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .s-inicio .marca { margin-top: 0; padding-block: 4px; }
  .s-inicio .marca img { width: 144px; }
  .s-inicio .eyebrow { margin-top: 14px; }
  .s-inicio h1 { font-size: 40px; margin-top: 8px; }
  .s-inicio .lead { font-size: 15.5px; margin-top: 10px; }
  .s-inicio .acciones { gap: 9px; }
  .s-inicio .pasos { margin-bottom: 2px; }
  .s-inicio .pasos li { font-size: 11px; gap: 4px; }
  .s-inicio .pasos svg { width: 22px; height: 22px; }
  .s-inicio .btn { height: 50px; font-size: 15px; }
  .s-inicio .btn-2 { height: 46px; }
}
@container (max-height: 700px) {
  .s-inicio h1 { font-size: 36px; }
  .s-inicio .lead { font-size: 15px; line-height: 1.42; }
  .s-inicio .eyebrow { margin-top: 10px; }
  .s-inicio .btn { height: 48px; }
  .s-inicio .btn-2 { height: 44px; }
}
/* Resultado en pantallas bajas: la tarjeta de visita no debe cortarse */
@container (max-height: 760px) {
  .marco-resultado { height: min(50cqh, 520px); }
  .s-resultado .acciones { gap: 8px; }
  .s-resultado .btn { height: 48px; font-size: 15px; }
  .invitacion { padding: 8px 14px; }
}
@media (max-height: 760px) { .s-resultado { gap: 12px; } }
/* Móviles estrechos: dirección y web en dos líneas limpias */
@container (max-width: 420px) {
  .inv-dir .sep { display: none; }
  .inv-dir a { display: block; }
}
@media (max-height: 740px) {
  .monarca { width: 18%; }

  .dato-texto { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .brillo, .entra, .screen, .barrido { animation: none; }
  .scene { transition: none; }
  .marco-resultado.revelar .despues { animation: none; clip-path: inset(0); }
  .marco-resultado.revelar .luz-revelado { display: none; }
}
