:root {
  --cream: #f7f3ec;
  --sand: #eee7dd;
  --ink: #2e2a26;
  --muted: #746b62;
  --line: #dcd3c8;
  --accent: #b98f83;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --serif: Georgia, "Times New Roman", "Songti SC", STSong, SimSun, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html {
  scroll-behavior: smooth;
  background: var(--cream);
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(185, 143, 131, 0.045), transparent 26rem),
    var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  transform: translateY(-150%);
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.reading-progress {
  position: fixed;
  z-index: 30;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border: 1px solid rgba(220, 211, 200, 0.7);
  border-radius: 999px;
  background: rgba(247, 243, 236, 0.82);
  box-shadow: 0 8px 28px rgba(45, 37, 30, 0.06);
  opacity: 0;
  transform: translateY(-10px);
  backdrop-filter: blur(12px);
  pointer-events: none;
  transition: opacity 450ms var(--ease), transform 450ms var(--ease);
}

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

.reading-progress__label {
  color: var(--muted);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
}

.reading-progress__track {
  position: relative;
  display: block;
  width: 52px;
  height: 1px;
  overflow: hidden;
  background: var(--line);
}

.reading-progress__track i {
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--accent);
}

.shell {
  width: min(100% - 48px, 1080px);
  margin-inline: auto;
}

.narrow {
  width: min(100% - 48px, 720px);
  margin-inline: auto;
}

.section {
  padding-block: 104px;
}

.section--airy {
  padding-block: 124px;
}

.section--sand {
  background: var(--sand);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1.5;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.18;
}

.prose {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.9;
}

.prose p {
  margin: 0 0 1.4em;
}

.prose--center {
  max-width: 600px;
  margin: 38px auto 0;
  text-align: center;
}

.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background: #554b40;
  color: #fffaf3;
}

.hero__image,
.hero__veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__image {
  object-fit: cover;
  object-position: 50% 58%;
  animation: heroImage 1.6s var(--ease) both;
}

.hero__veil {
  background: linear-gradient(180deg, rgba(35, 30, 25, 0.08), rgba(35, 30, 25, 0.14) 42%, rgba(35, 30, 25, 0.58));
}

.hero__content {
  position: absolute;
  z-index: 1;
  bottom: max(112px, calc(env(safe-area-inset-bottom) + 96px));
  left: 50%;
  transform: translateX(-50%);
}

.hero__eyebrow,
.hero h1,
.hero__subtitle,
.hero__cn,
.scroll-cue {
  opacity: 0;
  animation: heroText 0.9s var(--ease) forwards;
}

.hero__eyebrow {
  margin-bottom: 14px;
  color: rgba(255, 250, 243, 0.76);
  animation-delay: 0.2s;
}

.hero h1 {
  font-size: clamp(3.8rem, 13vw, 6.8rem);
  line-height: 0.95;
  animation-delay: 0.34s;
}

.hero__subtitle {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 3.6vw, 1.45rem);
  font-style: italic;
  animation-delay: 0.5s;
}

.hero__cn {
  margin: 12px 0 0;
  color: rgba(255, 250, 243, 0.82);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  animation-delay: 0.66s;
}

.scroll-cue {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 250, 243, 0.35);
  color: rgba(255, 250, 243, 0.74);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-decoration: none;
  animation-delay: 0.92s;
}

.scroll-cue i {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.birthday-intro {
  text-align: center;
}

.birthday-number {
  margin-bottom: -8px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: clamp(7rem, 30vw, 13rem);
  font-weight: 400;
  line-height: 0.78;
  opacity: 0.75;
}

.birthday-number__word {
  margin: 22px 0 52px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.8rem;
  font-style: italic;
  letter-spacing: 0.14em;
}

.pull-quote {
  margin-top: 2.1rem !important;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4.8vw, 1.8rem);
  line-height: 1.7;
}

.story {
  border-top: 1px solid var(--line);
}

.photo-copy {
  display: grid;
  gap: 54px;
}

.portrait-frame {
  margin: 0;
}

.portrait-frame img,
.editorial-grid img,
.closing__image img {
  width: 100%;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(45, 37, 30, 0.1);
}

.portrait-frame img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 46%;
}

figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.72rem;
  font-style: italic;
  letter-spacing: 0.06em;
}

.story__copy h2,
.moments__heading h2,
.letter h2 {
  margin-bottom: 32px;
}

.counter {
  text-align: center;
}

.counter h2 {
  margin-bottom: 58px;
}

.counter__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: min(100%, 840px);
  margin-inline: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.counter__grid div {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 30px 10px;
}

.counter__grid div:nth-child(odd)::after {
  position: absolute;
  top: 24%;
  right: 0;
  bottom: 24%;
  width: 1px;
  background: var(--line);
  content: "";
}

