/* ==========================================================================
   DESIGN TOKENS — lo único que hay que tocar para aplicar el diseño final
   ========================================================================== */
:root {
  color-scheme: light;

  /* Paleta provisoria (reemplazar por la de la diseñadora) */
  --color-bg: #faf7f2;
  --color-surface: #fffdf9;
  --color-band: #eeeadf;
  --color-ink: #2f2a26;
  --color-muted: #6f665e;
  --color-accent: #6e7b5c;
  --color-accent-ink: #ffffff;
  --color-line: rgb(47 42 38 / 0.18);
  --color-danger: #a4402f;
  --color-placeholder: rgb(110 123 92 / 0.08);

  /* Tipografías provisorias */
  --font-script: "Pinyon Script", cursive;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Jost", system-ui, sans-serif;

  /* Escala fluida */
  --text-sm: clamp(0.875rem, 0.84rem + 0.15vw, 0.95rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --text-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-script: clamp(2.5rem, 1.8rem + 3.2vw, 4.25rem);
  --text-names: clamp(3.5rem, 2.2rem + 6vw, 7rem);

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: clamp(2.5rem, 2rem + 2vw, 4rem);
  --space-xl: clamp(4rem, 3rem + 5vw, 7.5rem);

  --radius: 999px;
  --radius-card: 4px;
  --content-width: 42rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { text-wrap: balance; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: var(--space-sm); top: -4rem; z-index: 10;
  padding: 0.5rem 1rem; background: var(--color-ink); color: var(--color-bg);
}
.skip-link:focus { top: var(--space-sm); }

.muted { color: var(--color-muted); font-size: var(--text-sm); }

/* ==========================================================================
   SECCIONES
   ========================================================================== */
main > section {
  padding: var(--space-xl) max(1rem, env(safe-area-inset-left));
  text-align: center;
}
main > section > * { margin-inline: auto; max-width: var(--content-width); }

.band { background: var(--color-band); }

.script-title {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: var(--text-script);
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.eyebrow {
  font-size: var(--text-sm);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-xs);
}

/* Hero */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-md);
  position: relative;
}
.hero__kicker { max-width: 22rem !important; color: var(--color-muted); }
.hero__names {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: var(--text-names);
  line-height: 1;
}
.hero__amp { font-size: 0.6em; color: var(--color-accent); }
.hero__date {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  letter-spacing: 0.3em;
}
.scroll-hint {
  position: absolute; bottom: var(--space-md); left: 50%; translate: -50% 0;
  color: var(--color-muted);
  animation: bob 2.4s var(--ease) infinite;
}
@keyframes bob { 50% { translate: -50% 6px; } }

