@font-face {
  font-family: "Great Vibes";
  src: url("assets/great-vibes.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f5f1e9;
  --ink: #745938;
  --gold: #b58b54;
  --ease-paper: cubic-bezier(0.16, 0.88, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  min-width: 320px;
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  overflow-y: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
}

body.is-scroll-ready { overflow-y: auto; }

.music-toggle {
  position: fixed;
  z-index: 30;
  right: clamp(16px, 2.5vw, 30px);
  top: clamp(16px, 2.5vw, 30px);
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 250, 240, .68);
  border-radius: 50%;
  color: #fffaf0;
  background: rgba(48, 35, 23, .4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
  font-size: 1rem;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: opacity .3s ease, background .3s ease, transform .3s ease;
}

.music-toggle:hover { background: rgba(48, 35, 23, .62); transform: scale(1.04); }
.music-toggle:focus-visible { outline: 2px solid #f0d7a8; outline-offset: 3px; }
.music-toggle[hidden] { display: none; }
.music-toggle.is-paused { opacity: .6; }
.music-toggle.is-paused span { text-decoration: line-through; }

.experience {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: var(--paper);
}

.book {
  --left-angle: 0deg;
  --right-angle: 0deg;
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  perspective: 1800px;
  background: var(--paper);
}

.book.is-dragging { cursor: grabbing; }
.book.is-hero-ready { cursor: default; touch-action: pan-y; }

.book::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 242, 211, .5), transparent 18%, transparent 52%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.book.is-opening::after { animation: magicGlow 3.15s var(--ease-paper) both; }

.inside {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow: visible;
  padding: 0;
  color: #745938;
  text-align: center;
  background:
    radial-gradient(circle at 50% 44%, rgba(255,255,255,.92), transparent 37%),
    linear-gradient(135deg, #f7f3ec, #e9dfd1);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s ease, transform 1.15s var(--ease-paper);
}

body.is-scroll-ready .inside {
  opacity: 1;
  transform: translateY(0);
}

.inside::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
}

.inside__light {
  position: absolute;
  top: 0;
  left: -20%;
  width: 140%;
  height: 100vh;
  height: 100svh;
  background: linear-gradient(112deg, transparent 35%, rgba(255,255,255,.7) 48%, transparent 61%);
  animation: lightMove 8s ease-in-out infinite alternate;
  pointer-events: none;
}

.invitation-screen {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px;
  place-content: center;
  justify-items: center;
}

.invitation-for {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(90vw, 780px);
  min-height: min(62vh, 540px);
  padding: clamp(54px, 8vw, 92px) clamp(22px, 6vw, 70px);
  place-content: center;
  justify-items: center;
  border: 1px solid rgba(181, 139, 84, .2);
  border-radius: 48% 52% 46% 54% / 7% 8% 9% 7%;
  background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, .72), rgba(255, 250, 241, .24) 56%, transparent 74%);
  box-shadow: 0 24px 70px rgba(120, 88, 50, .07), inset 0 0 70px rgba(255, 255, 255, .36);
}

.invitation-for::before,
.invitation-for::after {
  content: "";
  position: absolute;
  width: 42%;
  height: 1px;
  left: 29%;
  background: linear-gradient(90deg, transparent, rgba(181, 139, 84, .55), transparent);
}

.invitation-for::before { top: 12%; }
.invitation-for::after { bottom: 12%; }

.invitation-for__ornament {
  width: 11px;
  height: 11px;
  margin-bottom: clamp(24px, 4vh, 38px);
  border: 1px solid rgba(181, 139, 84, .68);
  transform: rotate(45deg) scale(0);
  opacity: 0;
  box-shadow: 0 0 22px rgba(213, 175, 112, .34);
}

.invitation-for__intro {
  position: relative;
  z-index: 1;
  margin: 0;
  opacity: 0;
  color: rgba(116, 89, 56, .74);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(.76rem, 1.5vw, .98rem);
  letter-spacing: .23em;
  line-height: 1.7;
  text-transform: uppercase;
  transform: translateY(16px);
  transition: opacity 1.1s ease, transform 1.1s var(--ease-paper);
}

.invitation-for__name {
  position: relative;
  z-index: 1;
  min-height: 1.35em;
  margin: clamp(18px, 3vh, 30px) 0 0;
  color: #9c7137;
  font-family: "Great Vibes", "Snell Roundhand", "Segoe Script", cursive;
  font-size: clamp(3.1rem, 9vw, 7.3rem);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: .01em;
  text-shadow: 0 7px 18px rgba(125, 83, 35, .13), 0 0 30px rgba(228, 193, 130, .17);
}

