:root {
  --ivory: #f2f2f2;
  --champagne: #e7edd9;
  --cream: #ffffff;
  --sand: #c9d6b3;
  --rose: #d96868;
  --sage: #91a66e;
  --leaf: #689d4b;
  --ink: #355528;
  --forest: #355528;
  --butter: #d96868;
  --muted: #6b844f;
  --line: rgba(104, 157, 75, 0.22);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--forest);
  background: var(--ivory);
  font-family: Manrope, "Segoe UI", sans-serif;
  font-weight: 500;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 80;
  padding: 8px 12px;
  background: var(--cream);
  color: var(--ink);
}

.skip:focus {
  top: 12px;
}

.seal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--ivory);
  transition: opacity 700ms ease, visibility 700ms ease;
}

.seal.is-open {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-wrap {
  width: 275px;
  height: 375px;
}

.envelope {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  top: 150px;
  display: block;
  width: 275px;
  height: 174px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  background: #4e7a38;
  box-shadow: 0 4px 20px rgb(0 0 0 / 0.2);
  cursor: pointer;
  font: inherit;
  transform-origin: center center;
}

.front {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 3;
}

.flap {
  border-left: 137.5px solid transparent;
  border-right: 137.5px solid transparent;
  border-bottom: 80px solid transparent;
  border-top: 95px solid #4e7a38;
  transform-origin: top;
  pointer-events: none;
}

.pocket {
  border-left: 137.5px solid #689d4b;
  border-right: 137.5px solid #689d4b;
  border-bottom: 87.5px solid #547f3c;
  border-top: 87.5px solid transparent;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.envelope .letter {
  position: relative;
  top: 8%;
  z-index: 1;
  display: block;
  width: 90%;
  height: 78%;
  margin: 0 auto;
  padding: 0;
  border-radius: 6px;
  background: #f2f2f2;
  box-shadow: 0 2px 26px rgb(0 0 0 / 0.12);
}

.envelope .letter::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    180deg,
    rgb(242 242 242 / 0) 25%,
    rgb(217 104 104 / 0.35) 55%,
    rgb(217 104 104 / 0.85) 100%
  );
}

.words {
  position: absolute;
  left: 10%;
  width: 80%;
  height: 14%;
  background: #d9d9d9;
}

.words.line1 {
  top: 15%;
  width: 20%;
  height: 7%;
}

.words.line2 { top: 30%; }
.words.line3 { top: 50%; }
.words.line4 { top: 70%; }

.envelope.open .flap {
  transform: rotateX(180deg);
  transition: transform 0.4s ease, z-index 0.6s;
  z-index: 1;
}

.envelope.close {
  animation: envelopeShake 2.8s ease-in-out infinite;
}

.envelope.close:hover,
.envelope.open {
  animation: none;
}

.envelope.close .flap {
  transform: rotateX(0deg);
  transition: transform 0.4s 0.6s ease, z-index 1s;
  z-index: 5;
}

.envelope.close .letter {
  transform: translateY(0);
  transition: transform 0.4s ease, z-index 1s;
  z-index: 1;
}

.envelope.open .letter {
  transform: translateY(-72px);
  transition: transform 0.4s 0.6s ease, z-index 0.6s;
  z-index: 2;
}

.hearts {
  position: absolute;
  top: 90px;
  left: 0;
  right: 0;
  z-index: 2;
}

.heart {
  position: absolute;
  right: 10%;
  bottom: 0;
  pointer-events: none;
}

.heart::before,
.heart::after {
  position: absolute;
  content: "";
  left: 50px;
  top: 0;
  width: 50px;
  height: 80px;
  background: #d96868;
  border-radius: 50px 50px 0 0;
  transform: rotate(-45deg);
  transform-origin: 0 100%;
  pointer-events: none;
}

.heart::after {
  left: 0;
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}

.envelope.close .heart {
  opacity: 0;
  animation: none;
}

.envelope.open .a1 {
  left: 20%;
  transform: scale(0.6);
  animation: slideUp 4s linear 1, sideSway 2s ease-in-out 4 alternate;
  animation-fill-mode: forwards;
  animation-delay: 0.7s;
}

