/* ════════════════════════════════════════════
   Las fotos de Emma — mismo sistema visual que
   emma.vsabido.es, pensado primero para móvil.
════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* El atributo `hidden` debe ganar siempre: varias capas de esta hoja
   declaran `display: flex` y, a igual especificidad, se impondrían al
   estilo del navegador dejando el lightbox y la puerta siempre visibles. */
[hidden] { display: none !important; }

:root {
  --rosa: #F7C5D0;
  --rosa-deep: #E8839B;
  --lila: #D4BFEE;
  --lila-deep: #9B7DBE;
  --melocoton: #FDDBB4;
  --melocoton-deep: #F5A96A;
  --dorado: #F0D080;
  --dorado-deep: #C9962A;
  --texto: #4A3340;
  --texto-suave: #8E6F7E;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --border: rgba(255, 255, 255, 0.65);
  --shadow-sm: 0 8px 24px rgba(232, 131, 155, 0.12);
  --shadow-md: 0 16px 48px rgba(155, 125, 190, 0.16);
  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 32px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: linear-gradient(165deg, #fff9fb 0%, #fff4f8 38%, #f8f2ff 100%);
  background-attachment: fixed;
  color: var(--texto);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(247, 197, 208, 0.14) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(72px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  animation: orbFloat 14s ease-in-out infinite;
}
.bg-orb--rosa { width: 260px; height: 260px; background: var(--rosa); top: -70px; right: -60px; }
.bg-orb--lila { width: 230px; height: 230px; background: var(--lila); bottom: 14%; left: -80px; animation-delay: -4s; }
.bg-orb--melo { width: 190px; height: 190px; background: var(--melocoton); top: 45%; right: -60px; animation-delay: -8s; }

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-18px) scale(1.04); }
}

#confeti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.15rem;
  position: relative;
  z-index: 1;
}

.nombre-emma {
  background: linear-gradient(90deg, var(--dorado-deep), #F9E07A, var(--dorado-deep));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: brillo 3s linear infinite;
}

@keyframes brillo {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* ════════════════════════════════════════════
   PUERTA (código de invitación)
════════════════════════════════════════════ */
.puerta {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.puerta-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  text-align: center;
  padding: 2.25rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.puerta-globos {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  animation: flotar 3.5s ease-in-out infinite;
}

@keyframes flotar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.puerta-titulo {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2.4rem, 11vw, 3.2rem);
  line-height: 1.1;
  color: var(--rosa-deep);
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.puerta-texto {
  font-size: 0.92rem;
  color: var(--texto-suave);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.input-pin {
  width: 100%;
  padding: 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  font-family: inherit;
  color: var(--texto);
  background: #fff;
  border: 2px solid var(--rosa);
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.input-pin:focus {
  outline: none;
  border-color: var(--rosa-deep);
  box-shadow: 0 0 0 4px rgba(232, 131, 155, 0.16);
}

.pin-error {
  min-height: 1.2rem;
  margin-top: 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rosa-deep);
}

/* ════════════════════════════════════════════
   BOTONES
════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 1rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--rosa-deep), var(--lila-deep));
  border: none;
  border-radius: 99px;
  box-shadow: 0 10px 26px rgba(232, 131, 155, 0.3);
  cursor: pointer;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn--gigante {
  padding: 1.35rem 1.5rem;
  font-size: 1.12rem;
  min-height: 64px;
}

/* ════════════════════════════════════════════
   HERO
════════════════════════════════════════════ */
#hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 1.15rem 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 99px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rosa-deep);
  margin-bottom: 1.1rem;
}

.hero-titulo {
  font-family: 'Great Vibes', cursive;
  font-weight: 400;
  font-size: clamp(2.8rem, 13vw, 4.5rem);
  line-height: 1.05;
  color: var(--rosa-deep);
  text-shadow: 0 8px 32px rgba(232, 131, 155, 0.18);
  margin-bottom: 0.2rem;
}

.hero-subtitulo {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(1.4rem, 6vw, 2rem);
  color: var(--lila-deep);
  margin-bottom: 1.1rem;
}

.hero-texto {
  max-width: 34ch;
  margin: 0 auto;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--texto-suave);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.stat {
  flex: 0 1 128px;
  padding: 0.9rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

.stat-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--lila-deep);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--texto-suave);
}

/* ════════════════════════════════════════════
   SUBIDA
════════════════════════════════════════════ */
section { padding: 1.5rem 0; position: relative; z-index: 1; }

.card {
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card.arrastrando {
  border-color: var(--rosa-deep);
  border-style: dashed;
  background: rgba(255, 240, 245, 0.95);
}

.campo { display: block; margin-bottom: 1rem; }

.campo-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--texto-suave);
}

.campo-label em { font-weight: 500; font-style: normal; opacity: 0.75; }

.input {
  width: 100%;
  padding: 0.9rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--texto);
  background: #fff;
  border: 1.5px solid rgba(232, 131, 155, 0.28);
  border-radius: var(--radius-sm);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.input:focus {
  outline: none;
  border-color: var(--rosa-deep);
  box-shadow: 0 0 0 4px rgba(232, 131, 155, 0.14);
}

.ayuda {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--texto-suave);
}

/* ── Cola de subida ── */
.cola { list-style: none; margin-top: 1.1rem; display: grid; gap: 0.6rem; }

.cola:empty { margin-top: 0; }

.cola-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  animation: entrar 0.35s var(--ease);
}

