@import url("./fonts/cormorant-garamond.css");
@import url("./fonts/manrope.css");

:root {
  color-scheme: dark;
  --night: #09090d;
  --night-soft: #11111a;
  --paper: #f5f7fb;
  --cyan: #67e8f9;
  --violet: #8b5cf6;
  --rose: #fb7185;
  --lime: #bef264;
  --ink: #24212e;
  font-family: "Manrope", sans-serif;
  color: var(--paper);
  background: var(--night);
  scroll-behavior: smooth;
  scrollbar-color: #8b5cf6 #11111a;
  scrollbar-width: thin;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
::selection { background: var(--cyan); color: var(--night); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 7px; }
[hidden] { display: none !important; }
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--night); }
.backdrop img {
  position: absolute; left: 50%; top: 50%;
  width: 100svh; height: 100vw; object-fit: cover; object-position: center 60%;
  transform: translate(-50%, -50%) rotate(-90deg);
  filter: brightness(.62);
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgb(9 9 13 / 22%), rgb(9 9 13 / 16%) 45%, rgb(9 9 13 / 82%));
}
.stage {
  min-height: 100svh; display: grid; place-content: center; justify-items: center;
  padding: 4rem 1.5rem 9rem; text-align: center;
}
.stage h1 {
  margin: 0 0 1.25rem;
  font: 400 clamp(4rem, 9vw, 6rem)/1.04 "Cormorant Garamond", Georgia, serif;
  letter-spacing: -.035em;
  text-shadow: 0 4px 24px rgb(0 0 0 / 45%);
}
.envelope-trigger {
  position: relative; width: min(72vw, 29rem); aspect-ratio: 1.6;
  padding: 0; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink); isolation: isolate;
  transition: transform .45s cubic-bezier(.16, 1, .3, 1);
}
.envelope-trigger:hover { transform: translateY(-5px); }
.envelope-visual { position: absolute; inset: 0; filter: drop-shadow(0 20px 28px rgb(0 0 0 / 35%)); }
.envelope-visual svg { display: block; width: 100%; height: 100%; overflow: visible; }
.envelope-flap {
  transform-box: fill-box; transform-origin: 50% 0;
  transition: transform .8s cubic-bezier(.16, 1, .3, 1);
  backface-visibility: hidden;
}
.letter-in-envelope { transition: transform .8s cubic-bezier(.16, 1, .3, 1); }
.envelope-seal {
  position: absolute; left: 50%; top: 55%;
  display: grid; place-items: center;
  width: clamp(2.6rem, 6vw, 3.2rem); aspect-ratio: 1;
  border-radius: 50%; color: var(--paper); background: #7751be;
  box-shadow: 0 5px 10px rgb(9 9 13 / 25%), inset 0 1px 2px rgb(255 255 255 / 40%);
  transform: translate(-50%, -50%);
  transition: opacity .25s ease, transform .6s ease;
}
.envelope-seal svg { width: 22px; height: 22px; }
.trigger-label {
  position: absolute; left: 0; right: 0; top: 79%;
  font-size: clamp(.85rem, 1.5vw, 1rem); font-weight: 600;
}
.is-open .envelope-flap { transform: rotateX(-175deg); }
.is-open .letter-in-envelope { transform: translateY(-30px); }
.is-open .envelope-seal { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
.letter-content { width: min(100% - 3rem, 58rem); margin: 0 auto 9rem; scroll-margin-top: 2rem; }
.letter-sheet {
  position: relative; padding: clamp(2rem, 8vw, 5.5rem);
  color: var(--ink); background: #f5f3ee;
  border-radius: 3px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 30%);
}
.letter-sheet::before {
  content: ""; display: block; width: 2.5rem; height: 2px; background: #7751be; margin-bottom: 1.5rem;
}
.letter-sheet h2 {
  margin: 0 0 2.5rem;
  font: 500 clamp(2.7rem, 6vw, 4rem)/1.05 "Cormorant Garamond", Georgia, serif;
  letter-spacing: -.025em;
}
.letter-sheet h2:focus { outline: none; }
.letter-sheet h2:focus-visible { outline: 2px solid #7751be; outline-offset: 8px; }
.letter-copy { font-size: clamp(1rem, .25vw + .96rem, 1.15rem); line-height: 1.95; max-width: 68ch; }
.letter-copy p { margin: 0 0 1.5em; }
.letter-copy p:last-child { margin-bottom: 0; }
.letter-copy p:first-child::first-letter {
  float: left; padding: .07em .11em 0 0;
  font: 500 4.6em/.8 "Cormorant Garamond", Georgia, serif; color: #694896;
}
.signature {
  margin: 2.6rem 0 0; padding-top: 1.6rem;
  font: italic 400 clamp(1.6rem, 3vw, 2.1rem)/1.3 "Cormorant Garamond", Georgia, serif;
  text-align: right;
}
.signature::before { content: ""; display: block; width: 3rem; height: 1px; margin: 0 0 1rem auto; background: #aaa1b2; }
.letter-content.is-visible .letter-sheet { animation: unfold .75s cubic-bezier(.16, 1, .3, 1) both; }
.music-panel {
  position: fixed; z-index: 5; right: max(1.5rem, env(safe-area-inset-right));
  bottom: max(1.5rem, env(safe-area-inset-bottom)); width: min(21rem, calc(100% - 3rem));
  padding: .65rem .8rem; background: var(--night-soft); border-radius: 12px;
  box-shadow: 0 6px 22px rgb(0 0 0 / 24%);
}
.music-toggle {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: .75rem;
  padding: .2rem .4rem; border: 0; border-radius: 5px;
  color: var(--paper); background: transparent; text-align: left; font-size: .875rem;
}
.music-toggle:hover { background: #20202f; }
.music-icon { width: 24px; height: 24px; flex-shrink: 0; color: var(--cyan); }
.music-icon svg { width: 24px; height: 24px; display: block; }
.pause-icon { display: none !important; }
.is-playing .pause-icon { display: block !important; }
.is-playing .play-icon { display: none; }
.music-status { margin: .15rem .4rem .35rem 2.65rem; font-size: .8125rem; color: #c7c2d3; line-height: 1.6; }
.music-panel.is-playing .music-status { color: #d5eab2; }
.noscript-note { width: min(90%, 52rem); margin: 2rem auto; text-align: center; line-height: 1.7; }
@keyframes unfold { from { opacity: .5; transform: translateY(2rem); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .stage { padding-top: 3rem; padding-bottom: 10rem; }
  .stage h1 { font-size: clamp(3.5rem, 18vw, 5rem); margin-bottom: 1rem; }
  .envelope-trigger { width: min(86vw, 25rem); }
  .letter-content { width: calc(100% - 1.5rem); margin-bottom: 10rem; scroll-margin-top: .75rem; }
  .letter-sheet { padding: 2.2rem 1.5rem; }
  .letter-sheet h2 { margin-bottom: 1.8rem; }
  .letter-copy { font-size: 1rem; line-height: 1.9; }
  .music-panel { right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); width: calc(100% - 2rem); }
  .backdrop img { object-position: center 80%; }
}
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
