:root {
  --ink: #182027;
  --muted: #65707c;
  --paper: #fffaf3;
  --paper-soft: #f5efe5;
  --green: #2f6f5e;
  --gold: #c8944a;
  --rose: #b95f6b;
  --sky: #7aa6a2;
  --shadow: 0 20px 50px rgba(24, 32, 39, 0.16);
  --hero-x: 0px;
  --hero-y: 0px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    "Noto Serif SC", "Songti SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(47, 111, 94, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, #fffaf3, #f5efe5 58%, #fffaf3);
  background-size: 42px 42px, auto;
}

body.has-lightbox {
  overflow: hidden;
}

button {
  font: inherit;
}

.scroll-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--rose), var(--green));
  transform: scaleX(0);
  transform-origin: left;
}

.memorial {
  min-height: 100vh;
  overflow: hidden;
}

.hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  align-items: end;
  padding: 28px;
  isolation: isolate;
}

.hero-carousel {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: #182027;
}

.hero-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.hero-track::-webkit-scrollbar {
  display: none;
}

.hero-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
  scroll-snap-align: start;
  overflow: hidden;
}

.hero-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: translate(var(--hero-x), var(--hero-y)) scale(1.045);
  animation: heroDrift 16s ease-in-out infinite alternate;
}

.hero-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 250, 243, 0.52);
  border-radius: 50%;
  color: #fffaf3;
  background: rgba(24, 32, 39, 0.28);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transform: translateY(-50%);
  font-size: 2rem;
  line-height: 1;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.hero-nav:hover {
  background: rgba(24, 32, 39, 0.42);
  transform: translateY(-50%) scale(1.04);
}

.hero-nav--prev {
  left: 22px;
}

.hero-nav--next {
  right: 22px;
}

.hero-dots {
  position: absolute;
  left: 28px;
  bottom: 24px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.hero-dot {
  width: 26px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.42);
  cursor: pointer;
  transition:
    width 0.2s ease,
    background 0.2s ease;
}

.hero-dot.is-active {
  width: 44px;
  background: #fffaf3;
}

.hero__scrim {
  position: absolute;
  inset: auto 0 0;
  height: 62%;
  z-index: -1;
  background: linear-gradient(transparent, rgba(17, 24, 28, 0.78));
}

.hero__content {
  width: min(760px, 100%);
  color: #fffaf3;
  padding-bottom: 36px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(255, 250, 243, 0.84);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 13vw, 5.8rem);
  line-height: 1.02;
  font-weight: 700;
}

.subtitle {
  width: min(620px, 100%);
  margin: 18px 0 24px;
  font-size: 1.08rem;
  line-height: 1.8;
  color: rgba(255, 250, 243, 0.9);
}

.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid rgba(255, 250, 243, 0.72);
  border-radius: 999px;
  color: #fffaf3;
  background: rgba(255, 250, 243, 0.13);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition:
    transform 0.22s ease,
    background 0.22s ease;
}

.start-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 250, 243, 0.22);
}

.music-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  color: #fffaf3;
  background: var(--green);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease,
    background 0.2s ease;
}

.music-button:hover {
  transform: translateY(-2px);
}

.music-button.is-muted {
  opacity: 0.72;
  background: #7c7f78;
}

.music-button.is-playing {
  background: var(--rose);
  animation: pulse 1.8s ease-in-out infinite;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 82px;
  z-index: 21;
  width: min(280px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fffaf3;
  background: rgba(24, 32, 39, 0.86);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 74px 0;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  align-items: center;
  gap: 28px;
}

.intro .section-kicker,
.section-heading .section-kicker,
.message-card .section-kicker {
  color: var(--gold);
}

.section h2,
.closing h2 {
  margin: 0;
  font-size: clamp(1.9rem, 8vw, 3.5rem);
  line-height: 1.15;
}

.intro p:last-child {
  margin: 20px 0 0;
  color: var(--muted);
  line-height: 1.95;
}

.intro__media {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro__media img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.intro__media figcaption {
  position: absolute;
  inset: auto 12px 12px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #fffaf3;
  background: rgba(24, 32, 39, 0.58);
  backdrop-filter: blur(8px);
  font-size: 0.88rem;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline__item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid rgba(24, 32, 39, 0.14);
}

.timeline__item span {
  color: var(--gold);
  font-weight: 700;
}

.timeline__item h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.timeline__item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.timeline__item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(24, 32, 39, 0.12);
}

.gallery-section {
  width: 100%;
  max-width: none;
  padding: 76px max(20px, calc((100vw - 1020px) / 2));
  background: var(--paper-soft);
}

.section-heading {
  width: min(1020px, 100%);
  margin: 0 auto 28px;
}

.gallery {
  width: min(1020px, 100%);
  margin: 0 auto;
  columns: 3 260px;
  column-gap: 16px;
}

.photo-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  overflow: hidden;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 16px 38px rgba(24, 32, 39, 0.1);
  break-inside: avoid;
}

.photo-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.photo-open img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition:
    transform 0.45s ease,
    filter 0.45s ease;
}

.photo-card--tall .photo-open img {
  aspect-ratio: 3 / 4;
}

.photo-card:hover .photo-open img {
  transform: scale(1.045);
  filter: saturate(1.06);
}

.photo-card figcaption {
  padding: 14px 16px 16px;
  font-size: 0.94rem;
  color: var(--muted);
}

