/* ==========================================================================
   Promesa — una carta de amor para cada invitado. Mobile-first.
   Plantilla Premium: saludo personal escrito a mano, historia, el día y RSVP tipo chat.
   ========================================================================== */

/* ---------- Temas ---------- */
:root, :root[data-theme="marfil"] {
  --c-bg: #f6f1e8; --c-surface: #fffcf6; --c-ink: #2a2420; --c-muted: #6f645a; --c-line: rgba(42, 36, 32, .14);
  --c-accent: #a8834a; --c-accent-ink: #fffcf6; --c-gold-1: #8a6a36; --c-gold-2: #d8b77a; --c-gold-3: #f3e2b8;
  --c-hero-ink: #fffaf0;
  --f-display: "Cormorant Garamond", Georgia, serif; --f-script: "Pinyon Script", cursive; --f-body: "Jost", system-ui, sans-serif;
}
:root[data-theme="noche"] {
  --c-bg: #11141c; --c-surface: #181c27; --c-ink: #efe7d8; --c-muted: #a9a196; --c-line: rgba(239, 231, 216, .14);
  --c-accent: #c9a96e; --c-accent-ink: #11141c; --c-gold-1: #9c7b45; --c-gold-2: #e2c48d; --c-gold-3: #fff0c8;
  --c-hero-ink: #fff8ea;
  --f-display: "Bodoni Moda", Georgia, serif; --f-script: "Great Vibes", cursive; --f-body: "Manrope", system-ui, sans-serif;
}
:root[data-theme="salvia"] {
  --c-bg: #eef0e7; --c-surface: #f8f9f3; --c-ink: #243026; --c-muted: #5f6b5f; --c-line: rgba(36, 48, 38, .14);
  --c-accent: #6f8257; --c-accent-ink: #f8f9f3; --c-gold-1: #5c6d48; --c-gold-2: #a7b68e; --c-gold-3: #e3ead6;
  --c-hero-ink: #fbfcf7;
  --f-display: "Cormorant Garamond", Georgia, serif; --f-script: "Parisienne", cursive; --f-body: "Mulish", system-ui, sans-serif;
}
:root[data-theme="rosa"] {
  --c-bg: #f8efec; --c-surface: #fffaf8; --c-ink: #3a2729; --c-muted: #7d6466; --c-line: rgba(58, 39, 41, .14);
  --c-accent: #b0767b; --c-accent-ink: #fffaf8; --c-gold-1: #9a6a5a; --c-gold-2: #d9a98f; --c-gold-3: #f6dccd;
  --c-hero-ink: #fffaf7;
  --f-display: "Lora", Georgia, serif; --f-script: "Allura", cursive; --f-body: "Nunito Sans", system-ui, sans-serif;
}
:root { --radius: 22px; --ease: cubic-bezier(.2, .8, .2, 1); --gutter: 20px; }

html { scroll-padding-top: 72px; }
body { font-size: 17px; line-height: 1.7; }
.script { font-family: var(--f-script); font-weight: 400; }
em { font-style: italic; color: var(--c-accent); }
.section { padding: clamp(80px, 14vw, 150px) var(--gutter); }
.head { max-width: 720px; margin: 0 auto 48px; text-align: center; }
.eyebrow { margin: 0 0 14px; font-family: var(--f-body); font-size: 12px; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; color: var(--c-accent); }
.title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(44px, 11vw, 92px); line-height: 1; letter-spacing: -.01em; }
.head__lead { margin: 18px auto 0; max-width: 46ch; color: var(--c-muted); }
/* Oro con brillo lento */
.gold { font-style: normal; background: linear-gradient(110deg, var(--c-gold-1) 0%, var(--c-gold-2) 35%, var(--c-gold-3) 50%, var(--c-gold-2) 65%, var(--c-gold-1) 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px; border: 1px solid var(--c-accent); border-radius: 999px; background: var(--c-accent); color: var(--c-accent-ink); font-family: var(--f-body); font-size: 14px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; transition: transform .3s var(--ease), background .3s, color .3s; }
.btn:hover { transform: translateY(-2px); }
.btn--ghost { background: none; color: var(--c-ink); }
.btn--ghost:hover { background: var(--c-accent); color: var(--c-accent-ink); }

/* ---------- Navegación ---------- */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 var(--gutter); color: var(--c-ink); transition: background .4s, box-shadow .4s, transform .5s var(--ease); }
.nav.is-solid { background: color-mix(in srgb, var(--c-bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--c-line); }
.nav.is-hidden { transform: translateY(-100%); }
.nav__mark { margin-right: auto; font-family: var(--f-display); font-size: 24px; letter-spacing: .08em; text-decoration: none; }
.nav__mark span { font-family: var(--f-script); color: var(--c-accent); margin: 0 2px; }
.nav__links { display: none; gap: 28px; }
.nav__links a { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: var(--c-muted); }
.nav__links a:hover { color: var(--c-ink); }
.nav__cta { min-height: 40px; display: inline-flex; align-items: center; padding: 0 18px; border: 1px solid var(--c-accent); border-radius: 999px; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: var(--c-accent); }

/* ---------- 1 · Apertura: la carta ---------- */
.open { position: relative; min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 96px var(--gutter) 120px; text-align: center; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--c-surface) 0%, var(--c-bg) 70%); }
.open::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.open__mono { margin: 0 0 18px; font-family: var(--f-display); font-size: 18px; letter-spacing: .5em; color: var(--c-accent); }
.open__mono span { font-family: var(--f-script); letter-spacing: 0; }
.open__to { margin: 0; font-family: var(--f-body); font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--c-muted); }
.open__name { margin: 0; max-width: min(12ch, calc(100vw - 2 * var(--gutter))); font-size: clamp(64px, 18vw, 150px); line-height: 1.05; color: var(--c-ink); }
/* Escritura a mano: el nombre aparece de izquierda a derecha.
   El relleno (compensado con margen negativo) deja sitio a los trazos de la caligrafía que salen
   de la caja por arriba, por abajo y por los lados; si no, el clip-path los recortaba. */
