:root {
  --fondo: #faf6f0;
  --papel: #ffffff;
  --tinta: #2b211b;
  --suave: #6f6259;
  --linea: #e6ddd1;
  --oro: #b8925a;
  --oro-claro: #e9d8b8;
  --error: #a33b2f;
  --ok: #4f7a4a;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Nunito Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font: 16px/1.55 var(--sans);
  overflow-x: hidden;
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.1; }
h2 { font-size: 2rem; margin: 0 0 .4rem; }

/* ───── Botones ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 1.4rem;
  border-radius: 999px; border: 1.5px solid transparent;
  font: 700 1rem var(--sans); text-decoration: none; cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-claro { background: #fff; color: var(--tinta); }
.btn-borde { border-color: rgba(255,255,255,.85); color: #fff; }
.btn-oscuro { background: var(--tinta); color: #fff; }
.btn-borde-oscuro { border-color: var(--tinta); color: var(--tinta); background: transparent; }
.btn-ancho { width: 100%; }

/* ───── Portada ───── */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: flex-end;
  background: radial-gradient(circle at 50% 30%, #6b5444, #2b211b 70%);
  color: #fff; overflow: hidden;
}
.hero-foto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.hero-velo { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(20,14,10,.05) 30%, rgba(20,14,10,.85) 85%); }
.hero-texto {
  position: relative; width: 100%; max-width: 640px; margin: 0 auto;
  padding: 2rem 16px calc(2.5rem + env(safe-area-inset-bottom)); text-align: center;
}
.hero-pre { margin: 0; letter-spacing: .2em; text-transform: uppercase; font-size: .78rem; opacity: .85; }
.hero h1 { font-size: clamp(2.6rem, 11vw, 4.5rem); margin: .2rem 0 .4rem; }
.hero-fechas { margin: 0; font-size: 1.05rem; color: var(--oro-claro); }
.hero-fechas span { margin: 0 .3rem; }
.hero-fechas .nw { margin: 0; white-space: nowrap; }
.hero-frase { font: italic 500 1.25rem/1.35 var(--serif); margin: 1rem auto 1.6rem; max-width: 26rem; opacity: .95; }
.hero-botones { display: grid; gap: .75rem; }
@media (min-width: 560px) { .hero-botones { grid-template-columns: 1fr 1fr; } }

