:root {
  --cream: #f7f3ec;
  --white: #fffefc;
  --sage: #9bb070;
  --green: #6f8a3e;
  --green-dark: #5a7231;
  --ink: #33332f;
  --script: "Great Vibes", "Snell Roundhand", cursive;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: italic 400 1.0625rem/1.45 var(--serif);
  font-variant-numeric: lining-nums;
}

body.locked { overflow: hidden; }

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, dl, dd, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
strong, dt { font-weight: 700; }

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

.page {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  background: var(--white);
  overflow-x: hidden;
}

@media (min-width: 521px) {
  .page { box-shadow: 0 0 40px rgba(60, 60, 40, .08); }
}

/* Capa */
.cover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 24px 0 calc(24px + var(--safe-bottom));
  border: 0;
  border-radius: 0;
  background: radial-gradient(ellipse at 50% 42%, #fffdf8 0%, var(--cream) 55%, #ebe5d6 100%);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .6s ease .45s;
}

.cover:focus-visible { outline-offset: -8px; }

.cover-names {
  font: 400 clamp(2.6rem, 12vw, 3.4rem)/1.1 var(--script);
  color: var(--green);
}

.cover-date {
  margin-top: 4px;
  font-size: 1.125rem;
  letter-spacing: .12em;
}

.envelope {
  position: relative;
  display: block;
  width: min(84vw, 440px);
  margin: clamp(28px, 7vh, 56px) 0 clamp(24px, 5vh, 44px);
  filter: drop-shadow(0 14px 18px rgba(70, 80, 40, .24));
  animation: breathe 3.6s ease-in-out infinite;
}

.envelope > picture:first-child img { width: 100%; }

/* O selo fica exatamente sobre o selo do envelope, para poder saltar ao abrir */
.envelope-seal {
  position: absolute;
  left: 40.75%;
  top: 44.9%;
  width: 23.9%;
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1);
}

.envelope-seal img { width: 100%; }

.cover-hint {
  font-size: 1.25rem;
  color: var(--green-dark);
  animation: pulse 2s ease-in-out infinite;
}

.cover.opening { opacity: 0; pointer-events: none; }
.cover.opening .envelope {
  animation: none;
  transform: translateY(-9%) scale(1.14);
  opacity: 0;
  transition: transform .75s ease-in .2s, opacity .55s ease-in .35s;
}
.cover.opening .envelope-seal { transform: scale(1.22); }
.cover.opening .cover-hint,
.cover.opening .cover-names,
.cover.opening .cover-date {
  animation: none;
  opacity: 0;
  transition: opacity .3s ease;
}

@keyframes breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-7px) scale(1.012); }
}

@keyframes pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

/* Botão da música */
.music {
  position: fixed;
  right: max(14px, calc((100vw - 520px) / 2 - 62px));
  bottom: calc(14px + var(--safe-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(111, 138, 62, .45);
  border-radius: 50%;
  background: rgba(255, 254, 250, .86);
  color: var(--green-dark);
  box-shadow: 0 3px 10px rgba(40, 40, 30, .18);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.music[hidden] { display: none; }

.music svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.music .icon-off { display: none; }
.music.off .icon-on { display: none; }
.music.off .icon-off { display: block; }
.music.needs-tap { animation: attention 1.4s ease-in-out infinite; }

@keyframes attention {
  0%, 100% { box-shadow: 0 0 0 0 rgba(111, 138, 62, .55); }
  50% { box-shadow: 0 0 0 11px rgba(111, 138, 62, 0); }
}

/* Hero */
.hero {
  position: relative;
  aspect-ratio: 390 / 720;
  max-height: 100vh;
  max-height: 100dvh;
  width: 100%;
  overflow: hidden;
  /* Em ecrãs altos, o texto seguinte começa abaixo da dobra, longe do botão da música */
  margin-bottom: max(0px, calc(100vh - 184.6vw));
  margin-bottom: max(0px, calc(100dvh - 184.6vw));
  border-radius: 0 0 50% 50% / 0 0 30% 30%;
  background: #c9cacb;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 52% 0 0;
  background: linear-gradient(to bottom, rgba(25, 30, 15, 0), rgba(25, 30, 15, .42));
}

.hero-text {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 3.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-align: center;
}

.hero-monogram { width: clamp(70px, 23vw, 100px); }

.hero-date {
  margin-top: 6px;
  font-size: clamp(1.45rem, 6.6vw, 1.9rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .03em;
  text-shadow: 0 2px 7px rgba(0, 0, 0, .55);
}

.hero-names {
  font: 400 clamp(3.2rem, 15.5vw, 4.5rem)/1.12 var(--script);
  text-shadow: 0 2px 9px rgba(0, 0, 0, .6);
}

.hero-scroll {
  display: grid;
  place-items: center;
  width: 32px;
  height: 46px;
  margin-top: 4px;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 13px;
  color: #fff;
  animation: nudge 1.8s ease-in-out infinite;
}

.hero-scroll svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* Títulos */
.script {
  font: 400 clamp(3rem, 14vw, 3.9rem)/1.15 var(--script);
  color: var(--green);
}

.title {
  font-size: clamp(2.2rem, 10vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--green);
}

/* Versículo, noivos, convite */
.verse {
  padding: 30px 20px 10px;
  scroll-margin-top: 0;
  text-align: right;
}

.verse blockquote { font-size: 1.125rem; }
.verse-ref { margin-top: 4px; font-weight: 700; font-size: 1.15rem; }

.couple { padding: 18px 16px 6px; text-align: center; }
.person + .person { margin-top: 26px; }
.person p { margin-top: 6px; line-height: 1.6; }

.invitation {
  padding: 28px 22px 10px;
  font-size: 1.25rem;
  line-height: 1.35;
  text-align: center;
}

.flowers { width: 100%; }

/* Programa */
.programme { padding: 10px 14px 34px; }

.programme-intro {
  padding: 0 8px 26px;
  font-size: 1.25rem;
  line-height: 1.35;
  text-align: center;
}

.timeline {
  --time: 62px;
  position: relative;
  padding: 12px 0 18px;
}

/* A linha vertical verde, com argola em baixo */
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--time) + 9px);
  width: 2px;
  background: var(--sage);
}

.timeline::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: calc(var(--time) + 5px);
  width: 10px;
  height: 10px;
  border: 2px solid var(--sage);
  border-radius: 50%;
  background: var(--white);
}