.counter__grid strong {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 300;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.counter__grid span {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
}

.counter__note {
  max-width: 520px;
  margin: 38px auto 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.8;
}

.moments__heading {
  max-width: 620px;
  margin-bottom: 62px;
}

.editorial-grid {
  display: grid;
  gap: 44px;
}

.editorial-grid figure,
.editorial-grid blockquote {
  margin: 0;
}

.editorial-grid__lead img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.editorial-grid__detail img {
  aspect-ratio: 4 / 5.2;
  object-fit: cover;
  object-position: center;
}

.editorial-grid__copy,
.editorial-grid__quote {
  align-self: center;
  padding: 10px 8px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.3rem, 4.5vw, 1.75rem);
  line-height: 1.75;
}

.editorial-grid__copy p,
.editorial-grid__quote p {
  margin: 18px 0 0;
}

.index {
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
}

.editorial-grid__quote footer {
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.7rem;
  font-style: italic;
  letter-spacing: 0.06em;
}

.memory-gallery[hidden] {
  display: none;
}

.memory-gallery__heading {
  max-width: 680px;
  margin-bottom: 58px;
}

.memory-gallery__heading h2 {
  margin-bottom: 24px;
}

.memory-gallery__heading > p:last-child {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.9;
}

.memory-gallery__grid {
  display: grid;
  gap: 34px;
}

.memory-gallery__item {
  margin: 0;
}

.memory-gallery__item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 20px 60px rgba(45, 37, 30, 0.1);
}

.memory-gallery__item:nth-child(even) img {
  aspect-ratio: 5 / 4;
}

.letter__paper {
  width: min(100% - 32px, 760px);
  margin-inline: auto;
  padding: 52px 28px;
  border: 1px solid rgba(220, 211, 200, 0.78);
  border-radius: 24px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.28)),
    var(--cream);
  box-shadow: 0 16px 50px rgba(45, 37, 30, 0.06);
}

.letter__paper header {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.letter__body {
  margin-top: 38px;
  line-height: 2;
}

.letter__signature {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  margin-top: 48px;
  font-family: var(--serif);
}

.letter__signature span {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
}

.letter__signature strong {
  font-size: 1.45rem;
  font-weight: 400;
}

.secret {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 68%, rgba(185, 143, 131, 0.1), transparent 28rem),
    var(--cream);
}

.secret::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(70%, 720px);
  height: 1px;
  transform: translateX(-50%);
  background: var(--line);
  content: "";
}

.secret__intro {
  text-align: center;
}

.secret__intro h2 {
  margin-bottom: 24px;
}

.secret__intro > p:last-child {
  max-width: 540px;
  margin: 0 auto;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.85;
}

.secret__stage {
  display: grid;
  place-items: center;
  min-height: 460px;
  margin-top: 58px;
  padding: 40px 20px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.34), rgba(255,255,255,0)),
    var(--sand);
  box-shadow: 0 24px 80px rgba(45, 37, 30, 0.07);
}

.seal-button {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: opacity 480ms var(--ease), transform 480ms var(--ease);
}

.seal-button__mark {
  position: relative;
  display: grid;
  width: 104px;
  height: 104px;
  place-content: center;
  border: 1px solid rgba(46, 42, 38, 0.28);
  border-radius: 50%;
  background: var(--cream);
  box-shadow:
    0 0 0 7px var(--sand),
    0 0 0 8px rgba(46, 42, 38, 0.16),
    0 18px 45px rgba(45, 37, 30, 0.1);
  text-align: center;
  transition: transform 700ms var(--ease), box-shadow 700ms var(--ease);
}

.seal-button__mark::before,
.seal-button__mark::after {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 1px;
  background: rgba(46, 42, 38, 0.24);
  content: "";
}

.seal-button__mark::before { right: calc(100% + 13px); }
.seal-button__mark::after { left: calc(100% + 13px); }

.seal-button__mark b {
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 0.9;
}

.seal-button__mark i {
  margin-top: 7px;
  color: var(--accent);
  font: normal 0.55rem/1 var(--sans);
  letter-spacing: 0.22em;
}

