:root {
  --paper: #fbf7f3;
  --paper-deep: #f3e7e1;
  --blush: #e8cfc8;
  --rose: #caa49a;
  --terracotta: #a9786b;
  --cocoa: #5c4139;
  --ink: #3f302c;
  --gold: #bb9560;
  --line: rgba(114, 76, 65, 0.24);
  --shadow: 0 24px 80px rgba(76, 48, 40, 0.14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --script: "Snell Roundhand", "Segoe Script", "Apple Chancery", cursive;
  --sans: Inter, Avenir, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--serif);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.invitation-closed {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.noscript-note {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  padding: 0.8rem 1rem;
  color: white;
  background: var(--cocoa);
  text-align: center;
  font: 600 0.78rem/1.4 var(--sans);
}

.section-pad {
  padding: clamp(5.5rem, 11vw, 9rem) clamp(1.25rem, 5vw, 5rem);
}

.eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  line-height: 1.4;
  text-transform: uppercase;
}

.welcome {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100svh;
  overflow: hidden;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(circle at 15% 12%, rgba(255,255,255,0.88), transparent 28%),
    radial-gradient(circle at 86% 78%, rgba(208,164,151,0.23), transparent 35%),
    linear-gradient(145deg, #fbf6f1 0%, #f1e0d9 100%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.welcome::before,
.welcome::after {
  content: "";
  position: absolute;
  width: min(58vw, 420px);
  aspect-ratio: 1;
  border: 1px solid rgba(157, 116, 101, 0.16);
  border-radius: 50%;
}

.welcome::before {
  top: -22vw;
  left: -16vw;
}

.welcome::after {
  right: -25vw;
  bottom: -21vw;
}

.welcome.is-opening {
  pointer-events: none;
}

.welcome.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.welcome-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.7;
  animation: float 7s ease-in-out infinite;
}

.welcome-glow-one {
  top: 15%;
  left: 10%;
  width: 7px;
  height: 7px;
  background: var(--gold);
}

.welcome-glow-two {
  right: 13%;
  bottom: 25%;
  width: 5px;
  height: 5px;
  background: var(--gold);
  animation-delay: -2.3s;
}

.welcome-copy {
  position: relative;
  z-index: 2;
  margin-bottom: 2rem;
  text-align: center;
}

.welcome-copy .eyebrow {
  color: var(--terracotta);
}

.welcome-intro {
  margin: 0.5rem 0 0;
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  font-style: italic;
}

.envelope {
  position: relative;
  z-index: 2;
  width: min(78vw, 360px);
  aspect-ratio: 1.52;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 20px 28px rgba(80, 49, 40, 0.2));
  perspective: 900px;
}

.envelope-back,
.envelope-front,
.envelope-flap,
.envelope-letter {
  position: absolute;
  inset: 0;
  border-radius: 3px;
}

.envelope-back {
  background: #d6b2a6;
}

.envelope-letter {
  inset: 4% 7% 12%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: var(--cocoa);
  background: #fffaf5;
  border: 1px solid rgba(179, 141, 95, 0.28);
  transform: translateY(0);
  transition: transform 0.85s 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.mini-crown {
  color: var(--gold);
  font-size: 1.3rem;
}

.mini-name {
  margin-top: 0.25rem;
  font-family: var(--script);
  font-size: clamp(1.15rem, 6vw, 1.75rem);
}

.mini-date {
  margin-top: 0.65rem;
  font: 600 0.56rem/1 var(--sans);
  letter-spacing: 0.22em;
}

.envelope-front {
  z-index: 3;
  overflow: hidden;
  background: linear-gradient(145deg, #e2c6be, #cfaaa0);
  clip-path: polygon(0 34%, 50% 73%, 100% 34%, 100% 100%, 0 100%);
}

.envelope-front::after {
  content: "";
  position: absolute;
  inset: 33% 0 0;
  background: rgba(255,255,255,0.09);
  clip-path: polygon(0 0, 50% 46%, 100% 0, 100% 100%, 0 100%);
}

.envelope-flap {
  z-index: 4;
  height: 59%;
  background: linear-gradient(165deg, #ebd2ca, #d9b7ad);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 0.65s cubic-bezier(0.55, 0, 0.1, 1), z-index 0s 0.35s;
}

.wax-seal {
  position: absolute;
  top: 48%;
  left: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  color: #fff8f2;
  background: #a56f65;
  border: 3px double rgba(255,255,255,0.48);
  border-radius: 50%;
  box-shadow: 0 5px 12px rgba(79, 45, 39, 0.22);
  font: 600 0.72rem/1 var(--serif);
  letter-spacing: 0.08em;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease, transform 0.45s ease;
}

.welcome.is-opening .envelope-flap {
  z-index: 1;
  transform: rotateX(180deg);
}

.welcome.is-opening .wax-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7) rotate(18deg);
}

.welcome.is-opening .envelope-letter {
  transform: translateY(-48%);
}

.open-label {
  position: relative;
  z-index: 2;
  margin-top: 2.4rem;
  padding: 0.7rem 1.25rem;
  border: 0;
  border-bottom: 1px solid var(--terracotta);
  color: var(--cocoa);
  background: transparent;
  cursor: pointer;
  font: 600 0.68rem/1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.welcome-date {
  position: absolute;
  bottom: max(1.8rem, env(safe-area-inset-bottom));
  margin: 0;
  color: rgba(92, 65, 57, 0.68);
  font: 500 0.64rem/1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

main {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.8s 0.35s ease;
}

main.is-visible {
  opacity: 1;
}

.hero {
  position: relative;
  min-height: 100svh;
  background:
    linear-gradient(rgba(187,149,96,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(187,149,96,0.07) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 16px;
  pointer-events: none;
  border: 1px solid rgba(187, 149, 96, 0.34);
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.82fr);
  grid-template-areas:
    "copy portrait"
    "button portrait"
    "scroll portrait";
  align-items: center;
  gap: 2rem clamp(2.5rem, 7vw, 7rem);
  width: min(1120px, 100%);
  min-height: calc(100svh - clamp(11rem, 22vw, 18rem));
  margin: 0 auto;
}

.hero-copy {
  grid-area: copy;
  max-width: 640px;
}

.hero-copy .eyebrow {
  color: var(--terracotta);
}

.hero-kicker {
  max-width: 460px;
  margin: 1.15rem 0 1.4rem;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  font-style: italic;
  line-height: 1.65;
}

h1,
h2,
h3,
p {
  text-wrap: balance;
}

h1 {
  margin: 0;
  color: var(--cocoa);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.84;
}

h1 > span {
  display: block;
  font-size: clamp(4.2rem, 10vw, 8.5rem);
  letter-spacing: -0.055em;
}

h1 > span:nth-child(2) {
  margin-left: clamp(1rem, 6vw, 5.2rem);
  color: var(--terracotta);
  font-family: var(--script);
  font-size: clamp(4.5rem, 10.5vw, 9rem);
}

h1 small {
  display: block;
  margin-top: 1.4rem;
  font-family: var(--sans);
  font-size: clamp(0.62rem, 1.2vw, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.32em;
  line-height: 1.4;
  text-transform: uppercase;
}

.ornament {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: min(280px, 68%);
  margin: 2rem 0 1.4rem;
  color: var(--gold);
}

.ornament span {
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

.ornament b {
  font-size: 0.75rem;
}

.hero-date,
.hero-time {
  margin: 0.35rem 0;
  font-family: var(--sans);
  font-size: clamp(0.72rem, 1.5vw, 0.88rem);
  letter-spacing: 0.12em;
  line-height: 1.6;
  text-transform: uppercase;
}

.hero-time {
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-style: italic;
  letter-spacing: 0.03em;
  text-transform: none;
}

.portrait-wrap {
  position: relative;
  grid-area: portrait;
  width: min(100%, 440px);
  justify-self: center;
}

.portrait-arch {
  position: relative;
  z-index: 2;
  overflow: hidden;
  aspect-ratio: 0.77;
  background: var(--blush);
  border: 8px solid #fffaf5;
  border-radius: 48% 48% 3px 3px / 28% 28% 3px 3px;
  box-shadow: var(--shadow);
}

.portrait-arch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}

.portrait-arch::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(77, 43, 36, 0.1), transparent 38%);
}

.portrait-ring {
  position: absolute;
  inset: -20px 18px 22px -18px;
  border: 1px solid rgba(187, 149, 96, 0.7);
  border-radius: 48% 48% 3px 3px / 28% 28% 3px 3px;
}

.portrait-star {
  position: absolute;
  z-index: 3;
  color: var(--gold);
  animation: sparkle 2.4s ease-in-out infinite;
}

.star-one {
  top: 10%;
  right: -18px;
  font-size: 1.1rem;
}

.star-two {
  bottom: 16%;
  left: -25px;
  font-size: 1.6rem;
  animation-delay: -1.1s;
}

.botanical {
  position: absolute;
  z-index: 1;
  width: min(18vw, 180px);
  fill: rgba(232, 207, 200, 0.35);
  stroke: rgba(169, 120, 107, 0.48);
  stroke-width: 1.4;
}

.botanical-left {
  bottom: -20px;
  left: -15px;
}

.botanical-right {
  top: -20px;
  right: -15px;
  transform: rotate(180deg);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 1rem 1.6rem;
  border: 1px solid var(--cocoa);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  font: 600 0.68rem/1 var(--sans);
  letter-spacing: 0.17em;
  text-transform: uppercase;
  transition: transform 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  grid-area: button;
  width: max-content;
  color: white;
  background: var(--cocoa);
}

.button-primary:hover {
  background: var(--terracotta);
}

.button-outline {
  background: transparent;
}

.button-outline:hover {
  color: white;
  background: var(--cocoa);
}

.scroll-cue {
  grid-area: scroll;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: max-content;
  margin-top: 0.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: 500 0.64rem/1 var(--sans);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.scroll-cue i {
  position: relative;
  display: block;
  width: 34px;
  height: 1px;
  background: var(--terracotta);
}

.scroll-cue i::after {
  content: "";
  position: absolute;
  top: -3px;
  right: 0;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--terracotta);
  border-bottom: 1px solid var(--terracotta);
  transform: rotate(-45deg);
}

.section-heading {
  max-width: 650px;
  margin: 0 auto 3.2rem;
  text-align: center;
}

.section-heading .eyebrow {
  color: var(--terracotta);
}

.section-heading h2,
.blessing-copy h2,
.date-copy h2,
.closing h2 {
  margin: 0.65rem 0 0;
  color: var(--cocoa);
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.section-heading p {
  margin: 1.25rem auto 0;
  font-size: 1.08rem;
  font-style: italic;
  line-height: 1.7;
}

.countdown {
  color: #fff9f5;
  background: var(--cocoa);
}

.countdown .section-heading .eyebrow,
.countdown .section-heading h2 {
  color: inherit;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(820px, 100%);
  margin: 0 auto;
  border-top: 1px solid rgba(255,255,255,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.countdown-grid > div {
  position: relative;
  padding: clamp(1.8rem, 5vw, 3rem) 0.5rem;
  text-align: center;
}

.countdown-grid > div:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 25%;
  right: 0;
  bottom: 25%;
  width: 1px;
  background: rgba(255,255,255,0.2);
}

.countdown-grid strong {
  display: block;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  font-weight: 400;
  line-height: 1;
}

.countdown-grid span {
  display: block;
  margin-top: 0.7rem;
  font: 500 0.6rem/1 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.blessing {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(3rem, 9vw, 8rem);
  width: min(1040px, 100%);
  margin: 0 auto;
}

.blessing-photo {
  position: relative;
  padding: 0 0 1.35rem 1.35rem;
}

.blessing-photo img {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 0.78;
  object-fit: cover;
  object-position: center;
  box-shadow: var(--shadow);
}

.photo-frame {
  position: absolute;
  inset: 1.35rem 1.35rem 0 0;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}

.blessing-copy .eyebrow,
.date-copy .eyebrow {
  color: var(--terracotta);
}

.blessing-copy p,
.date-copy p {
  max-width: 550px;
  margin: 1.6rem 0 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.85;
}

.script-note {
  margin-top: 2rem;
  color: var(--terracotta);
  font-family: var(--script);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.details {
  background:
    radial-gradient(circle at 10% 15%, rgba(255,255,255,0.75), transparent 25%),
    var(--paper-deep);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: min(980px, 100%);
  margin: 0 auto;
}

.detail-card {
  position: relative;
  min-height: 480px;
  padding: clamp(2rem, 5vw, 3.5rem);
  overflow: hidden;
  background: rgba(255, 251, 247, 0.82);
  border: 1px solid rgba(187,149,96,0.28);
  text-align: center;
}

.detail-card::before,
.detail-card::after {
  content: "";
  position: absolute;
  width: 90px;
  aspect-ratio: 1;
  border: 1px solid rgba(187,149,96,0.22);
  border-radius: 50%;
}

.detail-card::before {
  top: -55px;
  left: -50px;
}

.detail-card::after {
  right: -50px;
  bottom: -55px;
}

.detail-number {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  color: rgba(169, 120, 107, 0.55);
  font: 500 0.62rem/1 var(--sans);
  letter-spacing: 0.14em;
}

.detail-icon {
  display: grid;
  place-items: center;
  width: 68px;
  aspect-ratio: 1;
  margin: 0 auto 1.5rem;
  color: var(--terracotta);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.detail-icon svg {
  width: 38px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.detail-card .eyebrow {
  color: var(--terracotta);
}

.detail-card h3 {
  max-width: 330px;
  margin: 1rem auto 0;
  color: var(--cocoa);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.08;
}

.detail-card p {
  margin: 1.25rem 0 0;
  font-size: 1rem;
  line-height: 1.65;
}

.detail-card time {
  display: block;
  margin-top: 1.1rem;
  color: var(--terracotta);
  font-family: var(--script);
  font-size: 1.5rem;
}

.detail-card a {
  display: inline-block;
  margin-top: 1.7rem;
  padding-bottom: 0.35rem;
  color: var(--ink);
  border-bottom: 1px solid var(--terracotta);
  text-decoration: none;
  font: 600 0.65rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.date-banner {
  display: grid;
  grid-template-columns: minmax(220px, 0.58fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(3rem, 9vw, 8rem);
  width: min(980px, 100%);
  margin: 0 auto;
}

.date-card {
  display: grid;
  place-items: center;
  aspect-ratio: 0.92;
  padding: 2rem;
  color: white;
  background: var(--terracotta);
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
}

.date-card strong {
  font-size: clamp(6rem, 13vw, 10rem);
  font-weight: 400;
  line-height: 0.8;
}

.date-month,
.date-year {
  font: 600 0.68rem/1 var(--sans);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.closing {
  position: relative;
  min-height: 78svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.8), transparent 45%),
    var(--paper-deep);
}

.closing::before {
  content: "";
  position: absolute;
  inset: 22px;
  pointer-events: none;
  border: 1px solid rgba(187,149,96,0.34);
}

.closing-flourish {
  margin-bottom: 1.5rem;
  color: var(--gold);
  font-size: 1.1rem;
}

.closing .eyebrow {
  color: var(--terracotta);
}

.closing-name {
  margin: 1.5rem 0 2.5rem;
  color: var(--terracotta);
  font-family: var(--script);
  font-size: clamp(2.3rem, 6vw, 4.2rem);
}

.share-status {
  min-height: 1.2em;
  margin: 1rem 0 0;
  font: 500 0.75rem/1.4 var(--sans);
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.85s ease, transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-delay-one {
  transition-delay: 0.13s;
}

.reveal-delay-two {
  transition-delay: 0.26s;
}

.reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-13px); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0.45; transform: scale(0.85) rotate(0); }
  50% { opacity: 1; transform: scale(1.14) rotate(22deg); }
}

@media (max-width: 820px) {
  .hero-inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "portrait"
      "button"
      "scroll";
    justify-items: center;
    text-align: center;
  }

  .hero-copy {
    padding-top: 2rem;
  }

  .hero-kicker,
  .ornament {
    margin-right: auto;
    margin-left: auto;
  }

  h1 > span:nth-child(2) {
    margin-left: 0;
  }

  .portrait-wrap {
    width: min(82vw, 390px);
    margin: 1.5rem 0;
  }

  .button-primary,
  .scroll-cue {
    justify-self: center;
  }

  .botanical {
    width: 30vw;
    opacity: 0.75;
  }

  .blessing,
  .date-banner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .blessing-photo,
  .date-card {
    width: min(75vw, 400px);
    margin: 0 auto;
  }

  .blessing-copy p,
  .date-copy p {
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 620px) {
  .section-pad {
    padding: 5.5rem 1.2rem;
  }

  .hero {
    padding-top: 4.8rem;
    padding-bottom: 4.8rem;
  }

  .hero::before {
    inset: 9px;
  }

  .hero-kicker {
    margin-bottom: 1.8rem;
  }

  h1 > span {
    font-size: clamp(4.05rem, 23vw, 6.4rem);
  }

  h1 > span:nth-child(2) {
    font-size: clamp(4.15rem, 23vw, 6.6rem);
  }

  h1 small {
    letter-spacing: 0.24em;
  }

  .countdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .countdown-grid > div:nth-child(2)::after {
    display: none;
  }

  .countdown-grid > div:nth-child(-n+2) {
    border-bottom: 1px solid rgba(255,255,255,0.2);
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .detail-card {
    min-height: 440px;
  }

  .date-card {
    width: min(75vw, 330px);
  }

  .closing::before {
    inset: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