@keyframes entrar {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cola-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--rosa);
}

.cola-nombre {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.35rem;
}

.cola-barra {
  height: 6px;
  border-radius: 99px;
  background: rgba(232, 131, 155, 0.18);
  overflow: hidden;
}

.cola-progreso {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--rosa-deep), var(--lila-deep));
  transition: width 0.25s var(--ease);
}

.cola-item--ok .cola-progreso { background: linear-gradient(90deg, #7BC47F, #4FA65B); }
.cola-item--error .cola-progreso { background: #E05B5B; width: 100% !important; }

.cola-estado {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--texto-suave);
}

.cola-item--error .cola-estado { color: #C23A3A; }

.cola-resumen {
  margin-top: 1.1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(232, 131, 155, 0.12);
  border: 1px solid rgba(232, 131, 155, 0.22);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rosa-deep);
}

.cola-reintentar {
  margin-top: 0.45rem;
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  background: #C23A3A;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ════════════════════════════════════════════
   GALERÍA
════════════════════════════════════════════ */
.sec-titulo {
  font-family: 'Great Vibes', cursive;
  font-weight: 400;
  font-size: clamp(2.1rem, 9vw, 2.9rem);
  text-align: center;
  color: var(--lila-deep);
}

.sec-linea {
  width: 64px;
  height: 3px;
  margin: 0.5rem auto 1.5rem;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--rosa), var(--dorado));
}

.galeria-vacia {
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--texto-suave);
  padding: 2rem 0;
}

/* Mosaico tipo masonry con columnas CSS: en móvil, 2 */
.grid { column-count: 2; column-gap: 0.6rem; }

.foto {
  position: relative;
  display: block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 0.6rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(247, 197, 208, 0.25);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s var(--ease);
}

.foto:active { transform: scale(0.97); }

.foto img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}

.foto img.cargada { opacity: 1; }

.foto-autor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.4rem 0.6rem 0.5rem;
  background: linear-gradient(to top, rgba(74, 51, 64, 0.72), transparent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.foto-video {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(140deg, var(--lila), var(--rosa));
  min-height: 150px;
}

.cargando {
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--texto-suave);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 0.4rem;
  border: 2px solid rgba(232, 131, 155, 0.3);
  border-top-color: var(--rosa-deep);
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════
   LIGHTBOX
════════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 26, 35, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: aparecer 0.25s var(--ease);
  /* pinch-zoom para poder acercarse a la foto; el desplazamiento horizontal
     se deja sin declarar para que el swipe entre fotos lo maneje el JS. */
  touch-action: pan-y pinch-zoom;
}

@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

.lb-contenido {
  max-width: 100%;
  max-height: 100svh;
  padding: 3.5rem 0.5rem 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-contenido img,
.lb-contenido video {
  max-width: 100%;
  max-height: calc(100svh - 8rem);
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lb-cerrar,
.lb-nav {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(6px);
}

.lb-cerrar {
  top: max(0.85rem, env(safe-area-inset-top));
  right: 0.85rem;
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 1.9rem;
  line-height: 1;
  padding-bottom: 4px;
}

.lb-nav--prev { left: 0.6rem; }
.lb-nav--next { right: 0.6rem; }
.lb-nav:disabled { opacity: 0.25; }

.lb-pie {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem 1.15rem calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 600;
}

.lb-contador {
  position: absolute;
  top: max(1.55rem, calc(env(safe-area-inset-top) + 0.7rem));
  left: 1.1rem;
  z-index: 2;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
}

.lb-acciones {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}

.lb-borrar {
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.16);
  border: none;
  border-radius: 99px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lb-borrar:disabled { opacity: 0.5; }

.lb-descargar {
  flex: none;
  padding: 0.6rem 1.1rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--rosa-deep), var(--lila-deep));
  border-radius: 99px;
}

/* ════════════════════════════════════════════
   AVISO FLOTANTE
════════════════════════════════════════════ */
.aviso {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 980;
  max-width: calc(100vw - 2rem);
  padding: 0.85rem 1.35rem;
  border-radius: 99px;
  background: rgba(74, 51, 64, 0.94);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-md);
  animation: subirAviso 0.3s var(--ease);
}

@keyframes subirAviso {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */
footer {
  position: relative;
  z-index: 1;
  padding: 2.5rem 1.15rem calc(2.5rem + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--texto-suave);
}

footer a { color: var(--rosa-deep); font-weight: 700; text-decoration: none; }
footer small { display: block; margin-top: 1rem; font-size: 0.72rem; opacity: 0.8; }

.corazon {
  display: block;
  margin: 0.75rem 0;
  font-size: 1.5rem;
  color: var(--rosa-deep);
  animation: latido 1.8s ease-in-out infinite;
}

@keyframes latido {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ════════════════════════════════════════════
   TABLET / ESCRITORIO
════════════════════════════════════════════ */
@media (min-width: 640px) {
  .grid { column-count: 3; column-gap: 0.85rem; }
  .foto { margin-bottom: 0.85rem; }
  #hero { padding: 4rem 1.15rem 2.5rem; }
  .card { padding: 1.85rem; }
  .btn { width: auto; min-width: 260px; margin: 0 auto; display: flex; }
  .lb-cerrar, .lb-nav { width: 52px; height: 52px; }
}

@media (min-width: 1024px) {
  .grid { column-count: 4; }
  .container { max-width: 980px; }
}

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