:root {
  color-scheme: light;
  --bg: #f2efe8;
  --surface: #faf8f2;
  --surface-strong: #fffdf7;
  --ink: #1e211f;
  --muted: #6b6d66;
  --line: rgba(30, 33, 31, 0.15);
  --line-strong: rgba(30, 33, 31, 0.28);
  --accent: #d74e32;
  --accent-soft: #f1d8cf;
  --deep: #173e35;
  --shadow: 0 18px 50px rgba(43, 38, 29, 0.1);
  --body-size: 19px;
  --reading-width: 720px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171a18;
  --surface: #1d211e;
  --surface-strong: #232824;
  --ink: #eef0e9;
  --muted: #a9ada6;
  --line: rgba(238, 240, 233, 0.13);
  --line-strong: rgba(238, 240, 233, 0.24);
  --accent: #f0785d;
  --accent-soft: #462c27;
  --deep: #9ccdbf;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, color-mix(in srgb, var(--accent) 8%, transparent) 0, transparent 25rem),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  text-rendering: optimizeLegibility;
  transition: background-color 180ms ease, color 180ms ease;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

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

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 3px;
  background: transparent;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 10px clamp(18px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px) saturate(120%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.brand-mark {
  display: grid;
  width: 32px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
}

.reading-tools,
.font-controls {
  display: flex;
  align-items: center;
}

.reading-tools {
  gap: 8px;
}

.font-controls,
.theme-toggle {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.font-controls button,
.theme-toggle {
  border: 0;
  cursor: pointer;
}

.font-controls button {
  width: 42px;
  height: 38px;
  padding: 0;
  background: transparent;
  font-weight: 700;
}

.font-controls button:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.font-controls span {
  min-width: 42px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(40px, 6vw, 100px);
  align-items: center;
  min-height: min(720px, calc(100vh - 66px));
  padding: clamp(64px, 9vw, 132px) clamp(24px, 7vw, 112px);
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.toc-kicker,
.method-index {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.hero h1 {
  max-width: 12ch;
  margin: 22px 0 24px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(45px, 6.2vw, 88px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.04;
}

.hero h1 span {
  display: block;
  margin-top: 0.16em;
  color: var(--accent);
  font-size: 0.48em;
  letter-spacing: -0.02em;
}

.hero-quote {
  margin: 0 0 34px;
  color: var(--deep);
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 700;
}

.byline {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.byline > div:nth-child(2) {
  display: grid;
  gap: 2px;
}

.byline strong {
  color: var(--ink);
}

.author-avatar {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-weight: 800;
}

.byline a {
  text-decoration: none;
}

.byline-separator {
  width: 1px;
  height: 30px;
  background: var(--line);
}

.cover-frame {
  position: relative;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transform: rotate(1.25deg);
}

.cover-frame::before {
  position: absolute;
  z-index: 1;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  content: "";
  pointer-events: none;
}

.cover-frame img {
  width: 100%;
  height: auto;
}

.cover-frame > span {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 14px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(18, 20, 18, 0.72);
  color: #fff;
  font-size: 12px;
}

.reading-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, var(--reading-width));
  gap: clamp(50px, 8vw, 130px);
  justify-content: center;
  padding: 96px clamp(24px, 5vw, 72px) 140px;
}

.toc-panel {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 122px);
  padding-left: 18px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}

.toc-kicker {
  margin: 0 0 20px;
}

.toc-panel nav {
  display: grid;
  gap: 2px;
}

.toc-panel nav a {
  position: relative;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease;
}

.toc-panel nav a:hover,
.toc-panel nav a.is-active {
  background: var(--surface);
  color: var(--ink);
}

.toc-panel nav a.is-active::before {
  position: absolute;
  top: 50%;
  left: -22px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  transform: translateY(-50%);
}

.source-shortcut {
  display: inline-block;
  margin: 24px 10px 0;
  color: var(--deep);
  font-size: 13px;
  font-weight: 700;
}

.article-body {
  min-width: 0;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: var(--body-size);
  line-height: 1.96;
  letter-spacing: 0.015em;
}

.article-body p {
  margin: 0 0 1.35em;
}

.lead {
  padding-bottom: 58px;
  border-bottom: 1px solid var(--line-strong);
  font-size: 1.12em;
  line-height: 2;
}

.lead p::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  color: var(--accent);
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 3.4em;
  font-weight: 700;
  line-height: 0.8;
}

blockquote {
  margin: 38px 0 0;
  padding: 22px 28px;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  color: var(--deep);
  font-size: 1.28em;
  font-weight: 700;
}

.article-section {
  position: relative;
  padding-top: 84px;
}

.article-section h2,
.article-section h3 {
  margin: 0 0 26px;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: -0.035em;
  line-height: 1.22;
}

.article-section h2 {
  font-size: clamp(34px, 5vw, 54px);
}

.article-section h3 {
  font-size: clamp(29px, 4vw, 40px);
}

.section-marker {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 10px;
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.principles-list,
.tips-list {
  margin: 30px 0 46px;
  padding: 0;
  list-style: none;
}

.principles-list {
  counter-reset: principle;
}

.principles-list li {
  position: relative;
  padding: 20px 20px 20px 62px;
  border-top: 1px solid var(--line);
  counter-increment: principle;
}

.principles-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.principles-list li::before {
  position: absolute;
  top: 21px;
  left: 12px;
  color: var(--accent);
  content: "0" counter(principle);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.chapter-start,
.feature-section,
.tips-section {
  margin-top: 72px;
  padding-top: 112px;
  border-top: 1px solid var(--line-strong);
}

.chapter-number {
  position: absolute;
  top: 58px;
  right: 0;
  color: color-mix(in srgb, var(--accent) 22%, transparent);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(70px, 13vw, 130px);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
  pointer-events: none;
}

.method-section {
  margin-top: 50px;
  padding-top: 72px;
  border-top: 1px solid var(--line);
}

.method-index {
  margin-bottom: 12px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

.section-opener {
  color: var(--deep);
  font-size: 1.18em;
  font-weight: 700;
}

.key-line {
  margin: 42px 0 !important;
  padding: 24px 28px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 8px 8px 0 var(--accent-soft);
  color: var(--deep);
  font-size: 1.08em;
  font-weight: 700;
}

.media-card {
  margin: 42px 0;
}

.media-card button {
  position: relative;
  display: block;
  width: 100%;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  cursor: zoom-in;
}

.media-card img {
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.portrait-media {
  max-width: 610px;
  margin-inline: auto;
}

.zoom-hint {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(19, 21, 19, 0.76);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
}

.media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 42px 0;
}

.media-grid .media-card {
  margin: 0;
}

.media-grid .media-card button {
  height: 100%;
}

.media-grid .media-card img {
  height: 100%;
  object-fit: cover;
}

.reference-link {
  display: grid;
  gap: 8px;
  margin: 34px 0 !important;
  padding: 22px 24px;
  border-left: 3px solid var(--deep);
  background: var(--surface);
}

.reference-link span {
  font-weight: 700;
}

.reference-link a {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.72em;
  line-height: 1.55;
}

.tips-list {
  counter-reset: tip;
}

.tips-list li {
  position: relative;
  padding: 24px 20px 24px 68px;
  border-top: 1px solid var(--line);
  counter-increment: tip;
}

.tips-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.tips-list li::before {
  position: absolute;
  top: 24px;
  left: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  content: counter(tip);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 800;
  line-height: 34px;
  text-align: center;
}

.closing-argument {
  margin: 54px 0 42px;
  padding: 34px;
  background: var(--deep);
  color: var(--bg);
  box-shadow: 10px 10px 0 var(--accent-soft);
  font-size: 1.06em;
}

:root[data-theme="dark"] .closing-argument {
  color: #18211e;
}

.closing-argument p:last-child {
  margin-bottom: 0;
  font-weight: 700;
}

.quality-mantra {
  margin: 56px 0 24px !important;
  color: var(--accent);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.signoff {
  color: var(--muted);
  font-size: 0.92em;
}

.page-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 70px clamp(24px, 7vw, 112px);
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.page-footer p {
  margin: 8px 0;
}

.footer-note {
  margin-bottom: 20px !important;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.source-button {
  flex: 0 0 auto;
  padding: 13px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
}

.lightbox {
  width: min(94vw, 1500px);
  max-width: none;
  height: min(92vh, 1100px);
  max-height: none;
  padding: 50px 24px 24px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: rgba(14, 16, 15, 0.96);
}

.lightbox::backdrop {
  background: rgba(8, 9, 8, 0.78);
  backdrop-filter: blur(10px);
}

.lightbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 62%, transparent);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .media-trigger img {
    transition: transform 220ms ease;
  }

  .media-trigger:hover img {
    transform: scale(1.012);
  }

  .theme-toggle:hover,
  .font-controls button:hover:not(:disabled) {
    background: var(--accent-soft);
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 86px;
  }

  .hero-copy {
    max-width: 680px;
  }

  .cover-frame {
    max-width: 760px;
    transform: none;
  }

  .reading-layout {
    grid-template-columns: minmax(0, var(--reading-width));
  }

  .toc-panel {
    position: static;
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --body-size: 18px;
  }

  html {
    scroll-padding-top: 74px;
  }

  .topbar {
    min-height: 58px;
    padding-inline: 14px;
  }

  .brand > span:last-child,
  .font-controls span,
  .theme-toggle span:last-child {
    display: none;
  }

  .font-controls button {
    width: 38px;
  }

  .theme-toggle {
    width: 40px;
    justify-content: center;
    padding: 0;
  }

  .hero {
    gap: 40px;
    padding: 64px 18px 52px;
  }

  .hero h1 {
    font-size: clamp(42px, 13vw, 62px);
  }

  .byline {
    flex-wrap: wrap;
  }

  .byline-separator {
    display: none;
  }

  .byline time {
    width: 100%;
    padding-left: 54px;
  }

  .reading-layout {
    padding: 64px 18px 96px;
  }

  .lead {
    font-size: 1.02em;
  }

  blockquote {
    padding: 18px 20px;
  }

  .article-section {
    padding-top: 66px;
  }

  .chapter-start,
  .feature-section,
  .tips-section {
    margin-top: 50px;
    padding-top: 92px;
  }

  .chapter-number {
    top: 50px;
    font-size: 74px;
  }

  .method-section {
    padding-top: 58px;
  }

  .principles-list li,
  .tips-list li {
    padding-right: 6px;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }

  .key-line,
  .closing-argument {
    padding: 22px;
  }

  .page-footer {
    align-items: start;
    flex-direction: column;
    padding: 50px 18px;
  }

  .source-button {
    width: 100%;
    text-align: center;
  }
}

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

@media print {
  .reading-progress,
  .topbar,
  .toc-panel,
  .zoom-hint,
  .cover-frame > span,
  .lightbox {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .hero,
  .reading-layout,
  .page-footer {
    display: block;
    padding: 32px 0;
  }

  .hero-copy,
  .cover-frame,
  .article-body,
  .page-footer > * {
    width: 82%;
    margin-inline: auto;
  }
}
