:root {
  color-scheme: dark;
  --ink: #17110f;
  --cream: #f6eee3;
  --paper: #efe1d2;
  --wine: #a33742;
  --white: #fffaf4;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body {
  color: var(--white);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.experience,
.intro,
.story,
.finale {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.intro {
  isolation: isolate;
  background: #31231d;
}

.intro__photo {
  position: absolute;
  z-index: -3;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 54% center;
  transform: scale(1.035);
  animation: intro-photo 8s var(--ease) both;
}

.intro__veil {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 8, 7, 0.15) 0%, rgba(10, 8, 7, 0.02) 38%, rgba(10, 8, 7, 0.84) 100%),
    linear-gradient(90deg, rgba(12, 9, 8, 0.34), transparent 68%);
}

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

.intro__topline,
.finale__topline {
  position: absolute;
  z-index: 3;
  top: max(1.5rem, env(safe-area-inset-top));
  right: 1.25rem;
  left: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  animation: rise-in 0.8s 0.15s var(--ease) both;
}

.intro__heart {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  line-height: 1;
}

.intro__content {
  position: absolute;
  z-index: 2;
  right: 1.25rem;
  bottom: max(2rem, calc(env(safe-area-inset-bottom) + 1rem));
  left: 1.25rem;
  max-width: 38rem;
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.intro .eyebrow {
  animation: rise-in 0.8s 0.28s var(--ease) both;
}

.intro h1,
.finale h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  font-size: clamp(3rem, 14vw, 6.6rem);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.055em;
}

.intro h1 {
  animation: rise-in 1s 0.35s var(--ease) both;
}

.intro__lead {
  max-width: 22rem;
  margin: 1.15rem 0 1.5rem;
  color: rgba(255, 250, 244, 0.8);
  font-family: "Iowan Old Style", "Baskerville", Georgia, serif;
  font-size: 1rem;
  line-height: 1.45;
  animation: rise-in 0.8s 0.48s var(--ease) both;
}

.start-button,
.replay-button {
  display: inline-flex;
  min-height: 3.35rem;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start-button {
  width: min(100%, 20rem);
  padding: 0.35rem 0.4rem 0.35rem 1.35rem;
  color: var(--ink);
  background: var(--cream);
  animation: rise-in 0.8s 0.58s var(--ease) both;
  transition: transform 0.25s var(--ease), background 0.25s ease;
}

.start-button:hover {
  transform: translateY(-2px);
  background: #fffaf4;
}

.start-button__arrow {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--wine);
  font-size: 1.2rem;
  transition: transform 0.25s var(--ease);
}

.start-button:hover .start-button__arrow {
  transform: rotate(-12deg);
}

.intro__hint {
  margin: 0.8rem 0 0 1.35rem;
  color: rgba(255, 250, 244, 0.72);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  animation: rise-in 0.8s 0.68s var(--ease) both;
}

.intro.is-leaving {
  animation: intro-out 0.8s var(--ease) both;
}

.story {
  isolation: isolate;
  touch-action: pan-y;
  background: #080707;
}

.frame,
.frame__backdrop,
.frame__photo,
.story__shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.frame {
  z-index: -4;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.85s var(--ease);
}

.frame.is-visible {
  opacity: 1;
}

.frame__backdrop {
  z-index: -2;
  background-position: center;
  background-size: cover;
  filter: blur(28px) saturate(0.8) brightness(0.58);
  transform: scale(1.14);
}

.frame__photo {
  z-index: -1;
  display: block;
  object-fit: cover;
  object-position: center;
  transform: scale(1.04);
  transition: transform 5.2s linear;
}

.frame.is-visible .frame__photo {
  transform: scale(1);
}

.story__shade {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7, 6, 6, 0.54) 0%, transparent 28%),
    linear-gradient(0deg, rgba(7, 6, 6, 0.8) 0%, transparent 43%);
  pointer-events: none;
}

