:root {
  --paper: #faf7f1;
  --sheet: #fffdf9;
  --ink: #1f1c18;
  --ink-soft: #4a443c;
  --ink-faint: #9a9086;
  --line: #ded5c6;
  --line-soft: #ece4d6;
  --seal: #a8342a;
  --serif: "Noto Serif SC", "Source Han Serif SC", "思源宋体",
    "Songti SC", "STSong", "SimSun", "Times New Roman", serif;
  --numeral: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* 极淡的纸面肌理与光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.95), transparent 70%),
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(168, 140, 100, 0.09), transparent 65%),
    repeating-linear-gradient(90deg, rgba(120, 100, 70, 0.022) 0 1px, transparent 1px 3px);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px 36px;
}

.site-head,
.footer {
  font-family: var(--numeral);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-faint);
  animation: appear 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.site-head { padding-bottom: 34px; }
.footer { padding-top: 40px; animation-delay: 1.1s; }

.memorial {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 册页：外框 + 内框，双线收边 */
.sheet {
  width: 100%;
  max-width: 540px;
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 7px;
  box-shadow:
    0 1px 2px rgba(80, 62, 40, 0.04),
    0 18px 44px -24px rgba(80, 62, 40, 0.22);
  animation: appear 1.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: 0.12s;
}

.sheet__inner {
  border: 1px solid var(--line-soft);
  padding: 52px 34px 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.mark {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: var(--ink-soft);
}

.lunar {
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--ink-faint);
}

.portrait-wrap {
  position: relative;
  margin: 38px 0 0;
  display: grid;
  place-items: center;
  width: clamp(132px, 34vw, 158px);
  aspect-ratio: 1;
}

.halo {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(168, 140, 100, 0.13), transparent 62%),
    radial-gradient(circle at 50% 50%, rgba(255, 253, 249, 0.9), transparent 70%);
  border: 1px solid var(--line-soft);
}

.portrait {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

.days {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.days__icon {
  width: 20px;
  height: 20px;
  color: #b3a898;
}

.days__text {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: var(--ink-soft);
}

.days__num {
  font-family: var(--numeral);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding: 0 0.1em;
  font-feature-settings: "lnum";
}

.rule {
  display: block;
  width: 28px;
  height: 1px;
  margin: 34px 0 28px;
  background: var(--line);
}

/* 竖排诗文：竖排下 line-height 控制列间距，字距用 letter-spacing */
.verse {
  writing-mode: vertical-rl;
  text-orientation: upright;
  height: auto;
  font-size: 15.5px;
  line-height: 2.6;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
}

.verse p { margin: 0; }
.verse p + p { margin-block-start: 1.5em; }

.closing-wrap {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.closing {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink);
}

.seal {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--seal);
  border-radius: 2px;
  color: var(--seal);
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0;
  text-indent: 0;
  opacity: 0.82;
  transform: rotate(-2deg);
}

@keyframes appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .page { padding: 40px 16px 28px; }
  .site-head { padding-bottom: 22px; }

  .sheet { padding: 6px; }
  .sheet__inner { padding: 40px 24px 36px; }

  .mark { letter-spacing: 0.5em; text-indent: 0.5em; }
  .lunar { font-size: 10px; letter-spacing: 0.18em; text-indent: 0.18em; }

  .portrait-wrap { margin-top: 30px; }

  /* 手机改回横排，避免竖排过高 */
  .verse {
    writing-mode: horizontal-tb;
    height: auto;
    font-size: 15px;
    line-height: 2.15;
    letter-spacing: 0.06em;
    margin-top: 4px;
  }
  .verse p + p { margin-block-start: 0; }

  .rule { margin: 28px 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .site-head, .footer { animation: none; opacity: 1; }
}

@media print {
  body { background: #ffffff; }
  body::before { display: none; }
  .sheet { box-shadow: none; }
  .sheet, .site-head, .footer { animation: none; opacity: 1; }
}
