/* ============================================================
   Boda Julio Roberto y Ana Margarita — Gutiérrez Arrivillaga
   Línea gráfica: blanco limpio, tinta sepia, dibujos a lápiz.
   ============================================================ */

:root {
  --paper:      #ffffff;
  --paper-warm: #faf7f2;
  --ink:        #34302b;   /* texto principal */
  --ink-soft:   #6f665c;   /* texto secundario */
  --muted:      #9a8f82;   /* etiquetas tenues */
  --sepia:      #9c8567;   /* acento (lápiz sepia) */
  --sepia-deep: #7d6647;
  --line:       #e7ddce;   /* hairlines */
  --line-soft:  #f0e9dd;

  --serif:  "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --script: "Tangerine", "Cormorant Garamond", cursive;

  --maxw: 1040px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

/* ---------- Reveal on scroll (progressive enhancement) ----------
   Por defecto todo es visible. Solo si JS está activo (html.js) se
   oculta para animar la entrada — así nunca queda una página en blanco. */
.reveal { opacity: 1; transform: none; }
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============ HERO ============ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px 48px;
  position: relative;
  background:
    radial-gradient(120% 80% at 50% 0%, #fffdfa 0%, var(--paper-warm) 60%, #f3ece1 100%);
}

.hero__inner { max-width: 760px; width: 100%; }

.hero__art {
  margin: 0 auto 26px;
  max-width: 320px;
}
.hero__art img {
  width: 100%;
  height: auto;
  margin: 0 auto;
  /* funde el papel del dibujo con el fondo blanco */
  mix-blend-mode: multiply;
  filter: saturate(0.92) contrast(1.02);
}

/* Verso (como en la invitación impresa) */
.invite__verse {
  margin: 0 auto 30px;
  color: var(--sepia-deep);
}
.invite__latin,
.invite__latin-es {
  font-style: italic;
  font-size: clamp(1.04rem, 2.5vw, 1.28rem);
  line-height: 1.45;
  margin: 0;
}
.invite__latin-es { color: var(--sepia); }

/* Padres de los novios, en dos columnas */
.invite__parents {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(26px, 9vw, 100px);
  margin: 0 auto 30px;
  font-family: var(--script);
  font-weight: 700;
  color: var(--ink);
}
.invite__parent {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.28;
  font-size: clamp(1.25rem, 3.4vw, 1.7rem);
}
.invite__parent .amp {
  color: var(--sepia);
  font-weight: 400;
  font-size: 0.78em;
  margin: 0.02em 0;
}

/* Línea de invitación */
.invite__intro {
  max-width: 640px;
  margin: 0 auto 6px;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 2.4vw, 1.24rem);
  line-height: 1.6;
}

/* Nombres de los novios (estructura en diagonal, como la imagen) */
.names {
  margin: 10px auto 4px;
  font-family: var(--script);
  font-weight: 700;
  line-height: 0.96;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  width: min(620px, 96%);
}
.names__a { font-size: clamp(2.8rem, 11vw, 5.4rem); align-self: flex-start; }
.names__b { font-size: clamp(2.8rem, 11vw, 5.4rem); align-self: flex-end; }
.names__amp {
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--sepia);
  font-weight: 400;
  align-self: center;
  margin: 0.04em 0;
}

/* Fecha y lugar */
.invite__when {
  margin-top: 30px;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 2.4vw, 1.24rem);
  line-height: 1.7;
}
.invite__when p { margin: 3px 0; }

/* ============ SECCIONES COMUNES ============ */
section { padding: 92px 24px; }

.section__script {
  font-family: var(--script);
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 5rem);
  line-height: 1;
  text-align: center;
  color: var(--sepia-deep);
  margin: 0 0 40px;
}

