/* =============================================================================
   Invitación web (extra de pago). Se aplica sobre rsvp.html cuando la boda la tiene activa.

   Dos capas independientes que la pareja combina:
   - Diseño (.tpl-*): fondo, ornamentos y marco de la portada.
   - Color  (.color-*): el acento (títulos pequeños, botones, ornamentos, cuenta regresiva).
   Ambas redefinen los tokens de styles.css, así el formulario de confirmación toma el mismo estilo.
   Contraste verificado: texto de acento ≥ 4.5:1 sobre los fondos; texto blanco en botones ≥ 3:1.
   ============================================================================= */

/* ------------------------------ Diseños ------------------------------ */

/* Clásica: marfil, marco fino doble y ornamento de rombo. Color propio: dorado. */
.tpl-elegant {
  --bg: #fbf8f2;
  --surface: #fffdf9;
  --ink: #2a2a33;
  --muted: #776f62;
  --line: #e9e1d2;
  --line-strong: #d8ccb6;
  --accent: #a8875a;
  --accent-strong: #76592f;
  --accent-ink: #ffffff;
  --accent-soft: #f3ece0;
}

/* Jardín: blanco, hojas en las esquinas de la portada. Color propio: salvia. */
.tpl-garden {
  --bg: #fafbf8;
  --surface: #ffffff;
  --ink: #2c3330;
  --muted: #6f7b75;
  --line: #e1e8e3;
  --line-strong: #cbd7ce;
  --accent: #6f8f7a;
  --accent-strong: #4f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e9f0eb;
}

/* ------------------------------ Colores ------------------------------
   Van después de los diseños para que el color elegido gane sobre el color propio del diseño. */

