:root {
  --wine: #631523;
  --wine-deep: #691a1a;
  --pink: #ebb2bc;
  --pink-deep: #e7b1bc;
  --cream: #f6f6ea;
  --paper: #ffffff;
  --chip: #e4b0bb;
  --magenta: #9d2a5a;
  --sans: "Montserrat", "Avenir Next", "Helvetica Neue", sans-serif;
  --name: "Fraunces", "Iowan Old Style", Palatino, serif;
  --serif: "Source Serif 4", "Palatino Linotype", Palatino, serif;
  --script: "Petemoss", "Segoe Script", cursive;
  --shell: 820px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #2a0c14;
  color: var(--wine-deep);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.is-sealed {
  overflow: hidden;
}

.shell {
  width: min(100%, var(--shell));
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  overflow-x: clip;
}

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

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Envelope */

.envelope {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  justify-content: center;
  perspective: 1400px;
}

.envelope[hidden] {
  display: none;
}

.envelope-card {
  position: relative;
  width: min(100%, var(--shell));
  min-height: 100dvh;
  overflow: visible;
  cursor: pointer;
  background: var(--magenta);
  transform-style: preserve-3d;
}

.envelope-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.envelope-inside {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 100%;
  height: 56%;
  background: linear-gradient(180deg, #f8e7ef 0%, #f3d5e2 46%, #e7b3c8 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.envelope-flap {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: 100%;
  height: 58%;
  transform-origin: 50% 0%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.flap-face {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  backface-visibility: hidden;
}

.flap-front {
  background:
    linear-gradient(165deg, #d27a9c 0%, #b24570 38%, #9a2b58 72%, #7d1d46 100%);
  box-shadow: inset 0 -18px 24px rgba(80, 10, 30, 0.18);
}

.flap-back {
  background: linear-gradient(180deg, #5a132c, #3d0c1e);
  transform: rotateX(180deg);
}

.envelope-content {
  position: relative;
  z-index: 6;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #fff;
  padding: 22vh 32px 12vh;
}

.envelope-kicker {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.envelope-name {
  margin: 16px 0 0;
  font-family: var(--name);
  font-weight: 560;
  font-size: clamp(46px, 13vw, 64px);
  line-height: 0.92;
  letter-spacing: 0.04em;
  font-variation-settings: "SOFT" 70, "WONK" 1, "opsz" 144, "wght" 560;
  text-transform: uppercase;
}

.envelope-name span {
  display: block;
}

.seal {
  position: relative;
  width: 104px;
  height: 104px;
  margin-top: auto;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 10px 16px rgba(70, 10, 30, 0.28));
  animation: seal-pulse 2.8s ease-in-out infinite;
}

.seal-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.seal-letter {
  position: relative;
  z-index: 1;
  font-family: var(--name);
  font-size: 34px;
  font-weight: 560;
  font-variation-settings: "SOFT" 70, "WONK" 1, "opsz" 144, "wght" 560;
  letter-spacing: 0.02em;
  color: #b44d78;
}

.envelope-action {
  margin: 26px 0 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

body.is-sealed main {
  opacity: 0;
}

.envelope.is-open .seal {
  animation: seal-break 0.55s ease forwards;
}

.envelope.is-open .envelope-flap {
  animation: flap-open 1.2s cubic-bezier(0.55, 0.02, 0.2, 1) 0.32s forwards;
}

.envelope.is-open .envelope-content {
  animation: copy-fade 0.28s ease 0.18s forwards;
}

.envelope.is-open .envelope-card {
  animation: card-lift 0.48s cubic-bezier(0.4, 0, 0.2, 1) 1.32s forwards;
}

main {
  animation: invite-in 0.45s ease 1.38s both;
}

body.is-sealed main {
  animation: none;
}

@keyframes seal-pulse {
  0%,
  100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@keyframes seal-break {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  40% { transform: scale(0.88) rotate(-6deg); opacity: 1; }
  100% { transform: scale(1.45) rotate(8deg); opacity: 0; }
}

@keyframes flap-open {
  0% { transform: rotateX(0deg); }
  100% { transform: rotateX(-168deg); }
}

@keyframes copy-fade {
  to { opacity: 0; }
}

@keyframes card-lift {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-110%); opacity: 0; }
}

@keyframes invite-in {
  from { opacity: 0; transform: translateY(36px); }
  to { opacity: 1; transform: none; }
}

/* Hero */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 62.6% 37.4%;
  height: 100dvh;
  min-height: 640px;
  background: var(--wine);
  overflow: hidden;
}

.hero-photo-frame {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.hero-photo {
  position: absolute;
  max-width: none;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 28px 12px 26px;
  color: var(--cream);
}

.hero-events {
  list-style: none;
  align-self: stretch;
  margin: 0;
  padding: 0;
  text-align: right;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.45;
  text-transform: uppercase;
}

.course-lockup {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.course-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  max-width: 100%;
  max-height: 100%;
}

.course-vertical,
.course-script {
  margin: 0;
  flex: none;
  writing-mode: vertical-rl;
  white-space: nowrap;
}

.course-vertical {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(38px, 11.4vw, 54px);
  letter-spacing: 0.14em;
  line-height: 0.82;
  text-transform: uppercase;
  color: #f0c9d2;
}

.course-script {
  position: relative;
  z-index: 1;
  margin-right: -0.22em;
  font-family: "Yellowtail", var(--script);
  font-weight: 400;
  font-size: clamp(50px, 14.6vw, 64px);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: lowercase;
  color: #fff;
  -webkit-text-stroke: 0.45px #fff;
  paint-order: stroke fill;
  pointer-events: none;
}

.hero-name {
  margin: 0;
  width: 100%;
  max-width: 100%;
  text-align: center;
  font-family: var(--name);
  font-weight: 560;
  font-size: 30px;
  line-height: 0.9;
  letter-spacing: 0.02em;
  font-variation-settings: "SOFT" 70, "WONK" 1, "opsz" 144, "wght" 560;
  text-transform: uppercase;
  outline: none;
}

.hero-name span {
  display: block;
  width: fit-content;
  margin-inline: auto;
}

.scroll-cue {
  position: absolute;
  left: calc(62.6% - 58px);
  bottom: 22px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--wine);
  background: rgba(255, 255, 255, 0.28);
  color: var(--wine);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.scroll-cue svg {
  width: 18px;
  height: 18px;
}

/* Countdown */

.countdown {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 74px;
  padding: 8px 12px 8px 6px;
  background: var(--pink);
  color: var(--wine);
}

.count-kicker {
  margin: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.count-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: start;
}

.count-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.count-value {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 7.6vw, 36px);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.count-label {
  margin-top: 4px;
  max-width: 100%;
  font-family: var(--sans);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.count-sep {
  font-family: var(--serif);
  font-size: clamp(22px, 6vw, 30px);
  line-height: 0.9;
  font-weight: 600;
}

/* Shared band */

.band {
  background: var(--wine);
  color: var(--pink);
  text-align: center;
  padding: 28px 20px 26px;
}

.band h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(32px, 9vw, 42px);
  letter-spacing: 0.01em;
  line-height: 1;
}

/* Schedule */

.schedule-body {
  padding: 28px 22px 8px;
}

.day-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 30px;
  color: var(--wine-deep);
}

.day-num {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 72px;
  line-height: 0.85;
}

.day-month {
  margin-top: 6px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.18em;
}

.day-year {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
}

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

.event-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(26px, 7.2vw, 32px);
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--wine-deep);
}

.event-row {
  display: grid;
  grid-template-columns: 86px 1fr;
  column-gap: 14px;
  align-items: center;
}

.event-time {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--wine-deep);
}

.event-detail {
  min-width: 0;
  padding: 4px 0 0 14px;
  border-left: 1px solid #e7c3cb;
}

.event-place {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--wine-deep);
}

.event-map {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: #fff;
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.event-map svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.back {
  display: flex;
  justify-content: center;
  width: fit-content;
  margin: 40px auto 0;
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--wine);
  color: var(--cream);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Verse */

.verse {
  background: var(--paper);
  padding: 28px 28px 56px;
}

.verse-body {
  margin: 0;
  padding: 8px 8px 0;
  text-align: center;
}

.verse-body p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(22px, 5.8vw, 26px);
  line-height: 1.35;
  color: var(--wine-deep);
}

.verse-body p::before {
  content: "“";
}

.verse-body p::after {
  content: "”";
}

.verse-body footer {
  margin-top: 22px;
  font-family: var(--script);
  font-size: 34px;
  color: #d98998;
}

.verse .back {
  margin-top: 36px;
}

.verse-body footer::before {
  content: "";
  display: block;
  width: 36px;
  height: 1px;
  margin: 0 auto 16px;
  background: var(--pink);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .seal { animation: none; }
  .envelope.is-open .seal,
  .envelope.is-open .envelope-flap,
  .envelope.is-open .envelope-content,
  .envelope.is-open .envelope-card,
  main {
    animation: none;
  }
}
