/* ================================================================
   For Ishu — Girlfriend's Day storybook
   Mobile-first, iOS-Safari-safe. Animate transform + opacity only.
   ================================================================ */

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

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

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: #0f193b;
  color: #FBF8F2;
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img { display: block; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- fixed layers ---------------- */

#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  --sky-top: #82a6c5;
  --sky-bot: #a79360;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bot));
}

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

#muteBtn {
  position: fixed;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(251, 248, 242, 0.4);
  background: rgba(18, 20, 34, 0.32);
  color: rgba(251, 248, 242, 0.92);
  font-size: 19px;
  line-height: 1;
}

#muteBtn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: #FBF8F2;
  transform: translate(-50%, -50%) rotate(-45deg) scaleX(0);
  transition: transform 0.25s ease;
}

#muteBtn.is-muted::after {
  transform: translate(-50%, -50%) rotate(-45deg) scaleX(1);
}

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

/* ---------------- fixed stage: crossfading artworks ---------------- */

#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.stage__art {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  will-change: opacity;
}

.scene__img {
  height: 100vh;   /* fallback */
  height: 100svh;
  width: auto;
  max-width: none;
  will-change: transform;
}

/* ---------------- scenes (scroll drivers + captions) ---------------- */

.scene {
  position: relative;
  min-height: 100vh;   /* fallback */
  min-height: 100svh;  /* one gesture = one scene; snapping rests on tops */
}

.scene--cover,
.scene--finale {
  min-height: 100vh;
  min-height: 100svh;
}

.scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(10, 10, 14, 0) 52%,
    rgba(18, 14, 7, 0.32) 78%,
    rgba(12, 10, 5, 0.52) 100%);
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.34;
  background: radial-gradient(ellipse 120% 90% at 50% 44%,
    rgba(0, 0, 0, 0) 55%,
    rgba(8, 6, 3, 0.55) 100%);
}

.caption {
  position: sticky;
  z-index: 2;
  top: 58svh;
  margin: 62svh auto 0;
  width: min(86vw, 500px);
  text-align: center;
  font-style: italic;
  font-size: clamp(1.02rem, 4.3vw, 1.35rem);
  line-height: 1.7;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 2px 18px rgba(10, 8, 2, 0.55);
}

.caption span { display: block; }

/* ---------------- cover ---------------- */

.cover__head {
  position: absolute;
  z-index: 2;
  top: 12%;
  left: 0;
  right: 0;
  text-align: center;
  padding: 0 6vw;
}

.cover__head h1 {
  font-weight: 400;
  font-size: clamp(2.6rem, 13vw, 4.2rem);
  letter-spacing: 0.02em;
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.35),
    0 6px 32px rgba(20, 12, 2, 0.4);
}

.cover__head p {
  margin-top: 0.55em;
  font-style: italic;
  font-size: clamp(1rem, 4.2vw, 1.2rem);
  opacity: 0.95;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

#begin {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  margin: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 9%);
  width: max-content;
  min-height: 48px;
  padding: 13px 30px;
  border-radius: 999px;
  border: 1px solid rgba(251, 248, 242, 0.55);
  background: rgba(22, 24, 38, 0.35);
  color: #FBF8F2;
  font-style: italic;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.88; }
  50%      { transform: scale(1.05); opacity: 1; }
}

#scrollHint {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  margin: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 3.5%);
  width: max-content;
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  animation: floaty 2.2s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ---------------- night: shooting star ---------------- */

#shootingStar {
  position: absolute;
  z-index: 2;
  top: 13%;
  right: 6%;
  width: 96px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

.star__tail {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 100% 50%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95));
  border-radius: 2px;
}

.star__tail::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 9px 2px rgba(255, 250, 230, 0.85);
}

/* ---------------- finale ---------------- */

.scene--finale {
  display: flex;
  align-items: center;
  justify-content: center;
}

.finale-wrap {
  position: relative;
  z-index: 2;
  width: min(88vw, 500px);
  text-align: center;
  padding: 18vh 0;
}

#finaleText {
  font-weight: 400;
  font-size: clamp(2.3rem, 10.5vw, 3.6rem);
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: #FBF8F2;
  text-shadow:
    0 0 22px rgba(255, 236, 190, 0.38),
    0 0 6px rgba(255, 244, 214, 0.28),
    0 2px 12px rgba(0, 0, 0, 0.55);
}

.word {
  display: inline-block;
  white-space: nowrap;
}

.letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(18px);
}

#daisies {
  position: absolute;
  inset: -14% -5%;
  pointer-events: none;
}

.daisy {
  position: absolute;
  opacity: 0;
  transform: scale(0);
}

.daisy.sway {
  animation: sway 3.8s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}

@keyframes sway {
  from { transform: rotate(calc(var(--r, 0deg) - 7deg)) scale(1); }
  to   { transform: rotate(calc(var(--r, 0deg) + 7deg)) scale(1); }
}

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  #particles { display: none; }
  #begin,
  #scrollHint,
  .daisy.sway { animation: none; }
}
