:root {
  --bg: #fbf8f1;
  --bg-alt: #f1f3e8;
  --paper: #ffffff;
  --ink: #2f3622;
  --ink-soft: #5d6650;
  --olive: #5f6b2f;
  --olive-dark: #4a5524;
  --sage: #a9b78e;
  --sage-soft: #dfe5d0;
  --gold: #c79a3f;
  --line: #e1e4d3;
  --danger: #a33a2f;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --script: 'Pinyon Script', 'Cormorant Garamond', Georgia, serif;
  --radius: 18px;
  --shadow: 0 10px 30px -14px rgba(74, 85, 36, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.1; margin: 0; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(251, 248, 241, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 1.5rem; font-style: italic; color: var(--olive); text-decoration: none; }
.brand span { color: var(--gold); }
.topbar nav { display: flex; gap: 12px; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; font-size: .85rem; font-weight: 500; }
@media (min-width: 640px) { .topbar nav { gap: 22px; } .topbar nav a { font-size: .9rem; } }

/* Hero */
.hero {
  position: relative;
  text-align: center;
  padding: 36px 20px 56px;
  background:
    radial-gradient(120% 60% at 50% 0%, #fdf1da 0%, rgba(253, 241, 218, 0) 65%),
    var(--bg);
  overflow: hidden;
}
.eyebrow { text-transform: uppercase; letter-spacing: .22em; font-size: .75rem; color: var(--olive); margin-bottom: 10px; font-weight: 500; }
.names { font-size: clamp(2.8rem, 13vw, 5.4rem); color: var(--olive-dark); display: flex; flex-direction: column; align-items: center; gap: 0; }
.names em { font-family: var(--script); font-style: normal; font-weight: 400; color: var(--gold); font-size: .75em; line-height: .8; margin: .05em 0; }
.script { font-family: var(--script); font-size: clamp(1.7rem, 7vw, 2.4rem); color: var(--olive); margin: 14px 0 22px; line-height: 1.2; }
.portrait {
  margin: 0 auto 22px;
  width: min(300px, 74vw);
  aspect-ratio: 1;
  border-radius: 999px 999px 24px 24px;
  overflow: hidden;
  border: 6px solid var(--paper);
  box-shadow: var(--shadow), 0 0 0 1px var(--sage-soft);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.when { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; margin-bottom: 4px; }
.welcome { max-width: 32em; margin: 0 auto 18px; color: var(--ink-soft); }
.countdown { font-family: var(--serif); font-size: 1.2rem; color: var(--olive); font-style: italic; }
.cta { display: grid; gap: 12px; max-width: 360px; margin: 26px auto 0; }

.deco { position: absolute; color: var(--sage); opacity: .5; width: 70px; height: 128px; pointer-events: none; }
.deco-tl { top: 18px; left: -14px; transform: rotate(-28deg); }
.deco-tr { top: 18px; right: -14px; transform: rotate(28deg) scaleX(-1); }
.deco-bl { bottom: 8px; left: -10px; transform: rotate(-20deg); }
.deco-br { bottom: 8px; right: -10px; transform: rotate(20deg) scaleX(-1); }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 26px;
  border: 1.5px solid var(--olive); border-radius: 999px;
  background: transparent; color: var(--olive-dark);
  font: 600 1rem var(--sans); letter-spacing: .02em;
  text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--sage-soft); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--olive); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--olive-dark); }
.btn-ghost { border-style: dashed; min-height: 46px; font-weight: 500; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Seções */
.section { padding: 56px 20px; max-width: 760px; margin: 0 auto; text-align: center; }
.section-alt { max-width: none; background: var(--bg-alt); }
.section-alt > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.section h2 { font-size: clamp(2rem, 8vw, 2.8rem); color: var(--olive-dark); }
.script-title { font-family: var(--script) !important; font-weight: 400 !important; font-size: clamp(2.4rem, 10vw, 3.4rem) !important; line-height: 1.2 !important; }
.rule { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px auto 22px; max-width: 240px; color: var(--gold); }
.rule i { flex: 1; height: 1px; background: var(--sage); }
.lead { max-width: 34em; margin: 0 auto 14px; }
.lead-title { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--olive-dark); }
.hint { font-size: .88rem; color: var(--ink-soft); }
.hint.center { text-align: center; max-width: 34em; margin: 0 auto 26px; }
.deadline {
  display: inline-block; padding: 8px 22px; border-radius: 999px;
  background: var(--olive); color: #fff; font-weight: 600; letter-spacing: .06em; font-size: .9rem;
  margin-bottom: 26px;
}
.deadline.closed { background: var(--danger); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 20px; }