.invitation-for__name i {
  display: inline-block;
  width: 1px;
  height: .82em;
  margin-left: 5px;
  opacity: 0;
  vertical-align: -.02em;
  background: rgba(156, 113, 55, .72);
}

.invitation-for.is-writing .invitation-for__name i { opacity: 1; animation: writingCursor .75s steps(1) infinite; }
.invitation-for.is-written .invitation-for__name i { animation: cursorFade .8s ease forwards; }

.invitation-for.is-visible .invitation-for__intro {
  opacity: 1;
  transform: translateY(0);
}

.invitation-for.is-visible .invitation-for__ornament {
  animation: ornamentBloom 1.2s var(--ease-paper) .15s forwards;
}

.invitation-for__signature {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 7px;
  margin: clamp(22px, 3vh, 34px) 0 0;
  opacity: 0;
  transform: translateY(13px);
}

.invitation-for__signature span {
  color: rgba(116, 89, 56, .58);
  font: 400 clamp(.62rem, 1vw, .76rem)/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.invitation-for__signature strong {
  color: #9c7137;
  font-family: "Great Vibes", "Snell Roundhand", "Segoe Script", cursive;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
  text-shadow: 0 5px 14px rgba(125, 83, 35, .11);
}

.invitation-for.is-written .invitation-for__signature {
  animation: signatureReveal 1.15s var(--ease-paper) .3s forwards;
}

.invitation-for__spark {
  position: absolute;
  opacity: 0;
  color: rgba(190, 145, 75, .72);
  font-size: clamp(.75rem, 1.5vw, 1.1rem);
  text-shadow: 0 0 14px rgba(232, 196, 132, .62);
  pointer-events: none;
}

.invitation-for__spark--one { top: 28%; left: 15%; }
.invitation-for__spark--two { top: 23%; right: 18%; }
.invitation-for__spark--three { right: 12%; bottom: 27%; }

.invitation-for.is-writing .invitation-for__spark { animation: handwrittenSpark 2.1s ease-in-out infinite; }
.invitation-for.is-writing .invitation-for__spark--two { animation-delay: .5s; }
.invitation-for.is-writing .invitation-for__spark--three { animation-delay: 1s; }

.love-story {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(26px, 5vw, 68px) clamp(14px, 4vw, 52px);
  place-items: center;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 249, 225, .72), transparent 34%),
    linear-gradient(135deg, #b79a6f 0%, #d8c39c 45%, #a98b63 100%);
  isolation: isolate;
}

.love-story::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.025 .12' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='.72'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
}

.love-story__paper {
  position: relative;
  width: min(100%, 920px);
  min-height: min(84vh, 840px);
  padding: clamp(62px, 8vw, 104px) clamp(28px, 8vw, 104px) clamp(52px, 7vw, 88px);
  color: #59432f;
  font-family: "Cormorant Garamond", Garamond, Georgia, serif;
  background:
    radial-gradient(ellipse at 13% 8%, rgba(151, 104, 53, .11), transparent 26%),
    radial-gradient(ellipse at 91% 94%, rgba(126, 83, 43, .12), transparent 30%),
    linear-gradient(104deg, rgba(125, 84, 43, .055), transparent 15%, rgba(255, 255, 255, .32) 52%, transparent 84%),
    #f2e4c5;
  border: 1px solid rgba(101, 67, 35, .28);
  border-radius: 3px 9px 5px 7px / 7px 4px 9px 3px;
  box-shadow:
    0 28px 65px rgba(58, 37, 19, .28),
    inset 0 0 72px rgba(113, 72, 33, .13),
    inset 0 0 0 8px rgba(255, 250, 229, .16);
}

.love-story__paper::before,
.love-story__paper::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.love-story__paper::before {
  inset: 0;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 150 150' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.love-story__paper::after {
  inset: 14px;
  border: 1px solid rgba(132, 92, 48, .15);
  border-radius: inherit;
}

.love-story__flourish {
  position: absolute;
  top: clamp(24px, 4vw, 40px);
  left: 50%;
  color: rgba(139, 94, 43, .56);
  font-size: clamp(.72rem, 1.3vw, .88rem);
  font-style: italic;
  letter-spacing: .27em;
  transform: translateX(-50%);
}

.love-story__eyebrow {
  margin: 0 0 13px;
  color: #9a703e;
  font-size: clamp(.72rem, 1.4vw, .9rem);
  font-weight: 600;
  letter-spacing: .25em;
  text-align: center;
  text-transform: uppercase;
}

