:root {
  --white: #FFFFFF;
  --mist: #F1F4EE;
  --sage: #A9B8A0;
  --olive: #5E6F4E;
  --cypress: #1E2F24;
  --error-light: #FFD9CF;
  --display: "Bodoni Moda", "Didot", Georgia, serif;
  --body: "Jost", "Futura", "Century Gothic", sans-serif;
  --gutter: 24px;
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--cypress);
  font: 400 1.125rem/1.55 var(--body);
}

h1, h2, h3, p { margin: 0; }

h2 {
  font: 400 2.5rem/1.1 var(--display);
  font-variation-settings: "opsz" 16;
  margin-bottom: 1.25rem;
}

h3 {
  font: 500 1.125rem/1.4 var(--body);
}

a { color: inherit; }

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

[hidden] { display: none !important; }

/* Cover */

.cover {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #E7E4DB url("cover.jpg") center / cover;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.sealed { overflow: hidden; }

.cover-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seal {
  position: absolute;
  z-index: 1;
  top: 51.7%;
  left: 50%;
  width: 124px;
  height: 124px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  transform: translate(-50%, -50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.seal::before, .seal::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1.5px solid var(--white);
  border-radius: 50%;
  animation: seal-pulse 2.8s ease-out infinite;
}

.seal::after { animation-delay: 1.4s; }

@keyframes seal-pulse {
  from { transform: scale(.8); opacity: .9; }
  to { transform: scale(1.5); opacity: 0; }
}

.seal:focus-visible { outline-color: var(--white); }

.seal-hint {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: max(32px, env(safe-area-inset-bottom));
  padding: .5rem 1.25rem;
  background: var(--white);
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.cover::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  background: var(--white);
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}

.opening::after { opacity: 1; }

.opened {
  opacity: 0;
  transition: opacity .8s ease;
  pointer-events: none;
}

/* Hero: the first thing guests see once the envelope opens */

.hero { padding: 0; }

.hero-image {
  display: block;
  width: 100%;
  height: auto;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
}

.hero-text {
  position: relative;
  margin-top: -2.5rem;
  padding: 0 var(--gutter);
}

h1 {
  font: italic 400 clamp(3rem, 20vw, 6.5rem)/.96 var(--display);
  letter-spacing: -.01em;
  margin-bottom: 1rem;
}

h1:focus { outline: none; }

.hero-text p { font-weight: 500; }

/* Sections */

section { padding: 4.5rem var(--gutter); }

section p { max-width: 34em; }

.statement {
  font: 400 clamp(2.1rem, 8.6vw, 2.9rem)/1.14 var(--display);
  font-variation-settings: "opsz" 16;
  margin-bottom: 1.5rem;
}

.intro { padding-top: 3.5rem; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2rem;
}

.button {
  display: inline-block;
  padding: .8rem 1.75rem;
  border: 1px solid var(--cypress);
  border-radius: 999px;
  background: var(--cypress);
  color: var(--white);
  font: 500 1.0625rem/1.3 var(--body);
  text-decoration: none;
  cursor: pointer;
}

.button-quiet {
  background: transparent;
  color: var(--cypress);
}

.button-light {
  border-color: var(--white);
  background: var(--white);
  color: var(--cypress);
}

.text-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .2em;
  cursor: pointer;
}

/* The day: an olive branch that grows as guests scroll */

.branch {
  list-style: none;
  margin: 2.75rem 0 0;
  padding: 0;
}

.moment {
  position: relative;
  padding: 0 0 3.25rem 72px;
}

.moment:last-child { padding-bottom: 2rem; }

.stem {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 40px;
  height: 100%;
  overflow: visible;
  clip-path: inset(0 -20px calc(100% - var(--grown, 1) * 100%) -20px);
}

.stem path {
  fill: none;
  stroke: var(--olive);
  stroke-width: 1.5;
}

.leaf {
  position: absolute;
  top: -8px;
  left: 28px;
  width: 42px;
  height: 16px;
  transform-origin: 0 50%;
  transform: rotate(-32deg) scale(var(--leaf, 1));
  transition: transform .5s ease;
}

.moment:nth-child(even) .leaf {
  transform: rotate(212deg) scale(var(--leaf, 1));
}

.tip {
  position: absolute;
  top: 100%;
  left: 8px;
  width: 40px;
  height: 48px;
  overflow: visible;
  transform: scale(var(--leaf-tip, 1));
  transform-origin: 50% 0;
  transition: transform .5s ease;
}

.time {
  font: italic 400 1.75rem/1.2 var(--display);
  color: var(--olive);
  margin-bottom: .125rem;
}

/* Getting there */

.day { padding-bottom: 7rem; }

.travel { background: var(--mist); }

.map {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
  margin-bottom: .875rem;
  filter: saturate(.4);
}

.travel h3 { margin-top: 1.75rem; }

/* What to wear, gifts */

.details h2:not(:first-child) { margin-top: 4rem; }

.details .button { margin-top: 1.5rem; }

.gift-panel {
  margin-top: 1rem;
  color: var(--olive);
}

/* RSVP */

.rsvp {
  background: var(--cypress);
  color: var(--white);
}

.rsvp :focus-visible { outline-color: var(--white); }

form { margin-top: 2.5rem; }

.field {
  margin: 0 0 1.75rem;
  padding: 0;
  border: 0;
}

label, legend {
  display: block;
  padding: 0;
  margin-bottom: .375rem;
}

input[type="text"], select, textarea {
  width: 100%;
  padding: .625rem 0;
  border: 0;
  border-bottom: 1px solid var(--sage);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

select { appearance: auto; }

select option { color: var(--cypress); }

.choices {
  display: grid;
  gap: .625rem;
  margin-top: .375rem;
}

.choice {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
}

.choice span {
  display: block;
  padding: .75rem 1.125rem;
  border: 1px solid var(--sage);
  border-radius: 999px;
  transition: background-color .2s ease, color .2s ease;
}

.choice input:checked + span {
  border-color: var(--white);
  background: var(--white);
  color: var(--cypress);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

.error {
  margin-top: .5rem;
  color: var(--error-light);
}

.sample-note {
  margin-top: 1rem;
  font-size: 1rem;
  color: #C8D3C1;
}

.thanks { margin-top: 2.5rem; }

.thanks:focus { outline: none; }

.rsvp footer {
  margin-top: 6rem;
}

.closing {
  font: italic 400 clamp(2.75rem, 12vw, 4rem)/1.05 var(--display);
  margin-bottom: 1.25rem;
}

.credit {
  margin-top: 2rem;
  font-size: .875rem;
  color: #C8D3C1;
}

/* Music */

.music-toggle {
  position: fixed;
  z-index: 5;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--sage);
  border-radius: 50%;
  background: var(--white);
  color: var(--olive);
  cursor: pointer;
}

.music-toggle svg {
  width: 20px;
  height: 20px;
}

.music-toggle[aria-pressed="true"] {
  background: var(--olive);
  border-color: var(--olive);
  color: var(--white);
}

/* Desktop: the 9:16 video stays whole, over a blurred copy of itself */

@media (min-width: 900px) {
  :root { --gutter: 56px; }

  .cover::before {
    content: "";
    position: absolute;
    inset: -40px;
    background: url("cover.jpg") center / cover;
    filter: blur(28px);
  }

  .cover-video { object-fit: contain; }

  main {
    max-width: 720px;
    margin: 0 auto;
  }

  .travel {
    box-shadow: 0 0 0 100vmax var(--mist);
    clip-path: inset(0 -100vmax);
  }

  .rsvp {
    box-shadow: 0 0 0 100vmax var(--cypress);
    clip-path: inset(0 -100vmax);
  }

  .choices { grid-template-columns: 1fr 1fr; max-width: 34em; }

  form { max-width: 34em; }
}

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

  .seal::before, .seal::after { animation: none; opacity: .9; }

  .cover::after, .opened, .leaf, .tip, .choice span { transition: none; }
}