/* ============ VERSÍCULO ============ */
.verse {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.verse__latin {
  font-style: italic;
  color: var(--sepia);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  margin: 0 0 28px;
}
.verse__text {
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 24px;
}
.verse__ref {
  font-size: 0.8rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.verse::before {
  content: "";
  display: block;
  width: 40px; height: 1px;
  background: var(--sepia);
  margin: 0 auto 40px;
}

/* ============ CUENTA REGRESIVA ============ */
.countdown { background: var(--paper-warm); }
.countdown__grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(18px, 6vw, 56px);
  max-width: 720px;
  margin: 0 auto;
}
.cd__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}
.cd__num {
  font-size: clamp(2.6rem, 8vw, 4rem);
  line-height: 1;
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.cd__lbl {
  margin-top: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}
.cd__married {
  font-family: var(--script);
  font-weight: 700;
  font-size: clamp(2.6rem, 8vw, 4rem);
  color: var(--sepia-deep);
  margin: 0;
}

/* Marco de respaldo mientras no estén los dibujos definitivos */
.art-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--paper-warm);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 28px 18px;
  line-height: 1.6;
}
.hero__art .art-placeholder { aspect-ratio: 3 / 4; }
.event__divider .art-placeholder { width: 150px; aspect-ratio: 3 / 4; }

/* ============ EVENTOS ============ */
.events {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(24px, 5vw, 60px);
}
.event { text-align: center; }
.event__tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--sepia);
  margin-bottom: 16px;
}
.event__title {
  font-family: var(--script);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  line-height: 1;
  margin: 0 0 14px;
  color: var(--ink);
}
.event__time {
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  margin: 0 0 18px;
  color: var(--sepia-deep);
}
.event__place {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 6px;
}
.event__addr {
  color: var(--ink-soft);
  font-size: 1.02rem;
  margin: 0 0 24px;
  line-height: 1.5;
}
.event__divider {
  width: 1px;
  align-self: stretch;
  justify-self: center;
  position: relative;
  display: flex;
  align-items: center;
}
.event__divider img {
  width: 150px;
  opacity: 0.92;
  mix-blend-mode: multiply;
  filter: saturate(0.9);
}

/* ============ BOTONES ============ */
.btn {
  display: inline-block;
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: 13px 30px;
  border: 1px solid var(--sepia);
  background: transparent;
  cursor: pointer;
  transition: background .35s ease, color .35s ease;
}
.btn:hover { background: var(--sepia); color: #fff; }
.btn--solid {
  background: var(--sepia-deep);
  border-color: var(--sepia-deep);
  color: #fff;
  width: 100%;
  padding: 16px;
}
.btn--solid:hover { background: var(--ink); border-color: var(--ink); }
.btn--solid:disabled { opacity: .5; cursor: default; }

/* ============ RSVP ============ */
.rsvp {
  background:
    radial-gradient(120% 90% at 50% 100%, #fffdfa 0%, var(--paper-warm) 70%, #f1e9dc 100%);
}
.rsvp__head { text-align: center; max-width: 620px; margin: 0 auto 44px; }
.rsvp__sub { color: var(--ink-soft); font-size: 1.08rem; margin: 0; }

.rsvp__form {
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  padding: 40px clamp(22px, 5vw, 40px);
  box-shadow: 0 24px 60px -40px rgba(124, 102, 71, .45);
}
.field { margin-bottom: 24px; }
.field label,
.field__label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}
.field .opt { text-transform: none; letter-spacing: 0; font-style: italic; }

input[type="text"],
select,
textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--paper-warm);
  border: 1px solid var(--line);
  padding: 12px 14px;
  outline: none;
  transition: border-color .25s ease, background .25s ease;
}
input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--sepia);
  background: #fff;
}
textarea { resize: vertical; }

.companion-input { margin-bottom: 10px; }
.companion-input:last-child { margin-bottom: 0; }

.radios {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  padding-top: 2px;
}
.radios label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 1.06rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin: 0;
  cursor: pointer;
}
.radios input { accent-color: var(--sepia-deep); width: 17px; height: 17px; }