.love-story__title {
  min-height: 1.15em;
  margin: 0 0 clamp(30px, 5vw, 48px);
  color: #76512f;
  font-size: clamp(2.35rem, 5.8vw, 4.7rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.02;
  text-align: center;
  text-wrap: balance;
}

.love-story__copy {
  display: grid;
  gap: clamp(17px, 2.5vw, 25px);
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(1.18rem, 2.25vw, 1.55rem);
  font-weight: 500;
  line-height: 1.55;
  text-align: center;
}

.love-story__copy p {
  min-height: 1.55em;
  margin: 0;
}

.story-typed:empty::after {
  content: "\00a0";
}

.love-story__names {
  min-height: 1.25em;
  margin: clamp(35px, 5vw, 52px) 0 0;
  color: #8e6538;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.love-story__cursor {
  display: block;
  width: 1px;
  height: 1.15em;
  margin: 8px auto 0;
  opacity: 0;
  background: rgba(118, 81, 47, .7);
}

.love-story.is-typing .love-story__cursor {
  opacity: 1;
  animation: writingCursor .78s steps(1) infinite;
}

.love-story.is-complete .love-story__paper {
  animation: storyGlow 1.8s ease both;
}

@keyframes storyGlow {
  0% { box-shadow: 0 28px 65px rgba(58, 37, 19, .28), inset 0 0 72px rgba(113, 72, 33, .13); }
  45% { box-shadow: 0 30px 78px rgba(58, 37, 19, .31), 0 0 45px rgba(255, 231, 176, .26), inset 0 0 72px rgba(113, 72, 33, .13); }
  100% { box-shadow: 0 28px 65px rgba(58, 37, 19, .28), inset 0 0 72px rgba(113, 72, 33, .13); }
}

@keyframes writingCursor {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@keyframes cursorFade {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes ornamentBloom {
  0% { opacity: 0; transform: rotate(45deg) scale(0); }
  60% { opacity: 1; transform: rotate(45deg) scale(1.28); }
  100% { opacity: .88; transform: rotate(45deg) scale(1); }
}

@keyframes handwrittenSpark {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); }
  38% { opacity: .9; transform: scale(1) rotate(18deg); }
  72% { opacity: .18; transform: scale(.72) rotate(34deg); }
}

@keyframes signatureReveal {
  from { opacity: 0; transform: translateY(13px); }
  to { opacity: 1; transform: translateY(0); }
}

.video-intro {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  background: #0d0b09;
  pointer-events: none;
  transition: opacity .8s ease, visibility 0s linear .8s;
}

.book.is-video-ready .video-intro,
.book.is-video-active .video-intro,
.book.is-hero-ready .video-intro {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.book.is-video-active .video-intro { pointer-events: auto; }

.book.is-video-ending .video-intro {
  visibility: visible;
  opacity: 0;
  pointer-events: none;
  transition-delay: 0s;
}

.video-intro__media {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d0b09;
  object-fit: cover;
  object-position: center;
}

.video-intro__control {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(255, 248, 234, .58);
  color: #fffaf0;
  background: rgba(35, 25, 17, .36);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
  font: 500 .66rem/1 Arial, sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background .25s ease, opacity .35s ease, transform .25s ease;
}

.video-intro__control:hover { background: rgba(35, 25, 17, .58); }
.video-intro__control:focus-visible { outline: 2px solid #f0d7a8; outline-offset: 3px; }
.video-intro__control[hidden] { display: none; }

.video-intro__sound,
.video-intro__play {
  top: 50%;
  left: 50%;
  min-width: 190px;
  padding: 16px 20px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.video-intro__sound { top: auto; bottom: 34px; }

.video-intro__skip {
  right: clamp(18px, 3vw, 42px);
  bottom: clamp(18px, 3vw, 34px);
  padding: 11px 14px;
  border-radius: 999px;
  opacity: .74;
}

.video-intro__scroll {
  position: absolute;
  z-index: 1;
  bottom: clamp(24px, 4vh, 44px);
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 9px;
  opacity: 0;
  color: rgba(255, 250, 240, .92);
  font: 500 .62rem/1 Arial, sans-serif;
  letter-spacing: .19em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .4);
  text-transform: uppercase;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity .8s ease .2s, transform .8s var(--ease-paper) .2s;
}

.video-intro__scroll i {
  width: 9px;
  height: 9px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  animation: scrollCue 1.7s ease-in-out infinite;
}

.book.is-hero-ready .video-intro__scroll {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes scrollCue {
  0%, 100% { transform: translateY(-2px) rotate(45deg); opacity: .45; }
  50% { transform: translateY(5px) rotate(45deg); opacity: 1; }
}

.cover-leaf {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  background-color: var(--paper);
  backface-visibility: hidden;
  transition: transform 2.65s var(--ease-paper), box-shadow 2.2s ease;
  will-change: transform;
}

.cover-leaf::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100vw;
  background-color: var(--paper);
  background-image: url("assets/cover-desktop-v2.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.cover-leaf--left {
  left: 0;
  transform: rotateY(var(--left-angle));
  transform-origin: left center;
}

.cover-leaf--left::before { left: 0; }

.cover-leaf--right {
  right: 0;
  transform: rotateY(var(--right-angle));
  transform-origin: right center;
}

.cover-leaf--right::before { right: 0; }

.book.is-dragging .cover-leaf { transition: none; }
.book.is-settling .cover-leaf { transition-duration: 1.7s; }
.book.is-closing .cover-leaf { transition-duration: 1.85s; }
.book.is-revealing .cover-leaf--left { box-shadow: 24px 0 45px rgba(92, 59, 29, .18); }
.book.is-revealing .cover-leaf--right { box-shadow: -24px 0 45px rgba(92, 59, 29, .18); }
.book.is-open .cover-leaf { pointer-events: none; }

.seal {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: clamp(128px, 17vw, 220px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  transform: translate(-50%, -50%);
  transition: opacity .4s ease, transform .45s var(--ease-paper), box-shadow .3s ease;
}

.seal::before, .seal::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.seal::before {
  inset: 7%;
  border: 1px solid rgba(210, 169, 112, .72);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 0 0 rgba(241, 207, 155, .34), 0 0 36px rgba(255, 226, 181, .42);
}

.seal::after {
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  opacity: 0;
  background: #fff6df;
  box-shadow:
    -74px -58px 0 -1px #f5d79f,
    82px -38px 0 -1px #fff2cc,
    -88px 36px 0 -1px #fff2cc,
    70px 63px 0 -1px #e8c185,
    -22px -94px 0 -1px #fff8e9,
    17px 91px 0 -1px #fff8e9;
}

.seal:hover { box-shadow: 0 0 0 8px rgba(192, 149, 103, .1), 0 0 42px rgba(192, 149, 103, .13); }
.seal:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }
.book.is-opening .seal { animation: sealPulse 1.25s var(--ease-paper) both; }
.book.is-opening .seal::before { animation: haloBloom 1.6s var(--ease-paper) both; }
.book.is-opening .seal::after { animation: sparkles 1.9s ease-out .12s both; }
.book.is-open .seal { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.78); }

@keyframes sealPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  42% { transform: translate(-50%, -50%) scale(1.045); }
  70% { transform: translate(-50%, -50%) scale(.985); }
}

@keyframes haloBloom {
  0% { opacity: 0; transform: scale(.72); box-shadow: 0 0 0 0 rgba(241, 207, 155, .35), 0 0 0 rgba(255, 226, 181, 0); }
  36% { opacity: .88; }
  100% { opacity: 0; transform: scale(1.42); box-shadow: 0 0 0 22px rgba(241, 207, 155, 0), 0 0 58px rgba(255, 226, 181, .12); }
}

@keyframes sparkles {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(.45); }
  30% { opacity: .92; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(22deg) scale(1.2); }
}

@keyframes magicGlow {
  0% { opacity: 0; transform: scale(.8); }
  22% { opacity: .68; }
  52% { opacity: .24; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(1.3); }
}

@keyframes lightMove {
  from { transform: translateX(-7%); }
  to { transform: translateX(7%); }
}

@media (max-width: 767px), (orientation: portrait) {
  .cover-leaf::before {
    background-image: url("assets/cover-mobile-v2.png");
  }

  .invitation-for {
    width: min(91vw, 520px);
    min-height: min(68vh, 570px);
    padding-inline: 20px;
  }

  .invitation-for__name { font-size: clamp(3.4rem, 17vw, 5.4rem); }

  .love-story {
    padding: 22px 10px;
  }

  .love-story__paper {
    min-height: calc(100svh - 44px);
    padding: 64px 23px 52px;
  }

  .love-story__copy {
    font-size: clamp(1.13rem, 5.1vw, 1.34rem);
    line-height: 1.48;
  }

  .video-intro__sound {
    right: auto;
    bottom: 76px;
  }

  .video-intro__skip {
    right: 16px;
    bottom: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