/* Countdown */
.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  max-width: 28rem !important;
  margin-bottom: var(--space-lg);
}
.countdown__unit span {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 1.5rem + 2.5vw, 3.25rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown__unit small {
  font-size: var(--text-sm); letter-spacing: 0.15em; text-transform: uppercase; color: var(--color-muted);
}
.countdown__message { font-family: var(--font-serif); font-size: var(--text-lg); margin-bottom: var(--space-lg); }


/* Foto de fondo + tarjeta */
.photo-section { position: relative; isolation: isolate; }
.photo-section > .placeholder--photo { position: absolute; inset: 0; max-width: none; z-index: -1; }
.card {
  background: var(--color-surface);
  padding: var(--space-lg) var(--space-md);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 60px -30px rgb(47 42 38 / 0.35);
  display: grid; gap: var(--space-sm); justify-items: center;
  max-width: 32rem !important;
}
.card .script-title { margin-bottom: 0; }
address { font-style: normal; }

/* Cronograma: vertical en mobile, horizontal cuando hay espacio */
.timeline-section { container-type: inline-size; }
.timeline {
  list-style: none; padding: 0;
  display: grid; gap: var(--space-lg);
  max-width: 56rem !important;
}
@container (min-width: 640px) {
  .timeline { grid-template-columns: repeat(3, 1fr); }
}
.timeline__item { display: grid; justify-items: center; gap: 0.25rem; }
.timeline__item time, .timeline__time {
  font-family: var(--font-serif); font-size: var(--text-lg); margin-top: var(--space-xs);
}
.timeline__item h3 { font-family: var(--font-script); font-weight: 400; font-size: clamp(2rem, 1.6rem + 1.5vw, 2.75rem); line-height: 1.1; }
.timeline__item p { color: var(--color-muted); }

/* Regalos */
.accounts { display: grid; gap: var(--space-sm); }
.account dt { font-size: var(--text-sm); color: var(--color-muted); }
.account dd { display: flex; gap: var(--space-xs); justify-content: center; align-items: center; font-variant-numeric: tabular-nums; }
.copy-btn {
  border: 1px solid var(--color-line); background: transparent; border-radius: var(--radius);
  padding: 0.15rem 0.75rem; font-size: 0.8rem; cursor: pointer;
}

/* RSVP */
.rsvp-section p { margin-bottom: var(--space-md); }

/* Cierre */
.closing { padding-bottom: 0 !important; }

/* ==========================================================================
   PLACEHOLDERS de ilustraciones/fotos (se borran al integrar el diseño)
   ========================================================================== */
.placeholder {
  display: grid; place-items: center;
  width: 100%;
  border: 1px dashed var(--color-line);
  background: var(--color-placeholder);
  color: var(--color-muted);
  font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: var(--radius-card);
}
.placeholder--frame { height: 5rem; }
.placeholder--hero { aspect-ratio: 16 / 7; max-width: 48rem !important; }
.placeholder--photo { border: 0; border-radius: 0; background: linear-gradient(160deg, #cfd3c4, #a9b097); color: rgb(255 255 255 / 0.8); place-items: start center; padding-top: var(--space-sm); }
.placeholder--icon { width: 8rem; aspect-ratio: 1; }
.placeholder--footer { aspect-ratio: 16 / 5; max-width: none !important; margin-top: var(--space-lg); }

/* ==========================================================================
   BOTONES
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--color-ink);
  border-radius: var(--radius);
  background: transparent;
  font-size: var(--text-sm);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:hover { background: var(--color-ink); color: var(--color-bg); }
.btn:active { transform: scale(0.98); }
.btn--ghost { border-color: var(--color-line); }
.btn--primary { background: var(--color-ink); color: var(--color-bg); border-color: var(--color-ink); }
.btn--primary:hover { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.btn--lg { min-height: 3.25rem; padding-inline: 2.25rem; }
.btn--block { width: 100%; }

.link-btn {
  background: none; border: 0; padding: 0.5rem; cursor: pointer;
  color: var(--color-muted); text-decoration: underline; text-underline-offset: 3px;
  font-size: var(--text-sm);
}

.spinner {
  display: none; width: 1rem; height: 1rem;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn[aria-busy="true"] { pointer-events: none; opacity: 0.85; }
.btn[aria-busy="true"] .spinner { display: inline-block; }
@keyframes spin { to { rotate: 360deg; } }

/* ==========================================================================
   DIÁLOGO / FORMULARIO
   ========================================================================== */
.dialog {
  width: min(100% - 2rem, 34rem);
  max-height: min(100dvh - 2rem, 52rem);
  margin: auto;
  padding: var(--space-lg) var(--space-md) var(--space-md);
  border: 0;
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.35);
  overscroll-behavior: contain;

  opacity: 0; translate: 0 16px;
  transition: opacity 0.3s var(--ease), translate 0.3s var(--ease), overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}
.dialog[open] { opacity: 1; translate: 0 0; }
@starting-style { .dialog[open] { opacity: 0; translate: 0 16px; } }
.dialog::backdrop {
  background: rgb(47 42 38 / 0); backdrop-filter: blur(0);
  transition: background-color 0.3s, backdrop-filter 0.3s, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}
.dialog[open]::backdrop { background: rgb(47 42 38 / 0.45); backdrop-filter: blur(3px); }
@starting-style { .dialog[open]::backdrop { background: rgb(47 42 38 / 0); backdrop-filter: blur(0); } }

/* En mobile: hoja a pantalla completa */
@media (max-width: 540px) {
  .dialog {
    width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh;
    border-radius: 0;
    padding-top: calc(var(--space-lg) + env(safe-area-inset-top));
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }
}
body:has(.dialog[open]) { overflow: hidden; }

.dialog__close {
  position: absolute; top: calc(0.75rem + env(safe-area-inset-top)); right: 0.75rem;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  background: none; border: 0; border-radius: 50%; cursor: pointer; color: var(--color-muted);
}
.dialog__close:hover { background: var(--color-placeholder); color: var(--color-ink); }
.dialog__title { font-family: var(--font-script); font-weight: 400; font-size: clamp(2.25rem, 1.8rem + 2vw, 3rem); line-height: 1.1; text-align: center; margin-bottom: var(--space-sm); }

.notice {
  font-size: var(--text-sm); color: var(--color-muted); text-align: center;
  padding: 0.75rem 1rem; background: var(--color-bg); border-radius: 8px;
  margin-bottom: var(--space-md);
}

#rsvp-form { display: grid; gap: var(--space-md); }
.field { display: grid; gap: 0.4rem; border: 0; padding: 0; min-width: 0; }
.field-row { display: grid; gap: var(--space-md); }
@media (min-width: 480px) { .field-row { grid-template-columns: 1fr 1fr; } }

label, legend { font-size: var(--text-sm); font-weight: 400; }
legend { margin-bottom: 0.4rem; padding: 0; }
.optional { color: var(--color-muted); }

input[type="text"] {
  width: 100%; min-height: 3rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--color-line); border-radius: 10px;
  background: var(--color-bg);
  font-size: 16px; /* evita el zoom automático en iOS */
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgb(110 123 92 / 0.2); }
input[aria-invalid="true"] { border-color: var(--color-danger); }
input::placeholder { color: var(--color-muted); opacity: 0.7; }

.field__error { color: var(--color-danger); font-size: 0.85rem; min-height: 0; }
.field__error:empty { display: none; }

/* Opciones Sí/No como tarjetas grandes y tocables */
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.choice-card, .chip { position: relative; cursor: pointer; }
.choice-card input, .chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice-card span {
  display: grid; place-items: center; min-height: 3.5rem; padding: 0.5rem;
  border: 1px solid var(--color-line); border-radius: 10px; text-align: center;
  transition: all 0.2s var(--ease);
}
.choice-card input:checked + span { border-color: var(--color-ink); background: var(--color-ink); color: var(--color-bg); }
.choice-card input:focus-visible + span, .chip input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip span {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.4rem 1rem;
  border: 1px solid var(--color-line); border-radius: var(--radius);
  font-size: var(--text-sm);
  transition: all 0.2s var(--ease);
}
.chip--wide span { width: 100%; justify-content: center; }
.chip input:checked + span { border-color: var(--color-accent); background: var(--color-accent); color: var(--color-accent-ink); }

[data-if-attending]:not([hidden]) { display: grid; gap: var(--space-md); animation: fade-in 0.35s var(--ease); }
@keyframes fade-in { from { opacity: 0; translate: 0 -6px; } }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.turnstile:empty { display: none; }
.turnstile { display: flex; justify-content: center; }

.form-error { color: var(--color-danger); font-size: var(--text-sm); text-align: center; }

.success { display: grid; justify-items: center; gap: var(--space-sm); text-align: center; padding-block: var(--space-md); outline: none; }
.success__icon { color: var(--color-accent); }
.success__actions { display: grid; justify-items: center; gap: 0.25rem; margin-top: var(--space-sm); }

/* Toast (p. ej. "Copiado") */
.toast {
  position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom)); translate: -50% 1rem;
  padding: 0.6rem 1.25rem; border-radius: var(--radius);
  background: var(--color-ink); color: var(--color-bg); font-size: var(--text-sm);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, translate 0.25s var(--ease);
}
.toast.is-visible { opacity: 1; translate: -50% 0; }

/* ==========================================================================
   ANIMACIONES AL SCROLLEAR (sin JS; respeta reduced-motion)
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
    @keyframes reveal { from { opacity: 0; translate: 0 24px; } }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