.event + .event { margin-top: 24px; }

.slot {
  position: relative;
  display: grid;
  grid-template-columns: var(--time) 1fr;
  align-items: center;
  column-gap: 44px;
  min-height: 44px;
}

.slot time { font-size: .975rem; font-weight: 700; white-space: nowrap; }

/* Seta horizontal de cada hora */
.slot time::after {
  content: "→";
  position: absolute;
  left: calc(var(--time) + 5px);
  top: 50%;
  transform: translateY(-52%);
  width: 34px;
  font: normal 400 1.05rem/1 Georgia, serif;
  color: var(--sage);
  letter-spacing: 0;
}

.slot h3 {
  font-size: clamp(1.45rem, 6.4vw, 1.75rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--green);
  text-align: center;
}

.slot-and .amp {
  grid-column: 2;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--green);
  text-align: center;
}

.slot-and { min-height: 26px; }

.event-details {
  margin-left: calc(var(--time) + 22px);
  padding-top: 6px;
  font-size: .975rem;
  line-height: 1.25;
  text-align: center;
}

.nowrap { white-space: nowrap; }

.map-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 12px;
  padding: 6px 22px 6px 14px;
  border-radius: 999px;
  background: linear-gradient(95deg, #8fa957, #7d9a45);
  box-shadow: 5px 6px 0 #55554f;
  color: #fff;
  font-size: 1.125rem;
  letter-spacing: .05em;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(40, 50, 20, .5);
}

.map-button svg { width: 22px; height: 22px; fill: #fff; }

/* Fotografias */
.gallery { padding-bottom: 26px; background: #fbf9f6; padding-top: 24px; }

.carousel {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 0 11%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.carousel::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  border-radius: 8px;
  overflow: hidden;
  background: #cfd0d3;
  aspect-ratio: 3 / 4;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 8px;
}

/* Área de toque grande, ponto pequeno */
.dots button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.dots button::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cfd5bd;
  transition: background .25s;
}

.dots button[aria-current="true"]::before { background: var(--green); }

/* R.S.V.P */
.rsvp {
  padding: 8px 18px 44px;
  font-size: 1.125rem;
  text-align: center;
}

.rsvp-box {
  margin: 8px 0 16px;
  padding: 8px 10px;
  border: 1.5px solid var(--green-dark);
  border-radius: 18px;
}

.rsvp-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  margin-top: 24px;
  padding-right: 14px;
}

.rsvp-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(100%, 320px);
  min-height: 62px;
  padding: 10px 20px;
  border-radius: 999px;
  color: #fff;
  font-size: 1.5rem;
  letter-spacing: .03em;
  text-decoration: none;
}

