:root {
  --cream: #F3EEE6;   /* fondo del diseño original */
  --beige: #E9E1D3;
  --olive: #6B7048;
  --ink: #3E4132;     /* tinta del diseño original */
  --taupe: #A89F8C;

  /* Ancho de la "tarjeta". Todos los elementos se escalan respecto al diseño original (1024 px). */
  --card: min(100vw, 760px);
  --k: calc(var(--card) / 1024);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
}

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

/* ---------- Save the Date ---------- */

.std {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.std__text { flex: none; }

.std__text {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--k) * 150) 16px calc(var(--k) * 70);
}
.std__text p, .std__title { margin: 0; }

.std__curve { position: absolute; pointer-events: none; }
.std__curve--tl { top: 0; left: 0; width: calc(var(--k) * 300); opacity: .9; }
.std__curve--br { display: none; }

.std__title img   { width: calc(var(--k) * 646); }
.std__rule        { width: calc(var(--k) * 258); margin: calc(var(--k) * 48) 0 calc(var(--k) * 34); }

.std__names {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: calc(var(--k) * 22);
}
.n-danny    { width: calc(var(--k) * 308); }
.n-amp      { width: calc(var(--k) * 46); margin-top: calc(var(--k) * 66); }
.n-andreina { width: calc(var(--k) * 390); margin-top: calc(var(--k) * 6); }

.std__date img { width: calc(var(--k) * 484); margin-top: calc(var(--k) * 40); }
.std__city img { width: calc(var(--k) * 288); margin-top: calc(var(--k) * 40); }

/* Botón RSVP en el lugar de "Más detalles pronto" */
.std__rsvp {
  font-family: inherit;
  background: transparent;
  cursor: pointer;
  margin-top: calc(var(--k) * 90);
  padding: .7em 2.2em .7em 2.5em;
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: max(14px, calc(var(--k) * 26));
  letter-spacing: .3em;
  transition: background .3s ease, color .3s ease;
}
.std__rsvp:hover,
.std__rsvp:focus-visible { background: var(--ink); color: var(--cream); outline: none; }

.std__heart { width: calc(var(--k) * 54); margin-top: calc(var(--k) * 50); }

/* ===== Tablet y pantallas grandes (por defecto): foto a todo el ancho, con scroll =====
   Alto >= 75% del ancho (foto 4:3): nunca se recorta arriba/abajo, la pareja sale entera. */
.std__photo {
  margin: 0;
  height: max(52svh, 75vw);
  position: relative;
}
.std__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 56% 50%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 22%);
}

/* ===== Móvil: pantalla fija, todo cabe sin scroll ===== */
@media (max-width: 767px), (orientation: landscape) and (max-height: 500px) {
  :root { --card: min(100vw, 760px, 52svh); }   /* el texto también se limita por el alto */
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .std { height: 100svh; min-height: 0; overflow: hidden; }

  /* La foto ocupa el resto de la pantalla; solo recorta lados o un poco de cielo */
  .std__photo {
    height: auto;
    flex: 1;
    min-height: 0;
    container-type: size;
    display: flex;
    justify-content: center;
  }
  .std__photo img {
    position: static;
    width: min(100cqw, 160cqh);
    height: 100cqh;
    object-position: 56% 85%;
  }
}

/* ---------- RSVP ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Popup (dialog nativo) */
.rsvp {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  padding: 44px 24px 36px;
  border: 1px solid var(--taupe);
  background: var(--cream);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 20px 60px rgba(40, 40, 30, .25);
}
.rsvp[open] { display: flex; flex-direction: column; align-items: center; }
.rsvp::backdrop { background: rgba(62, 65, 50, .45); backdrop-filter: blur(3px); }
.rsvp__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  outline: none;
}
.rsvp__close:focus-visible { color: var(--olive); text-decoration: underline; }
@media (prefers-reduced-motion: no-preference) {
  .rsvp[open] { animation: pop .35s ease both; }
  .rsvp[open]::backdrop { animation: fade .35s ease both; }
  @keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
}
.rsvp__heart { width: 28px; }
.rsvp__title {
  margin: 18px 0 36px;
  font-weight: 500;
  font-size: clamp(1rem, 4vw, 1.3rem);
  text-transform: uppercase;
  letter-spacing: .3em;
  padding-left: .3em;
}

.rsvp__step {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.rsvp__step[hidden] { display: none; }
.rsvp__lead { margin: 0; font-size: 1.1rem; line-height: 1.45; }

/* Lista del núcleo familiar */
.familia { list-style: none; margin: 0; padding: 0; text-align: left; }
.familia li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--beige);
}
.familia__nombre { font-size: 1.15rem; }
.choice--sm { flex: none; gap: 6px; }
.choice--sm label { flex: none; }
.choice--sm span { padding: 6px 14px; font-size: .95rem; min-width: 48px; text-align: center; }

.link {
  align-self: center;
  border: 0;
  background: none;
  font: inherit;
  font-size: .95rem;
  color: var(--taupe);
  text-decoration: underline;
  cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 1.05rem; }
.field input, .field select {
  font: inherit;
  font-size: 1.15rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--taupe);
  border-radius: 0;
  padding: 8px 2px;
  outline: none;
}
.field input::placeholder { color: var(--taupe); }
.field input:focus, .field select:focus { border-bottom-color: var(--ink); }

.choice { border: 0; margin: 0; padding: 0; display: flex; gap: 10px; }
.choice label { flex: 1; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span {
  display: block;
  padding: 12px 6px;
  border: 1px solid var(--taupe);
  font-size: 1.05rem;
  transition: background .25s, color .25s, border-color .25s;
}
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.choice input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 3px; }

.hp { position: absolute; left: -9999px; }

.btn {
  align-self: center;
  margin-top: 10px;
  padding: .75em 2.4em .75em 2.7em;
  font: inherit;
  font-weight: 500;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .3em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background .3s, color .3s;
}
.btn:hover, .btn:focus-visible { background: var(--ink); color: var(--cream); outline: none; }
.btn:disabled { opacity: .5; cursor: wait; }

.rsvp__error { margin: 0; color: #8a4b3c; font-size: 1rem; }
.rsvp__msg { margin: 0; font-size: 1.35rem; line-height: 1.5; }

/* ---------- Animación ---------- */
@media (prefers-reduced-motion: no-preference) {
  .std__text > :not(.std__curve) { animation: rise .9s ease both; }
  .std__rule   { animation-delay: .1s !important; }
  .std__names  { animation-delay: .2s !important; }
  .std__date   { animation-delay: .35s !important; }
  .std__city   { animation-delay: .45s !important; }
  .std__rsvp   { animation-delay: .6s !important; }
  .std__heart  { animation-delay: .75s !important; }
  .std__photo img { animation: fade 1.6s ease .4s both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
