/* ============================================================
   广阳入冬 · 排印视觉随笔样式表
   设计基准：375px–430px 移动优先竖向阅读长页
   字体体系：纯中文衬线/楷体/黑体及 iOS/Android 可靠系统回退
   ============================================================ */

:root {
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", "NSimSun", "SimSun", serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "Noto Serif CJK SC", serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;

  /* 纸面 · 初冬午后 */
  --paper-bg: #F3EFE6;
  --paper-alt: #EAE3D4;
  --ink-dark: #23201D;
  --ink-muted: #635C52;
  --seal-red: #9A3B26;

  /* 暮色 · 平原四时半 */
  --dusk-bg: #222933;
  --dusk-ink: #E5E1D8;
  --dusk-muted: #A7B0BA;
  --dusk-amber: #D7A56B;

  /* 室内 · 漆案与暖灯 */
  --lacquer-bg: #181311;
  --room-bg: #1B1512;
  --warm-ink: #EAE0D0;
  --warm-muted: #B8A58E;
  --gold-fill: #C79A58;
  --cinnabar-warm: #C7563E;

  /* 桌面衬垫（宽屏居中呈现印刷品尺度） */
  --desk-mat: #DFD8CA;

  /* 光影交互坐标 */
  --lamp-x: 38%;
  --lamp-y: 34%;
  --dusk-shift: 0px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--paper-bg);
  color: var(--ink-dark);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(154, 59, 38, 0.16);
}

.band-dusk ::selection,
.band-lacquer ::selection,
.band-room ::selection {
  background: rgba(199, 154, 88, 0.25);
}

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

/* 宽屏下的书页衬垫，375-430px 手机下自动满屏 */
.desk-mat {
  width: 100%;
  min-height: 100vh;
  background-color: var(--paper-bg);
}

.essay-sheet {
  width: 100%;
  margin: 0 auto;
  overflow-x: clip;
  background-color: var(--paper-bg);
}

@media (min-width: 481px) {
  .desk-mat {
    background-color: var(--desk-mat);
    padding: 28px 16px 44px;
  }

  .essay-sheet {
    max-width: 430px;
    box-shadow:
      0 22px 60px rgba(24, 18, 12, 0.16),
      0 2px 8px rgba(24, 18, 12, 0.08);
  }
}

.container {
  position: relative;
  z-index: 2;
  padding-inline: clamp(24px, 6.8vw, 32px);
}

/* 纸面纤维纹理层（仅用于纸面区与便笺） */
.paper-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("../assets/paper-grain.svg");
  background-size: 240px 240px;
  background-repeat: repeat;
}

/* ============================================================
   封面刊头：纸面 + 竖排主标题 + 篆印
   ============================================================ */
.band-paper {
  position: relative;
  background-color: var(--paper-bg);
  color: var(--ink-dark);
}

.cover-band {
  padding-top: max(36px, env(safe-area-inset-top, 24px));
  padding-bottom: 48px;
}

.folio-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 52px;
}

/* row-reverse 让 DOM 首位的 h1 视觉居右，符合直排右起阅读秩序 */
.cover-lockup {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
  align-items: flex-start;
  gap: clamp(20px, 6vw, 34px);
  min-height: 248px;
  margin-bottom: 44px;
  padding-right: 4px;
}

.cover-aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  align-self: stretch;
  padding-top: 12px;
}

.cover-subtitle {
  writing-mode: vertical-rl;
  -webkit-writing-mode: vertical-rl;
  text-orientation: upright;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.94rem;
  line-height: 1.75;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
}

.cover-seal {
  width: 42px;
  height: 42px;
  margin-top: 20px;
  opacity: 0.92;
}

.cover-title {
  writing-mode: vertical-rl;
  -webkit-writing-mode: vertical-rl;
  text-orientation: upright;
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.35rem, 10vw, 2.75rem);
  line-height: 1.25;
  letter-spacing: 0.28em;
  color: var(--ink-dark);
}

.lead-epigraph {
  margin: 0;
  padding-top: 24px;
  font-family: var(--font-kai);
  font-size: 1.06rem;
  line-height: 1.9;
  letter-spacing: 0.05em;
  color: #464037;
  max-width: 19.5em;
}

/* ============================================================
   通用散文段落排版
   ============================================================ */
.essay-section {
  position: relative;
  padding-block: 36px 46px;
}

.section-heading {
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.45;
  letter-spacing: 0.16em;
}

.essay-section p {
  margin: 0 0 1.25em;
  font-size: 1.03rem;
  line-height: 1.92;
  letter-spacing: 0.035em;
  text-indent: 2em;
  text-align: justify;
  text-justify: inter-ideograph;
}

.essay-section p:last-child {
  margin-bottom: 0;
}

.pull-note {
  margin: 28px 0 28px 0.6em;
  padding: 4px 0 4px 16px;
  border-left: 2px solid rgba(154, 59, 38, 0.42);
  font-family: var(--font-kai);
  font-size: 1rem;
  line-height: 1.88;
  letter-spacing: 0.04em;
  color: #453E36;
}

/* ============================================================
   暮色过渡带与版画图版
   ============================================================ */
.band-dusk-entry {
  padding: 20px 0 32px;
  background: linear-gradient(
    to bottom,
    var(--paper-bg) 0%,
    #DDD9CE 24%,
    #77828C 62%,
    var(--dusk-bg) 100%
  );
}

.plate-container {
  padding-inline: clamp(18px, 5vw, 24px);
}

.editorial-plate {
  margin: 0;
}

.plate-frame {
  position: relative;
  overflow: hidden;
  background-color: #16191D;
}