.rsvp__status {
  text-align: center;
  margin: 18px 0 0;
  font-style: italic;
  font-size: 1.05rem;
  min-height: 1.4em;
}
.rsvp__status.ok  { color: var(--sepia-deep); }
.rsvp__status.err { color: #b4533f; }

/* ============ REGALOS ============ */
.gifts {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}
.gifts__icon {
  color: var(--sepia);
  margin-bottom: 14px;
}
.gifts .section__script { margin-bottom: 22px; }
.gifts__text {
  font-size: 1.18rem;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0 0 18px;
}
.gifts__text strong { color: var(--sepia-deep); font-weight: 600; }
.gifts__verse {
  font-style: italic;
  color: var(--sepia);
  font-size: 1.05rem;
  margin: 0;
}

/* ============ BOTÓN WHATSAPP + DIVISOR ============ */
.rsvp__or {
  display: flex;
  align-items: center;
  text-align: center;
  max-width: 480px;
  margin: 24px auto 22px;
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.rsvp__or::before,
.rsvp__or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.rsvp__or span { padding: 0 16px; }

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  max-width: 480px;
  margin: 0 auto;
  padding: 15px 24px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow: 0 12px 26px -14px rgba(37, 211, 102, .9);
  transition: background .3s ease, transform .2s ease;
}
.btn-whatsapp:hover { background: #1ebe5b; transform: translateY(-2px); }
.btn-whatsapp svg { flex: none; }

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 80px 24px 70px;
  background: var(--ink);
  color: #efe7da;
}
.footer__script {
  font-family: var(--script);
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 4.6rem);
  margin: 0 0 14px;
  color: #f3ece0;
}
.footer__names {
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
}
.footer__date {
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  color: #b6a892;
  margin: 0;
  padding-left: 0.4em;
}

/* ============ GALERÍA ============ */
.gallery { background: var(--paper); }
.gallery__head { text-align: center; margin-bottom: 18px; }
.gallery__head .verse__latin { margin-bottom: 8px; }
.gallery__head .section__script { margin-bottom: 0; }

.gallery__grid {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.gallery__item {
  margin: 0;
  overflow: hidden;
  background: var(--paper-warm);
  border: 1px solid var(--line-soft);
  cursor: pointer;
}
.gallery__item img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  transition: transform .8s ease, filter .8s ease;
}
.gallery__item:hover img { transform: scale(1.04); filter: brightness(1.02); }

/* La 3.ª foto ocupa su propia fila, centrada (sin espacio en blanco) */
.gallery__item:nth-child(3) {
  grid-column: 1 / -1;
  width: calc(50% - 8px);
  justify-self: center;
}