.rsvp-button svg {
  flex: none;
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.confirm {
  background: linear-gradient(95deg, #7d9a45, #62802f 55%, #7d9a45);
  box-shadow: 8px 8px 0 #4a4a46, 15px 15px 0 #d2d2cf;
}

.decline {
  background: linear-gradient(95deg, #0d0d0d, #3b3b3b 55%, #0d0d0d);
  box-shadow: 8px 8px 0 #4a4a46, 15px 15px 0 #d2d2cf;
}

/* Secções em creme */
.cream {
  position: relative;
  background: var(--cream);
  border-top: 2px solid var(--sage);
  border-radius: 34px 34px 0 0;
}

.gifts { padding: 26px 18px 24px; }
.gifts > .title { text-align: center; margin-bottom: 14px; }

.accounts {
  margin: 18px 0 22px;
  padding: 16px 12px;
  border: 1.5px solid var(--sage);
  border-radius: 14px;
}

.accounts h3 {
  margin-bottom: 14px;
  font-size: 1.2rem;
  color: var(--green);
  text-align: center;
}

.account {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: start;
  column-gap: 12px;
}

.account + .account { margin-top: 18px; }

.logo {
  display: grid;
  place-items: center;
  height: 58px;
  padding: 3px;
  border-radius: 10px;
  background: #fff;
}

.logo img { max-height: 52px; width: auto; }

.account dl { min-width: 0; font-size: 1rem; line-height: 1.3; }
.account dl > div { margin-bottom: 5px; }
.account dt, .account dd { display: inline; }

.number {
  overflow-wrap: anywhere;
  font-variant-numeric: lining-nums tabular-nums;
  font-size: .95rem;
}

/* Área de toque mínima de 44px sem aumentar o botão visível */
.copy {
  position: relative;
  margin-left: 2px;
  padding: 2px 9px;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  font: italic 400 .8125rem/1.3 var(--serif);
  white-space: nowrap;
  vertical-align: 1px;
  cursor: pointer;
}

.copy::after {
  content: "";
  position: absolute;
  inset: -11px -4px;
}

.stores { margin-top: 14px; padding-left: 24px; }

.stores li {
  list-style: disc;
  font-weight: 700;
}

.stores a {
  display: inline-block;
  padding: 9px 0;
  text-underline-offset: 3px;
}

/* Manual do convidado */
.manual { padding: 4px 14px 30px 0; }
.manual > .title, .manual-sub { padding-left: 16px; }
.manual > .title { font-size: clamp(1.85rem, 8.5vw, 2.5rem); }
.manual-sub { margin-bottom: 16px; }

.card {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  margin-bottom: 18px;
}

.card-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 84px;
  border-radius: 0 14px 14px 0;
  background: #fff;
  box-shadow: 2px 3px 0 #b9b6ac;
}

.card-icon svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: #a3ad7f;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card p {
  padding: 10px 12px 10px 14px;
  border: 1.5px solid var(--sage);
  border-left: 0;
  border-radius: 0 16px 16px 0;
  background: #f9f6f0;
  font-size: 1rem;
  line-height: 1.3;
}

/* Dress code */
.dress { padding: 14px 18px 0; text-align: center; font-size: 1.125rem; }
.dress .title { margin-bottom: 8px; }
.dress-image { width: 100%; margin-top: 16px; }

/* Final */
.final { position: relative; background: #fff; }

.final-photo {
  width: 100%;
  -webkit-mask-image: linear-gradient(to bottom, #000 76%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 76%, transparent 100%);
}

.final-text {
  position: relative;
  margin-top: -18px;
  padding: 0 10px 28px;
  text-align: center;
}

.final-line {
  font: 400 clamp(1.75rem, 7.9vw, 2.3rem)/1.15 var(--script);
  color: #1f1f1c;
}

.countdown {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  margin-top: 14px;
  color: var(--green);
}

.countdown div { min-width: 58px; }

.countdown span {
  display: block;
  font-size: clamp(2.3rem, 11vw, 3rem);
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1.1;
}

.countdown small {
  display: block;
  color: var(--ink);
  font-size: .8125rem;
}

.countdown b {
  font-size: clamp(2rem, 9vw, 2.6rem);
  font-weight: 400;
  line-height: 1.15;
}

.countdown-note {
  margin-top: 12px;
  color: var(--green-dark);
}

.countdown-note.big {
  font-size: 1.6rem;
  font-weight: 700;
}

.footer {
  padding: 8px 76px calc(26px + var(--safe-bottom));
  background: #fff;
  color: #6d6d66;
  font-size: .8125rem;
  text-align: center;
}

/* Aviso "Copiado" */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + var(--safe-bottom));
  z-index: 45;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(40, 45, 30, .92);
  color: #fff;
  font-size: .95rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s, transform .2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Animações suaves ao descer */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .7s ease, transform .7s ease;
  }
  .js .reveal.in { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .envelope, .cover-hint, .hero-scroll, .music.needs-tap { animation: none; }
  .cover, .cover.opening .envelope, .cover.opening .envelope-seal { transition-duration: .2s; transition-delay: 0s; }
}