/* Álbum */
.story { max-width: none; background: var(--bg); padding-left: 0; padding-right: 0; }
.story > h2, .story > .rule, .story > .lead { padding-left: 20px; padding-right: 20px; }
.album { position: relative; }
.album-track {
  list-style: none; margin: 0; padding: 10px 20px 22px;
  display: flex; gap: 16px; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-padding: 0 20px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.album-track::-webkit-scrollbar { display: none; }
.album-track:focus-visible { outline-offset: -3px; }
.polaroid {
  flex: none; width: min(72vw, 280px); scroll-snap-align: center;
  margin: 0; padding: 12px 12px 14px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
}
.polaroid:nth-child(odd) { transform: rotate(-1.2deg); }
.polaroid:nth-child(even) { transform: rotate(1.2deg); }
.polaroid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 30%; background: var(--sage-soft); border-radius: 2px; }
.polaroid figcaption { margin-top: 10px; font-family: var(--script); font-size: 2rem; line-height: 1; color: var(--olive-dark); }
.polaroid figcaption small { display: block; margin-top: 2px; font: 500 .7rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.album-nav {
  display: none; position: absolute; top: 42%; z-index: 2; width: 48px; height: 48px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--olive-dark);
  font-size: 1.9rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.album-nav.prev { left: 10px; }
.album-nav.next { right: 10px; }
.album-nav:hover { background: var(--sage-soft); }
@media (min-width: 640px) { .album-nav { display: block; } .album-track { padding-left: 70px; padding-right: 70px; scroll-padding: 0 70px; } .polaroid { width: 290px; } }
@media (prefers-reduced-motion: reduce) { .album-track { scroll-behavior: auto; } }

/* Evento */
.info { display: grid; gap: 0; margin: 0 0 26px; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.info > div { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.info > div:last-child { border-bottom: 0; }
.info dt { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--olive); font-weight: 600; }
.info dd { margin: 2px 0 0; font-size: 1.08rem; overflow-wrap: anywhere; }
.dress { display: flex; gap: 14px; align-items: center; text-align: left; margin-top: 30px; }
.dress h3 { font-size: 1.5rem; color: var(--olive-dark); }
.dress p { margin: 4px 0 0; color: var(--ink-soft); }
.calla { flex: none; width: 46px; height: 86px; }

/* Formulário */
.form { text-align: left; }
.field { display: block; border: 0; padding: 0; margin: 0 0 20px; }
.field > span, .field > legend { display: block; font-weight: 600; margin-bottom: 8px; padding: 0; }
.field small { font-weight: 400; color: var(--ink-soft); }
input[type='text'] {
  width: 100%; min-height: 52px; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fdfdf9; color: var(--ink);
  font: 400 1rem var(--sans);
}
input[type='text']:focus { border-color: var(--olive); outline: 0; box-shadow: 0 0 0 3px var(--sage-soft); }
input.invalid { border-color: var(--danger); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.choice { display: grid; gap: 10px; }
.choice label { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span {
  display: flex; align-items: center; min-height: 52px; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fdfdf9; font-weight: 500;
}
.choice input:checked + span { border-color: var(--olive); background: var(--sage-soft); color: var(--olive-dark); }
.choice input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: #fdfdf9; }
.stepper button { width: 54px; height: 52px; border: 0; background: transparent; font-size: 1.6rem; color: var(--olive-dark); cursor: pointer; }
.stepper button:active { background: var(--sage-soft); }
.stepper output { min-width: 56px; text-align: center; font-weight: 600; font-size: 1.2rem; }
.guest-list { display: grid; gap: 10px; margin-bottom: 12px; }
.guest-row { display: flex; gap: 8px; }
.guest-row input { flex: 1; min-width: 0; }
.guest-row button { flex: none; width: 52px; border: 1.5px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink-soft); font-size: 1.3rem; cursor: pointer; }
.error { color: var(--danger); font-weight: 500; margin: 0 0 14px; }
.thanks { text-align: center; display: grid; justify-items: center; gap: 6px; }
.thanks h3 { font-size: 2rem; color: var(--olive-dark); }

/* Presentes */
.gifts { display: grid; grid-template-columns: 1fr; gap: 14px; text-align: center; }
.gift {
  display: flex; flex-direction: column; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 18px 20px; box-shadow: var(--shadow);
}
.gift .icon { font-size: 2.4rem; line-height: 1; margin-bottom: 10px; }
.gift h3 { font-size: 1.4rem; color: var(--olive-dark); margin-bottom: 6px; }
.gift p { color: var(--ink-soft); font-size: .95rem; margin-bottom: 12px; }
.gift .price { font-family: var(--serif); font-weight: 600; font-size: 1.7rem; margin-top: auto; margin-bottom: 14px; }
.gift .btn { width: 100%; }

/* Rodapé */
.footer { position: relative; text-align: center; padding: 48px 20px 56px; background: var(--bg-alt); overflow: hidden; }
.footer .script { margin-top: 0; }

/* Modal */
dialog {
  width: min(480px, calc(100vw - 20px)); max-height: calc(100dvh - 20px);
  padding: 0; border: 0; border-radius: 22px; background: var(--bg); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); overflow: auto;
}
dialog::backdrop { background: rgba(47, 54, 34, .55); backdrop-filter: blur(3px); }
.dlg-close { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 8px 8px 0; margin: 0; background: var(--bg); z-index: 1; }
.dlg-close button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--sage-soft); font-size: 1.6rem; line-height: 1; color: var(--olive-dark); cursor: pointer; }
.dlg-body { padding: 0 22px 26px; text-align: center; }
.dlg-body h3 { font-size: 1.8rem; color: var(--olive-dark); }
.gd-value { font-family: var(--serif); font-size: 2.3rem; font-weight: 600; margin: 6px 0 16px; }
.qr { width: min(240px, 70vw); margin: 0 auto 16px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.qr svg { display: block; width: 100%; height: auto; }
.copied { margin: 12px 0 0; color: var(--olive-dark); font-weight: 500; font-size: .95rem; }
.pixcode-label { display: block; margin: 16px 0 6px; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--olive); font-weight: 600; text-align: left; }
.pixcode { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fdfdf9; color: var(--ink); font: 16px/1.35 ui-monospace, Menlo, Consolas, monospace; word-break: break-all; resize: none; }
.copied.manual { color: var(--danger); }
.payee { margin: 18px 0; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.payee > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.payee > div:last-child { border-bottom: 0; }
.payee dt { color: var(--ink-soft); }
.payee dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.note { font-size: .92rem; color: var(--ink-soft); }
.steps { text-align: left; padding-left: 22px; font-size: .95rem; color: var(--ink-soft); }
.steps li { margin-bottom: 6px; }
.paid { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--sage); display: grid; gap: 10px; text-align: left; }
.paid p { margin: 0; }

@media (min-width: 640px) {
  .cta { grid-template-columns: repeat(3, auto); max-width: none; justify-content: center; }
  .names { flex-direction: row; justify-content: center; gap: .3em; align-items: baseline; }
  .names em { margin: 0; }
  .gifts { grid-template-columns: repeat(2, 1fr); }
  .info { grid-template-columns: 1fr 1fr; }
  .info > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .info > div:nth-last-child(-n+2) { border-bottom: 0; }
  .deco { width: 110px; height: 200px; }
  .choice { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .gifts { grid-template-columns: repeat(3, 1fr); }
  .section { max-width: 980px; }
  .topbar { padding-left: max(32px, calc((100vw - 980px) / 2)); padding-right: max(32px, calc((100vw - 980px) / 2)); }
  .hero { padding-top: 56px; padding-bottom: 72px; }
  .names { font-size: 5.4rem; }
  .portrait { width: 340px; }
  .deco { width: 130px; height: 240px; opacity: .45; }
  .deco-tl { top: 40px; left: 4vw; }
  .deco-tr { top: 40px; right: 4vw; }
  .deco-bl { left: 4vw; }
  .deco-br { right: 4vw; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