.color-salvia { --accent: #6f8f7a; --accent-strong: #4f6f5c; --accent-soft: #e9f0eb; }
.color-eucalipto { --accent: #5f8d8b; --accent-strong: #3f6b69; --accent-soft: #e6f0ef; }
.color-azul { --accent: #6a7db0; --accent-strong: #4b5e91; --accent-soft: #e8ecf7; }
.color-lavanda { --accent: #8a7fb5; --accent-strong: #665b93; --accent-soft: #eeebf6; }
.color-rosa { --accent: #b47880; --accent-strong: #8e5862; --accent-soft: #f6e9ea; }
.color-terracota { --accent: #c27a5a; --accent-strong: #8f4f33; --accent-soft: #f6e8e1; }
.color-dorado { --accent: #a8875a; --accent-strong: #76592f; --accent-soft: #f3ece0; }
.color-borgona { --accent: #8e3b4a; --accent-strong: #6e2a37; --accent-soft: #f3e3e6; }

/* ------------------------------ Página ------------------------------ */

.inv-page {
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(130% 55% at 50% 0%, var(--accent-soft) 0%, var(--bg) 60%) no-repeat, var(--bg);
}

.inv {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.preview-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: -24px -16px 0;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.86rem;
  text-align: center;
}

/* ------------------------------ Portada ------------------------------ */

.inv-hero {
  position: relative;
  text-align: center;
  padding: 56px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-radius: 4px;
}

/* Clásica: marco fino doble. */
.tpl-elegant .inv-hero {
  border: 1px solid var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: -8px;
}

/* Jardín: ramas de hojas en dos esquinas (SVG insertado por rsvp.js). */
.tpl-garden .inv-hero {
  border: 1px solid var(--line);
  border-radius: 24px;
}

.corner {
  position: absolute;
  width: 110px;
  height: 110px;
  color: var(--accent);
  opacity: 0.85;
  pointer-events: none;
}

.corner.top-left {
  top: 10px;
  left: 10px;
}

.corner.bottom-right {
  right: 10px;
  bottom: 10px;
  transform: rotate(180deg);
}

/* Foto de portada: arriba de los nombres, dentro del marco. */
.inv-cover {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  margin-bottom: 12px;
}

.tpl-elegant .inv-cover {
  border-radius: 2px;
}

.tpl-garden .inv-cover {
  border-radius: 16px;
}

/* Con portada, el marco de la portada empieza más arriba. */
.inv-hero.has-cover {
  padding-top: 24px;
}

/* Las hojas de Jardín no deben tapar la foto. */
.inv-hero.has-cover .corner.top-left {
  display: none;
}

.inv-eyebrow {
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.inv-names {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(3rem, 13vw, 5.2rem);
  line-height: 0.95;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.inv-names .connector {
  font-style: italic;
  font-size: 0.55em;
  color: var(--accent);
  margin: 6px 0;
}

.inv-date {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 500;
}

.inv-for {
  font-size: 0.92rem;
  color: var(--muted);
}

.inv-for b {
  color: var(--ink);
  font-weight: 600;
}

.ornament {
  width: 160px;
  height: 24px;
  margin: 0 auto;
  color: var(--accent);
}

.ornament svg,
.corner svg,
.inv-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ------------------------------ Cuenta regresiva ------------------------------ */

.countdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(330px, 100%);
}

.countdown div {
  padding: 12px 6px 10px;
  border-radius: 14px;
  background: var(--accent-soft);
}

/* Números alineados: la letra con serifa usa por defecto números "antiguos" que suben y bajan. */
.countdown b {
  display: block;
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--accent-strong);
  font-variant-numeric: lining-nums tabular-nums;
}

.countdown span {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.countdown-note {
  font-family: var(--display);
  font-size: 1.5rem;
  color: var(--accent-strong);
}

/* ------------------------------ Secciones ------------------------------ */

.inv-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.inv-section-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 2.1rem;
  text-align: center;
  line-height: 1.1;
}

.inv-message {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.45;
  text-align: center;
  white-space: pre-line;
  max-width: 34ch;
  margin: 0 auto;
}

.inv-places,
.inv-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.inv-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(42, 42, 51, 0.03), 0 10px 28px rgba(42, 42, 51, 0.05);
}

.inv-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
  margin-bottom: 2px;
}

.inv-label {
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.inv-place {
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.15;
}

.inv-time {
  font-size: 1.05rem;
  font-weight: 600;
}

.inv-address {
  color: var(--muted);
  font-size: 0.92rem;
}

.inv-details p {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.inv-details a {
  color: var(--accent-strong);
  font-weight: 600;
}

/* Galería */
.inv-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.inv-thumb {
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--accent-soft);
  cursor: zoom-in;
}

.inv-thumb:hover {
  background: var(--accent-soft);
}

.inv-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.inv-thumb:hover img {
  transform: scale(1.03);
}

/* Vista ampliada */
.lightbox {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(20, 20, 24, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox[open] {
  display: flex;
}

.lightbox::backdrop {
  background: rgba(20, 20, 24, 0.94);
}

.lightbox-image {
  max-width: calc(100% - 120px);
  max-height: 86vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-nav,
.lightbox-close {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox-nav:hover,
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-nav.prev {
  left: 12px;
}

.lightbox-nav.next {
  right: 12px;
}

.lightbox-close {
  top: 12px;
  right: 12px;
}

.lightbox-counter {
  position: absolute;
  bottom: 16px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

@media (max-width: 520px) {
  .lightbox-image {
    max-width: 100%;
  }

  .lightbox-nav {
    top: auto;
    bottom: 10px;
  }

  .lightbox-counter {
    bottom: 24px;
  }
}

/* Mesa de regalos y código de vestimenta */
.inv-gift-message {
  text-align: center;
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0 auto;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.inv-gift-message a {
  color: var(--accent-strong);
  font-weight: 600;
}

.gift-card {
  gap: 12px;
}

.gift-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gift-value {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

/* Enlaces con aspecto de botón (Cómo llegar, calendario). */
.inv-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.inv-link:hover {
  background: var(--accent-soft);
}

.inv-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.inv-center {
  display: flex;
  justify-content: center;
}

/* ------------------------------ Confirmación y cierre ------------------------------ */

.inv-rsvp-note {
  text-align: center;
  color: var(--muted);
  margin-top: -10px;
}

.inv-rsvp .card {
  box-shadow: 0 1px 2px rgba(42, 42, 51, 0.03), 0 10px 28px rgba(42, 42, 51, 0.05);
}

.inv-rsvp form button[type="submit"] {
  margin-top: 12px;
}

.inv-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--muted);
}

.inv-footer b {
  color: var(--ink);
  font-size: 1.9rem;
  font-weight: 600;
}

/* ------------------------------ Celular ------------------------------ */

@media (max-width: 520px) {
  .inv-hero {
    padding: 48px 18px 40px;
  }

  .corner {
    width: 78px;
    height: 78px;
  }

  .inv-section-title {
    font-size: 1.8rem;
  }
}

/* ------------------------------ Entrada suave ------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .inv-hero > :not(.corner) {
    animation: rise 0.8s ease both;
  }

  .inv-hero > :nth-child(3) {
    animation-delay: 0.08s;
  }

  .inv-hero > :nth-child(4) {
    animation-delay: 0.16s;
  }

  .inv-hero > :nth-child(n + 5) {
    animation-delay: 0.24s;
  }

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