:root {
  color-scheme: dark;
  --bg: #071125;
  --bg-deep: #030816;
  --ink: #fff4ed;
  --muted: #d9c6c7;
  --soft: rgba(255, 244, 237, 0.72);
  --rose: #ffc1cb;
  --rose-deep: #c56a7a;
  --gold: #f6dcb1;
  --line: rgba(255, 207, 218, 0.28);
  --glass: rgba(8, 18, 39, 0.54);
  --shadow: 0 24px 70px rgba(1, 4, 14, 0.42);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Times New Roman", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 78% 8%, rgba(187, 88, 111, 0.2), transparent 28rem),
    linear-gradient(180deg, var(--bg) 0%, #09152e 48%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.ambient-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background-image: radial-gradient(circle, rgba(255, 246, 224, 0.95) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(255, 188, 201, 0.72) 0 1px, transparent 1.2px);
  background-position: 4vw 8vh, 18vw 22vh;
  background-size: 19rem 17rem, 27rem 21rem;
  opacity: 0.38;
  animation: starDrift 18s linear infinite;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: max(1rem, env(safe-area-inset-top)) clamp(1.1rem, 4vw, 4rem) 1rem;
  background: linear-gradient(180deg, rgba(2, 8, 20, 0.72), rgba(2, 8, 20, 0));
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2vw, 1.62rem);
  letter-spacing: 0;
  white-space: nowrap;
}

.brand i {
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--gold);
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-20deg);
  box-shadow: 0 0 18px rgba(246, 220, 177, 0.35);
}

nav {
  display: flex;
  gap: clamp(1rem, 3vw, 3.2rem);
  align-items: center;
  font-family: var(--serif);
  font-size: clamp(0.95rem, 1.4vw, 1.3rem);
}

nav a {
  position: relative;
  color: rgba(255, 244, 237, 0.82);
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0;
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--rose);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

nav a:hover::after,
nav a:focus-visible::after {
  transform: scaleX(1);
}

.hero {
  position: relative;
  min-height: 88svh;
  display: grid;
  align-items: center;
  padding: 8rem clamp(1.25rem, 7vw, 6.5rem) 2.8rem;
  overflow: hidden;
}

.hero-media,
.hero-shade {
  position: absolute;
  inset: 0;
}

.hero-media {
  background-image: url("./assets/hero-night-letter.png");
  background-position: center;
  background-size: cover;
  transform: scale(1.02);
}

