/* ============================================================
   c-xuplkyvhu4os —— 亮色编辑版式（paper / tint / sand / brand）
   1 变量与基线  2 跳转链接  3 封面  4 色带与章节  5 正文图片
   6 页脚  7 大图层  8 窄屏  9 打印
   ============================================================ */

/* 1 变量与基线 */
:root {
  --paper: #f8f6f1;
  --paper-2: #fffefb;
  --sand: #f2ebdd;
  --tint: #edf1ff;
  --ink: #171a21;
  --ink-soft: #4b5263;
  --ink-mute: #7f8595;
  --line: #e2dcd0;
  --brand: #3d65fd;
  --brand-deep: #2847cf;
  --brand-soft: #c6d2ff;
  --shell: 70rem;
  --rail: 4.6rem;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 2rem;
}

/* 2 跳转链接 */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 90;
  padding: 0.6rem 1.1rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.9rem;
  text-decoration: none;
}
.skip:focus { left: 1rem; top: 1rem; }

/* 3 封面 */
.cover {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border-bottom: 4px solid var(--brand);
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(90% 120% at 96% -20%, rgba(61, 101, 253, 0.16), rgba(61, 101, 253, 0) 62%),
    linear-gradient(180deg, rgba(255, 254, 251, 0.9), rgba(248, 246, 241, 0) 55%);
}

.masthead {
  position: relative;
  z-index: 1;
  padding-top: 1.5rem;
}

.masthead__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--line);
}

.masthead__brand {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brand);
}

.masthead__url {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  text-decoration: none;
}
.masthead__url:hover,
.masthead__url:focus-visible { color: var(--brand); }

.cover__body {
  position: relative;
  z-index: 1;
  padding: 3.2rem 0 3.4rem;
}

.cover__title {
  margin: 0;
  max-width: 44rem;
  font-family: var(--serif);
  font-size: clamp(2.3rem, 5.9vw, 4.2rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

.cover__lead {
  margin: 2.6rem 0 0;
  max-width: 37rem;
  padding-left: 1.6rem;
  border-left: 3px solid var(--brand);
}

.cover__lead p {
  margin: 0 0 1rem;
  text-wrap: pretty;
}

.cover__lead p:first-child {
  font-size: 1.16rem;
  line-height: 1.92;
  color: var(--ink);
}

.cover__lead p:last-child {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink-soft);
}

/* 4 色带与章节 */
.band { padding: 4.2rem 0; }
.band--tint { background: var(--tint); }
.band--paper { background: var(--paper-2); }
.band--sand { background: var(--sand); }
.band--brand { background: var(--brand); color: #fff; }

.chapter {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  max-width: 45rem;
}

.chapter__n {
  margin: 0;
  padding-top: 0.35rem;
  font-family: var(--serif);
  font-size: 3rem;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--brand-soft);
  font-variant-numeric: tabular-nums;
}

.band--brand .chapter__n { color: rgba(255, 255, 255, 0.5); }

.chapter__body { max-width: 38rem; }

.chapter__body h2 {
  margin: 0 0 1.15rem;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 2.9vw, 2.05rem);
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: pretty;
}

.chapter__body p {
  margin: 0 0 1.1rem;
  font-size: 1.07rem;
  line-height: 1.95;
  color: var(--ink-soft);
  text-wrap: pretty;
}

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

