:root {
  --ink: #080b12;
  --night: #0e1420;
  --paper: #e8dfd0;
  --gold: #c4a574;
  --gold-dim: #8a7355;
  --rose: #9e4d5b;
  --rose-soft: rgba(158, 77, 91, 0.35);
  --mist: rgba(232, 223, 208, 0.55);
  --font-ru: 'Cormorant Garamond', Georgia, serif;
  --font-zh: 'Noto Serif SC', 'Songti SC', serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ru);
  overflow-x: hidden;
  line-height: 1.6;
}

body.lang-zh {
  font-family: var(--font-zh);
}

body.lang-zh .hero-names,
body.lang-zh .counter-main,
body.lang-zh .countdown-num {
  font-family: var(--font-zh);
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.65) 100%);
}

main,
.top {
  position: relative;
  z-index: 3;
}

.top {
  position: fixed;
  top: 0;
  right: 0;
  padding: 1.5rem 2rem;
  z-index: 10;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.music-toggle,
.lang-switch {
  background: none;
  border: 1px solid rgba(196, 165, 116, 0.25);
  color: var(--mist);
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.4s var(--ease-out), color 0.4s var(--ease-out), background 0.4s var(--ease-out);
}

.music-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.music-toggle:hover,
.lang-switch:hover {
  border-color: var(--gold);
  color: var(--paper);
}

.music-toggle.is-playing {
  border-color: rgba(196, 165, 116, 0.45);
  color: var(--gold);
}

.music-toggle .icon-wave {
  display: none;
}

.music-toggle.is-playing .icon-music {
  display: none;
}

.music-toggle.is-playing .icon-wave {
  display: block;
  animation: wavePulse 1.6s ease-in-out infinite;
}

.lang-switch [data-lang].active {
  color: var(--gold);
}

.lang-divider {
  margin: 0 0.35rem;
  opacity: 0.35;
}

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 6rem 8vw 7rem;
  max-width: 52rem;
}

.hero-eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: lowercase;
  color: var(--gold-dim);
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 0.3s forwards;
}

.hero-names {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  opacity: 0;
  animation: fadeUp 1.4s var(--ease-out) 0.5s forwards;
}

.name-her {
  display: block;
  font-style: italic;
  color: var(--paper);
}

.name-amp {
  display: block;
  font-size: 0.35em;
  color: var(--rose);
  margin: 0.15em 0;
  font-style: normal;
  letter-spacing: 0.5em;
  padding-left: 0.15em;
}

.name-him {
  display: block;
  font-weight: 500;
  color: var(--gold);
}

.hero-sub {
  margin-top: 2rem;
  font-size: 1.1rem;
  color: var(--mist);
  font-style: italic;
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 0.8s forwards;
}

.hero-intro {
  margin-top: 1.5rem;
  max-width: 26rem;
  font-size: 0.95rem;
  line-height: 1.9;
  color: rgba(232, 223, 208, 0.42);
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 1s forwards;
}

.scroll-hint {
  position: absolute;
  bottom: 3rem;
  left: 8vw;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--gold-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease-out);
  animation: fadeUp 1s var(--ease-out) 1.4s forwards, float 3s ease-in-out 2s infinite;
}

.scroll-hint.is-hidden {
  opacity: 0 !important;
  animation: none;
}

.scroll-hint svg {
  opacity: 0.5;
}

.chapter {
  min-height: 85vh;
  padding: 8rem 8vw 6rem;
  max-width: 56rem;
  position: relative;
}

.chapter::before {
  content: '';
  position: absolute;
  left: 8vw;
  top: 4rem;
  width: 1px;
  height: calc(100% - 6rem);
  background: linear-gradient(to bottom, transparent, var(--rose-soft), transparent);
  opacity: 0.6;
}

.chapter-label {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  margin-bottom: 2rem;
  padding-left: 2rem;
}

.chapter-num {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--rose);
  opacity: 0.7;
}

.chapter-title {
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.chapter-date {
  padding-left: 2rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 500;
  margin-bottom: 1.5rem;
  color: var(--paper);
}

.chapter-date time {
  font-variant-numeric: tabular-nums;
}

.chapter-poem {
  padding-left: 2rem;
  max-width: 28rem;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--mist);
  margin-bottom: 3.5rem;
  line-height: 1.85;
}

.counter-block {
  padding-left: 2rem;
}

.counter-main {
  font-size: clamp(4rem, 14vw, 9rem);
  font-weight: 400;
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  text-shadow: 0 0 80px rgba(196, 165, 116, 0.15);
}

