/* ═══════════════════════════════════════════════════════════════════════
   Ayu ♡ Yuno — Everlasting Love
   A scroll-driven memory slideshow (Safari 26+ / latest Safari on iOS).
   Slides snap like Apple-style presentation pages; entrances, exits and
   parallax are all pure CSS Scroll-driven Animations (no JavaScript).
   ═══════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────── Base & scroller ─────────────────────────── */

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

html {
  /* The page itself is the "slide deck": one full screen per memory */
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body {
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  background: #17102b;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ─────────────────────────── Slide skeleton ──────────────────────────── */

.slide {
  position: relative;
  height: 100vh;   /* fallback */
  /* height: 100vh;  /* stable viewport height on iOS Safari */
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.5vh, 30px);
  padding: max(20px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  color: var(--ink);
}

.slide__bg {
  position: absolute;
  inset: -4vh 0; /* slightly oversized so the slow zoom never shows edges */
  z-index: -1;
  background: var(--bg);
}

/* Frosted-glass text box — tinted per slide so it always fits the picture */
.slide__card {
  max-width: 348px;
  padding: 22px 26px 24px;
  border-radius: 22px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.slide__chapter {
  font-family: "Montserrat", sans-serif;
  font-weight: 300;
  font-size: 0.66rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.slide__lyric-ja {
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 500;
  font-size: clamp(1.28rem, 5.6vw, 1.7rem);
  line-height: 1.95;
  letter-spacing: 0.08em;
}

.slide__lyric-en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(0.95rem, 4vw, 1.15rem);
  line-height: 1.6;
  margin-top: 12px;
  opacity: 0.82;
}

/* ───────────────────── Photo cards (polaroid style) ──────────────────── */
/*
   Each memory is a little polaroid. Right now the "photo" area is a
   gradient that evokes the scene.

   ▼▼▼ TO USE YOUR REAL PICTURES ▼▼▼
   1. Put your photos in  public/images/  (e.g. public/images/camp.jpg)
   2. In each `.slide--xxx .slide__photo` rule below, replace the
      `background-image: linear-gradient(...)` line with:

        background-image: url("images/camp.jpg");
        background-size: cover;
        background-position: center;

   Portrait photos around 800×1000px look best (they load fast, too).
*/

.slide__photo {
  width: min(74vw, 320px);
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  border: 10px solid rgba(255, 253, 250, 0.96); /* polaroid frame */
  border-bottom-width: 36px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  transform: rotate(-2deg);
  flex-shrink: 1;
  min-height: 0;
}

/* ──────────────────────── Per-slide color stories ─────────────────────── */

/* 0 · Title — soft blush dawn */
.slide--intro {
  --bg: linear-gradient(165deg, #fdf3f5 0%, #f6e3ee 38%, #ddc9ea 72%, #c2b3e4 100%);
  --ink: #53355c;
  --accent: #b76e8e;
}

/* 1 · Camping — deep forest & campfire amber */
.slide--camp {
  --bg: linear-gradient(170deg, #10241a 0%, #1e4030 45%, #35583c 72%, #8a5a26 108%);
  --ink: #f6ecd8;
  --accent: #e8b46a;
  --card-bg: rgba(12, 28, 20, 0.52);
  --card-line: rgba(246, 236, 216, 0.22);
}
.slide--camp .slide__photo {
  /* ▼ Replace me with: background-image: url("images/camp.jpg"); */
  /* background-image: linear-gradient(160deg, #2c5e3f 0%, #487a4e 45%, #c98a3b 80%, #f2c368 100%); */
  background-image: url("images/fig1.JPG");
  background-size: cover;
  background-position: center;
}

/* 2 · Seaside — morning sky into open water */
.slide--sea {
  --bg: linear-gradient(175deg, #e3f4f8 0%, #a9d9e8 42%, #5fa8c7 76%, #2e7396 100%);
  --ink: #123a52;
  --accent: #1f6d94;
  --card-bg: rgba(255, 255, 255, 0.58);
  --card-line: rgba(18, 58, 82, 0.16);
}
.slide--sea .slide__photo {
  /* ▼ Replace me with: background-image: url("images/sea.jpg"); */
  background-image: url("images/fig2.jpeg");
  background-size: cover;
  background-position: center;
}

/* 3 · City — apricot dusk over rooftops */
.slide--city {
  --bg: linear-gradient(170deg, #fbe3c9 0%, #f2bfa4 36%, #c795a8 70%, #8579ab 100%);
  --ink: #43324e;
  --accent: #a06184;
  --card-bg: rgba(255, 250, 244, 0.55);
  --card-line: rgba(67, 50, 78, 0.15);
}
.slide--city .slide__photo {
  /* ▼ Replace me with: background-image: url("images/city.jpg"); */
  /* background-image: linear-gradient(160deg, #f6cfa5 0%, #e39a86 45%, #a97b9d 80%, #6f6a9e 100%); */
  background-image: url("images/fig3.jpeg");
  background-size: cover;
  background-position: center;
}

/* 4 · Bar & club — neon glow in the dark */
.slide--neon {
  --bg:
    radial-gradient(circle at 18% 24%, rgba(255, 63, 180, 0.38) 0%, transparent 46%),
    radial-gradient(circle at 82% 72%, rgba(58, 220, 255, 0.30) 0%, transparent 46%),
    linear-gradient(180deg, #1a1033 0%, #0e0a1f 100%);
  --ink: #ffe7f6;
  --accent: #ff6ec7;
  --card-bg: rgba(26, 13, 46, 0.58);
  --card-line: rgba(255, 110, 199, 0.30);
}
.slide--neon .slide__photo {
  /* ▼ Replace me with: background-image: url("images/neon.jpg"); */
  /* background-image: linear-gradient(150deg, #ff3fb4 0%, #8c2bd9 48%, #2bd0ff 100%); */
  background-image: url("images/fig4.jpeg");
  background-size: cover;
  background-position: center;
}
.slide--neon .slide__lyric-ja {
  text-shadow: 0 0 18px rgba(255, 110, 199, 0.55);
}

/* 5 · Night view — midnight blue & a million lights */
.slide--night {
  --bg: linear-gradient(180deg, #070b22 0%, #12183f 55%, #27305e 100%);
  --ink: #f2e2b8;
  --accent: #e9c979;
  --card-bg: rgba(8, 12, 34, 0.52);
  --card-line: rgba(233, 201, 121, 0.24);
}
.slide--night .slide__bg::after {
  /* a scatter of tiny city lights / stars */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 22% 28%, rgba(255, 240, 200, 0.9) 45%, transparent 55%),
    radial-gradient(1.2px 1.2px at 64% 14%, rgba(255, 240, 200, 0.7) 45%, transparent 55%),
    radial-gradient(1.4px 1.4px at 84% 42%, rgba(255, 240, 200, 0.8) 45%, transparent 55%),
    radial-gradient(1.1px 1.1px at 38% 56%, rgba(255, 240, 200, 0.6) 45%, transparent 55%),
    radial-gradient(1.5px 1.5px at 10% 72%, rgba(255, 240, 200, 0.75) 45%, transparent 55%),
    radial-gradient(1.2px 1.2px at 52% 84%, rgba(255, 240, 200, 0.65) 45%, transparent 55%),
    radial-gradient(1.3px 1.3px at 90% 78%, rgba(255, 240, 200, 0.7) 45%, transparent 55%);
  background-size: 240px 240px;
}
.slide--night .slide__photo {
  /* ▼ Replace me with: background-image: url("images/night.jpg"); */
  /* background-image: linear-gradient(165deg, #101638 0%, #27305e 50%, #b28c3c 115%); */
  background-image: url("images/fig5.jpeg");
  background-size: cover;
  background-position: center;
}

/* 6 · The surprise — deep plum blooming into rose */
.slide--proposal {
  --bg: linear-gradient(170deg, #2c1030 0%, #5b2249 42%, #a24a68 78%, #e2907f 115%);
  --ink: #ffeef2;
  --accent: #ffc9d6;
}

/* ─────────────────────────── Title slide bits ─────────────────────────── */

.intro__eyebrow {
  font-family: "Montserrat", sans-serif;
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.intro__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.intro__names {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.5rem, 11vw, 3.4rem);
  letter-spacing: 0.04em;
}

.intro__heart {
  width: clamp(26px, 7vw, 34px);
  height: clamp(26px, 7vw, 34px);
  color: #c96f92;
}

.intro__sub {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(1.3rem, 6vw, 1.8rem);
  letter-spacing: 0.14em;
  color: #7d5286;
}

.intro__ja {
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 300;
  font-size: 0.95rem;
  letter-spacing: 0.24em;
  margin-top: 26px;
  opacity: 0.75;
}

.scroll-cue {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  opacity: 0.65;
}

.scroll-cue__arrow {
  animation: cue-bob 1.8s ease-in-out infinite;
}

@keyframes cue-bob {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(7px); opacity: 1; }
}

/* Gentle time-based entrance for the very first screen */
.slide--intro .slide__content > * {
  animation: intro-rise 1s ease-out both;
}
.slide--intro .intro__eyebrow { animation-delay: 0.15s; }
.slide--intro .intro__title   { animation-delay: 0.38s; }
.slide--intro .intro__ja      { animation-delay: 0.62s; }

@keyframes intro-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────── Proposal slide ──────────────────────────── */

.slide--proposal .slide__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(14px, 2.6vh, 22px);
  max-width: 360px;
}

.proposal__lead {
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 300;
  font-size: clamp(0.92rem, 4vw, 1.05rem);
  line-height: 2.15;
  letter-spacing: 0.06em;
  text-wrap: balance;
}

.proposal__lead-en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(0.9rem, 3.8vw, 1.05rem);
  line-height: 1.65;
  opacity: 0.8;
}

.proposal__heart {
  width: clamp(72px, 20vw, 96px);
  height: clamp(72px, 20vw, 96px);
  color: var(--accent);
  filter: drop-shadow(0 0 16px rgba(255, 201, 214, 0.45));
}
.proposal__heart path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0; /* fully drawn by default; animated where supported */
}

.proposal__question {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 500;
}

.proposal__now {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(1.35rem, 6vw, 1.7rem);
  letter-spacing: 0.1em;
  opacity: 0.9;
}

.proposal__ask {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 9vw, 2.7rem);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-wrap: balance;
  text-shadow: 0 0 26px rgba(255, 190, 205, 0.35);
}

.proposal__ja {
  font-family: "Shippori Mincho", serif;
  font-weight: 500;
  font-size: clamp(1.05rem, 4.6vw, 1.3rem);
  letter-spacing: 0.3em;
  margin-top: 4px;
  color: var(--accent);
}

.proposal__rings {
  width: 44px;
  height: 44px;
  color: var(--accent);
  opacity: 0.9;
}

.proposal__sign {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  opacity: 0.75;
}

/* ─────────────────────── Line-art decorations ─────────────────────────── */

.deco {
  position: absolute;
  color: var(--accent);
  opacity: 0.34;
  pointer-events: none;
}

.deco--a { top: 9%;  left: 7%;   width: 52px; height: 52px; }
.deco--b { top: 15%; right: 9%;  width: 36px; height: 36px; }
.deco--c { bottom: 13%; left: 9%; width: 42px; height: 42px; transform: rotate(-12deg); }

.slide--proposal .deco--a { width: 60px; height: 60px; opacity: 0.42; }
.slide--proposal .deco--c { right: 9%; left: auto; }

/* ─────────────────── Scroll progress ribbon (top edge) ────────────────── */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10;
  background: linear-gradient(90deg, #f5b0c6, #c96f92, #8579ab);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ═══════════════════════════════════════════════════════════════════════
   CSS Scroll-driven Animations — the "slide transition" magic.
   Wrapped in @supports so older browsers simply see a static page.
   ═══════════════════════════════════════════════════════════════════════ */

@supports (animation-timeline: view()) {

  /* Progress ribbon follows overall page scroll */
  .progress {
    animation: progress-grow linear both;
    animation-timeline: scroll(root);
  }
  @keyframes progress-grow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }

  /* Slow "breathing" zoom on every background while its slide is on screen */
  .slide__bg {
    animation: bg-drift linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
  @keyframes bg-drift {
    from { transform: scale(1.06) translateY(1.5vh); }
    to   { transform: scale(1.06) translateY(-1.5vh); }
  }

  /* Polaroid settles into place as it enters, drifts up as it leaves */
  .slide__photo {
    animation-name: photo-in, away;
    animation-timing-function: cubic-bezier(0.22, 0.9, 0.3, 1), ease-in;
    animation-fill-mode: both, both;
    animation-timeline: view(), view();
    animation-range: entry 5% entry 90%, exit 10% exit 75%;
  }
  @keyframes photo-in {
    from { opacity: 0; transform: translateY(10vh) rotate(4deg) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) rotate(-2deg) scale(1); }
  }

  /* Text card children rise one after another — the stagger is the charm */
  .slide__card > * {
    animation: rise linear both;
    animation-timeline: view();
  }
  .slide__card > :nth-child(1) { animation-range: entry 10% entry 65%; }
  .slide__card > :nth-child(2) { animation-range: entry 25% entry 80%; }
  .slide__card > :nth-child(3) { animation-range: entry 40% entry 95%; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Whole text block gently fades away while scrolling to the next memory */
  .slide__content {
    animation: away linear both;
    animation-timeline: view();
    animation-range: exit 5% exit 70%;
  }
  /* `away` has no `from` keyframe on purpose: it starts from whatever the
     entry animations produced, so entrances and exits never fight. */
  @keyframes away {
    to { opacity: 0; transform: translateY(-6vh) scale(0.97); }
  }

  /* Decorations drift in gentle parallax across each slide */
  .deco--a, .deco--c {
    animation: drift-up linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
  .deco--b {
    animation: drift-down linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
  @keyframes drift-up {
    from { transform: translateY(7vh) rotate(-6deg); }
    to   { transform: translateY(-7vh) rotate(6deg); }
  }
  @keyframes drift-down {
    from { transform: translateY(-5vh) rotate(8deg); }
    to   { transform: translateY(5vh) rotate(-8deg); }
  }

  /* The finale: a heart draws itself as the last slide arrives */
  .proposal__heart path {
    stroke-dashoffset: 1;
    animation: heart-draw ease-out both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
  @keyframes heart-draw {
    from { stroke-dashoffset: 1; }
    to   { stroke-dashoffset: 0; }
  }

  .proposal__question {
    animation: bloom cubic-bezier(0.22, 0.9, 0.3, 1) both;
    animation-timeline: view();
    animation-range: entry 20% entry 100%;
  }
  @keyframes bloom {
    from { opacity: 0; transform: scale(0.82) translateY(14px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
}

/* ─────────────────────────── Accessibility ────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes parallax-effect {
  to { transform: translateY(100px) }
}
#parallax {
  animation: parallax-effect linear both;
  animation-timeline: scroll(block root);
  animation-range: 0px 200px;
}