/* Pantallas anchas: foto a la derecha, texto a la izquierda */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .hero { align-items: center; }
  .hero-foto { left: auto; width: 52%; object-position: center 22%; }
  .hero-velo { background: linear-gradient(to right, #2b211b 48%, rgba(43,33,27,0) 62%); }
  .hero-texto { margin: 0; width: 48%; max-width: none; padding: 2rem 4vw; }
}

/* ───── Barra superior ───── */
.barra {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem 16px; padding-top: calc(.6rem + env(safe-area-inset-top));
  background: rgba(250,246,240,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linea);
}
.barra-nombre { font: 600 1.2rem var(--serif); color: var(--tinta); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra nav { display: flex; gap: .25rem; flex-shrink: 0; }
.barra nav a { padding: .45rem .9rem; border-radius: 999px; color: var(--suave); text-decoration: none; font-weight: 700; font-size: .92rem; }
.barra nav a.activo { background: var(--tinta); color: #fff; }

/* ───── Contenido ───── */
.contenido { max-width: 560px; margin: 0 auto; padding: 1.5rem 16px 2rem; }
.contenido-ancho { max-width: 1100px; }
.nota { color: var(--suave); margin: 0 0 1.25rem; }
.estado { color: var(--suave); text-align: center; min-height: 1.5em; }
.estado.error { color: var(--error); }
.estado.ok { color: var(--ok); font-weight: 700; }

/* ───── Subir ───── */
.elegir {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: 1.8rem 1rem; border: 2px dashed var(--oro); border-radius: 18px;
  background: var(--papel); text-align: center; cursor: pointer; font-weight: 700;
}
.elegir input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.elegir small { font-weight: 400; color: var(--suave); }
.elegir-icono { font-size: 2.2rem; line-height: 1; color: var(--oro); }

.cola { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .5rem; }
.cola li {
  display: grid; grid-template-columns: 56px 1fr auto; gap: .75rem; align-items: center;
  background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; padding: .5rem;
}
.cola .mini { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--linea); display: grid; place-items: center; font-size: 1.4rem; }
.cola .info { min-width: 0; }
.cola .nombre { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cola .detalle { font-size: .8rem; color: var(--suave); }
.cola .barra-prog { height: 5px; background: var(--linea); border-radius: 3px; margin-top: .35rem; overflow: hidden; }
.cola .barra-prog i { display: block; height: 100%; width: 0; background: var(--oro); transition: width .3s; }
.cola li.listo .barra-prog i { background: var(--ok); }
.cola li.fallo .barra-prog i { background: var(--error); }
.cola .quitar { border: 0; background: none; font-size: 1.2rem; color: var(--suave); padding: .5rem; cursor: pointer; }

.campo { margin: 1rem 0; }
.campo label { display: block; font-weight: 700; margin-bottom: .35rem; }
.campo small { font-weight: 400; color: var(--suave); }
.campo input, .campo textarea {
  width: 100%; padding: .8rem .9rem; border: 1px solid var(--linea); border-radius: 12px;
  background: var(--papel); color: var(--tinta); font: 16px var(--sans); /* 16px evita zoom en iPhone */
}
.campo input:focus, .campo textarea:focus { outline: 2px solid var(--oro); border-color: transparent; }

/* ───── Ver ───── */
.homenaje { position: relative; margin: 0 -16px 1.25rem; aspect-ratio: 16 / 9; background: #000; }
@media (min-width: 720px) { .homenaje { margin: 0 0 1.5rem; border-radius: 16px; overflow: hidden; } }
.homenaje iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.filtros { display: grid; gap: .6rem; margin-bottom: 1rem; }
.filtros input {
  width: 100%; padding: .75rem 1rem; border: 1px solid var(--linea); border-radius: 999px;
  background: var(--papel); font: 16px var(--sans); color: var(--tinta);
}
.personas { display: flex; gap: .7rem; overflow-x: auto; padding: .2rem 2px .4rem; scrollbar-width: none; }
.personas::-webkit-scrollbar { display: none; }
.persona {
  flex-shrink: 0; width: 68px; border: 0; background: none; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  font: 600 .75rem/1.2 var(--sans); color: var(--suave); -webkit-tap-highlight-color: transparent;
}
.persona img {
  width: 60px; height: 60px; border-radius: 50%; object-fit: cover; display: block; background: var(--linea);
  box-shadow: 0 0 0 2px var(--fondo), 0 0 0 3px var(--linea);
  transition: box-shadow .25s, transform .2s;
}
.persona span { max-width: 68px; text-align: center; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.persona.activo { color: var(--tinta); }
.persona.activo img { box-shadow: 0 0 0 2px var(--fondo), 0 0 0 4px var(--oro); transform: scale(1.05); }
.persona:active img { transform: scale(.94); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--linea);
  background: var(--papel); color: var(--tinta); font: 600 .88rem var(--sans); cursor: pointer;
}
.chip.activo { background: var(--tinta); border-color: var(--tinta); color: #fff; }

.galeria { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
@media (min-width: 720px) { .galeria { grid-template-columns: repeat(5, 1fr); gap: 6px; } }
.mini-foto {
  position: relative; aspect-ratio: 1; padding: 0; border: 0; cursor: pointer; overflow: hidden;
  background: linear-gradient(100deg, var(--linea) 40%, #f3ece2 50%, var(--linea) 60%) 0 0 / 300% 100%;
  animation: brillo 1.4s linear infinite;
  -webkit-tap-highlight-color: transparent;
}
.mini-foto.lista { animation: none; background: var(--linea); }
.mini-foto img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transform: scale(1.04);
  transition: opacity .5s ease var(--d, 0ms), transform .7s cubic-bezier(.2,.7,.2,1) var(--d, 0ms);
}
.mini-foto.lista img { opacity: 1; transform: none; }
.mini-foto.sin-imagen img { display: none; }
.mini-foto:active img { transform: scale(.96); transition-duration: .15s; transition-delay: 0ms; }
@media (hover: hover) { .mini-foto:hover img { transform: scale(1.05); transition-delay: 0ms; } }
@media (min-width: 720px) { .mini-foto { border-radius: 8px; } }
.grupo {
  grid-column: 1 / -1; margin: 1.4rem 0 .4rem; padding: 0 2px;
  font: 600 1.6rem var(--serif); color: var(--tinta);
}
.grupo:first-child { margin-top: .2rem; }
#mas { height: 1px; }

.buscar-fila { display: flex; gap: .5rem; align-items: center; }
.buscar-caja {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem;
  background: var(--papel); border: 1px solid var(--linea); border-radius: 999px; padding: 0 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.buscar-caja:focus-within { border-color: var(--oro); box-shadow: 0 0 0 3px rgba(184,146,90,.15); }
.buscar-caja svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--suave); stroke-width: 2; stroke-linecap: round; }
.filtros .buscar-caja input { border: 0; background: none; padding: .75rem 0; outline: none; border-radius: 0; }
.btn-filtro {
  position: relative; flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--linea); background: var(--papel); cursor: pointer; display: grid; place-items: center;
  transition: transform .15s, background .2s;
}
.btn-filtro:active { transform: scale(.94); }
.btn-filtro svg { width: 22px; height: 22px; fill: none; stroke: var(--tinta); stroke-width: 2; stroke-linecap: round; }
.filtros-cuenta {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--oro); color: #fff; font: 700 .7rem/18px var(--sans); text-align: center;
}
.activos { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ───── Panel de filtros (hoja inferior) ───── */
.panel { position: fixed; inset: 0; z-index: 40; }
.panel-fondo { position: absolute; inset: 0; background: rgba(20,14,10,.45); opacity: 0; transition: opacity .3s; }
.panel-hoja {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto;
  background: var(--fondo); border-radius: 22px 22px 0 0; padding: .6rem 16px calc(1rem + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 720px) {
  .panel-hoja { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; border-radius: 20px; transform: translate(-50%, -45%) scale(.97); opacity: 0; transition: transform .3s, opacity .3s; }
}
.panel.abierto .panel-fondo { opacity: 1; }
.panel.abierto .panel-hoja { transform: none; }
@media (min-width: 720px) { .panel.abierto .panel-hoja { transform: translate(-50%, -50%); opacity: 1; } }
.panel-asa { width: 40px; height: 5px; border-radius: 3px; background: var(--linea); margin: 0 auto .8rem; }
.panel-titulo { font-size: 1.6rem; margin: 0 0 .5rem; }
.panel h3 { font: 700 .78rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--suave); margin: 1rem 0 .5rem; }
.opciones { display: flex; flex-wrap: wrap; gap: .45rem; }
.panel-pie { position: sticky; bottom: calc(-1rem - env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 2fr; gap: .6rem; margin-top: 1.4rem; padding: .8rem 0; background: var(--fondo); }

/* ───── Video de bienvenida ───── */
.bienvenida {
  position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .5s ease;
}
.bienvenida.abierto { opacity: 1; }
.bienvenida video { width: 100%; height: 100%; object-fit: contain; }
.saltar {
  position: absolute; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom));
  padding: .7rem 1.2rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.5);
  background: rgba(0,0,0,.45); color: #fff; font: 700 .95rem var(--sans); cursor: pointer;
  backdrop-filter: blur(6px); animation: subir .6s 1s both;
}
.galeria .play {
  position: absolute; right: 6px; bottom: 6px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: .8rem;
}

.recuerdos { margin-top: 2.5rem; }
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-left: 4px solid var(--oro); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: .75rem; }
.tarjeta p { margin: 0 0 .4rem; white-space: pre-line; font: 500 1.15rem/1.45 var(--serif); }
.tarjeta small { color: var(--suave); }

/* ───── Visor ───── */
.visor {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(12,9,7,var(--velo, .97));
  opacity: 0; transition: opacity .25s ease;
}
.visor.abierto { opacity: 1; }
.visor-medio { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 56px 0 72px; touch-action: pan-y pinch-zoom; }
.visor-item { transition: transform .3s cubic-bezier(.2,.7,.2,1); animation: entrar .35s cubic-bezier(.2,.7,.2,1) both; }
.visor-item.desde-der { animation-name: desde-der; }
.visor-item.desde-izq { animation-name: desde-izq; }
.visor-medio img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.visor-medio iframe { width: 100%; max-width: 1000px; aspect-ratio: 16 / 9; max-height: 100%; border: 0; }
.visor-contador { position: absolute; top: calc(20px + env(safe-area-inset-top)); left: 16px; color: rgba(255,255,255,.7); font-size: .85rem; font-variant-numeric: tabular-nums; }
.visor-cerrar, .visor-nav { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 50%; cursor: pointer; }
.visor-cerrar { top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 44px; height: 44px; font-size: 1.1rem; }
.visor-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 1.8rem; line-height: 1; }
.visor-ant { left: 8px; }
.visor-sig { right: 8px; }
.visor-pie { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: .8rem 16px calc(.8rem + env(safe-area-inset-bottom)); color: #eee; text-align: center; font-size: .92rem; }

/* ───── Pie ───── */
.pie { text-align: center; padding: 2rem 16px 3rem; color: var(--suave); border-top: 1px solid var(--linea); }
.qr { display: inline-block; margin: 1.25rem auto .5rem; padding: 10px; background: #fff; border-radius: 10px; }
.qr img, .qr canvas { display: block; width: 140px; height: 140px; }

/* ───── Movimiento ───── */
html { scroll-behavior: smooth; }
.hero-foto { animation: acercar 24s ease-out both; }
.hero-texto > * { animation: subir .9s cubic-bezier(.2,.7,.2,1) both; }
.hero-texto > :nth-child(2) { animation-delay: .12s; }
.hero-texto > :nth-child(3) { animation-delay: .24s; }
.hero-texto > :nth-child(4) { animation-delay: .36s; }
.hero-texto > :nth-child(5) { animation-delay: .5s; }
.contenido:not([hidden]) { animation: subir .45s cubic-bezier(.2,.7,.2,1) both; }
.cola li { animation: subir .35s ease both; }
.tarjeta { animation: subir .5s ease both; }
.btn, .chip, .barra nav a { transition: transform .15s, background .25s, color .25s, opacity .2s; }
@media (hover: hover) { .btn:hover { transform: translateY(-1px); } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }

@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes acercar { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes brillo { to { background-position: -300% 0; } }
@keyframes entrar { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes desde-der { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes desde-izq { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
