* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

:root {
  --crema: #F3EEE1;
  --tinta: #1F3E8C;
  --tinta-oscura: #16265C;
  --vino: #C21D0E;
  --texto: #2A2620;
}

@font-face {
  font-family: "Cooper Black";
  src: url("assets/CooperBlack.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cascadia Mono";
  src: url("assets/CascadiaMono.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

body {
  margin: 0;
  background: var(--crema);
  color: var(--texto);
  font-family: "Work Sans", sans-serif;
  line-height: 1.6;
}

h1, h2 {
  font-family: "Fraunces", serif;
  font-weight: 500;
  margin: 0;
}

.titulo-boda {
  font-family: "Cooper Black", "Bevan", serif;
  font-weight: 400;
  color: var(--vino) !important;
}

.subtitulo-mono {
  font-family: "Cascadia Mono", monospace;
  text-transform: uppercase;
  color: var(--tinta) !important;
}

.nombres-boda {
  font-family: "Cooper Black", "Bevan", serif;
  font-weight: 400;
  color: #000 !important;
}

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

/* ---------- Contraseña ---------- */

#candado {
  position: fixed;
  inset: 0;
  background: var(--crema);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.candado-caja { text-align: center; max-width: 340px; width: 100%; }

.candado-titulo {
  font-size: 32px;
}

.candado-sub {
  font-size: 20px;
  margin: 6px 0 32px;
}

#form-candado { display: flex; gap: 8px; }

#input-clave {
  flex: 1;
  padding: 13px 14px;
  border: 1.5px solid var(--tinta);
  border-radius: 6px;
  background: transparent;
  font-family: "Work Sans", sans-serif;
  font-size: 15px;
  color: var(--texto);
}

#input-clave:focus { outline: 2px solid var(--vino); outline-offset: 1px; }

#form-candado button {
  padding: 13px 22px;
  border: none;
  border-radius: 6px;
  background: var(--tinta);
  color: var(--crema);
  font-family: "Work Sans", sans-serif;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
}

#form-candado button:hover { background: var(--tinta-oscura); }

#candado-error {
  color: var(--vino);
  font-size: 13px;
  margin-top: 14px;
  visibility: hidden;
}

#candado-error.visible { visibility: visible; }

/* ---------- Navegación ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 36px;
  padding: 18px 20px;
  background: rgba(243, 238, 225, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(31, 62, 138, 0.15);
}

.nav a {
  color: var(--tinta);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.03em;
  font-weight: 500;
}

.nav a:hover { color: var(--vino); }

/* ---------- Hero ---------- */

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 24px 64px;
  text-align: center;
}

.hero-titulo {
  font-size: 72px;
  line-height: 1;
}

.hero-nombres {
  font-size: 24px;
  margin: 18px 0 4px;
}

.hero-lugar {
  font-size: 13px;
  letter-spacing: 0.14em;
  opacity: 0.85;
  margin: 0 0 40px;
}

.hero-foto {
  width: 100%;
  border-radius: 14px;
  margin-bottom: 32px;
}

.hero-mensaje {
  font-size: 17px;
  max-width: 440px;
  margin: 0 auto;
  opacity: 0.9;
}

/* ---------- Vídeos ---------- */

.videos {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 90px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.video-caja { text-align: center; }

.video-etiqueta {
  font-size: 28px;
  letter-spacing: 0.04em;
  margin: 0 0 16px;
}

.video-marco {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tinta-oscura);
}

.video-marco iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-alt {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--tinta);
  opacity: 0.7;
}

/* ---------- Grupos ---------- */

.grupos {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 24px 100px;
  text-align: center;
}

.grupos-titulo { font-size: 28px; letter-spacing: 0.02em; }

.grupos-sub { font-size: 15px; opacity: 0.75; margin: 8px 0 28px; }

.buscador {
  width: 100%;
  max-width: 360px;
  padding: 10px 4px;
  border: none;
  border-bottom: 1.5px solid var(--tinta);
  background: transparent;
  font-family: "Work Sans", sans-serif;
  font-size: 16px;
  color: var(--texto);
  text-align: center;
  margin-bottom: 44px;
}

.buscador:focus { outline: none; border-color: var(--vino); }

.grupos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 28px;
  text-align: left;
}

.grupo-tarjeta {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}

.grupo-foto {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 8px;
  background: var(--tinta-oscura);
}

.grupo-nombre {
  font-family: "Fraunces", serif;
  font-size: 18px;
  color: var(--tinta);
  margin-top: 12px;
}

.grupo-cuenta {
  font-size: 13px;
  color: var(--texto);
  opacity: 0.6;
  margin-top: 2px;
}

#sin-resultados { margin-top: 20px; opacity: 0.7; }

/* ---------- Lightbox ---------- */

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(22, 38, 92, 0.97);
  z-index: 90;
  overflow-y: auto;
  padding: 60px 24px;
}

#lightbox-cerrar {
  position: fixed;
  top: 20px;
  right: 24px;
  background: none;
  border: 1.5px solid var(--crema);
  color: var(--crema);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

#lightbox-titulo { color: var(--crema); text-align: center; font-size: 28px; margin-bottom: 28px; }

#lightbox-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.foto-celda {
  position: relative;
}

.foto-ver {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.foto-celda img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
}

.foto-descargar {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(22, 38, 92, 0.85);
  color: var(--crema);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.foto-descargar:hover { background: var(--vino); }

/* ---------- Visor de foto ampliada ---------- */

#visor {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 40, 0.98);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#visor[hidden] { display: none; }

#visor-img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 4px;
}

#visor-cerrar {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: 1.5px solid var(--crema);
  color: var(--crema);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

#visor-anterior, #visor-siguiente {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(243, 238, 225, 0.15);
  border: none;
  color: var(--crema);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

#visor-anterior:hover, #visor-siguiente:hover { background: rgba(243, 238, 225, 0.3); }

#visor-anterior { left: 16px; }
#visor-siguiente { right: 16px; }

.visor-barra {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 20px;
}

#visor-contador {
  color: var(--crema);
  font-family: "Work Sans", sans-serif;
  font-size: 14px;
  opacity: 0.8;
}

#visor-descargar {
  padding: 10px 18px;
  border-radius: 6px;
  border: none;
  background: var(--vino);
  color: var(--crema);
  font-family: "Work Sans", sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}

#visor-descargar:hover { background: #a01a0c; }

@media (max-width: 640px) {
  #visor-anterior, #visor-siguiente { width: 40px; height: 40px; font-size: 20px; }
  #visor-anterior { left: 6px; }
  #visor-siguiente { right: 6px; }
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .hero { padding: 48px 20px 40px; }
  .hero-titulo { font-size: 46px; }
  .nav { gap: 22px; padding: 14px 16px; }
  .videos { gap: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { scroll-behavior: auto !important; }
}