.open__name .ink { display: inline-block; padding: .3em .35em; margin: -.3em -.35em; clip-path: inset(0 100% 0 0); animation: write 1.9s .7s cubic-bezier(.6, .1, .3, 1) forwards; }
@keyframes write { to { clip-path: inset(0 -10% 0 0); } }
@keyframes fadeIn { to { opacity: 1; } }
.open__lead { margin: 18px 0 0; font-family: var(--f-display); font-style: italic; font-size: clamp(22px, 5.5vw, 32px); color: var(--c-muted); }
.open__scroll { position: absolute; left: 50%; bottom: 34px; width: 1px; height: 56px; transform: translateX(-50%); background: var(--c-line); overflow: hidden; }
.open__scroll span { position: absolute; inset: 0; background: var(--c-accent); transform: translateY(-100%); animation: drip 2.2s 2.6s ease-in-out infinite; }
@keyframes drip { 0% { transform: translateY(-100%); } 60%, 100% { transform: translateY(100%); } }
/* Polvo dorado */
.open__dust i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--c-gold-2); opacity: 0; box-shadow: 0 0 10px var(--c-gold-2); animation: float 9s ease-in-out infinite; }
.open__dust i:nth-child(1) { left: 14%; top: 70%; animation-delay: .5s; }
.open__dust i:nth-child(2) { left: 82%; top: 64%; animation-delay: 2s; }
.open__dust i:nth-child(3) { left: 26%; top: 30%; animation-delay: 3.4s; width: 3px; height: 3px; }
.open__dust i:nth-child(4) { left: 70%; top: 24%; animation-delay: 1.2s; }
.open__dust i:nth-child(5) { left: 50%; top: 82%; animation-delay: 4.6s; width: 3px; height: 3px; }
.open__dust i:nth-child(6) { left: 90%; top: 40%; animation-delay: 6s; }
@keyframes float { 0% { opacity: 0; transform: translateY(0); } 25% { opacity: .9; } 100% { opacity: 0; transform: translateY(-120px); } }

/* ---------- 2 · Anuncio ---------- */
.news { position: relative; min-height: 100svh; display: grid; align-items: end; overflow: hidden; color: var(--c-hero-ink); }
.news__media { position: absolute; inset: 0; }
.news__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; transform: scale(var(--zoom, 1.15)); transform-origin: 50% 20%; will-change: transform; }
.news::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.05) 30%, rgba(0,0,0,.55) 100%); }
.news__copy { position: relative; z-index: 1; padding: 0 var(--gutter) clamp(60px, 12vw, 110px); text-align: center; }
.news__k { margin: 0 0 6px; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; opacity: .85; }
.news__names { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(64px, 17vw, 190px); line-height: .95; letter-spacing: -.01em; }
.news__marry { margin: -6px 0 0; font-size: clamp(44px, 11vw, 96px); line-height: 1; }
.news__date { margin: 16px 0 0; font-size: 13px; letter-spacing: .26em; text-transform: uppercase; }

