/* ==========================================================================
   Detallazo · Estilos compartidos de los regalos
   Estilo papelería: papel cálido, colores planos, contorno de tinta y sombras
   sólidas tipo sticker. Cada plantilla solo cambia la paleta (variables :root).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;700&family=Fraunces:ital,opsz,wght,SOFT,WONK@0,9..144,400..700,100,1;1,9..144,400..700,100,1&family=Nunito:wght@500;600;700;800&display=swap');

:root {
  --rg-fondo: #fff4e6;
  --rg-texto: #2a211c;
  --rg-texto-suave: rgba(42, 33, 28, 0.68);
  --rg-tinta: #2a211c;
  --rg-papel: #fffdf8;
  --rg-acento: #ff8a5b;
  --rg-acento-2: #ffd166;
  --rg-acento-tinta: #c2410c;
  --rg-boton-texto: var(--rg-tinta);
  --rg-sombra: var(--rg-tinta);
  --rg-caja: var(--rg-acento);
  --rg-cinta: var(--rg-acento-2);
  --rg-washi: rgba(255, 209, 102, 0.85);
  --rg-intro-fondo: var(--rg-fondo);
  --rg-fuente-titulo: 'Fraunces', Georgia, serif;
  --rg-fuente-mano: 'Caveat', 'Segoe Print', cursive;
  --rg-fuente-acento: var(--rg-fuente-mano);
  --rg-fuente: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --rg-borde: 2.5px solid var(--rg-tinta);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--rg-fondo);
  color: var(--rg-texto);
  font-family: var(--rg-fuente);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { font: inherit; }

/* Vista previa dentro del celular de la portada (iframe): sin barra de desplazamiento */
.rg-embebido { scrollbar-width: none; }
.rg-embebido::-webkit-scrollbar, .rg-embebido body::-webkit-scrollbar { display: none; }

/* Textura de papel muy suave */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.42 0 0 0 0 0.35 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
}

/* ---------- Tipografía compartida ---------- */
.rg-etiqueta {
  display: inline-block;
  font-family: var(--rg-fuente-mano);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: var(--rg-acento-tinta);
  margin: 0 0 6px;
  transform: rotate(-3deg);
}

.rg-titulo {
  font-family: var(--rg-fuente-titulo);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-weight: 650;
  font-size: clamp(2.2rem, 9vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  max-width: 13em;
  text-wrap: balance;
}

.rg-ayuda {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--rg-texto-suave);
  min-height: 1.5em;
  text-wrap: balance;
}

.rg-subtitulo {
  font-family: var(--rg-fuente-titulo);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-weight: 600;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 56px 0 4px;
}

/* Subrayado dibujado a mano debajo de los títulos de sección */
.rg-subtitulo::after {
  content: '';
  display: block;
  width: 120px;
  height: 12px;
  margin: 4px auto 0;
  background: var(--rg-acento);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M3 8c18-6 30 3 48-1s32-5 66-1' fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M3 8c18-6 30 3 48-1s32-5 66-1' fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Escenas y contenedores ---------- */
.rg-escena {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px 48px;
  position: relative;
  z-index: 2;
}

.rg-contenido {
  position: relative;
  z-index: 2;
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 20px 24px;
}

/* ---------- Botón sticker ---------- */
.rg-boton, .rg-intro-boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--rg-fuente);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--rg-boton-texto);
  background: var(--rg-acento);
  border: var(--rg-borde);
  border-radius: 999px;
  padding: 13px 30px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--rg-sombra);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.rg-boton:hover, .rg-intro-boton:hover { transform: translateY(-1px); box-shadow: 0 6px 0 var(--rg-sombra); }
.rg-boton:active, .rg-intro-boton:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rg-sombra); }
.rg-boton[hidden] { display: none; }

.rg-boton.rg-secundario {
  background: var(--rg-papel);
  color: var(--rg-tinta);
}

/* ---------- Pantalla de apertura: la caja de regalo ---------- */
.rg-intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--rg-intro-fondo);
  color: var(--rg-texto);
  cursor: pointer;
  transition: opacity 0.6s ease 0.35s, visibility 0s linear 0.95s;
}

.rg-intro.rg-saliendo { opacity: 0; visibility: hidden; pointer-events: none; }

.rg-intro-caja {
  text-align: center;
  padding: 32px 24px;
  max-width: 420px;
  width: 100%;
}

.rg-regalo {
  width: 168px;
  margin: 0 auto 22px;
  overflow: visible;
  animation: rg-menear 2.8s ease-in-out infinite;
  transform-origin: 50% 90%;
}

.rg-regalo .rg-tapa {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 0.55s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.4s ease 0.2s;
}

.rg-saliendo .rg-regalo { animation: rg-saltito 0.5s ease; }
.rg-saliendo .rg-regalo .rg-tapa { transform: translate(-14px, -70px) rotate(-24deg); opacity: 0; }

@keyframes rg-menear {
  0%, 70%, 100% { transform: rotate(0); }
  76% { transform: rotate(-5deg); }
  82% { transform: rotate(4deg); }
  88% { transform: rotate(-2deg); }
  94% { transform: rotate(1deg); }
}

@keyframes rg-saltito {
  40% { transform: translateY(6px) scale(1.04, 0.95); }
}

.rg-intro-para {
  font-family: var(--rg-fuente-mano);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--rg-acento-tinta);
  margin: 0 0 6px;
}