.video-section {
  width: min(1060px, calc(100% - 40px));
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 18px;
}

.video-grid--shared {
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
}

.video-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
  transform-origin: center;
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(24, 32, 39, 0.18);
}

.video-card video {
  display: block;
  width: 100%;
  background: #182027;
  object-fit: cover;
}

.video-card--portrait video {
  aspect-ratio: 9 / 16;
  max-height: 720px;
}

.video-card--landscape video {
  aspect-ratio: 16 / 9;
}

.video-card__caption {
  padding: 20px 22px 22px;
}

.video-card__caption span {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
}

.video-card__caption h3 {
  margin: 0 0 8px;
  font-size: 1.28rem;
}

.video-card__caption p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.graduates-section {
  width: min(1060px, calc(100% - 40px));
}

.graduate-index {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 24px;
}

.graduate-index a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(47, 111, 94, 0.2);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.72);
  text-decoration: none;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.graduate-index a:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 111, 94, 0.44);
  background: #fffdf8;
}

.graduate-feature {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  overflow: hidden;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.graduate-feature__cover {
  min-height: 420px;
}

.graduate-feature__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.graduate-feature__content {
  display: grid;
  align-content: center;
  padding: clamp(28px, 5vw, 54px);
}

.graduate-feature__content .section-kicker {
  color: var(--gold);
}

.graduate-feature__content h3 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.15;
}

.graduate-feature__content p {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.85;
}

.wish-stack {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.wish-stack blockquote {
  margin: 0;
  padding: 16px 18px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper-soft);
  line-height: 1.75;
}

.graduate-media {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.graduate-media .photo-card,
.graduate-media .video-card {
  margin: 0;
}

.graduate-media .video-card {
  min-width: 0;
}

.graduate-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.graduate-card {
  overflow: hidden;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 14px 30px rgba(24, 32, 39, 0.1);
}

.graduate-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.graduate-card h3 {
  margin: 14px 14px 6px;
  font-size: 1.18rem;
}

.graduate-card p {
  margin: 0 14px 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.message-card {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  padding: 70px 28px;
  text-align: center;
  color: #fffaf3;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.message-card__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(24, 32, 39, 0.32), rgba(24, 32, 39, 0.78)),
    url("assets/photos/memory-photo-04.jpg") center / cover no-repeat;
  transform: scale(1.04);
}

.message-card .section-kicker {
  color: rgba(255, 250, 243, 0.78);
}

.message-card blockquote {
  margin: 0 auto;
  max-width: 820px;
  font-size: clamp(1.45rem, 6vw, 3rem);
  line-height: 1.45;
  font-weight: 700;
}

.signature {
  margin: 24px 0 0;
  color: rgba(255, 250, 243, 0.78);
}

.closing {
  min-height: 46vh;
  display: grid;
  place-content: center;
  padding: 72px 20px 100px;
  text-align: center;
  color: #fffaf3;
  background:
    linear-gradient(rgba(26, 37, 40, 0.2), rgba(26, 37, 40, 0.86)),
    url("assets/photos/memory-photo-05.jpg") center 42% / cover no-repeat;
}

.closing p {
  margin: 0 0 14px;
  color: rgba(255, 250, 243, 0.78);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 17, 20, 0.86);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.lightbox.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: min(100%, 1040px);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  transform: scale(0.98);
  transition: transform 0.2s ease;
}

.lightbox.is-visible img {
  transform: scale(1);
}

.lightbox p {
  margin: 14px 0 0;
  color: #fffaf3;
}

.lightbox__close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #fffaf3;
  background: rgba(255, 250, 243, 0.15);
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.72s ease var(--delay, 0ms),
    transform 0.72s ease var(--delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes heroDrift {
  from {
    filter: saturate(1) contrast(1);
  }
  to {
    filter: saturate(1.08) contrast(1.04);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 860px) {
  .intro {
    grid-template-columns: 1fr;
  }

  .timeline__item {
    grid-template-columns: 42px 1fr;
  }

  .timeline__item img {
    grid-column: 2;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .video-grid--shared,
  .graduate-feature,
  .graduate-media {
    grid-template-columns: 1fr;
  }

  .graduate-feature__cover {
    min-height: 320px;
  }

  .graduate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-card--portrait video {
    aspect-ratio: 4 / 5;
    max-height: 680px;
  }
}

@media (max-width: 620px) {
  .hero {
    min-height: 90vh;
    padding: 22px;
  }

  .hero__content {
    padding-bottom: 58px;
  }

  .hero-nav {
    display: none;
  }

  .hero-dots {
    left: 22px;
    bottom: 18px;
  }

  .subtitle {
    font-size: 1rem;
  }

  .section {
    width: min(100% - 32px, 980px);
    padding: 56px 0;
  }

  .gallery-section {
    padding: 60px 16px;
  }

  .gallery {
    columns: 1;
  }

  .photo-open img,
  .photo-card--tall .photo-open img {
    aspect-ratio: 16 / 11;
  }

  .video-section {
    width: min(100% - 32px, 980px);
  }

  .graduates-section {
    width: min(100% - 32px, 980px);
  }

  .graduate-index {
    gap: 8px;
  }

  .graduate-index a {
    flex: 1 1 calc(50% - 8px);
  }

  .graduate-grid {
    grid-template-columns: 1fr;
  }

  .message-card {
    min-height: 380px;
    padding: 58px 20px;
  }
}
