:root {
  color-scheme: light;
  --accent: #f5d36c;
  --ink: #1f2926;
  --paper: #fffdf8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@font-face {
  font-family: 'XiaoXiao Title Font';
  src: url('assets/fonts/title.woff2') format('woff2');
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
}

.memory {
  position: relative;
  height: 100dvh;
  min-height: 100svh;
  overflow: hidden;
  background: #101615;
}

.slides {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  touch-action: pan-y;
}

.slides::-webkit-scrollbar {
  display: none;
}

.slide {
  position: relative;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  scroll-snap-align: start;
  isolation: isolate;
}

.slide::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--image, none);
  background-position: center;
  background-size: cover;
  opacity: 0;
}

.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transition:
    transform 900ms ease,
    filter 900ms ease;
}

.slide.is-active img {
  transform: scale(1);
}

.shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.16), transparent 24%),
    linear-gradient(0deg, rgba(13, 17, 15, 0.7), transparent 45%),
    radial-gradient(
      circle at 50% 72%,
      transparent 0 22%,
      rgba(0, 0, 0, 0.12) 64%
    );
}

.caption {
  position: absolute;
  left: clamp(20px, 7vw, 48px);
  right: clamp(20px, 7vw, 48px);
  bottom: calc(74px + var(--safe-bottom));
  z-index: 2;
  max-width: 560px;
  color: #fffdf8;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.32);
}

.caption--night {
  text-shadow: 0 2px 22px rgba(0, 29, 96, 0.5);
}

.eyebrow {
  margin: 0 0 9px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.caption h1 {
  margin: 0;
  font-family:
    'XiaoXiao Title Font', 'Songti SC', 'Noto Serif CJK SC', 'STSong', serif;
  font-size: clamp(2.7rem, 14vw, 5.8rem);
  line-height: 1.02;
  font-weight: 400;
  letter-spacing: 0;
}

.caption p:last-child {
  max-width: 28rem;
  margin: 18px 0 0;
  font-size: clamp(0.95rem, 3.8vw, 1.15rem);
  line-height: 1.55;
}

.journey {
  position: fixed;
  top: 50%;
  right: clamp(12px, 4vw, 30px);
  z-index: 3;
  display: grid;
  grid-template-rows: repeat(5, 34px);
  gap: 7px;
  width: 42px;
  padding: 14px 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(14, 20, 18, 0.14);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(3px);
}

.journey::before {
  content: '';
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 50%;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(255, 255, 255, 0.52),
    transparent
  );
  transform: translateX(-50%);
}

.place {
  position: relative;
  display: grid;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  place-items: center;
}

.place span {
  position: relative;
  z-index: 1;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition:
    width 240ms ease,
    height 240ms ease,
    background 240ms ease,
    border-color 240ms ease,
    box-shadow 240ms ease;
}

.place.is-active span {
  width: 8px;
  height: 24px;
  border-color: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: var(--accent);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--accent) 24%, transparent),
    0 8px 18px rgba(0, 0, 0, 0.16);
}

@media (min-width: 760px) {
  .caption {
    bottom: calc(72px + var(--safe-bottom));
  }

  .caption h1 {
    font-size: clamp(4.8rem, 8vw, 7.6rem);
  }

  .caption p:last-child {
    font-size: 1.08rem;
  }
}

@media (orientation: landscape) {
  .memory {
    background: #111716;
  }

  .slide {
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--accent) 16%, #101615);
  }

  .slide::before {
    z-index: 0;
    opacity: 0.72;
    filter: blur(28px) saturate(1.08);
    transform: scale(1.16);
  }

  .slide::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
      linear-gradient(
        90deg,
        rgba(10, 14, 13, 0.52),
        transparent 26%,
        transparent 74%,
        rgba(10, 14, 13, 0.52)
      ),
      radial-gradient(
        circle at 50% 52%,
        transparent 0 28%,
        rgba(5, 8, 7, 0.28) 72%
      );
  }

  .slide img {
    top: 50%;
    left: 50%;
    z-index: 2;
    width: auto;
    height: min(100dvh, 100svh);
    max-width: min(62vw, 760px);
    aspect-ratio: 10 / 16;
    object-fit: cover;
    transform: translate(-50%, -50%) scale(1.02);
    transition: transform 900ms ease;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  }

  .slide.is-active img {
    transform: translate(-50%, -50%) scale(1);
  }

  .shade {
    z-index: 3;
    width: min(62.5vh, 62vw, 760px);
    height: min(100dvh, 100svh);
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%) scale(1.02);
    transition: transform 900ms ease;
    background:
      linear-gradient(180deg, rgba(255, 253, 248, 0.08), transparent 22%),
      linear-gradient(0deg, rgba(13, 17, 15, 0.68), transparent 48%);
  }

  .slide.is-active .shade {
    transform: translate(-50%, -50%) scale(1);
  }

  .caption {
    left: 50%;
    right: auto;
    bottom: calc(46px + var(--safe-bottom));
    z-index: 4;
    width: min(54vh, calc(62vw - 56px), 420px);
    transform: translateX(-50%);
  }

  .caption h1 {
    font-size: clamp(2.2rem, 5.4vw, 4.8rem);
  }

  .caption p:last-child {
    font-size: clamp(0.9rem, 1.8vw, 1rem);
  }

  .journey {
    right: clamp(18px, 3vw, 34px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .slides,
  .slide img,
  .place span {
    scroll-behavior: auto;
    transition: none;
  }
}