.hero-shade {
  background:
    linear-gradient(90deg, rgba(3, 8, 22, 0.86) 0%, rgba(5, 12, 27, 0.68) 35%, rgba(5, 12, 27, 0.14) 72%),
    linear-gradient(180deg, rgba(3, 8, 22, 0.25) 0%, rgba(3, 8, 22, 0.08) 65%, var(--bg) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 54rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 48rem;
  margin-bottom: 1.35rem;
  font-family: var(--serif);
  font-size: clamp(3.1rem, 7.5vw, 7rem);
  line-height: 1.12;
  font-weight: 500;
  text-wrap: balance;
  text-shadow: 0 16px 40px rgba(1, 4, 14, 0.55);
}

h1 span {
  display: block;
}

.hero-copy {
  max-width: 34rem;
  margin-bottom: 2.35rem;
  color: var(--soft);
  font-family: var(--serif);
  font-size: clamp(1.12rem, 2vw, 1.55rem);
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.button {
  min-height: 3.7rem;
  border: 1px solid rgba(255, 231, 222, 0.64);
  border-radius: 999px;
  padding: 0 2rem;
  color: var(--ink);
  background: transparent;
  font-family: var(--serif);
  font-size: 1.08rem;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button span {
  margin-right: 0.6rem;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.button.primary {
  background: linear-gradient(180deg, #ffe3e8, #f4a7b6);
  color: #2c1420;
  border-color: rgba(255, 234, 238, 0.9);
  box-shadow: 0 12px 34px rgba(255, 175, 189, 0.42);
}

.button.secondary {
  background: rgba(2, 9, 24, 0.36);
  backdrop-filter: blur(10px);
}

.button.compact {
  min-height: 3.25rem;
  padding-inline: 1.45rem;
  font-size: 1rem;
}

.star-count {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: rgba(255, 244, 237, 0.7);
  font-size: 0.94rem;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 2rem;
  z-index: 3;
  width: 2rem;
  height: 3rem;
  border: 1px solid rgba(255, 244, 237, 0.45);
  border-radius: 999px;
  transform: translateX(-50%);
}

.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 0.55rem;
  width: 0.28rem;
  height: 0.72rem;
  border-radius: 999px;
  background: var(--rose);
  transform: translateX(-50%);
  animation: cue 1.6s ease-in-out infinite;
}

.section-band {
  position: relative;
  padding: clamp(4rem, 9vw, 7rem) clamp(1.25rem, 7vw, 6.5rem);
}

.memories {
  background:
    linear-gradient(180deg, rgba(7, 17, 37, 0.98), rgba(9, 20, 43, 0.96)),
    radial-gradient(circle at 16% 20%, rgba(255, 193, 203, 0.18), transparent 20rem);
  padding-top: clamp(2rem, 3.5vw, 3.1rem);
}

.section-heading {
  text-align: center;
  max-width: 42rem;
  margin: 0 auto 2.4rem;
}

.section-heading h2,
.letter-panel h2,
.tonight h2,
.letter-dialog h2 {
  color: var(--rose);
  font-family: var(--serif);
  font-size: clamp(2rem, 4.2vw, 3.8rem);
  line-height: 1.2;
  font-weight: 500;
}

.section-heading p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1rem, 1.8vw, 1.28rem);
}

.meeting-counter {
  width: min(48rem, 100%);
  margin: 0 auto 4.8rem;
  padding: clamp(1.2rem, 3vw, 1.65rem);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, transparent, rgba(255, 193, 203, 0.07), transparent);
  text-align: center;
}

.meeting-counter p {
  margin: 0 0 1rem;
  color: rgba(255, 244, 237, 0.72);
  font-family: var(--serif);
  font-size: clamp(0.98rem, 1.55vw, 1.15rem);
  line-height: 1.7;
}

.meeting-counter time {
  color: var(--gold);
}

.counter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.counter-grid span {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
  justify-items: center;
}

.counter-grid strong {
  max-width: 100%;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.65rem, 4vw, 3rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(255, 193, 203, 0.32);
}

.counter-grid small {
  color: rgba(255, 193, 203, 0.78);
  font-size: 0.82rem;
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 4rem);
  max-width: 68rem;
  margin: 0 auto;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 1.25rem;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 193, 203, 0.9), transparent);
  box-shadow: 0 0 22px rgba(255, 193, 203, 0.58);
}

.memory {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  min-height: 13rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.memory-star {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff7e8 0 18%, #ffc3d0 19% 35%, transparent 36%),
    conic-gradient(from 0deg, transparent 0 10%, rgba(255, 244, 237, 0.92) 11% 14%, transparent 15% 35%, rgba(255, 244, 237, 0.88) 36% 39%, transparent 40% 100%);
  filter: drop-shadow(0 0 14px rgba(255, 193, 203, 0.82));
  transition: transform 200ms ease;
}

.memory strong {
  color: var(--rose);
  font-family: var(--serif);
  font-size: clamp(1.22rem, 2vw, 1.75rem);
  font-weight: 500;
}

.memory small {
  max-width: 14rem;
  color: rgba(255, 244, 237, 0.66);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.7;
}

.memory.active .memory-star,
.memory:hover .memory-star,
.memory:focus-visible .memory-star {
  transform: scale(1.22) rotate(10deg);
}

.memory:focus-visible {
  outline: 1px solid var(--rose);
  outline-offset: 0.9rem;
  border-radius: 1rem;
}

.memory-note {
  width: min(40rem, calc(100% - 2.5rem));
  margin: 3.4rem auto 0;
  padding: 1.2rem 1.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--gold);
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.wishes {
  background: linear-gradient(180deg, #071125, #0f1830);
}

.letter-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(16rem, 0.8fr);
  gap: clamp(2rem, 7vw, 6rem);
  align-items: center;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.5rem);
  border: 1px solid rgba(246, 220, 177, 0.28);
  border-radius: 0.5rem;
  background:
    linear-gradient(135deg, rgba(255, 244, 237, 0.09), rgba(255, 193, 203, 0.04)),
    rgba(4, 10, 24, 0.52);
  box-shadow: var(--shadow);
}

