:root {
  --ink: #183126;
  --ink-soft: #3f554a;
  --moss: #315f46;
  --moss-deep: #173426;
  --sage: #dce7db;
  --paper: #f5f0e6;
  --paper-light: #fbf8f1;
  --line: #d9d1c3;
  --orange: #e9a33c;
  --red: #a9513d;
  --shadow: 0 22px 60px rgba(26, 49, 38, .10);
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --serif: Georgia, "Songti SC", "STSong", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.65; }
button, input { font: inherit; }
a { color: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }
.paper-grain { position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .045; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E"); }

.topbar { position: fixed; inset: 0 0 auto; height: 74px; z-index: 12; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(245,240,230,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > span:last-child { display: grid; line-height: 1.15; }
.brand strong { font-family: var(--serif); font-size: 21px; letter-spacing: -.02em; }
.brand small { color: var(--ink-soft); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.brand-mark { position: relative; width: 39px; height: 39px; border-radius: 11px; background: var(--moss-deep); overflow: hidden; box-shadow: 0 5px 14px rgba(23,52,38,.18); }
.brand-mark i { position: absolute; display: block; height: 8px; border-radius: 2px; background: var(--paper-light); }
.brand-mark i:first-child { width: 21px; left: 8px; top: 9px; }
.brand-mark i:nth-child(2) { width: 18px; right: 7px; bottom: 9px; }
.brand-mark b { position: absolute; width: 19px; height: 19px; left: 8px; top: 10px; border-left: 3px solid var(--orange); border-bottom: 3px solid var(--orange); border-radius: 0 0 0 14px; transform: rotate(-10deg); }
.topbar-actions { display: flex; align-items: center; gap: 25px; }
.live-note { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.live-note i { width: 7px; height: 7px; border-radius: 50%; background: #4a9568; box-shadow: 0 0 0 4px rgba(74,149,104,.13); }
.text-link { color: var(--moss); font-size: 13px; font-weight: 700; text-decoration: none; }
.text-link span { color: var(--orange); }
.menu-button { display: none; width: 40px; height: 40px; background: none; border: 0; cursor: pointer; }
.menu-button span { display: block; width: 21px; height: 1px; margin: 6px auto; background: var(--ink); }

.workspace { min-height: 100vh; padding-top: 74px; }
.sidebar { position: fixed; top: 74px; bottom: 0; left: 0; z-index: 10; width: 288px; padding: 26px 20px 20px 28px; overflow-y: auto; background: var(--paper); border-right: 1px solid var(--line); }
.search-shell { position: relative; display: flex; align-items: center; margin-bottom: 28px; }
.search-shell svg { position: absolute; left: 13px; width: 17px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; }
.search-shell input { width: 100%; height: 44px; padding: 0 40px; border: 1px solid #cec5b5; border-radius: 5px; outline: 0; color: var(--ink); background: var(--paper-light); transition: border .2s, box-shadow .2s; }
.search-shell input:focus { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(49,95,70,.10); }
.search-shell input::placeholder { color: #7e897f; }
.search-shell kbd { position: absolute; right: 10px; min-width: 23px; padding: 1px 5px; color: #69776f; background: #eee8dc; border: 1px solid #d5ccbc; border-radius: 4px; text-align: center; font: 11px var(--sans); }
.nav-group { margin: 0 0 23px; }
.nav-group-title { display: block; margin: 0 0 7px; color: #7a847e; font-size: 10px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.nav-item { position: relative; display: flex; align-items: center; width: 100%; min-height: 38px; padding: 7px 11px; border: 0; border-radius: 4px; color: var(--ink-soft); background: transparent; cursor: pointer; text-align: left; }
.nav-item::before { content: ""; position: absolute; left: -28px; top: 8px; bottom: 8px; width: 3px; background: transparent; }
.nav-item:hover { color: var(--ink); background: rgba(255,255,255,.48); }
.nav-item.active { color: var(--moss-deep); background: var(--sage); font-weight: 700; }
.nav-item.active::before { background: var(--orange); }
.nav-item em { margin-left: auto; color: #879188; font: normal 10px var(--sans); }
.sidebar-foot { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-soft); }
.sidebar-foot p { display: inline; margin: 0 13px 0 0; font-size: 11px; }
.sidebar-foot b { color: var(--ink); font-family: var(--serif); font-size: 15px; }
.sidebar-foot span { display: block; margin-top: 10px; color: #879188; font-size: 10px; }

.content { min-height: calc(100vh - 74px); margin-left: 288px; background: var(--paper-light); outline: 0; }
.content-inner { width: min(1040px, calc(100% - 64px)); margin: 0 auto; padding: 64px 0 96px; }
.reading-progress { position: fixed; top: 74px; left: 288px; right: 0; z-index: 11; height: 2px; background: transparent; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--orange); }

.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.hero { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 76px; align-items: end; padding: 32px 0 54px; border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 690px; margin: 19px 0 22px; font: 500 clamp(48px,6.4vw,82px)/.99 var(--serif); letter-spacing: -.055em; }
.hero h1 em { color: var(--moss); font-style: italic; }
.hero-copy > p { max-width: 650px; margin: 0; color: var(--ink-soft); font-size: 17px; line-height: 1.85; }
.hero-actions { display: flex; align-items: center; gap: 20px; margin-top: 30px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; border: 1px solid var(--moss-deep); border-radius: 4px; color: var(--paper-light); background: var(--moss-deep); cursor: pointer; text-decoration: none; font-weight: 750; box-shadow: 0 10px 25px rgba(23,52,38,.14); }
.primary-button:hover { background: var(--moss); transform: translateY(-1px); }
.quiet-button { border: 0; border-bottom: 1px solid var(--moss); padding: 4px 0; color: var(--moss); background: none; cursor: pointer; font-weight: 700; }
.hero-index { padding: 22px 0 5px 24px; border-left: 1px solid var(--line); }
.hero-index > span { color: #7a847e; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero-index ol { margin: 15px 0 0; padding: 0; list-style: none; counter-reset: loop; }
.hero-index li { counter-increment: loop; display: grid; grid-template-columns: 28px 1fr; gap: 9px; padding: 9px 0; border-bottom: 1px solid #e7e0d5; font-size: 13px; }
.hero-index li::before { content: "0" counter(loop); color: var(--orange); font: 12px var(--serif); }

.section { padding: 52px 0 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 22px; }
.section-head h2 { margin: 6px 0 0; font: 500 31px/1.2 var(--serif); letter-spacing: -.025em; }
.section-head p { max-width: 460px; margin: 0; color: var(--ink-soft); }
.article-list { border-top: 1px solid var(--ink); }
.article-row { display: grid; grid-template-columns: 54px 1.25fr 1fr 76px; gap: 22px; align-items: center; width: 100%; padding: 19px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; transition: background .18s, padding .18s; }
.article-row:hover { padding-left: 14px; background: #f1eadf; }
.article-row > b { color: var(--orange); font: 500 15px var(--serif); }
.article-row strong { font: 600 18px/1.25 var(--serif); }
.article-row p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.article-row small { color: #78847b; text-align: right; }
.model-strip { display: grid; grid-template-columns: repeat(4,1fr); border: 1px solid var(--line); border-left: 0; }
.model { min-height: 118px; padding: 20px; border-left: 1px solid var(--line); background: rgba(255,255,255,.28); }
.model b { display: block; font: 600 18px var(--serif); }
.model span { display: block; margin-top: 6px; color: var(--ink-soft); font-size: 12px; }
.model small { display: inline-block; margin-top: 16px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .09em; }

.article-header { max-width: 830px; padding: 28px 0 43px; border-bottom: 1px solid var(--line); }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 24px; color: #758078; font-size: 12px; }
.article-header h1 { margin: 18px 0; font: 500 clamp(42px,6vw,66px)/1.05 var(--serif); letter-spacing: -.045em; }
.article-header > p { max-width: 720px; color: var(--ink-soft); font-size: 18px; }
.article-layout { display: grid; grid-template-columns: minmax(0,720px) 220px; gap: 62px; align-items: start; padding-top: 38px; }
.prose { color: #283d31; font-size: 16px; line-height: 1.9; }
.prose h2 { margin: 52px 0 15px; padding-top: 10px; font: 600 30px/1.25 var(--serif); letter-spacing: -.025em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 32px 0 10px; font: 650 19px var(--serif); }
.prose p { margin: 0 0 20px; }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 22px; }
.prose li { margin: 7px 0; padding-left: 5px; }
.prose code { padding: 2px 5px; border-radius: 3px; color: var(--red); background: #f0e5d7; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.prose blockquote { margin: 28px 0; padding: 20px 24px; border-left: 3px solid var(--orange); color: var(--moss-deep); background: #f1eadc; font: 500 18px/1.65 var(--serif); }
.prose table { width: 100%; margin: 24px 0 30px; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { color: var(--ink); background: #eee7da; }
.callout { margin: 28px 0; padding: 22px 24px; border: 1px solid #cfbf9e; background: #f8ebce; }
.callout b { display: block; margin-bottom: 7px; font-family: var(--serif); }
.checklist { list-style: none; padding-left: 0 !important; }
.checklist li { position: relative; padding: 8px 0 8px 31px; border-bottom: 1px dashed var(--line); }
.checklist li::before { content: "✓"; position: absolute; left: 3px; color: var(--moss); font-weight: 800; }
.toc { position: sticky; top: 112px; padding-left: 21px; border-left: 1px solid var(--line); }
.toc strong { display: block; margin-bottom: 12px; color: #78837b; font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
.toc a { display: block; margin: 9px 0; color: var(--ink-soft); font-size: 12px; line-height: 1.45; text-decoration: none; }
.toc a:hover { color: var(--moss); }
.article-next { display: flex; justify-content: space-between; gap: 20px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--ink); }
.article-next button { max-width: 48%; padding: 0; border: 0; color: var(--ink-soft); background: none; cursor: pointer; text-align: left; }
.article-next button:last-child { text-align: right; }
.article-next b { display: block; color: var(--ink); font-family: var(--serif); font-size: 17px; }

.search-panel { position: fixed; top: 127px; left: 38px; z-index: 18; width: min(540px,calc(100vw - 76px)); max-height: 64vh; overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-light); box-shadow: var(--shadow); }
.search-panel-head { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--ink-soft); font-size: 12px; }
.search-result { display: block; width: 100%; padding: 13px 10px; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; text-align: left; }
.search-result:hover { background: var(--sage); }
.search-result b { display: block; font: 600 16px var(--serif); }
.search-result span { color: var(--ink-soft); font-size: 12px; }
.empty { padding: 35px 10px; color: var(--ink-soft); text-align: center; }
.backdrop { position: fixed; inset: 74px 0 0; z-index: 8; border: 0; background: rgba(19,38,28,.34); backdrop-filter: blur(2px); }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-index { display: none; }
  .model-strip { grid-template-columns: repeat(2,1fr); }
  .article-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}

@media (max-width: 820px) {
  .topbar { padding: 0 18px; }
  .live-note, .text-link { display: none; }
  .menu-button { display: block; }
  .sidebar { transform: translateX(-102%); width: min(330px,86vw); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .reading-progress { left: 0; }
  .content-inner { width: min(100% - 36px,720px); padding-top: 40px; }
  .search-panel { top: 126px; left: 19px; width: calc(100vw - 38px); }
  .hero h1 { font-size: clamp(44px,13vw,67px); }
  .article-row { grid-template-columns: 38px 1fr 54px; gap: 10px; }
  .article-row p { display: none; }
  .section-head { display: block; }
  .section-head p { margin-top: 10px; }
}

@media (max-width: 520px) {
  .topbar { height: 66px; }
  .brand small { display: none; }
  .workspace { padding-top: 66px; }
  .sidebar { top: 66px; }
  .content { min-height: calc(100vh - 66px); }
  .reading-progress { top: 66px; }
  .hero { padding-top: 18px; }
  .hero h1 { margin-top: 14px; }
  .hero-copy > p { font-size: 15px; }
  .hero-actions { align-items: stretch; flex-direction: column; gap: 12px; }
  .quiet-button { align-self: flex-start; }
  .model-strip { grid-template-columns: 1fr; }
  .article-header h1 { font-size: 41px; }
  .article-header > p { font-size: 16px; }
  .article-row { padding-left: 0; padding-right: 0; }
  .article-row:hover { padding-left: 5px; }
  .article-next { flex-direction: column; }
  .article-next button, .article-next button:last-child { max-width: 100%; text-align: left; }
}

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