.rg-intro-texto {
  font-family: var(--rg-fuente-titulo);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-size: clamp(1.8rem, 7vw, 2.3rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 24px;
}

.rg-expirado, .rg-espera { cursor: default; }
.rg-espera .rg-regalo { animation: none; }

/* ---------- Apertura programada: el reloj ---------- */
.rg-reloj {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 12px;
}

.rg-reloj-bloque {
  background: var(--rg-papel);
  color: var(--rg-tinta);
  border: var(--rg-borde);
  border-radius: 14px;
  padding: 12px 8px 10px;
  min-width: 66px;
  box-shadow: 0 4px 0 var(--rg-sombra);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rg-reloj-bloque b {
  font-family: var(--rg-fuente-titulo);
  font-size: 1.9rem;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rg-reloj-bloque small {
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0.6;
  margin-top: 4px;
}

/* ---------- Pregunta secreta ---------- */
.rg-pregunta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 340px;
  margin: 0 auto;
}

.rg-pregunta label {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
}

.rg-pregunta input {
  width: 100%;
  font-family: var(--rg-fuente);
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  color: var(--rg-tinta);
  background: var(--rg-papel);
  border: var(--rg-borde);
  border-radius: 999px;
  padding: 13px 20px;
  outline: none;
  transition: box-shadow 0.2s;
}

.rg-pregunta input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--rg-acento) 45%, transparent); }

.rg-pista {
  margin: 0;
  min-height: 1.4em;
  font-family: var(--rg-fuente-mano);
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--rg-acento-tinta);
}

.rg-mal { animation: rg-temblor 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes rg-temblor {
  15%, 85% { transform: translateX(-6px); }
  35%, 65% { transform: translateX(6px); }
  50% { transform: translateX(-3px); }
}

/* ---------- Canción (Spotify o YouTube) ---------- */
.rg-cancion, .rg-yt {
  position: fixed;
  z-index: 90;
  bottom: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.3, 1.3, 0.5, 1);
  border: var(--rg-borde);
  box-shadow: 0 5px 0 var(--rg-sombra);
  overflow: hidden;
}

.rg-cancion {
  left: 14px;
  right: 14px;
  max-width: 420px;
  margin: 0 auto;
  height: 84px;
  border-radius: 18px;
  background: #282828;
}

.rg-yt {
  left: 14px;
  width: 210px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: #000;
}

.rg-cancion.rg-visible, .rg-yt.rg-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.rg-cancion iframe, .rg-yt iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.rg-cerrar {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.rg-cerrar svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; }

body:has(.rg-cancion.rg-visible) { padding-bottom: 110px; }

/* ---------- Carta de papel con cinta washi ---------- */
.rg-carta {
  position: relative;
  background: var(--rg-papel);
  color: var(--rg-tinta);
  border: var(--rg-borde);
  border-radius: 18px;
  padding: 40px 28px 30px;
  box-shadow: 7px 7px 0 var(--rg-sombra);
  text-align: left;
}

.rg-carta::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  width: 116px;
  height: 30px;
  transform: translateX(-50%) rotate(-3deg);
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 0 6px, transparent 6px 12px),
    var(--rg-washi);
  border-radius: 2px;
}

.rg-carta p {
  white-space: pre-line;
  line-height: 1.7;
  font-size: 1.1rem;
  margin: 0;
  min-height: 3.4em;
}

.rg-firma {
  font-family: var(--rg-fuente-mano);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  text-align: right;
  margin-top: 20px;
  color: var(--rg-acento-tinta);
}

/* ---------- Máquina de escribir ---------- */
.rg-cursor::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 3px;
  vertical-align: -0.12em;
  animation: rg-parpadeo 1s steps(2, start) infinite;
}

@keyframes rg-parpadeo { to { visibility: hidden; } }

/* ---------- Galería: polaroids pegadas con cinta ---------- */
.rg-galeria {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 30px 22px 30px;
  margin: 0 -20px;
  scrollbar-width: none;
}

.rg-galeria::-webkit-scrollbar { display: none; }
.rg-galeria:has(figure:only-child) { justify-content: center; }

.rg-galeria figure {
  flex: 0 0 74%;
  max-width: 360px;
  margin: 0;
  scroll-snap-align: center;
  background: #fffdf8;
  color: var(--rg-tinta);
  padding: 12px 12px 14px;
  border: var(--rg-borde);
  border-radius: 6px;
  box-shadow: 5px 5px 0 var(--rg-sombra);
  transform: rotate(calc((var(--i) % 3 - 1) * 2deg));
  position: relative;
}

.rg-galeria figure::before {
  content: '';
  position: absolute;
  top: -13px;
  left: 50%;
  width: 84px;
  height: 24px;
  transform: translateX(-50%) rotate(calc((var(--i) % 2 * 2 - 1) * 4deg));
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 0 6px, transparent 6px 12px),
    var(--rg-washi);
  z-index: 1;
}

.rg-galeria img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 2px solid var(--rg-tinta);
  border-radius: 3px;
}

.rg-galeria figcaption {
  font-family: var(--rg-fuente-mano);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
  text-align: center;
  margin-top: 10px;
}

/* ---------- Capas de efectos ---------- */
.rg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 85;
}

.rg-flotantes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.rg-flotantes span {
  position: absolute;
  bottom: -50px;
  animation: rg-ascenso linear forwards;
}

.rg-flotantes svg { width: 100%; height: auto; display: block; overflow: visible; }

@keyframes rg-ascenso {
  0% { transform: translateY(0) rotate(-10deg); opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(-118vh) rotate(20deg); opacity: 0; }
}

/* ---------- Revelado progresivo ---------- */
.rg-oculto {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.rg-visible { opacity: 1; transform: none; }

/* ---------- Pie con la marca ---------- */
.rg-pie {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 26px 20px 34px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rg-texto-suave);
}

.rg-pie a { color: inherit; text-decoration: none; }
.rg-pie b { font-family: var(--rg-fuente-titulo); font-weight: 650; color: var(--rg-texto); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
