:root {
  --night: #1b1614;
  --night-deep: #130f0e;
  --paper: #f5efe6;
  --paper-deep: #eae0d2;
  --ink: #2a2420;
  --muted: #6e635a;
  --line: #cbbcad;
  --accent: #a64f3e;
  --accent-deep: #743428;
  --amber: #deb084;
  --amber-soft: #e8be9e;
  --white: #fbf7f0;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--night-deep);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background-color: var(--night);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.autumn-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 18% 8%, rgba(244, 224, 198, 0.09), transparent 36%),
    radial-gradient(circle at 82% 22%, rgba(214, 134, 88, 0.12), transparent 44%),
    linear-gradient(175deg, var(--night-deep) 0%, var(--night) 55%, #241b17 100%);
}

.yesterday-moon {
  position: absolute;
  top: clamp(32px, 7vh, 76px);
  right: clamp(28px, 9vw, 140px);
  width: clamp(54px, 8vw, 84px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle at 38% 38%,
    rgba(253, 245, 228, 0.88) 0%,
    rgba(238, 214, 180, 0.42) 48%,
    rgba(218, 174, 128, 0.08) 72%,
    transparent 100%
  );
  box-shadow: 0 0 64px 18px rgba(238, 206, 166, 0.12);
  opacity: 0.72;
}

.bar-lamp {
  position: absolute;
  top: 26vh;
  left: -12vw;
  width: min(74vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 108, 68, 0.11), transparent 68%);
  filter: blur(28px);
}

.letter-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) clamp(18px, 5vw, 56px) max(54px, env(safe-area-inset-bottom));
}

.top-nav {
  width: min(100%, 920px);
  min-height: 44px;
  margin: 0 auto clamp(34px, 7vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: rgba(251, 247, 240, 0.7);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.top-nav a,
.page-ending a {
  text-decoration: none;
  border-bottom: 1px solid rgba(251, 247, 240, 0.34);
  padding-bottom: 2px;
  transition: color 180ms ease, border-color 180ms ease;
}

.top-nav a:hover,
.page-ending a:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.top-nav a:focus-visible,
.page-ending a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 5px;
}

.letter-hero {
  width: min(100%, 760px);
  margin: 0 auto clamp(36px, 6vw, 56px);
}

.hero-copy {
  padding-bottom: 4px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--amber);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.hero-copy h1 {
  margin: 0;
  color: var(--white);
  font-size: clamp(2.4rem, 5vw, 3.85rem);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero-copy h1 em {
  color: var(--amber-soft);
  font-style: normal;
}

.hero-lede {
  max-width: 38em;
  margin: 20px 0 0;
  color: rgba(251, 247, 240, 0.76);
  font-size: clamp(1rem, 1.8vw, 1.1rem);
  line-height: 1.9;
  text-wrap: pretty;
}

.inline-photos {
  margin: 28px 0;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.photo-card {
  width: 156px;
  margin: 0;
  padding: 7px 7px 9px;
  background: #fbf7f0;
  border: 1px solid rgba(203, 188, 173, 0.85);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  color: var(--ink);
}

.photo-card img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(110, 99, 90, 0.16);
}

.photo-card figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 7px 2px 0;
}

.photo-card figcaption span {
  color: var(--accent);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.photo-card figcaption strong {
  font-size: 0.84rem;
  font-weight: 500;
}

.letter-paper {
  position: relative;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(42px, 8vw, 84px) clamp(24px, 8vw, 76px) clamp(56px, 9vw, 96px);
  background-color: var(--paper);
  background-image: url("../../assets/paper-texture.png");
  background-size: 580px auto;
  border: 1px solid rgba(203, 188, 173, 0.76);
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.letter-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 92% 4%, rgba(216, 152, 108, 0.12), transparent 34%),
    linear-gradient(180deg, transparent 85%, rgba(166, 79, 62, 0.05));
}

.letter-paper::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(166, 79, 62, 0.18);
  pointer-events: none;
}

.letter-meta,
.letter-body {
  position: relative;
  z-index: 1;
}

.letter-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(110, 99, 90, 0.32);
}

.meta-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

.letter-meta strong {
  color: var(--accent-deep);
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 500;
}

.meta-right {
  text-align: right;
  color: var(--muted);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 0.74rem;
  line-height: 1.6;
}

.meta-right small {
  display: block;
  color: var(--accent);
  font-size: 0.68rem;
}

.letter-body {
  max-width: 66ch;
  margin: 40px auto 0;
  font-size: clamp(1.04rem, 2.4vw, 1.18rem);
  line-height: 2.1;
  text-wrap: pretty;
}

.letter-body > p {
  margin: 0;
}

.letter-body > p + p {
  margin-top: 1.12em;
}

.salutation-line {
  color: var(--accent-deep);
  font-size: 1.12em;
}

.breath-line {
  margin-top: 2.1em !important;
  margin-bottom: 0.3em !important;
  padding-left: 14px;
  border-left: 2px solid rgba(166, 79, 62, 0.45);
  color: var(--accent-deep);
  font-size: 1.24em;
  line-height: 1.65;
}

.farewell-dialogue {
  position: relative;
  margin: clamp(34px, 6vw, 52px) 0;
  padding: clamp(22px, 4.5vw, 34px) clamp(20px, 5vw, 34px);
  background: rgba(234, 224, 210, 0.72);
  border: 1px solid rgba(166, 79, 62, 0.22);
  border-left: 3px solid var(--accent);
}

.farewell-dialogue p {
  margin: 0;
}

.farewell-dialogue p + p {
  margin-top: 0.9em;
}

.farewell-dialogue .vow-line {
  color: var(--accent-deep);
  font-size: 1.18em;
  line-height: 1.75;
}

.letter-ending {
  position: relative;
  margin-top: clamp(56px, 10vw, 86px);
  padding-top: 32px;
  border-top: 1px solid rgba(110, 99, 90, 0.32);
  color: var(--accent-deep);
}

.letter-ending p {
  margin: 0;
  font-size: 1.12em;
}

.letter-ending span {
  display: block;
  margin-top: 20px;
  color: var(--muted);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.page-ending {
  width: min(100%, 760px);
  margin: 28px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 24px;
  color: rgba(251, 247, 240, 0.68);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 0.76rem;
  line-height: 1.7;
}

@media (max-width: 520px) {
  .top-nav {
    align-items: flex-start;
    font-size: 0.7rem;
  }

  .hero-copy h1 {
    font-size: clamp(2.15rem, 10vw, 3.2rem);
  }

  .photo-card {
    width: calc(50% - 8px);
    max-width: 152px;
  }

  .letter-paper {
    padding-right: 22px;
    padding-left: 22px;
  }

  .letter-paper::after {
    inset: 10px;
  }

  .letter-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .meta-right {
    text-align: left;
  }

  .letter-body {
    font-size: 1.04rem;
    line-height: 2.02;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .photo-card,
  .top-nav a,
  .page-ending a {
    transition: none;
  }
}