.counter-label {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.counter-detail {
  margin-top: 1.2rem;
  font-size: 0.95rem;
  color: var(--mist);
  font-variant-numeric: tabular-nums;
}

.chapter-birth {
  margin-left: auto;
  margin-right: 0;
  text-align: right;
  max-width: 58rem;
}

.chapter-birth::before {
  left: auto;
  right: 8vw;
}

.chapter-birth .chapter-label,
.chapter-birth .chapter-date,
.chapter-birth .chapter-poem,
.chapter-birth .countdown-grid,
.chapter-birth .age-note,
.chapter-birth .birth-extra {
  padding-left: 0;
  padding-right: 2rem;
}

.chapter-birth .chapter-label {
  justify-content: flex-end;
}

.chapter-birth .chapter-poem {
  margin-left: auto;
}

.countdown-grid {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.3rem 0.5rem;
  flex-wrap: wrap;
  padding-right: 2rem;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.5rem;
}

.countdown-num {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 500;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: transform 0.3s var(--ease-out);
}

.countdown-num.tick {
  transform: scale(1.06);
  color: var(--gold);
}

.countdown-name {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-top: 0.5rem;
}

.countdown-sep {
  font-size: 2rem;
  color: var(--rose);
  opacity: 0.5;
  padding-bottom: 1.2rem;
  animation: pulse 2s ease-in-out infinite;
}

.age-note {
  margin-top: 2rem;
  padding-right: 2rem;
  font-size: 0.9rem;
  color: var(--mist);
  font-style: italic;
}

.birth-extra {
  margin-top: 1rem;
  padding-right: 2rem;
  max-width: 24rem;
  margin-left: auto;
  font-size: 0.88rem;
  color: rgba(232, 223, 208, 0.4);
  font-style: italic;
  line-height: 1.75;
}

.chapter-timeline {
  max-width: 40rem;
}

.timeline {
  list-style: none;
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.timeline li {
  position: relative;
  padding-left: 1.8rem;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 12px var(--rose-soft);
}

.timeline li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1.2rem;
  width: 1px;
  height: calc(100% + 1.5rem);
  background: linear-gradient(to bottom, var(--rose-soft), transparent);
}

.timeline time,
.timeline-now {
  display: block;
  font-size: 1.15rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.timeline p {
  font-size: 0.98rem;
  color: var(--mist);
  line-height: 1.8;
  max-width: 28rem;
}

.chapter-facts {
  max-width: 52rem;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  padding-left: 2rem;
  background: rgba(196, 165, 116, 0.12);
  border: 1px solid rgba(196, 165, 116, 0.12);
}

.fact-card {
  background: var(--ink);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.fact-num {
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.fact-label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-dim);
  line-height: 1.5;
}

.chapter-memories,
.chapter-forward {
  max-width: 44rem;
}

.memory-list,
.forward-list {
  list-style: none;
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.memory-list li,
.forward-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.2rem;
  align-items: start;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid rgba(196, 165, 116, 0.08);
}

.memory-list li:last-child,
.forward-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.memory-tag {
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rose);
  padding-top: 0.35rem;
  white-space: nowrap;
}

.forward-num {
  font-size: 0.75rem;
  color: var(--gold-dim);
  padding-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}

.memory-list p,
.forward-list p {
  font-size: 1rem;
  color: var(--mist);
  line-height: 1.85;
}

.chapter-letter {
  min-height: 60vh;
  padding-bottom: 6rem;
}

.letter {
  padding-left: 2rem;
  max-width: 38rem;
  font-size: 1.05rem;
  line-height: 1.95;
  color: var(--mist);
  border: none;
  font-style: italic;
}

.letter strong {
  font-style: normal;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.08em;
  font-size: 0.88rem;
}

.letter cite {
  display: block;
  margin-top: 2rem;
  font-style: normal;
  color: var(--gold);
  letter-spacing: 0.15em;
}

.footer {
  padding: 3rem 8vw 4rem;
  border-top: 1px solid rgba(196, 165, 116, 0.1);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem 2rem;
  align-items: baseline;
}

.footer-time {
  grid-column: 1;
}

.footer-note,
.footer-music {
  text-align: right;
}

.footer-note {
  grid-column: 2;
  grid-row: 1;
}

.footer-music {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
}

.footer-music {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(232, 223, 208, 0.22);
  text-transform: none;
  font-style: italic;
}

.footer-time {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  font-variant-numeric: tabular-nums;
}

.footer-note {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: rgba(232, 223, 208, 0.3);
  text-transform: uppercase;
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@keyframes wavePulse {
  0%, 100% { opacity: 0.45; transform: scaleY(0.85); }
  50% { opacity: 1; transform: scaleY(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

@media (max-width: 640px) {
  .hero {
    padding: 5rem 6vw 3rem;
  }

  .chapter {
    padding: 6rem 6vw 4rem;
  }

  .chapter::before {
    left: 6vw;
  }

  .chapter-birth::before {
    right: 6vw;
  }

  .countdown-grid {
    justify-content: center;
    padding-right: 0;
  }

  .chapter-birth {
    text-align: left;
  }

  .chapter-birth .chapter-label {
    justify-content: flex-start;
  }

  .chapter-birth .chapter-label,
  .chapter-birth .chapter-date,
  .chapter-birth .chapter-poem,
  .chapter-birth .age-note,
  .chapter-birth .birth-extra {
    padding-right: 0;
    padding-left: 2rem;
  }

  .fact-grid {
    grid-template-columns: 1fr;
    padding-left: 2rem;
    padding-right: 0;
  }

  .memory-list li,
  .forward-list li {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

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

  .footer-note,
  .footer-music {
    grid-column: 1;
    text-align: left;
  }

  .top-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}
