/* galeria.css — Galería de invitados con el diseño de la variante
   (verde oliva, serif editorial, fotos de los novios en arco, detalles dorados). */

:root {
  --f-display: 'Instrument Serif', 'Iowan Old Style', 'Times New Roman', serif;
  --f-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bg: #47522F;
  --bg-2: #616D45;
  --fg: #EEF2E8;
  --mut: #C3C8B8;
  --acc: #D4AF37;
  --linea: color-mix(in srgb, #EEF2E8 22%, transparent);
  --velo: color-mix(in srgb, #EEF2E8 7%, transparent);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gut: clamp(20px, 5.5vw, 72px);
  --ancho: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh;
  background: radial-gradient(120% 60% at 50% -8%, var(--bg-2) 0%, var(--bg) 58%) no-repeat, var(--bg);
  color: var(--fg); font-family: var(--f-body); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased; overflow-x: clip; -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
h1, h2, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 4px; }

/* ── Barra superior ───────────────────────────────────────── */
.gp-barra { display: flex; align-items: center; justify-content: space-between; padding: max(16px, env(safe-area-inset-top)) var(--gut) 0; max-width: calc(var(--ancho) + 2 * var(--gut)); margin-inline: auto; }
.gp-monograma { font-family: var(--f-display); font-size: 1.7rem; line-height: 1; text-decoration: none; letter-spacing: 0.02em; display: inline-flex; align-items: center; min-height: 44px; }
.gp-monograma em { font-style: italic; color: var(--acc); margin-inline: 1px; }

main { max-width: calc(var(--ancho) + 2 * var(--gut)); margin-inline: auto; padding: 0 var(--gut) 90px; }
section { padding-top: clamp(44px, 8vw, 96px); }

/* ── Encabezado ───────────────────────────────────────────── */
.pg-encabezado { padding-top: clamp(24px, 5vw, 56px); }
.pg-volver { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 12px; border-radius: 999px; font-size: 0.92rem; font-weight: 500; text-decoration: none; box-shadow: inset 0 0 0 1px var(--linea); transition: box-shadow 200ms ease, color 200ms ease, scale 160ms var(--ease-out); }
.pg-volver:active { scale: 0.97; }
@media (hover: hover) and (pointer: fine) { .pg-volver:hover { box-shadow: inset 0 0 0 1px var(--acc); color: var(--acc); } }
.gp-titulo { font-family: var(--f-display); font-weight: 400; font-size: clamp(3rem, 11vw, 7rem); line-height: 0.95; letter-spacing: -0.012em; margin-top: clamp(24px, 5vw, 48px); text-wrap: balance; }
.gp-sub { font-family: var(--f-display); font-style: italic; font-size: clamp(1.25rem, 3.4vw, 1.7rem); color: var(--mut); margin-top: 16px; }

/* ── Títulos de sección ───────────────────────────────────── */
.pg-titulo { font-family: var(--f-display); font-weight: 400; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1; letter-spacing: -0.01em; text-wrap: balance; }
.pg-contador { display: inline-block; vertical-align: middle; margin-left: 10px; padding: 2px 12px; border-radius: 999px; font-family: var(--f-body); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; color: var(--acc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 55%, transparent); }
.pg-contador:empty { display: none; }
.pg-texto { color: var(--mut); max-width: 46ch; margin-top: 16px; text-wrap: pretty; }
.pg-tarjeta + .pg-tarjeta { border-top: 1px solid var(--linea); margin-top: clamp(44px, 8vw, 96px); }
.pg-tarjeta + .pg-tarjeta { padding-top: clamp(44px, 8vw, 96px); }

/* ── Subir fotos ──────────────────────────────────────────── */
#subir > * { max-width: 680px; }
.form-group { margin-top: 30px; }
.form-group label { display: block; font-size: 0.92rem; color: var(--mut); margin-bottom: 4px; }
.form-group .opcional { font-size: 0.85em; opacity: 0.8; }
.form-group input { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--linea); padding: 10px 0; font-size: 1.1rem; line-height: 1.4; border-radius: 0; transition: border-color 200ms ease; }
.form-group input::placeholder { color: color-mix(in srgb, var(--mut) 70%, transparent); }
.form-group input:focus { outline: none; border-bottom-color: var(--acc); }

.pg-elegir {
  width: 100%; margin-top: 30px; padding: 30px 20px; border-radius: 120px 120px 22px 22px;
  display: grid; justify-items: center; gap: 12px; text-align: center; font-weight: 500;
  background: var(--velo); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 55%, transparent);
  transition: background-color 200ms ease, box-shadow 200ms ease, scale 160ms var(--ease-out);
}
.pg-elegir svg { color: var(--acc); }
.pg-elegir:active { scale: 0.985; }
@media (hover: hover) and (pointer: fine) { .pg-elegir:hover { background: color-mix(in srgb, var(--fg) 11%, transparent); box-shadow: inset 0 0 0 1px var(--acc); } }

