:root {
  color-scheme: dark;
  --text: #fff8ef;
  --soft: rgba(255, 248, 239, 0.76);
  --ink: #2f2524;
  --rose: #cf6075;
  --rose-deep: #8e3148;
  --green: #315b50;
  --blue: #719fb8;
  --gold: #d7a85e;
  --paper: #fff7ec;
  --shadow: 0 28px 90px rgba(25, 17, 17, 0.34);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  background: #171413;
}

button {
  font: inherit;
}

.experience {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
}

.bg {
  position: absolute;
  inset: 0;
  z-index: -4;
  background-image: url("./assets/letter-bg.png");
  background-position: center;
  background-size: cover;
  transform: scale(1.04);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 248, 239, 0.08), transparent 26%),
    linear-gradient(90deg, rgba(21, 18, 18, 0.72), rgba(34, 26, 26, 0.26), rgba(16, 19, 19, 0.72)),
    linear-gradient(0deg, rgba(17, 14, 14, 0.72), transparent 42%, rgba(17, 14, 14, 0.28));
}

.grain {
  position: absolute;
  inset: 0;
  z-index: -3;
  opacity: 0.19;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 38px 38px;
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 78%);
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.glow-field {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 76%, rgba(207, 96, 117, 0.22), transparent 18%),
    radial-gradient(circle at 78% 24%, rgba(215, 168, 94, 0.18), transparent 20%),
    radial-gradient(circle at 52% 56%, rgba(113, 159, 184, 0.14), transparent 24%);
  filter: blur(4px);
  animation: breathe 8s ease-in-out infinite alternate;
}

@keyframes breathe {
  from {
    opacity: 0.62;
    transform: scale(1);
  }
  to {
    opacity: 0.95;
    transform: scale(1.04);
  }
}

.petals {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.petals span {
  position: absolute;
  top: -10vh;
  width: var(--size);
  height: calc(var(--size) * 0.58);
  border-radius: 80% 0 80% 0;
  background: linear-gradient(135deg, rgba(255, 191, 200, 0.82), rgba(255, 248, 239, 0.25));
  opacity: var(--alpha);
  animation: petalFall var(--speed) linear infinite;
  animation-delay: var(--delay);
  transform: translateX(var(--x)) rotate(var(--rot));
}

@keyframes petalFall {
  to {
    transform: translate(calc(var(--x) + var(--drift)), 116vh) rotate(calc(var(--rot) + 310deg));
  }
}

.sparkles {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 229, 178, 0.94);
  box-shadow: 0 0 18px rgba(255, 229, 178, 0.7);
  animation: sparklePop 780ms ease-out forwards;
}

@keyframes sparklePop {
  to {
    opacity: 0;
    transform: translate(var(--sx), var(--sy)) scale(0.2);
  }
}

.deck {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  touch-action: pan-y;
}

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(22px, 5vw, 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  pointer-events: none;
  transform: translateX(36px) scale(0.985);
  transition: opacity 520ms ease, transform 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.cover {
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: clamp(22px, 3.8vh, 36px);
}

.kicker {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(5rem, 16vw, 12rem);
  line-height: 0.92;
  text-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

.cover-copy {
  width: 92vw;
  max-width: 31ch;
  color: var(--soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.35;
}

.start-button {
  min-width: 168px;
  min-height: 48px;
  border: 1px solid rgba(255, 248, 239, 0.42);
  border-radius: 999px;
  background: rgba(255, 248, 239, 0.16);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.2);
  transition: transform 180ms ease, background 180ms ease;
}

.start-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 248, 239, 0.24);
}

.acrostic-slide {
  grid-template-columns: minmax(160px, 0.72fr) minmax(320px, 620px);
  gap: clamp(16px, 6vw, 80px);
}