.band--brand .chapter__body h2 { color: #fff; }
.band--brand .chapter__body p { color: #eef2ff; }

/* 5 正文图片 */
.figure {
  margin: 3.2rem 0 0;
  padding: 0;
  max-width: 66rem;
}

.figure__link {
  position: relative;
  display: block;
  background: #fff;
  border: 1px solid rgba(23, 26, 33, 0.08);
  box-shadow: 0 26px 52px -36px rgba(23, 26, 33, 0.5);
}

.figure__link img { width: 100%; }

.figure__link::after {
  content: "＋";
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(61, 101, 253, 0.28);
  color: var(--brand);
  font-size: 0.95rem;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease;
}

.figure__link:hover::after,
.figure__link:focus-visible::after {
  background: var(--brand);
  color: #fff;
}

.figure__link:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.figure figcaption {
  margin-top: 0.95rem;
  padding-top: 0.7rem;
  max-width: 44rem;
  border-top: 1px solid var(--line);
  font-size: 0.87rem;
  line-height: 1.75;
  color: var(--ink-mute);
  text-wrap: pretty;
}

/* 6 页脚 */
.foot {
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 3rem 0 2.6rem;
}

.foot__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.foot__brand { margin: 0; }

.foot__wordmark {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6.5vw, 4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--brand);
}

.foot__link {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  text-decoration: none;
}
.foot__link:hover,
.foot__link:focus-visible { color: var(--brand); }

.cta {
  display: inline-block;
  padding: 0.85rem 1.65rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 12px 24px -18px rgba(61, 101, 253, 0.95);
  transition: background 0.18s ease;
}
.cta:hover { background: var(--brand-deep); }
.cta:focus-visible {
  outline: 3px solid var(--brand-soft);
  outline-offset: 3px;
}

/* 7 大图层（纯 CSS，不用脚本） */
.zoom-exit {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(248, 246, 241, 0.97);
}

.lightbox img {
  width: auto;
  max-width: min(1200px, 94vw);
  max-height: 84vh;
  background: #fff;
  border: 1px solid rgba(23, 26, 33, 0.08);
  box-shadow: 0 40px 90px -52px rgba(23, 26, 33, 0.65);
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
}
.lightbox__close:hover { border-color: var(--brand); color: var(--brand); }
.lightbox__close:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.zoom-exit:target,
.lightbox:target { display: flex; }

/* 8 窄屏 */
@media (max-width: 900px) {
  .cover__body { padding: 2.7rem 0 2.9rem; }
  .band { padding: 3.4rem 0; }
  .figure { margin-top: 2.6rem; }
}

@media (max-width: 720px) {
  body { font-size: 16.5px; }
  .shell { padding: 0 1.2rem; }

  .chapter {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    max-width: none;
  }

  .chapter__n {
    padding-top: 0;
    font-size: 2.1rem;
    color: var(--brand);
    opacity: 0.75;
  }

  .band--brand .chapter__n { color: #fff; opacity: 0.7; }

  .chapter__body { max-width: none; }

  .cover__title { font-size: clamp(1.95rem, 8.4vw, 2.8rem); }
  .cover__lead { margin-top: 1.9rem; padding-left: 1.1rem; }
  .cover__lead p:first-child { font-size: 1.08rem; line-height: 1.88; }

  .figure { margin-top: 2.2rem; }
  .foot__row { align-items: flex-start; gap: 1.4rem; }
  .cta { padding: 0.8rem 1.35rem; }
}

@media (max-width: 400px) {
  .cover__title { font-size: 1.78rem; line-height: 1.24; }
  .chapter__body h2 { font-size: 1.4rem; }
  .masthead__brand { letter-spacing: 0.18em; }
}

/* 9 打印 */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .cover { border-bottom: 2px solid #000; }
  .cover::before,
  .figure__link::after,
  .zoom-exit,
  .lightbox,
  .skip { display: none !important; }
  .band { padding: 1.2rem 0; background: #fff !important; }
  .band--brand,
  .band--brand .chapter__body h2,
  .band--brand .chapter__body p { color: #000 !important; }
  .chapter { grid-template-columns: 2.4rem 1fr; }
  .chapter__n { color: #666 !important; opacity: 1 !important; }
  .figure__link { border: none; box-shadow: none; }
  .foot { border-top: 1px solid #000; }
  .foot__wordmark { color: #000; }
  .cta { border: 1px solid #000; color: #000; background: #fff; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