.envelope.open .a2 {
  left: 55%;
  transform: scale(1);
  animation: slideUp 5s linear 1, sideSway 4s ease-in-out 2 alternate;
  animation-fill-mode: forwards;
  animation-delay: 0.7s;
}

.envelope.open .a3 {
  left: 10%;
  transform: scale(0.8);
  animation: slideUp 7s linear 1, sideSway 2s ease-in-out 6 alternate;
  animation-fill-mode: forwards;
  animation-delay: 0.7s;
}

@keyframes envelopeShake {
  0%,
  68%,
  100% {
    transform: rotate(0deg);
  }
  72% {
    transform: rotate(-4deg);
  }
  76% {
    transform: rotate(4deg);
  }
  80% {
    transform: rotate(-3deg);
  }
  84% {
    transform: rotate(3deg);
  }
  88% {
    transform: rotate(-1.5deg);
  }
  92% {
    transform: rotate(0deg);
  }
}

@keyframes slideUp {
  0% { top: 0; }
  100% { top: -600px; }
}

@keyframes sideSway {
  0% { margin-left: 0; }
  100% { margin-left: 50px; }
}

.page {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms ease 180ms, transform 800ms var(--ease) 180ms;
}

.page.is-visible {
  opacity: 1;
  transform: none;
}

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: color-mix(in srgb, var(--ivory) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: Unbounded, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand span {
  color: var(--rose);
  padding: 0 1px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.nav a {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
}

.hero {
  min-height: calc(100svh - 64px);
  display: grid;
  align-content: start;
  justify-items: center;
  text-align: center;
  padding: 0 24px 88px;
}

.hero__photo {
  justify-self: stretch;
  /* width: calc(100% + 48px); */
  max-width: none;
  /* margin: 0 -24px 40px; */
}

.hero__photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid green;
}

.hero__kicker,
.hero__verb {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero__mono {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.hero__mono i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.hero__mono i:nth-child(1) { background: var(--rose); }
.hero__mono i:nth-child(2) { background: var(--ivory); border: 1px solid var(--line); }
.hero__mono i:nth-child(3) { background: var(--sage); }
.hero__mono i:nth-child(4) { background: var(--leaf); }

.hero__names {
  margin: 12px 0 12px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(3.2rem, 11vw, 7.2rem);
  font-weight: 500;
  line-height: 0.9;
}

.hero__amp {
  display: block;
  color: var(--rose);
  font-style: italic;
  font-size: 0.5em;
}

.hero__invite {
  margin: 20px 0 0;
  max-width: 22ch;
  color: var(--forest);
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  font-weight: 500;
  line-height: 1.35;
}

.hero__stamp {
  margin: 28px 0 36px;
  color: var(--muted);
}

.hero__stamp p {
  margin: 0;
}

.hero__stamp p + p {
  margin-top: 6px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.btn:hover,
.btn:focus-visible {
  background: var(--ink);
  color: var(--ivory);
}

.btn--ink {
  background: var(--ink);
  color: var(--ivory);
}

.btn--ink:hover,
.btn--ink:focus-visible {
  background: var(--leaf);
  border-color: var(--leaf);
}

.btn--ghost {
  border-color: var(--line);
  color: var(--ink);
}

.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  color: var(--muted);
}

.marquee__track {
  display: flex;
  gap: 28px;
  width: max-content;
  padding: 14px 0;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: ticker 28s linear infinite;
}

.marquee__track span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 28px;
  border-radius: 50%;
  vertical-align: 1px;
}

.marquee__track span:nth-child(5n + 1)::before { background: var(--rose); }
.marquee__track span:nth-child(5n + 2)::before { background: var(--sage); }
.marquee__track span:nth-child(5n + 3)::before { background: var(--leaf); }
.marquee__track span:nth-child(5n + 4)::before { background: var(--sage); }
.marquee__track span:nth-child(5n)::before { background: var(--ivory); border: 1px solid var(--line); }

html.is-opened .seal {
  display: none;
}

html.is-opened .page {
  opacity: 1;
  transform: none;
}

html.is-opened body {
  overflow: auto;
}

section.letter,
.when,
.plan,
.dress,
.rsvp,
.hero {
  scroll-margin-top: 76px;
}

section.letter,
.when,
.plan,
.dress,
.rsvp {
  padding: 88px 24px;
}

.letter__card,
.when__card,
.ticket,
.section-head,
.dress__lead,
.plan__list {
  width: min(760px, 100%);
  margin-inline: auto;
}

.letter__card {
  text-align: center;
}

.letter__label,
.chip {
  display: inline-block;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.letter__body,
.letter__sign {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  font-weight: 500;
  line-height: 1.4;
}

.letter__body {
  margin: 0 auto 28px;
  max-width: 34ch;
}

.letter__sign {
  margin: 0;
  color: var(--muted);
}

.letter__sign em {
  color: var(--ink);
  font-family: Unbounded, sans-serif;
  font-style: normal;
  font-size: 0.55em;
}

.when {
  display: grid;
  gap: 20px;
  background: var(--champagne);
}

.when__card {
  padding: 8px 0 0;
}

.when__card h2,
.section-head h2,
.ticket h2 {
  margin: 0 0 8px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 500;
  line-height: 1;
}

.when__big {
  margin: 0;
  font-size: 1.15rem;
}

.when__time {
  margin: 8px 0 24px;
  color: var(--muted);
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.countdown div {
  display: grid;
  padding: 12px 6px 10px;
  border-top: 2px solid var(--sand);
  background: var(--cream);
  text-align: center;
}

.countdown div:nth-child(1) { border-top-color: var(--rose); }
.countdown div:nth-child(2) { border-top-color: var(--sage); }
.countdown div:nth-child(3) { border-top-color: var(--leaf); }
.countdown div:nth-child(4) { border-top-color: var(--sage); }

.countdown strong {
  font-family: Unbounded, sans-serif;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 700;
}

.countdown span {
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head {
  margin-bottom: 28px;
  text-align: center;
}

.section-head h2 {
  max-width: none;
}

.plan__list {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.plan__item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 20px;
  align-items: baseline;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.plan__item:last-child {
  border-bottom: 1px solid var(--line);
}

.plan__item time {
  color: var(--muted);
  font-size: 0.92rem;
}

.plan__item h3 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.45rem;
  font-weight: 500;
}

.plan__item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.plan__item:nth-child(1) time { color: var(--rose); }
.plan__item:nth-child(2) time { color: var(--sage); }
.plan__item:nth-child(3) time { color: var(--leaf); }
.plan__item:nth-child(4) time { color: var(--sage); }

.dress__lead {
  margin: 0 auto;
  max-width: 36ch;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  text-align: center;
}

.rsvp {
  position: relative;
  background: var(--champagne);
  overflow: hidden;
}

.ticket {
  display: grid;
  gap: 28px;
}

.ticket__stub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ticket__stub p {
  margin: 0;
}

.ticket__stub p:first-child {
  color: var(--forest);
  font-family: Unbounded, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
}

.ticket__stub p:last-child {
  color: var(--muted);
}

.ticket__body {
  display: grid;
  gap: 16px;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

legend {
  padding: 0 0 8px;
}

input,
textarea {
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}

input:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--forest);
}

.choice {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin-bottom: 8px;
  color: var(--ink);
}

.choice input {
  width: auto;
  accent-color: var(--forest);
}

.form-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--forest);
  font-size: 0.9rem;
}

.footer-bloom {
  position: absolute;
  top: 0;
  right: -57px;
  bottom: -73px;
  width: min(420px, 86%);
  margin: 0;
  transform: rotate(176deg);
  pointer-events: none;
}

.footer-bloom img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.foot {
  padding: 56px 24px 72px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.foot__mono {
  margin: 0 0 10px;
  font-family: Unbounded, sans-serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.08em;
}

.foot p:last-child {
  margin: 0;
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.25rem;
  font-style: italic;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

@media (max-width: 639px) {
  .nav {
    gap: 8px 12px;
  }

  .hero__actions {
    flex-direction: column;
    width: min(100%, 300px);
  }

  .hero__actions .btn {
    width: 100%;
  }
}

@media (min-width: 840px) {
  .when {
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    padding-inline: max(24px, calc(50vw - 380px));
  }

  .hero__amp {
    display: inline;
    padding: 0 0.12em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .seal,
  .page,
  .btn,
  .envelope,
  .flap,
  .letter,
  .heart,
  .marquee__track {
    animation: none;
    transition: none;
  }
}