.seal-button__copy {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.seal-button__copy strong {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
}

.seal-button__copy small {
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.seal-button:hover .seal-button__mark {
  transform: rotate(-5deg) scale(1.035);
  box-shadow:
    0 0 0 7px var(--sand),
    0 0 0 8px rgba(46, 42, 38, 0.18),
    0 24px 55px rgba(45, 37, 30, 0.14);
}

.seal-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 14px;
  border-radius: 18px;
}

.secret__stage.is-open .seal-button {
  position: absolute;
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

.secret__note {
  width: min(100%, 660px);
  padding: 54px 28px;
  border: 1px solid rgba(220, 211, 200, 0.9);
  border-radius: 3px;
  background: var(--cream);
  box-shadow: 0 22px 70px rgba(45, 37, 30, 0.11);
  opacity: 0;
  transform: perspective(900px) rotateX(-10deg) translateY(28px) scale(0.97);
  transform-origin: top center;
  text-align: center;
  transition: opacity 850ms var(--ease), transform 850ms var(--ease);
}

.secret__note.is-open {
  opacity: 1;
  transform: perspective(900px) rotateX(0) translateY(0) scale(1);
}

.secret__wish {
  margin: 12px 0 30px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.65rem, 6vw, 2.4rem);
  line-height: 1.65;
}

.secret__rule {
  display: block;
  width: 36px;
  height: 1px;
  margin: 0 auto 28px;
  background: var(--accent);
}

.secret__note > p:not(.eyebrow):not(.secret__wish) {
  max-width: 470px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.9;
}

.secret__note footer {
  margin-top: 38px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.72rem;
  font-style: italic;
  letter-spacing: 0.06em;
}

.closing {
  padding-bottom: 82px;
  text-align: center;
}

.closing__image {
  width: min(100% - 48px, 1080px);
  margin: 0 auto 70px;
}

.closing__image img {
  max-height: 70svh;
  object-fit: cover;
  object-position: center 54%;
}

.closing__content h2 {
  max-width: 620px;
  margin-inline: auto;
}

.closing__content > p:not(.eyebrow) {
  margin: 20px 0 40px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.85rem;
  font-style: italic;
}

.restart-button {
  min-height: 50px;
  padding: 12px 28px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  cursor: pointer;
  font: 500 0.86rem/1 var(--sans);
  letter-spacing: 0.06em;
  transition: transform 350ms var(--ease), background-color 350ms var(--ease);
}

.restart-button:hover {
  transform: translateY(-2px);
  background: #514840;
}

.restart-button:focus-visible,
.scroll-cue:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.restart-button:active {
  transform: scale(0.98);
}

.site-footer {
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.music-control {
  position: fixed;
  z-index: 35;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
  left: 18px;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(220, 211, 200, 0.78);
  border-radius: 999px;
  background: rgba(247, 243, 236, 0.88);
  box-shadow: 0 10px 32px rgba(45, 37, 30, 0.08);
  color: var(--muted);
  cursor: pointer;
  font: 500 0.68rem/1 var(--sans);
  letter-spacing: 0.08em;
  backdrop-filter: blur(12px);
}

.music-control[hidden] {
  display: none;
}

.music-control:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.music-control__bars {
  display: flex;
  height: 14px;
  align-items: center;
  gap: 2px;
}

.music-control__bars i {
  display: block;
  width: 2px;
  height: 5px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: center;
}

.music-control.is-playing .music-control__bars i {
  animation: soundBars 800ms ease-in-out infinite alternate;
}

.music-control.is-playing .music-control__bars i:nth-child(2) { animation-delay: -260ms; }
.music-control.is-playing .music-control__bars i:nth-child(3) { animation-delay: -520ms; }

@keyframes soundBars {
  from { transform: scaleY(0.65); }
  to { transform: scaleY(2.1); }
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 800ms var(--ease), transform 800ms var(--ease);
}

.reveal--image {
  transform: translateY(18px) scale(0.98);
  transition-duration: 1000ms;
}

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

@keyframes heroImage {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes heroText {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 760px) {
  .shell,
  .narrow {
    width: min(100% - 96px, var(--content, 1080px));
  }

  .narrow { --content: 720px; }
  .section { padding-block: 150px; }
  .section--airy { padding-block: 170px; }

  .hero__content {
    bottom: 120px;
  }

  .scroll-cue {
    right: 48px;
    left: 48px;
  }

  .photo-copy {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 0.8fr);
    gap: clamp(64px, 8vw, 120px);
    align-items: center;
  }

  .counter__grid {
    grid-template-columns: 1.7fr repeat(3, 1fr);
  }

  .counter__grid div {
    padding: 38px 20px;
  }

  .counter__grid div:not(:last-child)::after {
    position: absolute;
    top: 24%;
    right: 0;
    bottom: 24%;
    width: 1px;
    background: var(--line);
    content: "";
  }

  .editorial-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.7fr);
    gap: 80px 96px;
    align-items: start;
  }

  .editorial-grid__lead {
    grid-row: span 2;
  }

  .editorial-grid__detail {
    grid-column: 2;
  }

  .editorial-grid__quote {
    align-self: center;
    padding-inline: 24px;
  }

  .memory-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 54px 42px;
    align-items: start;
  }

  .memory-gallery__item:nth-child(4n + 1) {
    grid-row: span 2;
  }

  .memory-gallery__item:nth-child(4n + 1) img {
    aspect-ratio: 4 / 5.4;
  }

  .letter__paper {
    padding: 76px 72px;
  }

  .secret__stage {
    min-height: 540px;
    padding: 64px;
  }

  .secret__note {
    padding: 72px 64px;
  }

  .closing__image {
    margin-bottom: 100px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .portrait-frame img,
  .editorial-grid img,
  .memory-gallery__item img,
  .closing__image img {
    transition: transform 700ms var(--ease);
  }

  .portrait-frame:hover img,
  .editorial-grid figure:hover img,
  .memory-gallery__item:hover img,
  .closing__image:hover img {
    transform: scale(1.015);
  }
}

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

@media (max-width: 420px) {
  .seal-button {
    flex-direction: column;
    text-align: center;
  }

  .seal-button__mark::before,
  .seal-button__mark::after {
    display: none;
  }
}