.big-letter {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(150px, 27vw, 320px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 248, 239, 0.28);
  border-radius: 50%;
  color: rgba(255, 248, 239, 0.92);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(7rem, 20vw, 17rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 70px rgba(255, 248, 239, 0.08), 0 28px 90px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.slide[data-theme="rose"] .big-letter {
  background: radial-gradient(circle at 35% 25%, rgba(255, 213, 206, 0.42), rgba(207, 96, 117, 0.36));
}

.slide[data-theme="green"] .big-letter {
  background: radial-gradient(circle at 35% 25%, rgba(231, 240, 219, 0.4), rgba(49, 91, 80, 0.48));
}

.slide[data-theme="blue"] .big-letter {
  background: radial-gradient(circle at 35% 25%, rgba(232, 244, 247, 0.42), rgba(113, 159, 184, 0.42));
}

.slide[data-theme="gold"] .big-letter {
  background: radial-gradient(circle at 35% 25%, rgba(255, 235, 182, 0.45), rgba(215, 168, 94, 0.42));
}

.slide-copy {
  width: min(620px, 46vw);
  height: clamp(430px, 54vh, 540px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(18px, 2.5vh, 26px);
  max-width: 620px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid rgba(255, 248, 239, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 248, 239, 0.08), rgba(255, 248, 239, 0.02)),
    rgba(20, 17, 17, 0.18);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
}

.slide-copy h2,
.letter-paper h2 {
  font-size: clamp(2.8rem, 7vw, 5.8rem);
  line-height: 0.9;
}

.slide-copy p {
  color: var(--soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.35rem, 2.7vw, 2rem);
  line-height: 1.35;
}

.final {
  padding-bottom: 96px;
}

.final-content {
  width: min(1120px, 94vw);
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(320px, 690px);
  align-items: center;
  gap: clamp(22px, 5vw, 58px);
}

.reasons {
  grid-template-columns: minmax(280px, 520px) minmax(280px, 520px);
  gap: clamp(24px, 6vw, 70px);
}

.reasons-copy {
  display: grid;
  gap: 16px;
}

.reasons-copy h2 {
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.88;
}

.reasons-copy p:not(.kicker) {
  color: var(--soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.35rem, 2.6vw, 1.95rem);
  line-height: 1.35;
}

.reason-grid {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.reason-card {
  height: 154px;
  display: grid;
  align-content: end;
  gap: 10px;
  border: 1px solid rgba(255, 248, 239, 0.28);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(255, 248, 239, 0.18), rgba(255, 248, 239, 0.06)),
    rgba(28, 22, 22, 0.24);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
  transform-style: preserve-3d;
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease;
}

.reason-card:hover,
.reason-card.revealed {
  transform: translateY(-4px);
  border-color: rgba(215, 168, 94, 0.68);
  background:
    linear-gradient(145deg, rgba(215, 168, 94, 0.24), rgba(207, 96, 117, 0.12)),
    rgba(28, 22, 22, 0.3);
}

.reason-card span {
  color: var(--gold);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 700;
  line-height: 0.92;
}

.reason-card strong {
  max-height: 0;
  overflow: hidden;
  color: rgba(255, 248, 239, 0.86);
  font-size: 0.98rem;
  line-height: 1.35;
  opacity: 0;
  transition: max-height 240ms ease, opacity 240ms ease;
}

.reason-card.revealed strong {
  max-height: 70px;
  opacity: 1;
}

.constellation {
  grid-template-columns: minmax(280px, 500px) minmax(280px, 520px);
  gap: clamp(26px, 7vw, 86px);
}

.constellation-copy {
  display: grid;
  gap: 16px;
}

.constellation-copy h2 {
  font-size: clamp(3.2rem, 8vw, 6.8rem);
  line-height: 0.86;
}

.constellation-copy p:not(.kicker) {
  color: var(--soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.35rem, 2.6vw, 1.95rem);
  line-height: 1.35;
}

.star-map {
  position: relative;
  width: min(88vw, 520px);
  aspect-ratio: 1.12;
  border: 1px solid rgba(255, 248, 239, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 248, 239, 0.16), transparent 34%),
    linear-gradient(145deg, rgba(113, 159, 184, 0.18), rgba(207, 96, 117, 0.12)),
    rgba(20, 17, 17, 0.26);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.star-map::before {
  content: "";
  position: absolute;
  inset: 17% 16% 32% 18%;
  background:
    linear-gradient(32deg, transparent 48.7%, rgba(255, 248, 239, 0.22) 49%, rgba(255, 248, 239, 0.22) 51%, transparent 51.3%),
    linear-gradient(148deg, transparent 48.8%, rgba(255, 248, 239, 0.16) 49%, rgba(255, 248, 239, 0.16) 51%, transparent 51.2%);
  opacity: 0.68;
}

.star-note {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.star-note span {
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: #ffe6a7;
  box-shadow: 0 0 0 8px rgba(255, 230, 167, 0.08), 0 0 26px rgba(255, 230, 167, 0.82);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.star-note:hover span,
.star-note.active span {
  transform: scale(1.38);
  box-shadow: 0 0 0 12px rgba(255, 230, 167, 0.1), 0 0 34px rgba(255, 230, 167, 1);
}

.star-note-a {
  left: 24%;
  top: 35%;
}

.star-note-b {
  left: 66%;
  top: 24%;
}

.star-note-c {
  left: 78%;
  top: 58%;
}

.star-note-d {
  left: 38%;
  top: 70%;
}

.star-message {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: min(82%, 390px);
  min-height: 86px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid rgba(255, 248, 239, 0.28);
  border-radius: 8px;
  background: rgba(25, 20, 20, 0.42);
  color: rgba(255, 248, 239, 0.92);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.18rem, 2.5vw, 1.55rem);
  line-height: 1.3;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.portrait-card {
  position: relative;
  width: min(100%, 390px);
  margin: 0;
  justify-self: end;
  border: 1px solid rgba(255, 248, 239, 0.32);
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(145deg, rgba(255, 248, 239, 0.2), rgba(255, 248, 239, 0.06)),
    rgba(20, 17, 17, 0.28);
  box-shadow: 0 26px 76px rgba(0, 0, 0, 0.28);
  transform: rotate(-2deg);
  backdrop-filter: blur(12px);
}

.portrait-card::before {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: -1;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 42%, rgba(215, 168, 94, 0.38), transparent 64%);
  filter: blur(10px);
}

.portrait-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  object-fit: cover;
  object-position: center;
}

.portrait-card figcaption {
  padding: 13px 8px 4px;
  color: rgba(255, 248, 239, 0.84);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.12rem, 2vw, 1.38rem);
  line-height: 1.25;
  text-align: center;
}

.letter-paper {
  width: 100%;
  padding: clamp(30px, 6vw, 58px);
  border: 1px solid rgba(215, 168, 94, 0.46);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(207, 96, 117, 0.12), transparent 18%, transparent 82%, rgba(49, 91, 80, 0.12)),
    var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.letter-paper h2 {
  color: var(--rose-deep);
}

.letter-paper p {
  margin-top: 20px;
  color: #5d504d;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.28rem, 2.4vw, 1.75rem);
  line-height: 1.42;
}

.nav {
  position: fixed;
  left: 50%;
  bottom: max(clamp(16px, 4vh, 34px), env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  grid-template-columns: 46px auto 46px;
  align-items: center;
  gap: 14px;
  transform: translateX(-50%);
}

.nav-button {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 248, 239, 0.36);
  border-radius: 50%;
  background: rgba(22, 18, 18, 0.36);
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.nav-button:hover {
  transform: translateY(-2px);
}

.nav-button:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.dots {
  display: flex;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 248, 239, 0.24);
  border-radius: 999px;
  background: rgba(22, 18, 18, 0.34);
  backdrop-filter: blur(12px);
}

.dot {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 248, 239, 0.42);
  padding: 0;
  cursor: pointer;
  transition: width 220ms ease, background 220ms ease;
}