.plate-dusk-frame img {
  transform: scale(1.035) translateY(var(--dusk-shift));
  transition: transform 0.25s ease-out;
  will-change: transform;
}

.plate-caption {
  margin: 12px 4px 0;
  font-family: var(--font-kai);
  font-size: 0.85rem;
  line-height: 1.72;
  letter-spacing: 0.04em;
  color: #C7CFD6;
}

/* ============================================================
   第二节：四时半的天色（深青灰暮色）
   ============================================================ */
.band-dusk {
  background-color: var(--dusk-bg);
  color: var(--dusk-ink);
  padding-top: 24px;
  padding-bottom: 36px;
}

.band-dusk .section-heading {
  color: #F0ECE3;
}

.band-dusk p {
  color: var(--dusk-ink);
}

.twig-break {
  display: flex;
  justify-content: center;
  padding: 36px 0 8px;
  opacity: 0.72;
}

/* ============================================================
   第三节：南汉村的灯下（黑漆底 + 室内暖光）
   ============================================================ */
.band-lacquer {
  background: linear-gradient(
    to bottom,
    var(--dusk-bg) 0%,
    #1D2026 10%,
    var(--lacquer-bg) 22%,
    var(--lacquer-bg) 100%
  );
  color: var(--warm-ink);
  padding-top: 44px;
  padding-bottom: 44px;
}

.band-lacquer .section-heading {
  color: #F2E8D8;
}

.plate-lacquer-wrap {
  margin: 30px -6px 30px;
}

.plate-lacquer-frame {
  background-color: #130E0C;
  cursor: pointer;
  touch-action: pan-y;
  outline: none;
}

.plate-lacquer-frame:focus-visible {
  box-shadow: 0 0 0 2px var(--gold-fill);
}

/* 模拟室内台灯侧光拂过推光漆面与螺钿微光 */
.lamp-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle 175px at var(--lamp-x) var(--lamp-y),
    rgba(255, 224, 166, 0.20) 0%,
    rgba(218, 166, 94, 0.08) 42%,
    rgba(0, 0, 0, 0) 76%
  );
  mix-blend-mode: screen;
  transition: background 0.16s ease-out;
}

.plate-caption-interactive {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  color: var(--warm-muted);
}

.lamp-shift-btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(199, 154, 88, 0.45);
  padding: 2px 0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--gold-fill);
  cursor: pointer;
}

.lamp-shift-btn:hover,
.lamp-shift-btn:focus-visible {
  color: #E8C184;
  border-bottom-color: #E8C184;
  outline: none;
}

/* 工艺笺注（原生 details，无 JS 亦可展开阅读） */
.craft-notes {
  margin-top: 34px;
  border-top: 1px solid rgba(215, 185, 142, 0.16);
}

.craft-note {
  border-bottom: 1px solid rgba(215, 185, 142, 0.16);
}

.craft-note summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 15px 2px;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 0.96rem;
  letter-spacing: 0.1em;
  color: #E5D7C2;
}

.craft-note summary::-webkit-details-marker {
  display: none;
}

.note-hint {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--gold-fill);
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.craft-note[open] .note-hint {
  color: var(--cinnabar-warm);
}

.craft-note .note-body {
  margin: 0 0 18px;
  padding: 0 2px;
  text-indent: 0;
  font-family: var(--font-kai);
  font-size: 0.93rem;
  line-height: 1.85;
  letter-spacing: 0.03em;
  color: var(--warm-muted);
  text-align: left;
}

/* ============================================================
   第四节：玻璃内外的两重季节（室内暖光）
   ============================================================ */
.band-room {
  background: linear-gradient(
    to bottom,
    var(--lacquer-bg) 0%,
    var(--room-bg) 18%,
    var(--room-bg) 100%
  );
  color: var(--warm-ink);
  padding-top: 22px;
  padding-bottom: 52px;
}

.band-room .plate-window-frame {
  background-color: #16110F;
}

.band-room .plate-caption {
  color: var(--warm-muted);
  margin-bottom: 34px;
}

.band-room .section-heading {
  color: #F2E8D8;
}

/* ============================================================
   尾声与刊记（夹入的温润纸笺）
   ============================================================ */
.band-colophon {
  background-color: var(--room-bg);
  padding: 12px 0 max(48px, env(safe-area-inset-bottom, 36px));
}

.colophon-slip {
  position: relative;
  background-color: #EFE9DC;
  color: var(--ink-dark);
  padding: 34px 24px 28px;
  overflow: hidden;
}

.colophon-inner {
  position: relative;
  z-index: 2;
}

.colophon-closing {
  margin: 0 0 28px;
  font-family: var(--font-kai);
  font-size: 1.05rem;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: #2E2924;
}

.colophon-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid rgba(35, 32, 29, 0.14);
}

.colophon-list {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  line-height: 1.85;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.colophon-list div {
  display: flex;
  gap: 12px;
}

.colophon-list dt {
  color: var(--seal-red);
  min-width: 1.2em;
}

.colophon-list dd {
  margin: 0;
}

.colophon-seal {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  opacity: 0.9;
}

.colophon-return {
  margin-top: 26px;
}

.return-link {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(99, 92, 82, 0.35);
  padding-bottom: 2px;
}

.return-link:hover,
.return-link:focus-visible {
  color: var(--seal-red);
  border-bottom-color: var(--seal-red);
  outline: none;
}

/* ============================================================
   渐进式入场（仅在 JS 启用且非减动效时激活）
   ============================================================ */
html.has-js .reveal-item {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

html.has-js .reveal-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .plate-dusk-frame img,
  .lamp-sheen,
  html.has-js .reveal-item {
    transition: none;
    transform: none;
    opacity: 1;
  }
}
