:root {
  --ink: #152923;
  --quiet: #4a625c;
  --rule: #d2ded8;
  --serif: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  color: var(--ink);
  background: #fff;
  font-family: "PingFang SC", "Noto Sans CJK SC", sans-serif;
  scroll-behavior: smooth;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p, figure { margin: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #2d7467; outline-offset: 5px; }
.wrap { width: min(calc(100% - 44px), 1100px); margin-inline: auto; }

.space-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: max(560px, 86vh);
  min-height: max(560px, 86svh);
  padding-top: max(20px, env(safe-area-inset-top));
  overflow: hidden;
  color: #f8faf5;
  background: #192b2e;
}
.hero-image, .space-hero::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-image { z-index: -2; object-fit: cover; object-position: 55% 28%; }
.space-hero::after {
  z-index: -1;
  content: "";
  background: linear-gradient(180deg, #122329b5, #1223290a 28%, #1027251a 43%, #132724e8 92%);
}
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font: 600 clamp(1.35rem, 3vw, 1.85rem) / 1.2 var(--serif);
  letter-spacing: .19em;
  text-shadow: 0 1px 12px #172523b3;
}
.brand img { width: clamp(50px, 9vw, 71px); height: auto; }
.hero-caption { padding-block: 46px max(36px, env(safe-area-inset-bottom)); }
.hero-dedication { margin-bottom: clamp(12px, 3vw, 22px); color: #f1eee0; font-size: clamp(.75rem, 2.5vw, .96rem); letter-spacing: .055em; }
.hero-class { white-space: nowrap; }
.hero-caption h1 {
  font: 600 clamp(2.65rem, 7.8vw, 6rem) / 1.15 var(--serif);
  letter-spacing: .045em;
  text-shadow: 0 2px 24px #101e22a3;
}
.hero-nav { display: flex; flex-wrap: wrap; gap: 8px clamp(14px, 4vw, 27px); margin-top: clamp(20px, 4vw, 36px); }
.cover-next {
  display: inline-flex;
  align-items: center;
  gap: clamp(7px, 2.4vw, 23px);
  min-height: 44px;
  border-bottom: 1px solid #f1f4e77a;
  color: #f8faf5;
  text-decoration: none;
  font-size: clamp(.78rem, 2.65vw, .98rem);
  white-space: nowrap;
}
.cover-next:hover { border-color: #fff; }
.cover-next:focus-visible { outline-color: #fff; }

.section-label { color: #4c6f65; font-size: .78rem; letter-spacing: .22em; font-weight: 600; }
.signals { background: #f2f8f6; padding: clamp(42px, 7vw, 83px) 0 clamp(40px, 7vw, 73px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 27px; }
.section-heading h2 { margin-top: 11px; font: 600 clamp(1.75rem, 4vw, 3.25rem) / 1.26 var(--serif); }
.pause {
  flex: none;
  padding: 6px 0;
  color: var(--quiet);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #94aea4;
  font-size: .8rem;
}
.barrage-stage { border-block: 1px solid var(--rule); }
.barrage-lanes {
  display: grid;
  gap: clamp(15px, 2vw, 26px);
  padding: clamp(34px, 5vw, 58px) 0;
  overflow: hidden;
}
.barrage-row {
  width: max-content;
  display: flex;
  animation: flow var(--duration, 38s) linear var(--start, -3s) infinite;
}
.barrage-row:nth-child(2) { --duration: 46s; --start: -19s; --gap: 6.2rem; }
.barrage-row:nth-child(3) { --duration: 35s; --start: -11s; --gap: 4rem; }
.barrage-row:nth-child(4) { --duration: 43s; --start: -29s; --gap: 7rem; }
.barrage-row:nth-child(5) { --duration: 50s; --start: -9s; --gap: 4.8rem; }
.barrage-group { display: flex; flex: none; min-width: 100vw; justify-content: space-between; }
.barrage-chip {
  flex: none;
  margin-inline-end: var(--gap, 3.6rem);
  color: #244f48;
  font-size: clamp(.94rem, 2vw, 1.14rem);
  line-height: 1.65;
  white-space: nowrap;
}
.barrage-chip:nth-child(2) { margin-inline-end: calc(var(--gap, 3.6rem) * 1.4); color: #356285; }
.barrage-chip:nth-child(3) { margin-inline-end: calc(var(--gap, 3.6rem) * .8); color: #785139; }
.barrage-row:nth-child(even) .barrage-chip:first-child { color: #74536d; }
@keyframes flow { to { transform: translateX(-50%); } }
.quote-list {
  display: grid;
  gap: 14px;
  width: min(calc(100% - 44px), 850px);
  margin: 0 auto;
  padding: 24px 0 24px 20px;
  line-height: 1.75;
}
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .barrage-row { animation: none; }
}

.family-section { padding: clamp(54px, 9vw, 104px) 0; }
.family-letter { width: min(calc(100% - 38px), 680px); }
.family-letter > .section-label { margin-bottom: 15px; }
.letter-paper {
  background: #faf8f2;
  border-top: 2px solid #9ab0a6;
  padding: clamp(23px, 5.2vw, 48px);
  font: 500 clamp(1.06rem, 2.6vw, 1.26rem) / 1.92 var(--serif);
}
.salutation { margin-bottom: 14px; font: 600 clamp(1.38rem, 3vw, 1.78rem) / 1.35 var(--serif); }
.letter-paper p + p { margin-top: 1.05em; }
.letter-paper .parent-sign {
  margin-top: 23px;
  text-align: right;
  font-size: .95em;
  color: var(--quiet);
}

.closing { padding: clamp(42px, 7vw, 76px) 0 82px; background: #edf5f3; text-align: center; }
.confluence { display: block; width: min(76%, 400px); margin: 0 auto 30px; }
.gift-spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  align-items: center;
  gap: clamp(28px, 6vw, 88px);
  text-align: left;
}
.gift-image { background: #f5f7f6; }
.gift-image img { width: 100%; height: auto; }
.closing h2 { font: 600 clamp(2rem, 5.35vw, 4.6rem) / 1.17 var(--serif); }
.closing-copy { margin: 18px 0 24px; max-width: 21em; line-height: 1.85; color: var(--quiet); }
.blessing { font: 600 clamp(1.15rem, 3vw, 1.65rem) / 1.8 var(--serif); }
.poster-button, .poster-preview a {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid #235449;
  border-radius: 2px;
  background: #235449;
  color: white;
  text-decoration: none;
}
.poster-button { margin-top: 42px; }
.poster-button:disabled { opacity: .65; cursor: wait; }
#poster-status:not(:empty) { margin-top: 13px; font-size: .875rem; }
.poster-preview { width: min(100%, 370px); margin: 24px auto 0; }
.poster-preview img { width: 100%; height: auto; box-shadow: 0 8px 28px #213d3729; }
.poster-preview figcaption { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin-top: 15px; font-size: .875rem; }

@media (max-width: 640px) {
  .space-hero { min-height: max(450px, 100vh); min-height: max(450px, 100svh); }
  .hero-image { object-position: 64% 25%; }
  .hero-caption { padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 18px)); }
  .section-heading { align-items: start; flex-direction: column; gap: 9px; }
  .gift-spread { grid-template-columns: 1fr; gap: 25px; }
  .gift-copy { padding-inline: 4px; }
}

.memories { background: #f8faf7; }
.memory-intro {
  max-width: 780px;
  padding-block: clamp(48px, 8vw, 104px) clamp(40px, 7vw, 78px);
}
.memory-intro .section-label { margin-bottom: 10px; }
.memory-hours {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(36px, 1fr) auto;
  align-items: end;
  gap: clamp(12px, 3vw, 30px);
  max-width: 660px;
  margin-block: 23px;
  padding: clamp(15px, 3vw, 26px) clamp(16px, 4vw, 30px);
  overflow: hidden;
  isolation: isolate;
  color: #fffdf4;
  border: 1px solid #355851;
  background: linear-gradient(104deg, #6e5940, #3b6159 47%, #25394c);
}
.memory-hours::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  opacity: .52;
  background: url("assets/contours.svg") center 47% / 105% auto no-repeat;
}
.daybreak, .nightfall { display: grid; gap: 2px; }
.nightfall { justify-items: end; }
.time-icon { display: block; margin-bottom: 6px; width: 14px; height: 14px; border-radius: 50%; }
.sun { background: #ffe0a4; box-shadow: 0 0 15px #ffd79880; }
.moon { width: 13px; height: 13px; box-shadow: 4px 1px 0 0 #e1edfa; margin-right: 4px; }
.time-label { font-size: .74rem; letter-spacing: .1em; }
.memory-hours time {
  font: 500 clamp(1.4rem, 4vw, 2.15rem) / 1.12 var(--serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: .045em;
}
.time-course {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  height: 12px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #f7d29b, #ebf3e9, #bacfe6) center / 100% 1px no-repeat;
}
.time-course span { width: 5px; height: 5px; border-radius: 50%; background: #f4f1e5; }
.memory-intro h2 { font: 600 clamp(2.25rem, 6vw, 5rem) / 1.17 var(--serif); }
.memory-intro > p:last-child {
  max-width: 35em;
  margin-top: 20px;
  color: var(--quiet);
  font: clamp(1.02rem, 2.2vw, 1.25rem) / 1.95 var(--serif);
}
.memory-chapter {
  padding-block: clamp(28px, 5.5vw, 66px) clamp(40px, 7.5vw, 82px);
  border-top: 1px solid var(--rule);
}
.memory-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 54px);
  align-items: start;
  margin-bottom: clamp(22px, 4vw, 38px);
}
.memory-heading h3 { margin: 0; font: 600 clamp(1.48rem, 3.2vw, 2.55rem) / 1.35 var(--serif); }
.memory-heading p { color: var(--quiet); line-height: 1.85; }
.memories figure {
  min-width: 0;
  padding: clamp(7px, 1.3vw, 13px);
  border: 1px solid #c6d6cd;
  background: linear-gradient(132deg, #e1ebe4, #f5f5ed);
}
.memories figure img { width: 100%; height: auto; background: #e5ece7; }
.memories figcaption {
  display: grid;
  align-content: start;
  gap: 3px;
  padding: clamp(10px, 2vw, 19px) clamp(4px, 1.8vw, 14px) 4px;
  background: linear-gradient(90deg, #edf2e9 35%, #edf2e950), url("assets/contours.svg") right 48% / 310px auto no-repeat;
  border-top: 2px solid #8da99b;
  line-height: 1.55;
}
.memories figcaption strong { font: 600 clamp(.91rem, 2.35vw, 1.27rem) / 1.45 var(--serif); }
.memories figcaption span { color: var(--quiet); font-size: clamp(.82rem, 1.65vw, .98rem); }
.track-spread > figure:nth-child(2) { background: #edece1; }
.track-spread > figure:nth-child(2) figcaption { border-color: #a6a58b; }
.track-feature figure { background: #dce7e4; }
.track-pair figure { background: #e9ede4; }
.meal-chapter > figure { background: #eeeade; }
.meal-chapter figcaption { border-color: #a29479; }
.classroom-spread > figure:first-child { background: #e4e9e5; }
.track-spread {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: clamp(16px, 3vw, 34px);
  align-items: center;
}
.track-feature, .track-pair {
  display: grid;
  gap: clamp(12px, 2.5vw, 26px);
  align-items: center;
}
.track-feature { grid-template-columns: minmax(0, .68fr) minmax(0, 1fr); }
.track-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.track-feature, .track-pair { grid-column: 1 / -1; }
.track-pair img { aspect-ratio: 3 / 2; object-fit: cover; }
.meal-chapter {
  display: grid;
  grid-template-columns: minmax(0, .52fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 6vw, 88px);
}
.meal-chapter .memory-heading { display: block; margin-bottom: 0; }
.meal-chapter .memory-heading p { margin-top: 15px; }
.classroom-spread {
  display: grid;
  grid-template-columns: minmax(0, .73fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(16px, 3vw, 38px);
}
.memory-end { background: #254c42; color: #f0f7f2; text-align: center; }
.memory-end .wrap { max-width: 620px; padding-block: clamp(34px, 7vw, 68px); }
.memory-end img { width: 82px; height: auto; margin: 0 auto 16px; }
.memory-end p { font: 500 clamp(1.25rem, 3vw, 1.8rem) / 1.72 var(--serif); }
.letter-paper .letter-close { margin-top: 1.55em; font-weight: 600; }

@media (max-width: 640px) {
  .memory-heading, .meal-chapter, .classroom-spread, .track-spread { grid-template-columns: 1fr; }
  .memory-heading { gap: 10px; }
  .track-spread > figure:nth-child(2) { width: 90%; justify-self: end; }
  .track-feature { grid-template-columns: minmax(0, .78fr) minmax(0, 1fr); align-items: start; }
  .track-feature figure:nth-child(2) { margin-top: 17px; }
  .track-feature figure img { aspect-ratio: 4 / 5; object-fit: cover; }
  .track-feature .track-portrait img { object-position: 58% 42%; }
  .track-feature .track-relay img { object-position: 48% center; }
}