.dot.active {
  width: 28px;
  background: var(--gold);
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .slide {
    padding: 24px 18px 104px;
    overflow-x: hidden;
  }

  .cover-copy {
    width: min(100%, 520px);
    max-width: 27ch;
    overflow-wrap: break-word;
  }

  .acrostic-slide,
  .reasons,
  .constellation {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    gap: 24px;
    text-align: center;
  }

  .big-letter {
    width: min(56vw, 230px);
  }

  .slide-copy {
    width: min(92vw, 520px);
    height: auto;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .slide-copy p {
    margin-top: 20px;
    width: min(92vw, 520px);
  }

  .reasons-copy,
  .constellation-copy {
    max-width: 520px;
    text-align: center;
  }

  .reason-grid {
    width: min(92vw, 520px);
  }

  .final-content {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 18px;
  }

  .portrait-card {
    width: min(64vw, 270px);
    justify-self: center;
    transform: rotate(-1deg);
  }

  .letter-paper {
    width: min(92vw, 690px);
  }
}

@media (max-width: 430px) {
  .cover {
    gap: 24px;
  }

  .cover-copy {
    width: 236px;
    max-width: calc(100vw - 82px);
  }

  h1 {
    font-size: clamp(3.85rem, 18vw, 4.75rem);
  }

  .cover-copy,
  .slide-copy p,
  .reasons-copy p:not(.kicker),
  .constellation-copy p:not(.kicker) {
    font-size: 1.22rem;
  }

  .slide-copy h2,
  .letter-paper h2,
  .reasons-copy h2,
  .constellation-copy h2 {
    font-size: clamp(2.45rem, 13vw, 3.4rem);
  }

  .star-map {
    width: min(92vw, 390px);
  }

  .star-note-a {
    left: 24%;
    top: 29%;
  }

  .star-note-b {
    left: 66%;
    top: 22%;
  }

  .star-note-c {
    left: 78%;
    top: 45%;
  }

  .star-note-d {
    left: 34%;
    top: 52%;
  }

  .star-message {
    bottom: 18px;
    width: min(84%, 310px);
    min-height: 92px;
  }

  .portrait-card {
    width: min(68vw, 236px);
    padding: 8px;
  }

  .portrait-card figcaption {
    font-size: 1.04rem;
  }

  .reason-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .reason-card {
    height: 118px;
    padding: 16px;
  }

  .nav {
    grid-template-columns: 38px auto 38px;
    gap: 8px;
  }

  .nav-button {
    width: 38px;
    height: 38px;
  }

  .dots {
    gap: 5px;
    padding: 10px 9px;
  }

  .dot {
    width: 7px;
    height: 7px;
  }

  .dot.active {
    width: 24px;
  }
}

@media (max-width: 760px) and (max-height: 740px) {
  .slide {
    align-content: start;
    padding-top: 20px;
  }

  .cover {
    align-content: center;
  }

  .big-letter {
    width: min(46vw, 176px);
  }

  .portrait-card {
    width: min(54vw, 204px);
  }

  .final-content {
    gap: 14px;
  }

  .letter-paper {
    padding: 24px 22px;
  }
}

@media (max-height: 660px) and (min-width: 761px) {
  .big-letter {
    width: clamp(130px, 22vw, 240px);
  }

  .slide-copy {
    height: clamp(310px, 52vh, 350px);
    gap: 16px;
  }

  .slide-copy h2,
  .reasons-copy h2,
  .constellation-copy h2 {
    font-size: clamp(2.5rem, 6vw, 4.6rem);
  }

  .slide-copy p,
  .reasons-copy p:not(.kicker),
  .constellation-copy p:not(.kicker) {
    font-size: clamp(1.2rem, 2.2vw, 1.65rem);
  }

  .reason-card {
    height: 126px;
  }
}

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