.story__header {
  position: absolute;
  z-index: 5;
  top: max(1.2rem, env(safe-area-inset-top));
  right: 1rem;
  left: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story__brand {
  margin: 0;
  font-family: "Iowan Old Style", "Baskerville", Georgia, serif;
  font-size: 1.15rem;
  font-style: italic;
}

.story__brand span {
  margin: 0 0.2rem;
  color: #f0adac;
}

.icon-button,
.nav-button {
  display: grid;
  border: 1px solid rgba(255, 255, 255, 0.33);
  border-radius: 50%;
  place-items: center;
  cursor: pointer;
  background: rgba(8, 7, 7, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s ease, transform 0.2s var(--ease);
}

.icon-button:hover,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
}

.icon-button svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-button .icon-play,
.icon-button.is-paused .icon-pause {
  display: none;
}

.icon-button.is-paused .icon-play {
  display: block;
}

.progress {
  position: absolute;
  z-index: 5;
  top: max(4.65rem, calc(env(safe-area-inset-top) + 3.45rem));
  right: 1.25rem;
  left: 1.25rem;
  display: flex;
  gap: 0.25rem;
}

.progress__segment {
  position: relative;
  height: 2px;
  flex: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.25);
}

.progress__segment::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left;
}

.progress__segment.is-done::after {
  transform: scaleX(1);
}

.progress__segment.is-current::after {
  animation: progress-fill var(--slide-duration, 3000ms) linear forwards;
}

.story.is-paused .progress__segment.is-current::after {
  animation-play-state: paused;
}

.story__copy {
  position: absolute;
  z-index: 4;
  right: 1.25rem;
  bottom: max(7.2rem, calc(env(safe-area-inset-bottom) + 5.5rem));
  left: 1.25rem;
  max-width: 36rem;
}

