:root {
  --accent: #ff4d8d;
  --accent-rgb: 255, 77, 141;
  --accent-2: #ffa3c6;
  --text: #f9eaf0;
  --muted: rgba(249, 234, 240, .62);
  --serif: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --script: 'Great Vibes', 'Brush Script MT', cursive;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { background: #000; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: #000;
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }

::selection { background: rgba(var(--accent-rgb), .35); }

#heart {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

main { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- gate */
.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), .07), rgba(0, 0, 0, .55) 60%, rgba(0, 0, 0, .85));
  transition: opacity 1.4s ease, visibility 1.4s;
  touch-action: none;
}
.gate.hide { opacity: 0; visibility: hidden; }
.gate.hide .gate-btn { transform: scale(1.15); filter: blur(8px); }

.gate-btn {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 48px 32px;
  text-align: center;
  transition: transform 1.4s var(--ease), filter 1.4s;
}
.gate-btn:focus-visible { outline: 1px solid rgba(var(--accent-rgb), .6); outline-offset: 6px; border-radius: 16px; }

.gate-heart {
  width: 58px;
  height: 58px;
  fill: var(--accent);
  filter: drop-shadow(0 0 14px rgba(var(--accent-rgb), .9)) drop-shadow(0 0 40px rgba(var(--accent-rgb), .5));
  animation: gateBeat 1.15s ease-in-out infinite;
}
.gate-for {
  font-family: var(--script);
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1.2;
  color: var(--accent-2);
  min-height: 1.2em;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.gate-for.on { opacity: 1; }
.gate-label {
  font-size: 12px;
  letter-spacing: .5em;
  text-indent: .5em;
  text-transform: uppercase;
  color: var(--muted);
  animation: breathe 2.8s ease-in-out infinite;
}

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7svh 22px 13svh;
  text-align: center;
}
.heart-slot {
  flex: none;
  width: 100%;
  height: min(40svh, 60vw);
  margin-bottom: 3svh;
  cursor: pointer;
}

.hero-text > * {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(8px);
  transition: opacity 1.6s ease, transform 1.6s var(--ease), filter 1.6s ease;
}
.hero.show .hero-text > * { opacity: 1; transform: none; filter: none; }
.hero.show .hero-text > :nth-child(2) { transition-delay: .35s; }
.hero.show .hero-text > :nth-child(3) { transition-delay: .8s; }
.hero.show .hero-text > :nth-child(4) { transition-delay: 1.4s; }

.pre {
  font-size: 12px;
  letter-spacing: .48em;
  text-indent: .48em;
  text-transform: uppercase;
  color: var(--muted);
}
@media (max-width: 480px) {
  .pre { font-size: 11px; letter-spacing: .28em; text-indent: .28em; }
}
.headline {
  margin-top: 10px;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(30px, 5.6vw, 54px);
  line-height: 1.1;
  letter-spacing: .01em;
}
.name {
  margin-top: 2px;
  padding: 0 .2em;
  font-family: var(--script);
  font-size: clamp(54px, 12vw, 108px);
  line-height: 1.2;
  background: linear-gradient(100deg, var(--accent) 15%, #fff 35%, var(--accent-2) 50%, var(--accent) 70%, var(--accent-2) 90%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 7s linear infinite;
}
.hero.show .name { filter: drop-shadow(0 0 18px rgba(var(--accent-rgb), .45)); }
.sub {
  max-width: 32ch;
  margin: 12px auto 0;
  font-style: italic;
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--muted);
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 1px;
  height: 46px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
  opacity: 0;
  transition: opacity 1.5s ease 2.4s;
}
.hero.show .scroll-hint { opacity: 1; }
.scroll-hint span {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, var(--accent-2));
  animation: drip 2.2s var(--ease) infinite;
}

/* ------------------------------------------------------------ sections */
.block {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12svh 22px;
}

.title {
  position: relative;
  margin-bottom: 44px;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(42px, 7vw, 66px);
  line-height: 1.25;
  text-align: center;
  color: var(--accent-2);
  text-shadow: 0 0 30px rgba(var(--accent-rgb), .35);
}
.title::after {
  content: '';
  display: block;
  width: 120px;
  height: 1px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .8), transparent);
}

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1.3s ease, transform 1.3s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* counter */
.counter { text-align: center; }
.counter::before {
  content: '';
  position: absolute;
  inset: 10% 10%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), .12), transparent);
  pointer-events: none;
}
.num {
  font-weight: 300;
  font-size: clamp(76px, 18vw, 168px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, var(--accent-2) 60%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 30px rgba(var(--accent-rgb), .35));
}
.counter-label {
  margin-top: 10px;
  font-style: italic;
  font-size: clamp(20px, 3vw, 28px);
}
.ticker {
  margin-top: 6px;
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.since {
  margin-top: 18px;
  font-size: 12px;
  letter-spacing: .4em;
  text-indent: .4em;
  text-transform: uppercase;
  color: rgba(var(--accent-rgb), .85);
}

/* letter */
.paper {
  position: relative;
  max-width: 660px;
  margin: 0 auto;
  padding: clamp(30px, 6vw, 60px) clamp(24px, 6vw, 64px);
  border: 1px solid rgba(var(--accent-rgb), .2);
  border-radius: 20px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(var(--accent-rgb), .09), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .012));
  box-shadow: 0 40px 120px -40px rgba(var(--accent-rgb), .25), inset 0 1px 0 rgba(255, 255, 255, .05);
  font-size: clamp(19px, 2.1vw, 22px);
  line-height: 1.85;
}
#letterBody p { white-space: pre-line; }
#letterBody p + p { margin-top: 1.1em; }
#letterBody p:first-child { display: flow-root; }
#letterBody p:first-child::first-letter {
  float: left;
  margin: .08em .12em 0 0;
  font-family: var(--script);
  font-size: 3.4em;
  line-height: .8;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(var(--accent-rgb), .5);
}
.sign {
  margin-top: 30px;
  font-family: var(--script);
  font-size: clamp(30px, 4vw, 38px);
  line-height: 1.2;
  text-align: right;
  color: var(--accent-2);
}