/* ---------- 3 · La carta ---------- */
.letter { display: grid; place-items: center; background: var(--c-bg); }
.paper { position: relative; width: min(680px, 100%); padding: clamp(36px, 8vw, 72px) clamp(26px, 7vw, 64px); background: var(--c-surface); border-radius: 4px; box-shadow: 0 30px 80px -40px rgba(0,0,0,.35), 0 0 0 1px var(--c-line); font-family: var(--f-display); font-size: clamp(20px, 4.6vw, 24px); line-height: 1.6; }
.paper::before { content: ""; position: absolute; inset: 12px; border: 1px solid var(--c-line); pointer-events: none; }
.paper p { margin: 0 0 1em; }
.paper__date { font-family: var(--f-body); font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--c-muted); text-align: right; }
.paper__hi { font-size: clamp(32px, 8vw, 44px); line-height: 1.2; color: var(--c-accent); }
.paper__sign { margin-top: 1.6em !important; font-style: italic; }
.paper__sign .script { display: block; font-style: normal; font-size: clamp(40px, 10vw, 56px); line-height: 1.2; color: var(--c-accent); }

/* ---------- 4 · Historia ---------- */
.story__line { position: relative; max-width: 960px; margin: 0 auto; padding: 0; list-style: none; display: grid; gap: 64px; }
.story__line::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--c-line); display: none; }
.story__line::after { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: calc(var(--p, 0) * 100%); background: var(--c-accent); display: none; }
.moment { display: grid; gap: 22px; text-align: center; }
.moment h3 { margin: 0 0 8px; font-family: var(--f-display); font-weight: 400; font-size: clamp(30px, 7vw, 40px); line-height: 1.1; }
.moment p { margin: 0; color: var(--c-muted); }
.moment__y { margin: 0 0 6px !important; font-family: var(--f-script); font-size: 34px; line-height: 1; color: var(--c-accent) !important; }
.arch { margin: 0 auto; width: min(320px, 78vw); aspect-ratio: 3 / 4; border-radius: 999px 999px 18px 18px; overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0,0,0,.4); }
.arch img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease); }
.moment:hover .arch img { transform: scale(1.05); }

/* ---------- 5 · Cuenta atrás ---------- */
.count { text-align: center; background: var(--c-surface); }
.count__grid { display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: clamp(14px, 5vw, 56px); margin: 0 0 34px; }
.count__grid span { display: block; font-family: var(--f-display); font-weight: 300; font-size: clamp(44px, 13vw, 120px); line-height: 1; font-variant-numeric: tabular-nums; }
.count__grid small { display: block; margin-top: 8px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--c-muted); }

/* ---------- 6 · El día ---------- */
.hours { max-width: 620px; margin: 0 auto 56px; padding: 0; list-style: none; }
.hours li { display: grid; grid-template-columns: 76px 1fr; align-items: baseline; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--c-line); font-family: var(--f-display); font-size: clamp(21px, 5vw, 26px); }
.hours span { font-family: var(--f-body); font-size: 14px; letter-spacing: .14em; color: var(--c-accent); }
.places { display: grid; gap: 18px; max-width: 1080px; margin: 0 auto; }
.place { overflow: hidden; border-radius: var(--radius); background: var(--c-surface); box-shadow: 0 0 0 1px var(--c-line); }
.place img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.place__body { padding: 24px 24px 28px; }
.place h3 { margin: 0 0 6px; font-family: var(--f-display); font-weight: 400; font-size: 32px; line-height: 1.1; }
.place p:not(.eyebrow) { margin: 0 0 20px; color: var(--c-muted); }

/* ---------- 7 · Info ---------- */
.info { background: var(--c-surface); }
.info__grid { display: grid; gap: 16px; max-width: 1080px; margin: 0 auto; }
.card { padding: 28px 26px; border-radius: var(--radius); background: var(--c-bg); }
.card h3 { margin: 0 0 8px; font-family: var(--f-display); font-weight: 400; font-size: 30px; }
.card p { margin: 0 0 14px; color: var(--c-muted); }
.swatches { display: flex; gap: 10px; }
.swatches i { width: 36px; height: 36px; border-radius: 50%; background: var(--s); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.iban { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px; border: 1px dashed var(--c-accent); border-radius: 14px; background: var(--c-surface); font-family: var(--f-body); font-size: 14px; letter-spacing: .04em; color: var(--c-ink); }
.iban span { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--c-accent); }

