:root {
  --night: #140c1c;
  --ink: #f6efe4;
  --soft: #cbbba6;
  --gold: #e7c27a;
  --marigold: #e07a3d;
  --rose: #c45c6a;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --text: "Outfit", "Avenir Next", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--text);
  font-weight: 330;
  line-height: 1.5;
}
button, img { font: inherit; }
img { max-width: 100%; display: block; }

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

.sound {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 6;
  background: transparent;
  color: var(--soft);
  border: 1px solid rgba(231, 194, 122, 0.35);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

#stage { min-height: 100dvh; }
.scene {
  min-height: 100dvh;
  display: none;
  place-items: center;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 64px 22px 36px;
  gap: 10px;
  overflow: auto;
}
.scene.is-on { display: grid; animation: rise 0.7s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

h1, h2, .name, .display, .cert-name {
  font-family: var(--display);
  font-weight: 460;
  letter-spacing: -0.03em;
  margin: 0;
  max-width: 16ch;
}
h1 { font-size: clamp(2.4rem, 7vw, 5.2rem); }
h2 { font-size: clamp(2.2rem, 6vw, 4.4rem); }
.display { font-size: clamp(3rem, 9vw, 7rem); max-width: none; }
.name, .cert-name {
  font-size: clamp(2.6rem, 8vw, 6rem);
  color: var(--gold);
  max-width: none;
}
.certificate .cert-name {
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  color: var(--gold);
  margin: 0;
}
.eyebrow, .marathi {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--gold);
}
.marathi { text-transform: none; letter-spacing: 0.04em; font-size: 1.05rem; }
.lead, .certificate p, .letter p {
  max-width: 38rem;
  color: var(--soft);
  font-size: 1.08rem;
  margin: 0;
}
.sign { font-family: var(--display); font-size: 1.35rem; color: var(--ink); }
.letter .sign { color: #2a1c14; }
.certificate .sign { color: var(--gold); }
.ps { font-size: 0.95rem !important; }

.btn {
  appearance: none;
  border: 0;
  background: var(--gold);
  color: #24160c;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 580;
  cursor: pointer;
  margin-top: 8px;
}
.btn:focus-visible, .sound:focus-visible, .envelope:focus-visible, .card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid rgba(246, 239, 228, 0.35); }

.cake { position: relative; width: 240px; height: 230px; margin: 10px 0 6px; }
.cake-base, .cake-mid, .cake-top {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 16px 16px 8px 8px;
}
.cake-base { width: 220px; height: 64px; bottom: 0; background: linear-gradient(#f3d2b0, #d9896a); }
.cake-mid { width: 180px; height: 52px; bottom: 52px; background: linear-gradient(#fff6ea, #f0c9a0); }
.cake-top { width: 140px; height: 36px; bottom: 96px; background: linear-gradient(#ffe7c2, #e7c27a); border-radius: 40px; }
.candle {
  position: absolute;
  bottom: 124px;
  width: 10px;
  height: 42px;
  background: #f6efe4;
  border-radius: 3px;
  transform-origin: bottom center;
}
.candle.tall { height: 54px; bottom: 124px; }
.candle b {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 8px;
  height: 16px;
  margin-left: -4px;
  background: radial-gradient(circle at 50% 70%, #fff4c8, #ffb347 40%, #e07a3d 70%, transparent 72%);
  border-radius: 50% 50% 40% 40%;
  animation: flicker 0.35s infinite alternate;
}
.candle.out b { animation: none; opacity: 0; height: 0; }
.candle:nth-child(1) { left: 58px; }
.candle:nth-child(2) { left: 90px; }
.candle:nth-child(3) { left: 118px; }
.candle:nth-child(4) { left: 150px; }
.candle:nth-child(5) { left: 178px; }
@keyframes flicker { to { transform: scale(0.85) translateY(1px); } }
.hint { min-height: 1.2em; color: var(--soft); font-size: 0.9rem; margin: 0; }

.portrait, .certificate img {
  width: min(220px, 46vw);
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
}
.portrait img { max-height: 34dvh; object-fit: cover; }
.portrait img, .certificate img { border-radius: 18px; }

.scene-years {
  align-content: center;
  padding-top: 28px;
  padding-inline: 0;
  overflow-x: hidden;
}
.years-head { display: grid; gap: 6px; justify-items: center; padding-inline: 22px; }
.reel { width: 100%; max-width: 100%; min-width: 0; position: relative; }
.reel::before, .reel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 22px;
  width: 72px;
  z-index: 2;
  pointer-events: none;
}
.reel::before { left: 0; background: linear-gradient(90deg, var(--night), transparent); }
.reel::after { right: 0; background: linear-gradient(270deg, var(--night), transparent); }
.film {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  width: 100%;
  min-width: 0;
  padding: 22px 0 12px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  cursor: grab;
  scrollbar-width: none;
}
.film::-webkit-scrollbar { display: none; }
.film:active { cursor: grabbing; scroll-behavior: auto; }
.card {
  flex: 0 0 240px;
  scroll-snap-align: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: #2a1c14;
  cursor: pointer;
  transform:
    translateY(calc((1 - var(--focus, 0)) * 22px))
    scale(calc(0.78 + var(--focus, 0) * 0.28))
    rotate(calc(var(--tilt) * (1 - var(--focus, 0))));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.polaroid {
  display: block;
  background: #f6efe4;
  padding: 12px 12px 16px;
  border-radius: 3px;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.38);
  text-align: left;
}
.card img { height: min(250px, 34dvh); width: 100%; object-fit: cover; }
.card em {
  display: block;
  margin-top: 12px;
  font-style: normal;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: #a68455;
}
.card span {
  display: block;
  margin-top: 4px;
  min-height: 2.8em;
  font-family: var(--display);
  font-size: 1rem;
  line-height: 1.35;
  color: #3a281c;
  opacity: calc(0.45 + var(--focus, 0) * 0.55);
}
.scene-years.is-on .polaroid {
  animation: deal 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i) * 55ms);
}
@keyframes deal {
  from { opacity: 0; transform: translateY(36px) rotate(var(--tilt)); }
  to { opacity: 1; transform: none; }
}
.reel-progress {
  position: relative;
  width: min(180px, 40vw);
  height: 3px;
  margin: 14px auto 4px;
  background: rgba(231, 194, 122, 0.2);
  border-radius: 99px;
}
.reel-progress i {
  position: absolute;
  left: calc(var(--p, 0) * (100% - 36px));
  top: -2px;
  width: 36px;
  height: 7px;
  border-radius: 99px;
  background: var(--gold);
}

.envelope {
  width: min(420px, 90vw);
  height: 240px;
  border: 0;
  background: #f3e6d4;
  color: #3a2418;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}
.flap {
  position: absolute;
  inset: 0 0 50% 0;
  background: #e7d3b8;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.seal {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--rose);
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 1.4rem;
}
.env-label { position: absolute; left: 16px; right: 16px; bottom: 22px; }
.letter {
  display: grid;
  gap: 14px;
  justify-items: start;
  text-align: left;
  width: min(640px, 100%);
  background: #f7f1e8;
  color: #2a1c14;
  padding: 28px 26px 24px;
  border-radius: 6px;
}
.letter .eyebrow { color: var(--rose); }
.letter h2, .letter .sign { color: #2a1c14; }
.letter .lead, .letter p { color: #4a382c; }
.letter[hidden], .scene[hidden] { display: none !important; }

.certificate {
  width: min(520px, 100%);
  border: 1px solid rgba(231, 194, 122, 0.45);
  padding: 28px 22px;
  display: grid;
  gap: 12px;
  justify-items: center;
  background: radial-gradient(circle at 50% 0%, rgba(231, 194, 122, 0.12), transparent 55%);
}

#lightbox {
  border: 0;
  padding: 18px;
  background: #100914;
  color: var(--ink);
  max-width: min(920px, 94vw);
}
#lightbox::backdrop { background: rgba(8, 4, 12, 0.82); }
#lightbox img { max-height: 72dvh; margin: 0 auto; object-fit: contain; }
#lightbox p { text-align: center; color: var(--soft); }

@media (max-width: 640px) {
  .film { padding-inline: calc(50vw - 110px); gap: 14px; }
  .card { flex-basis: 210px; }
  .card img { height: 240px; }
  .reel::before, .reel::after { width: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene.is-on, .candle b, .scene-years.is-on .polaroid { animation: none; }
  .card, .film { transition: none; scroll-behavior: auto; }
}