/* gallery */
.grid { display: flex; align-items: flex-start; gap: 14px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) { .grid, .col { gap: 18px; } }

.ph {
  opacity: 0;
  transform: translateY(26px) scale(.98);
  transition: opacity 1s ease, transform 1.1s var(--ease);
}
.ph.in { opacity: 1; transform: none; }
.ph button {
  all: unset;
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  cursor: zoom-in;
  background: linear-gradient(135deg, #150810, #22091a 50%, #150810);
  background-size: 200% 200%;
  animation: shimmer 2.4s ease-in-out infinite;
}
.ph button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ph button::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .16);
  pointer-events: none;
  transition: box-shadow .5s ease;
}
.ph img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity .9s ease, transform 1.4s var(--ease);
}
.ph img.ok { opacity: 1; }
@media (hover: hover) {
  .ph button:hover img { transform: scale(1.045); }
  .ph button:hover::after { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .5), 0 0 40px rgba(var(--accent-rgb), .25); }
}
.ph figcaption {
  padding: 8px 6px 0;
  font-style: italic;
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
  color: var(--muted);
}
.sentinel { height: 1px; }

/* footer */
.end { padding: 10svh 22px calc(16svh + env(safe-area-inset-bottom)); text-align: center; }
.beat {
  display: inline-block;
  font-size: 30px;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(var(--accent-rgb), .8);
  animation: gateBeat 1.15s ease-in-out infinite;
}
.closing {
  max-width: 22ch;
  margin: 12px auto 0;
  font-family: var(--script);
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.3;
  color: var(--accent-2);
}

/* ------------------------------------------------------------ lightbox */
.lb {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fadeIn .35s ease;
  touch-action: pan-y;
}
.lb[hidden] { display: none; }
.lb-fig { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 12px; }
.lb-fig img {
  max-width: min(92vw, 1400px);
  max-height: 80vh;
  max-height: 80svh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 0 80px rgba(var(--accent-rgb), .2);
  transition: opacity .3s ease;
}
.lb-fig figcaption { max-width: 60ch; font-style: italic; text-align: center; color: var(--muted); }
.lb-close, .lb-nav {
  all: unset;
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 34px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  background: rgba(255, 255, 255, .06);
  transition: background .3s;
}
.lb-close:hover, .lb-nav:hover { background: rgba(var(--accent-rgb), .3); }
.lb-close { top: calc(14px + env(safe-area-inset-top)); right: 14px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-count {
  position: absolute;
  top: calc(26px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: .3em;
  color: var(--muted);
}
@media (max-width: 640px) {
  .lb-nav { top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); transform: none; }
  .lb-prev { left: calc(50% - 64px); }
  .lb-next { right: calc(50% - 64px); }
  .lb-fig img { max-height: 70svh; }
}

/* --------------------------------------------------------------- music */
.music {
  all: unset;
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 46px;
  height: 46px;
  padding-bottom: 15px;
  box-sizing: border-box;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(var(--accent-rgb), .45);
  background: rgba(15, 0, 7, .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 24px rgba(var(--accent-rgb), .25);
  opacity: 0;
  transition: opacity 1s ease, box-shadow .4s;
}
.music.on { opacity: 1; }
.music[hidden] { display: none; }
.music span {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent-2);
  transform-origin: bottom;
  transform: scaleY(.25);
  transition: transform .4s;
}
.music.playing span { animation: eq 1s ease-in-out infinite; }
.music.playing span:nth-child(2) { animation-delay: -.3s; }
.music.playing span:nth-child(3) { animation-delay: -.6s; }
.music.playing span:nth-child(4) { animation-delay: -.15s; }

/* ---------------------------------------------------------- keyframes */
@keyframes gateBeat {
  0%, 100% { transform: scale(1); }
  10% { transform: scale(1.16); }
  22% { transform: scale(1.02); }
  32% { transform: scale(1.1); }
  50% { transform: scale(1); }
}
@keyframes breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes sheen { to { background-position: -220% center; } }
@keyframes drip { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

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