@media (max-width: 540px) {
  .gallery__grid { grid-template-columns: 1fr; max-width: 360px; }
  .gallery__item:nth-child(3) { grid-column: auto; width: 100%; }
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(38, 34, 30, .92);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
  padding: 24px;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__img {
  max-width: min(92vw, 760px);
  max-height: 86vh;
  width: auto;
  height: auto;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
  border: 4px solid #fff;
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  background: none;
  border: 0;
  color: #f3ece0;
  cursor: pointer;
  line-height: 1;
  transition: color .25s ease, transform .25s ease;
}
.lightbox__close {
  top: 22px; right: 26px;
  font-size: 2.6rem;
}
.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3.4rem;
  padding: 10px 18px;
}
.lightbox__prev { left: 8px; }
.lightbox__next { right: 8px; }
.lightbox__close:hover,
.lightbox__nav:hover { color: #fff; }
.lightbox__prev:hover { transform: translateY(-50%) translateX(-3px); }
.lightbox__next:hover { transform: translateY(-50%) translateX(3px); }

@media (max-width: 540px) {
  .lightbox__nav { font-size: 2.4rem; padding: 8px 10px; }
  .lightbox__close { font-size: 2.2rem; top: 14px; right: 16px; }
}

/* ============ INTRO · SOBRE QUE SE ABRE ============ */
/* Sin JS no se muestra el overlay (el sitio queda accesible). */
.intro { display: none; }
.js .intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(125% 90% at 50% 28%, #fffdf9 0%, #f4ecdb 62%, #e9d9c8 100%);
  background: radial-gradient(125% 90% at 50% 28%, #fffdf9 0%, #f4ecdb 62%, #e9ddc8 100%);
  transition: opacity 1s ease, visibility 1s ease;
}
.intro.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.intro-active { overflow: hidden; }

.intro__scene {
  perspective: 1500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.envelope {
  --w: clamp(290px, 84vw, 460px);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 0.66);
  transform-style: preserve-3d;
}

/* Forro interior con la iglesia */
.envelope__liner {
  position: absolute; inset: 0;
  background: #f6efe1;
  overflow: hidden;
  z-index: 1;
}
.envelope__liner img {
  position: absolute; left: 50%; top: 5%;
  width: 82%;
  transform: translateX(-50%);
  mix-blend-mode: multiply;
  opacity: .98;
}

/* Solapas del sobre — el punto de unión está en (50%, 55%).
   Las laterales e inferior son fijas; la superior se abre. */
.flap {
  position: absolute;
  inset: 0;
}
.flap--bottom {
  background: linear-gradient(180deg, #efe5d2 0%, #e6d9c1 100%);
  clip-path: polygon(0 100%, 100% 100%, 50% 55%);
  z-index: 4;
  filter: drop-shadow(0 -2px 3px rgba(124, 102, 71, .10));
}
.flap--left {
  background: linear-gradient(95deg, #f1e7d4 0%, #e7dbc4 100%);
  clip-path: polygon(0 0, 0 100%, 50% 55%);
  z-index: 3;
  filter: drop-shadow(2px 0 3px rgba(124, 102, 71, .08));
}
.flap--right {
  background: linear-gradient(265deg, #f1e7d4 0%, #e7dbc4 100%);
  clip-path: polygon(100% 0, 100% 100%, 50% 55%);
  z-index: 3;
  filter: drop-shadow(-2px 0 3px rgba(124, 102, 71, .08));
}
.flap--top {
  background: linear-gradient(180deg, #f2e8d6 0%, #e8dcc5 100%);
  clip-path: polygon(0 0, 100% 0, 50% 55%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform .95s ease, z-index 0s linear .5s;
  z-index: 6;
  filter: drop-shadow(0 4px 5px rgba(124, 102, 71, .16));
}

/* Sello de cera dorado */
.envelope__seal {
  position: absolute;
  top: 55%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(70px, 18vw, 92px);
  height: clamp(70px, 18vw, 92px);
  z-index: 7;
  border: 0;
  cursor: pointer;
  padding: 0;
  border-radius: 48% 52% 51% 49% / 52% 49% 51% 48%;
  background:
    radial-gradient(circle at 36% 30%, #e7c578 0%, #c9983f 48%, #9a6e2b 78%, #7c5621 100%);
  box-shadow:
    0 7px 16px -5px rgba(70, 48, 12, .65),
    inset 0 2px 5px rgba(255, 238, 190, .55),
    inset 0 -5px 10px rgba(70, 45, 10, .5);
  display: flex; align-items: center; justify-content: center;
  transition: transform .55s ease, opacity .55s ease;
  animation: sealPulse 2.6s ease-in-out infinite;
}
.envelope__seal span {
  font-family: var(--script);
  font-weight: 700;
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  line-height: 1;
  color: #6f4f1b;
  display: inline-flex;
  align-items: center;
  text-shadow: 0 1px 0 rgba(255, 240, 200, .5), 0 -1px 1px rgba(60, 40, 8, .55);
}
.envelope__seal i { font-size: .5em; font-style: normal; margin: 0 2px; opacity: .85; }
@keyframes sealPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.06); }
}

/* ---- Estado ABIERTO ---- */
.intro.is-open .flap--top {
  transform: rotateX(178deg);
  z-index: 1;
  transition: transform .95s ease, z-index 0s linear .45s;
}
.intro.is-open .envelope__seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.35);
  pointer-events: none;
  animation: none;
}

.intro__hint {
  margin: 34px 0 0;
  font-size: .76rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity .5s ease;
}
.intro.is-open .intro__hint { opacity: 0; }
.intro__skip {
  margin-top: 16px;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--serif);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--sepia);
  text-decoration: underline;
  text-underline-offset: 4px;
  opacity: .75;
  transition: opacity .3s ease;
}
.intro__skip:hover { opacity: 1; }
.intro.is-open .intro__skip { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .envelope__seal { animation: none; }
  .flap--top { transition: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  body { font-size: 18px; }
  section { padding: 72px 22px; }
  .events {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .event__divider {
    width: auto;
    height: auto;
    padding: 14px 0;
  }
  .event__divider img { width: 120px; margin: 0 auto; }
  .event:first-child { padding-bottom: 8px; }
}