.letter-panel p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
  line-height: 2;
}

.letter-panel ul {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.letter-panel li {
  border-bottom: 1px solid var(--line);
  padding: 0 0 1rem 1.6rem;
  color: rgba(255, 244, 237, 0.8);
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.65;
}

.letter-panel li::before {
  content: "";
  display: inline-block;
  width: 0.48rem;
  height: 0.48rem;
  margin-left: -1.45rem;
  margin-right: 0.9rem;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 16px rgba(255, 193, 203, 0.75);
}

.tonight {
  min-height: 62svh;
  display: grid;
  place-items: center;
  padding: clamp(4rem, 10vw, 8rem) clamp(1.25rem, 7vw, 6.5rem);
  background:
    linear-gradient(180deg, rgba(15, 24, 48, 0.82), rgba(3, 8, 22, 0.94)),
    image-set(url("./assets/hero-night-letter.png") type("image/png"));
  background-position: center 62%;
  background-size: cover;
}

.tonight-inner {
  width: min(48rem, 100%);
  text-align: center;
  text-shadow: 0 12px 38px rgba(0, 0, 0, 0.5);
}

.tonight p {
  color: rgba(255, 244, 237, 0.78);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.8;
}

.promise-state {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: var(--gold);
}

.letter-dialog {
  width: min(40rem, calc(100% - 2rem));
  border: 1px solid rgba(246, 220, 177, 0.42);
  border-radius: 0.55rem;
  padding: clamp(1.7rem, 5vw, 3.2rem);
  color: #2b1721;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 232, 222, 0.9)),
    #f6ddc7;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

.letter-dialog::backdrop {
  background: rgba(1, 5, 14, 0.66);
  backdrop-filter: blur(8px);
}

.letter-dialog h2 {
  color: #673046;
  margin-right: 2rem;
}

.letter-dialog p {
  color: #4d3340;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 2;
}

.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(103, 48, 70, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
}

.close::before,
.close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 1px;
  background: #673046;
}

.close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.spark {
  position: fixed;
  z-index: 30;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  pointer-events: none;
  background: #fff6df;
  box-shadow: 0 0 18px #ffc1cb;
  animation: sparkFly 900ms ease-out forwards;
}

@keyframes starDrift {
  to {
    background-position: 24vw 18vh, 2vw 44vh;
  }
}

@keyframes cue {
  0%,
  100% {
    opacity: 0.35;
    transform: translate(-50%, 0);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, 0.8rem);
  }
}