.pg-cola { display: grid; gap: 12px; margin-top: 18px; }
.pg-item { position: relative; display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 14px; padding: 10px 12px 10px 10px; border-radius: 16px; background: var(--velo); box-shadow: inset 0 0 0 1px var(--linea); }
.pg-item-vista { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.pg-item-info { display: grid; gap: 4px; min-width: 0; }
.pg-item-nombre { font-size: 0.92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-item-estado { font-size: 0.82rem; color: var(--mut); }
.pg-item[data-estado="listo"] .pg-item-estado { color: #E6C65A; }
.pg-item[data-estado="error"] .pg-item-estado { color: #FFC2B8; }
.pg-barra { height: 3px; border-radius: 2px; background: var(--linea); overflow: hidden; }
.pg-barra-relleno { height: 100%; width: 0; background: var(--acc); border-radius: 2px; transition: width 240ms var(--ease-out); }
.pg-item-quitar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; line-height: 1; color: var(--mut); transition: color 200ms ease, scale 160ms var(--ease-out); }
.pg-item-quitar:active { scale: 0.94; }
.pg-item[data-estado="subiendo"] .pg-item-quitar, .pg-item[data-estado="listo"] .pg-item-quitar { visibility: hidden; }

.btn-submit, .pg-subir {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 58px; margin-top: 22px; padding: 0 28px;
  border-radius: 999px; background: var(--acc); color: #2C2C2C; font-weight: 600; font-size: 1.05rem; letter-spacing: 0.01em;
  transition: scale 160ms var(--ease-out), opacity 160ms ease;
}
.btn-submit:active { scale: 0.97; }
.btn-submit:disabled { opacity: 0.55; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .btn-submit:hover { opacity: 0.9; } }

.pg-mensaje { min-height: 1.5em; margin-top: 16px; font-size: 0.95rem; }
.pg-mensaje.exito { color: #E6C65A; }
.pg-mensaje.error { color: #FFC2B8; }
.pg-mensaje.aviso { color: #E6C65A; }
.pg-album { margin-top: 18px; color: var(--mut); font-size: 0.95rem; }
.pg-album a { color: var(--acc); text-underline-offset: 4px; }

/* ── Cuadrículas de fotos ─────────────────────────────────── */
.pg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: clamp(24px, 5vw, 44px); }
@media (min-width: 700px) { .pg-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } #pg-grid-pareja .pg-foto:nth-child(3n + 2) { margin-top: 36px; } }
@media (min-width: 1100px) { .pg-grid { grid-template-columns: repeat(4, 1fr); } #pg-grid-pareja .pg-foto:nth-child(3n + 2) { margin-top: 0; } #pg-grid-pareja .pg-foto:nth-child(even) { margin-top: 36px; } }

.pg-foto { display: block; width: 100%; border-radius: 6px; }
.pg-foto img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--velo); opacity: 0; transition: opacity 600ms var(--ease-out), transform 700ms var(--ease-out); }
.pg-foto.cargada img { opacity: 1; }
.pg-foto:active img { filter: brightness(0.92); }
@media (hover: hover) and (pointer: fine) { .pg-foto:hover img { transform: scale(1.03); } }
/* Fotos de los novios: marco en arco apuntado. Las de los invitados: esquinas suaves, sin recortar rostros */
#pg-grid-pareja .pg-foto { overflow: hidden; }
#pg-grid-pareja .pg-foto img { clip-path: url(#arco); }
#pg-grid-invitados .pg-foto { overflow: hidden; border-radius: 16px; }
#pg-grid-invitados .pg-foto img { aspect-ratio: 1; }

.pg-vacio { margin-top: 24px; color: var(--mut); font-family: var(--f-display); font-style: italic; font-size: 1.4rem; line-height: 1.3; max-width: 34ch; }

/* ── Visor ────────────────────────────────────────────────── */
.visor { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(30, 37, 20, 0.96); color: var(--fg); opacity: 0; transition: opacity 220ms var(--ease-out); }
.visor[hidden] { display: none; }
.visor.abierto { opacity: 1; }
.visor-figura { display: grid; justify-items: center; gap: 12px; padding: 4rem 1rem 1.5rem; transform: scale(0.985); transition: transform 320ms var(--ease-out); }
.visor.abierto .visor-figura { transform: none; }
.visor-figura img { max-width: 92vw; max-height: 78dvh; object-fit: contain; border-radius: 4px; }
.visor-figura figcaption { font-size: 0.9rem; color: var(--mut); text-align: center; }
.visor-cerrar, .visor-nav { position: absolute; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(238, 242, 232, 0.09); transition: background-color 200ms ease, scale 160ms var(--ease-out); }
.visor-cerrar { top: max(14px, env(safe-area-inset-top)); right: 14px; }
.visor-nav { top: 50%; translate: 0 -50%; }
.visor-prev { left: 12px; } .visor-next { right: 12px; }
.visor-cerrar:active, .visor-nav:active { scale: 0.94; }
@media (hover: hover) and (pointer: fine) { .visor-cerrar:hover, .visor-nav:hover { background: rgba(238, 242, 232, 0.18); } }
@media (max-width: 700px) { .visor-nav { top: auto; bottom: max(18px, env(safe-area-inset-bottom)); translate: none; } .visor-prev { left: 24%; } .visor-next { right: 24%; } }
.visor-borrar { min-height: 44px; padding: 0 20px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; color: #FFC2B8; box-shadow: inset 0 0 0 1px rgba(255, 194, 184, 0.55); }
.visor-borrar:active { scale: 0.97; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}


/* ════════ Movimiento ════════ */
/* Línea del día: un sol que viaja por la parte de arriba mientras bajas */
#progreso-g { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60; pointer-events: none; }
#progreso-g i { position: absolute; inset: 0; background: var(--acc); transform-origin: left; transform: scaleX(0); opacity: 0.85; }
#progreso-g b { position: absolute; top: -4px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: #E6C65A; box-shadow: 0 0 12px 2px rgba(230, 198, 90, 0.55); }

/* Luciérnagas del encabezado */
.pg-encabezado { position: relative; }
.pg-encabezado > *:not(.gp-luciernagas) { position: relative; z-index: 1; }
.pg-encabezado .pg-volver { display: inline-flex; }
.gp-luciernagas { position: absolute; inset: -30px -24px -10px; z-index: 0; pointer-events: none; overflow: hidden; }
.gp-luciernagas span { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #FFE9A0; box-shadow: 0 0 10px 3px rgba(255, 215, 110, 0.7); opacity: 0; animation: gpLuz var(--d, 7s) ease-in-out var(--r, 0s) infinite; animation-play-state: paused; }
.gp-luciernagas.activas span { animation-play-state: running; }
@keyframes gpLuz {
  0%   { opacity: 0; transform: translate(0, 0); }
  20%  { opacity: 0.95; }
  60%  { opacity: 0.6; transform: translate(var(--x, 20px), var(--y, -40px)); }
  100% { opacity: 0; transform: translate(calc(var(--x, 20px) * 1.6), calc(var(--y, -40px) * 1.8)); }
}

/* Las fotos entran en cascada por columnas */
html.anim .pg-foto { opacity: 0; transform: translateY(46px) scale(0.94); transition: opacity 900ms var(--ease-out), transform 1100ms var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms); }
html.anim .pg-foto.entra { opacity: 1; transform: none; }

/* Las secciones: la línea dorada se dibuja y el contenido sube escalonado */
html.anim .pg-tarjeta + .pg-tarjeta { border-top: 0; }
html.anim .pg-tarjeta + .pg-tarjeta::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, var(--acc), var(--linea) 55%, transparent); transform: scaleX(0); transform-origin: left; transition: transform 1.6s var(--ease-out); }
html.anim .pg-tarjeta + .pg-tarjeta.entra::before { transform: scaleX(1); }
.pg-tarjeta { position: relative; }
html.anim #subir > *:not(.pg-titulo), html.anim .pg-vacio { opacity: 0; transform: translateY(22px); transition: opacity 800ms var(--ease-out), transform 900ms var(--ease-out); transition-delay: calc(var(--n, 0) * 90ms + 160ms); }
html.anim #subir.entra > *, html.anim #pg-invitados.entra .pg-vacio { opacity: 1; transform: none; }
#subir > :nth-child(2) { --n: 0; } #subir > :nth-child(3) { --n: 1; } #subir > :nth-child(4) { --n: 2; } #subir > :nth-child(5) { --n: 3; }
#subir > :nth-child(6) { --n: 4; } #subir > :nth-child(7) { --n: 5; } #subir > :nth-child(8) { --n: 6; } #subir > :nth-child(9) { --n: 7; }

/* El icono de subir fotos flota despacio */
.pg-elegir svg { animation: gpFlota 3.2s ease-in-out infinite alternate; }
@keyframes gpFlota { from { transform: translateY(2px); } to { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  html.anim .pg-foto, html.anim #subir > *, html.anim .pg-vacio { opacity: 1; transform: none; }
  .gp-luciernagas, .pg-elegir svg { animation: none; }
}

/* Las máscaras de las animaciones no recortan las letras con cola */
.ln-mask { padding-bottom: 0.22em; margin-bottom: -0.22em; }
