@font-face {
  font-family: Bodoni;
  src: url("./assets/bodoni.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: Bodoni;
  src: url("./assets/bodoni-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fff5f8;
  --ink: #642b4b;
  --rose: #9e305c;
  --rule: #d08aa8;
  --type-serif: Bodoni, 'Times New Roman', serif;
  --type-mono: 'Courier New', monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }

.gift {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 33fr) minmax(0, 67fr);
  grid-template-rows: 1fr auto auto 1.17fr;
  align-items: center;
  min-height: 100svh;
  padding: 4.5vh 4.8vw;
  overflow: hidden;
  background: radial-gradient(ellipse at 67% 48%, #f7dce8 0%, #fceaf0 30%, var(--paper) 66%);
}

.frame {
  position: absolute;
  inset: clamp(16px, 2.1vw, 34px);
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--rule) 76%, transparent);
}

.frame i {
  position: absolute;
  height: 18px;
  width: 18px;
  border: solid var(--rule);
  background: var(--paper);
}

.frame i:nth-child(1) { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.frame i:nth-child(2) { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.frame i:nth-child(3) { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.frame i:nth-child(4) { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }

.dedication {
  grid-column: 1;
  grid-row: 2;
  z-index: 2;
  margin: 0;
  width: max-content;
  max-width: 100%;
  line-height: 1;
  font: 500 clamp(21px, 2.84vw, 54px) / 1.06 var(--type-serif);
  letter-spacing: -.035em;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 58;
  pointer-events: none;
}

.dedication span { display: block; }
.dedication em {
  display: block;
  margin: .09em 0 0 -.045em;
  color: var(--rose);
  font-size: clamp(99px, 12.6vw, 207px);
  font-variation-settings: "opsz" 69;
  line-height: .86;
  font-weight: 500;
  letter-spacing: -.063em;
}

.next-action,
.reveal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-height: 49px;
  padding: 0 20px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--rose);
  background: #fbe0ea;
  font: 400 clamp(14px, 1.16vw, 16px) / 1.2 var(--type-mono);
  letter-spacing: .045em;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease, color .25s ease;
}

.next-action {
  grid-column: 1;
  grid-row: 3;
  z-index: 2;
  justify-self: start;
  margin: clamp(27px, 5vh, 51px) 0 0;
}

.next-action[hidden] { display: none; }
.next-action:hover, .reveal:hover {
  border-color: var(--rose);
  background: #f5ccde;
  color: #762044;
}
.next-action:focus-visible, .reveal:focus-visible, .display:focus-visible {
  outline: 1px dashed var(--rose);
  outline-offset: 7px;
}
.gift h1:focus { outline: none; }

.display {
  grid-column: 2;
  grid-row: 1 / -1;
  position: relative;
  height: 91svh;
  min-height: 480px;
  margin-inline: -2vw -1.9vw;
  user-select: none;
}

.display.ready { cursor: grab; touch-action: pan-y; }
.display.dragging { cursor: grabbing; }
.viewport { position: absolute; inset: 0; }
.viewport canvas[hidden] { display: none; }

.viewport canvas, .poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.poster { position: absolute; inset: 0; pointer-events: none; }
.ready .poster { display: none; }

.orbit {
  position: absolute;
  width: 79%;
  height: 7%;
  left: 10.5%;
  bottom: 3.2%;
  border: 1px dotted #c587a6;
  border-radius: 50%;
  opacity: .69;
}

.spark {
  position: absolute;
  z-index: 1;
  color: #ad5b80;
  font: 13px / .67 var(--type-mono);
  white-space: pre;
  pointer-events: none;
  text-shadow: 0 0 6px #e9a8c29c;
  opacity: .76;
}
.spark-one { top: 9%; left: 5%; }
.spark-two { top: 14%; right: 4%; }
.spark-three { bottom: 21%; left: 1%; }
.spark-four { bottom: 18%; right: 10%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .gift {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-content: center;
    justify-items: center;
    row-gap: clamp(5px, 2svh, 20px);
    padding: max(38px, 5.6svh) 25px 32px;
    background: radial-gradient(ellipse at 50% 58%, #f7dce8 0%, #fceaf0 37%, var(--paper) 72%);
  }
  .dedication { grid-row: 1; text-align: center; font-size: clamp(24px, 6.3vw, 40px); }
  .dedication em { font-size: clamp(78px, 19vw, 126px); font-variation-settings: "opsz" 48; }
  .display {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-height: 0;
    height: min(105vw, 58svh, 620px);
    margin: 5px 0 0;
  }
  .orbit { width: 78%; left: 11%; bottom: 4.5%; }
  .next-action { justify-self: center; margin: 6px 0 0; }
  .spark { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

body.cover-visible,
body.is-untying,
body:has(.flower-dialog[open]) {
  overflow: hidden;
}

.intro {
  position: fixed;
  z-index: 4;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 28px;
  isolation: isolate;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background: radial-gradient(ellipse at 50% 47%, #fff9fa 0%, #fff1f6 47%, #f9dce9 100%);
}

.intro[hidden] { display: none; }
.intro .frame { z-index: 1; }
.intro.is-leaving {
  pointer-events: none;
  animation: open-cover 760ms cubic-bezier(.64, .04, .24, 1) both;
}

@keyframes open-cover {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(var(--exit-x), var(--exit-y), 0); }
}

.intro-content {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  text-align: center;
  transform: translate(var(--drift-x, 0px), var(--drift-y, 0px));
  transition: transform .32s ease-out;
}

.intro.is-dragging .intro-content { transition: none; }
.intro-dedication {
  grid-column: auto;
  grid-row: auto;
  font-size: clamp(29px, 4.05vw, 64px);
}
.intro-dedication em {
  margin-left: 0;
  font-size: clamp(88px, 14.5vw, 205px);
}

.intro-anniversary {
  margin: clamp(20px, 3.6svh, 40px) 0 0;
  color: var(--rose);
  font: 500 clamp(14px, 1.66vw, 24px) / 1.35 var(--type-serif);
  letter-spacing: .075em;
  text-wrap: balance;
}

.intro-ornament {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 clamp(18px, 3.5svh, 32px);
  color: #af6387;
  font-family: var(--type-mono);
}

.intro-ornament span {
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d18fa9);
}

.intro-ornament span:last-child { transform: rotate(180deg); }
.reveal { margin-top: clamp(21px, 4.1svh, 41px); padding-inline: 19px 16px; }
.reveal svg { transition: transform .24s ease; }
.reveal:hover svg { transform: translateX(3px); }

.intro-spray {
  z-index: 0;
  position: absolute;
  width: min(55vw, 800px);
  aspect-ratio: 1;
  pointer-events: none;
}

.intro-spray-left { top: -27%; left: -17%; transform: rotate(-9deg); }
.intro-spray-right { bottom: -29%; right: -16%; transform: rotate(172deg); }

.intro-spray img {
  position: absolute;
  width: var(--width);
  top: var(--top);
  left: var(--left);
  opacity: var(--opacity, .84);
  transform: rotate(var(--rotate));
  filter: drop-shadow(0 12px 24px #9c4a7024);
}
.intro-spray img:nth-child(1) { --top: 47%; --left: 48%; --width: 52%; --rotate: -38deg; --opacity: .61; }
.intro-spray img:nth-child(2) { --top: 57%; --left: 17%; --width: 48%; --rotate: 26deg; --opacity: .64; }
.intro-spray img:nth-child(3) { --top: 33%; --left: 55%; --width: 32%; --rotate: 20deg; }
.intro-spray img:nth-child(4) { --top: 37%; --left: 15%; --width: 55%; --rotate: -19deg; }
.intro-spray img:nth-child(5) { --top: 67%; --left: 54%; --width: 21%; --rotate: 38deg; }
.intro-spray img:nth-child(6) { --top: 54%; --left: 73%; --width: 19%; --rotate: -33deg; }

.petal-trail {
  position: fixed;
  z-index: 5;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.petal-trail i {
  position: absolute;
  top: var(--y);
  left: 0;
  width: var(--length);
  height: calc(var(--length) * .62);
  border-radius: 92% 21% 84% 28%;
  opacity: 0;
  background: linear-gradient(125deg, #f4b3b3, #b3496b 70%, #742542);
}

.petal-trail i:nth-child(3n) {
  background: linear-gradient(120deg, #f7d4bc, #d68992 68%, #86586f);
}

.petal-trail.is-scattering i {
  animation: spill-petal 980ms var(--delay) cubic-bezier(.12, .38, .35, .92) both;
}

@keyframes spill-petal {
  0% { opacity: 0; transform: translate3d(-30px, 50px, 0) rotate(-28deg); }
  16% { opacity: .83; }
  73% { opacity: .51; }
  100% { opacity: 0; transform: translate3d(108vw, var(--curve), 0) rotate(285deg); }
}

@media (max-width: 760px) {
  .intro-spray { width: min(100vw, 520px); }
  .intro-spray-left { top: -20vw; left: -39vw; }
  .intro-spray-right { bottom: -22vw; right: -36vw; }
  .intro-dedication { font-size: clamp(25px, 6.9vw, 45px); }
  .intro-dedication em { font-size: clamp(84px, 22vw, 128px); }
}

@media (max-height: 440px) {
  .intro-dedication { font-size: 26px; }
  .intro-dedication em { font-size: 85px; }
  .intro-ornament { margin-bottom: 9px; }
  .reveal { margin-top: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .intro.is-leaving, .petal-trail.is-scattering i { animation: none; }
}

.gift[hidden], .garden[hidden] { display: none; }

.bouquet-dedication span { font-size: clamp(21px, 2.52vw, 47px); }
.bouquet-dedication em {
  font-size: clamp(70px, 9.7vw, 160px);
  letter-spacing: -.045em;
  margin-top: .13em;
}

.gift.is-departing {
  opacity: 0;
  transition: opacity .64s ease;
}

.garden {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 100svh;
  padding: clamp(56px, 8svh, 82px) clamp(29px, 4.4vw, 77px);
  background: radial-gradient(ellipse at 50% 46%, #fbe2eb 0%, #fdf0f4 47%, var(--paper) 78%);
}

.garden.is-staged {
  position: absolute;
  inset: 0 0 auto;
  opacity: 0;
  pointer-events: none;
}
.garden.is-arriving {
  opacity: 1;
  transition: opacity .88s ease;
}

#garden-title {
  position: relative;
  margin: 0 0 clamp(27px, 6.3svh, 65px);
  color: var(--rose);
  text-align: center;
  font: italic 500 clamp(51px, 7.3vw, 115px) / .95 var(--type-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 55;
  letter-spacing: -.052em;
}
#garden-title:focus { outline: none; }

.garden-star {
  position: absolute;
  font: 12px / .75 var(--type-mono);
  color: #ad5b80;
  pointer-events: none;
  opacity: .74;
}
.garden-star-top { top: 12%; left: 14%; }
.garden-star-bottom { bottom: 10%; right: 14%; }

.bloom-grid {
  position: relative;
  width: min(100%, 1220px);
  height: clamp(440px, 60svh, 650px);
}

.bloom {
  position: absolute;
  left: var(--wide-x);
  top: var(--wide-y);
  width: calc(clamp(115px, 14.8vw, 204px) * var(--flower-scale));
  aspect-ratio: 5 / 7;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: transparent;
  cursor: pointer;
  perspective: 550px;
  translate: -50% -50%;
  transform: scale(1);
  transition: transform .3s ease, filter .25s ease;
  --twist: var(--wide-angle);
}

.bloom img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: contain;
  user-select: none;
  transform: rotateZ(var(--twist)) rotateX(var(--lean-x, 0deg)) rotateY(var(--lean-y, 0deg));
  transition: transform .26s ease;
  pointer-events: none;
  animation: flower-breathe 8.5s var(--drift-delay) ease-in-out infinite;
}

@keyframes flower-breathe {
  0%, 100% { translate: 0 2px; rotate: y -8deg; }
  50% { translate: 0 -4px; rotate: y 10deg; }
}

.bloom:focus-visible {
  outline: 1px dashed var(--rose);
  outline-offset: 4px;
}

.bloom:is(:hover, :focus-visible) {
  z-index: 1;
  transform: scale(1.105) translateY(-6px);
  filter: brightness(1.10) drop-shadow(0 10px 16px #924b7140);
}
.bloom.is-picked img,
.garden.is-staged .bloom img { visibility: hidden; animation: none; }

.flower-flight {
  position: fixed;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  perspective: 720px;
  pointer-events: none;
}
.flower-flight img {
  position: absolute;
  display: block;
  aspect-ratio: 5 / 7;
  object-fit: contain;
}

.flower-dialog {
  position: fixed;
  width: min(475px, calc(100% - 33px));
  max-height: calc(100svh - 36px);
  padding: 0;
  margin: auto;
  overflow: visible;
  border: 0;
  background: transparent;
  color: #582743;
}

.flower-dialog::backdrop { background: #e7bbce77; backdrop-filter: blur(2px); }

.flower-paper {
  position: relative;
  isolation: isolate;
  min-height: 267px;
  padding: clamp(87px, 15vw, 115px) clamp(24px, 7vw, 55px) clamp(31px, 6vw, 47px);
  border: 1px solid #ce8da7;
  border-radius: 2px;
  text-align: center;
  background: radial-gradient(ellipse at 12% 5%, #fffbf9, #fff2f6 66%, #f9e0eb);
  box-shadow: 0 24px 96px #85436238;
  overflow: hidden;
}

.flower-paper::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid #d59bb3;
  pointer-events: none;
}

.flower-paper::after {
  content: "";
  position: absolute;
  right: -29px;
  bottom: -52px;
  z-index: -1;
  width: 151px;
  aspect-ratio: 1;
  background: url("./assets/rose.webp") center / contain no-repeat;
  transform: rotate(-16deg);
  opacity: .13;
  pointer-events: none;
}

.flower-crown {
  position: absolute;
  z-index: 1;
  top: -158px;
  left: 0;
  right: 0;
  width: clamp(130px, 36vw, 177px);
  aspect-ratio: 5 / 7;
  margin: 0 auto;
  filter: drop-shadow(0 10px 14px #7b3a5652);
  object-fit: contain;
  transform: rotateZ(-24deg);
  pointer-events: none;
}

.flower-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8d3358;
  cursor: pointer;
}
.flower-close:hover { background: #f0c6d77d; }
.flower-close:focus-visible { outline: 1px dashed #9e305c; outline-offset: 0; }

#flower-title {
  margin: 0 0 .52em;
  color: #8d3358;
  font: italic 500 clamp(36px, 8vw, 55px) / .99 var(--type-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 44;
  letter-spacing: -.045em;
}

#flower-note { margin: 0; font: 18px / 1.48 Georgia, serif; }

@media (max-width: 760px) {
  .bouquet-dedication span { font-size: clamp(20px, 5.45vw, 32px); }
  .bouquet-dedication em { font-size: clamp(59px, 15vw, 100px); }
  .garden {
    align-content: start;
    padding: clamp(64px, 9svh, 83px) 26px clamp(54px, 8svh, 72px);
  }
  .bloom-grid { width: min(100%, 510px); height: clamp(655px, 190vw, 900px); }
  .bloom {
    left: var(--narrow-x);
    top: var(--narrow-y);
    width: calc(clamp(104px, 31vw, 156px) * var(--flower-scale));
    --twist: var(--narrow-angle);
  }
  .garden-star-top { top: 5%; left: 10%; }
  .garden-star-bottom { bottom: 4%; right: 10%; }
  .flower-crown { top: -119px; width: min(144px, 37vw); }
}

@media (max-height: 480px) and (orientation: landscape) {
  .flower-paper { min-height: 0; padding-block: 62px 24px; }
  .flower-crown { width: 107px; top: -92px; }
  #flower-title { font-size: 35px; }
}

@media (max-width: 360px) and (orientation: portrait) {
  .flower-dialog { translate: 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .bloom img { animation: none; }
  .bloom:is(:hover, :focus-visible) { transform: none; }
}

.password-gate { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 25%, #fffdfb, #ffeaf3 58%, #f4cada); }
.password-gate[hidden] { display: none; }
.password-card { width: min(100%, 470px); padding: 52px 35px; text-align: center; background: #fff9f9; border: 1px solid #dda5bc; box-shadow: 0 15px 50px #a8547629; }
.password-flower { color: #b75b81; font-size: 22px; }
.password-card h1 { color: #8e3156; font: italic 500 clamp(39px, 8vw, 58px)/1.06 var(--type-serif); margin: 20px 0 27px; }
.password-card label { display: block; margin-bottom: 14px; font: 18px var(--type-serif); color: #8b5270; }
.password-card input { width: min(100%, 260px); padding: 13px; border: 1px solid #d69bb3; border-radius: 2px; background: white; color: #642b4b; text-align: center; font: 20px var(--type-mono); letter-spacing: .15em; }
.password-card button { cursor: pointer; padding: 13px 24px; border: 1px solid #bd7996; background: #f8d6e4; color: #8e3156; font: 15px var(--type-mono); }
#password-error { min-height: 1.2em; margin: 10px 0; color: #a43557; font: 14px var(--type-mono); }
body.locked { overflow: hidden; }