@keyframes sparkFly {
  to {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(0.2);
  }
}

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

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    padding: max(0.8rem, env(safe-area-inset-top)) 1.1rem 0.65rem;
    background: linear-gradient(180deg, rgba(2, 8, 20, 0.88), rgba(2, 8, 20, 0.32) 82%, rgba(2, 8, 20, 0));
  }

  nav {
    gap: 0.9rem;
    font-size: 0.9rem;
  }

  .hero {
    min-height: 92svh;
    padding: 8.15rem 1.1rem 3.05rem;
    align-items: end;
  }

  .hero-media {
    background-position: 61% center;
  }

  .hero-shade {
    background:
      linear-gradient(180deg, rgba(3, 8, 22, 0.2) 0%, rgba(3, 8, 22, 0.56) 42%, rgba(3, 8, 22, 0.95) 100%),
      linear-gradient(90deg, rgba(3, 8, 22, 0.56), rgba(3, 8, 22, 0.05));
  }

  h1 {
    max-width: 100%;
    margin-bottom: 1rem;
    font-size: clamp(2.35rem, 11.6vw, 3.5rem);
    line-height: 1.12;
  }

  .hero-copy {
    margin-bottom: 1.55rem;
    font-size: clamp(1rem, 4.2vw, 1.16rem);
    line-height: 1.72;
  }

  .hero-actions {
    gap: 0.8rem;
  }

  .button {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 3.65rem;
    padding-inline: 1.2rem;
    font-size: 1.04rem;
  }

  .star-count {
    margin-top: 0.75rem;
    font-size: 0.9rem;
  }

  .scroll-cue {
    bottom: 1.45rem;
    width: 1.85rem;
    height: 2.7rem;
  }

  .section-band {
    padding: 3.3rem 1.1rem;
  }

  .section-heading {
    margin-bottom: 1.7rem;
  }

  .meeting-counter {
    margin-bottom: 3.3rem;
    padding: 1.05rem 0.7rem;
  }

  .counter-grid {
    gap: 0.45rem;
  }

  .counter-grid strong {
    font-size: clamp(1.5rem, 8vw, 2.25rem);
  }

  .counter-grid small {
    font-size: 0.76rem;
  }

  .timeline {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }

  .timeline::before {
    top: 0;
    bottom: 0;
    left: 1.24rem;
    right: auto;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg, transparent, rgba(255, 193, 203, 0.9), transparent);
  }

  .memory {
    min-height: auto;
    justify-items: start;
    padding-left: 4rem;
    text-align: left;
  }

  .memory-star {
    position: absolute;
    left: 0;
    top: 0;
  }

  .letter-panel {
    grid-template-columns: 1fr;
    padding: 1.35rem;
  }

  .letter-dialog {
    width: min(35rem, calc(100% - 1.2rem));
    max-height: min(82vh, 42rem);
    padding: 1.55rem 1.25rem;
    overflow: auto;
  }

  .letter-dialog p {
    font-size: 1.03rem;
    line-height: 1.86;
  }
}

@media (max-width: 560px) {
  .site-header {
    display: grid;
    gap: 0.7rem;
  }

  nav {
    width: 100%;
    justify-content: space-between;
    gap: 0.25rem;
  }

  .brand {
    max-width: 100%;
    font-size: clamp(1rem, 4.5vw, 1.12rem);
  }

  .brand i {
    width: 1.45rem;
    height: 1.45rem;
    flex: 0 0 auto;
  }

  nav a {
    min-height: 2.4rem;
    padding-inline: 0.1rem;
  }

  .hero {
    min-height: 91svh;
    padding-top: 7.45rem;
  }

  .hero-content {
    width: 100%;
  }

  h1 {
    font-size: clamp(2.2rem, 11vw, 3.08rem);
  }

  .memories {
    padding-top: 2.15rem;
  }

  .meeting-counter p {
    font-size: 0.96rem;
  }

  .memory {
    padding-left: 3.55rem;
  }

  .memory-note {
    width: 100%;
    margin-top: 2.4rem;
    padding-inline: 0.85rem;
  }
}

@media (max-width: 360px) {
  .site-header {
    padding-inline: 0.85rem;
  }

  nav {
    font-size: 0.82rem;
  }

  .hero {
    padding-inline: 0.9rem;
  }

  h1 {
    font-size: clamp(2rem, 10.4vw, 2.55rem);
  }

  .counter-grid {
    gap: 0.3rem;
  }

  .counter-grid strong {
    font-size: clamp(1.28rem, 7.2vw, 1.8rem);
  }
}