/* ---------- 8 · RSVP (conversación) ---------- */
.rsvp { background: var(--c-bg); }
.demo-pick { max-width: 640px; margin: 0 auto 16px; text-align: center; }
.demo-pick p { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--c-muted); }
.demo-pick__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.demo-pick button { min-height: 38px; padding: 0 14px; border: 1px dashed var(--c-accent); border-radius: 999px; background: none; font-size: 13px; color: var(--c-ink); }
.demo-pick button[aria-pressed="true"] { background: var(--c-accent); border-style: solid; color: var(--c-accent-ink); }
.chat { max-width: 640px; margin: 0 auto; padding: 0 0 18px; border-radius: 28px; background: var(--c-surface); box-shadow: 0 40px 90px -50px rgba(0,0,0,.45), 0 0 0 1px var(--c-line); overflow: hidden; }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--c-line); }
.chat__head b { display: block; font-family: var(--f-display); font-size: 20px; font-weight: 500; line-height: 1.1; }
.chat__head small { font-size: 12px; color: var(--c-muted); }
.chat__avatar { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--c-accent); color: var(--c-accent-ink); font-family: var(--f-display); font-size: 15px; letter-spacing: .04em; }
.chat__log { display: flex; flex-direction: column; gap: 10px; min-height: 140px; padding: 20px 18px 10px; }
.chat__msg { max-width: 86%; margin: 0; padding: 11px 15px; font-size: 16px; line-height: 1.45; animation: msgIn .35s var(--ease) both; }
.chat__msg--q { align-self: flex-start; background: var(--c-bg); border-radius: 4px 18px 18px 18px; font-family: var(--f-display); font-size: 19px; }
.chat__msg--a { align-self: flex-end; background: var(--c-accent); color: var(--c-accent-ink); border-radius: 18px 4px 18px 18px; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.chat__typing { display: inline-flex; gap: 5px; }
.chat__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--c-muted); animation: bob 1.1s ease-in-out infinite; }
.chat__typing span:nth-child(2) { animation-delay: .18s; } .chat__typing span:nth-child(3) { animation-delay: .36s; }
@keyframes bob { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat__opts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 4px 18px 0; }
.chat__opts[hidden], .chat__form[hidden], .chat__restart[hidden] { display: none; }
.chat__opt { min-height: 46px; padding: 0 20px; border: 1px solid var(--c-accent); border-radius: 999px; background: none; color: var(--c-ink); font-family: var(--f-body); font-size: 15px; transition: background .25s, color .25s, transform .25s; animation: msgIn .35s var(--ease) both; }
.chat__opt:hover { background: var(--c-accent); color: var(--c-accent-ink); transform: translateY(-1px); }
.chat__form { display: flex; gap: 8px; padding: 4px 18px 0; }
.chat__form input { flex: 1; min-width: 0; min-height: 48px; padding: 0 18px; border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-bg); font-size: 16px; }
.chat__form input:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.chat__send { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--c-accent); color: var(--c-accent-ink); }
.chat__send svg { width: 18px; height: 18px; }
.chat__restart { display: block; margin: 14px auto 0; min-height: 38px; padding: 0 16px; border: 1px solid var(--c-line); border-radius: 999px; background: none; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted); }
.privacy { max-width: 560px; margin: 18px auto 0; font-size: 12px; line-height: 1.5; text-align: center; color: var(--c-muted); }

/* ---------- Final ---------- */
.end { position: relative; display: grid; place-items: center; min-height: 80svh; padding: 80px var(--gutter); overflow: hidden; color: var(--c-hero-ink); text-align: center; }
.end__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.end::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.end__copy { position: relative; z-index: 1; }
.end__see { margin: 0; font-size: clamp(64px, 18vw, 150px); line-height: 1; }
.end__names { margin: 10px 0 0; font-family: var(--f-display); font-size: clamp(22px, 5vw, 30px); letter-spacing: .06em; }
.end__credit { margin: 48px 0 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.end__credit a { color: inherit; }

/* ---------- ≥ 720px ---------- */
@media (min-width: 720px) {
  :root { --gutter: 40px; }
  .nav__links { display: flex; }
  .story__line::before, .story__line::after { display: block; }
  .moment { grid-template-columns: 1fr 1fr; align-items: center; gap: 64px; text-align: left; }
  .moment:nth-child(even) > figure { order: 2; }
  .moment:nth-child(even) > div { text-align: right; }
  .places, .info__grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) { .info__grid { grid-template-columns: repeat(4, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  .open__name .ink { animation: none; clip-path: none; }
  .gold, .open__dust i, .open__scroll span { animation: none; }
}