.story__count {
  margin: 0 0 0.75rem;
  color: rgba(255, 250, 244, 0.62);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.story__caption {
  max-width: 8.5em;
  margin: 0;
  font-family: "Iowan Old Style", "Baskerville", Georgia, serif;
  font-size: clamp(2.35rem, 11vw, 5rem);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.story__copy.is-entering .story__count,
.story__copy.is-entering .story__caption {
  animation: rise-in 0.75s var(--ease) both;
}

.story__copy.is-entering .story__caption {
  animation-delay: 0.08s;
}

.story__nav {
  position: absolute;
  z-index: 5;
  right: 1.25rem;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  left: 1.25rem;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
}

.story__nav p {
  margin: 0;
  color: rgba(255, 250, 244, 0.55);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.nav-button {
  width: 3rem;
  height: 3rem;
  font-size: 1rem;
}

.finale {
  isolation: isolate;
  color: var(--ink);
  background: var(--cream);
}

.finale::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.finale__glow {
  position: absolute;
  z-index: -1;
  top: -22vw;
  right: -24vw;
  width: 75vw;
  height: 75vw;
  border-radius: 50%;
  background: rgba(174, 52, 65, 0.15);
  filter: blur(2px);
  animation: glow-pulse 5s ease-in-out infinite alternate;
}

.finale__topline {
  color: rgba(23, 17, 15, 0.65);
  animation: none;
}

.finale__content {
  position: absolute;
  top: 50%;
  right: 1.25rem;
  left: 1.25rem;
  max-width: 48rem;
  transform: translateY(-52%);
}

.eyebrow--red {
  color: var(--wine);
}

.date {
  margin: 0 0 2rem;
  font-family: "Iowan Old Style", "Baskerville", Georgia, serif;
}

.date__weekday {
  display: block;
  font-size: clamp(4.7rem, 21vw, 10rem);
  line-height: 0.72;
  letter-spacing: -0.075em;
}

.date__details {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 1.1rem 0 0 0.25rem;
  color: var(--wine);
  text-transform: uppercase;
}

.date__details strong {
  font-size: clamp(1.05rem, 4.5vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.date__details span {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.19em;
}

.finale h2 {
  font-size: clamp(2.9rem, 12.5vw, 6rem);
}

.finale__note {
  max-width: 24rem;
  margin: 1.15rem 0 1.6rem;
  color: rgba(23, 17, 15, 0.64);
  font-family: "Iowan Old Style", "Baskerville", Georgia, serif;
  font-size: 1rem;
  line-height: 1.45;
}

.replay-button {
  gap: 1rem;
  padding: 0 1.25rem;
  border: 1px solid rgba(23, 17, 15, 0.28);
  color: var(--ink);
  background: transparent;
  transition: color 0.2s ease, background 0.2s ease;
}

.replay-button:hover {
  color: var(--cream);
  background: var(--ink);
}

.replay-button span {
  font-size: 1rem;
}

.finale__signature {
  position: absolute;
  right: 1.25rem;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  margin: 0;
  color: rgba(23, 17, 15, 0.68);
  font-family: "Iowan Old Style", "Baskerville", Georgia, serif;
  font-size: 1rem;
  font-style: italic;
}

.finale__signature span {
  color: var(--wine);
  font-size: 1.3rem;
}

.finale.is-entering .finale__topline,
.finale.is-entering .eyebrow,
.finale.is-entering .date,
.finale.is-entering h2,
.finale.is-entering .finale__note,
.finale.is-entering .replay-button,
.finale.is-entering .finale__signature {
  animation: rise-in 0.9s var(--ease) both;
}

.finale.is-entering .date { animation-delay: 0.08s; }
.finale.is-entering h2 { animation-delay: 0.2s; }
.finale.is-entering .finale__note { animation-delay: 0.3s; }
.finale.is-entering .replay-button { animation-delay: 0.4s; }
.finale.is-entering .finale__signature { animation-delay: 0.48s; }

.heart-particle {
  position: absolute;
  z-index: 0;
  bottom: -3rem;
  color: var(--wine);
  font-family: Georgia, serif;
  opacity: 0;
  pointer-events: none;
  animation: float-heart var(--float-time) var(--float-delay) ease-in forwards;
}

@keyframes intro-photo {
  from { transform: scale(1.09); }
  to { transform: scale(1.035); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(1.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes intro-out {
  to { opacity: 0; transform: scale(1.035); }
}

@keyframes progress-fill {
  to { transform: scaleX(1); }
}

@keyframes glow-pulse {
  to { transform: scale(1.12) translate(-4%, 5%); }
}

@keyframes float-heart {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  15% { opacity: 0.45; }
  100% { opacity: 0; transform: translate3d(var(--drift), -115vh, 0) rotate(28deg); }
}

@media (min-width: 700px) {
  .intro__topline,
  .finale__topline,
  .story__header,
  .progress,
  .story__copy,
  .story__nav,
  .finale__signature {
    right: 2.5rem;
    left: 2.5rem;
  }

  .intro__content,
  .finale__content {
    right: auto;
    left: clamp(2.5rem, 7vw, 7rem);
  }

  .intro__content {
    bottom: clamp(3rem, 8vh, 6rem);
  }

  .intro__photo {
    object-position: center 58%;
  }

  .intro__veil {
    background:
      linear-gradient(90deg, rgba(10, 8, 7, 0.78) 0%, rgba(10, 8, 7, 0.22) 53%, transparent 84%),
      linear-gradient(0deg, rgba(10, 8, 7, 0.54), transparent 50%);
  }

  .story__copy {
    bottom: 3rem;
  }

  .story__nav {
    right: 2.5rem;
    bottom: 3rem;
    left: auto;
    width: 12.5rem;
  }

  .finale__content {
    width: min(54rem, calc(100vw - 5rem));
  }

  .finale__signature {
    left: auto;
  }
}

@media (max-height: 690px) {
  .intro__content {
    bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .intro h1 {
    font-size: clamp(2.7rem, 12vw, 4.5rem);
  }

  .intro__lead {
    margin: 0.8rem 0 1rem;
  }

  .intro__hint {
    display: none;
  }

  .finale__content {
    transform: translateY(-50%);
  }

  .date {
    margin-bottom: 1.2rem;
  }

  .date__weekday {
    font-size: clamp(3.8rem, 17vw, 6.5rem);
  }

  .date__details {
    margin-top: 0.7rem;
  }

  .finale h2 {
    font-size: clamp(2.5rem, 10.5vw, 5rem);
  }

  .finale__note {
    margin: 0.8rem 0 1.15rem;
    font-size: 0.92rem;
  }
}

@media (max-width: 360px) {
  .replay-button {
    min-height: 3rem;
    gap: 0.45rem;
    padding: 0 0.8rem;
    font-size: 0.62rem;
  }

  .finale__signature {
    font-size: 0.84rem;
  }
}

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