@font-face {
  font-family: Newsreader;
  src: url("/fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Newsreader;
  src: url("/fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f6f2ea;
  --ink: #1c1b19;
  --soft: #5f5b53;
  --faint: #736e63;
  --line: #dcd5c7;
  --link: #2c47c9;
  --dot: #ffd600;
  --dot-glow: rgb(255 214 0 / 45%);
  --night: #14161f;
  --night-ink: #eeeae1;
  --night-soft: #a8a59c;
  --night-line: #2c2f3b;
  --serif: Newsreader, "Iowan Old Style", Georgia, serif;
  --display: Newsreader, "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --body-size: 19px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161f;
    --ink: #eeeae1;
    --soft: #a8a59c;
    --faint: #918f88;
    --line: #2c2f3b;
    --link: #b4c0ff;
    --night: #0e1017;
    --night-line: #262935;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14161f;
  --ink: #eeeae1;
  --soft: #a8a59c;
  --faint: #918f88;
  --line: #2c2f3b;
  --link: #b4c0ff;
  --night: #0e1017;
  --night-line: #262935;
}

:root[data-theme="light"] { color-scheme: light; }

:lang(zh-Hans) {
  --display: Newsreader, "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, serif;
  --serif: Newsreader, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --body-size: 17px;
}

:lang(ja) {
  --display: Newsreader, "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
  --serif: Newsreader, -apple-system, "Hiragino Sans", "Yu Gothic", Meiryo, "Noto Sans CJK JP", sans-serif;
  --sans: -apple-system, "Hiragino Sans", "Yu Gothic", Meiryo, "Noto Sans CJK JP", sans-serif;
  --body-size: 17px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--body-size)/1.62 var(--serif); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 4px; }
code { font: 0.84em var(--mono); }
em { font-style: italic; }
:focus-visible { outline: 1px solid currentcolor; outline-offset: 4px; }

h1, h2, .trust, .closing-line, .sheet-title, .pillars h3, .os-list { font-family: var(--display); font-weight: 300; }
h1 { font-size: clamp(58px, 11.2vw, 164px); line-height: 0.98; letter-spacing: -0.028em; text-wrap: balance; }
h2 { max-width: 15em; font-size: clamp(34px, 4.6vw, 58px); line-height: 1.1; letter-spacing: -0.016em; text-wrap: balance; }
h3 { font-size: 1em; font-weight: 500; }
:lang(zh-Hans) h1, :lang(ja) h1 { font-size: clamp(50px, 9.6vw, 136px); font-weight: 400; line-height: 1.14; letter-spacing: 0.01em; }
:lang(zh-Hans) h2, :lang(ja) h2 { font-size: clamp(30px, 3.8vw, 46px); font-weight: 400; line-height: 1.32; letter-spacing: 0.02em; }
:lang(ja) h1, :lang(ja) h2 { word-break: auto-phrase; }

.wrap { width: min(1240px, 100% - 96px); margin-inline: auto; }
.label { color: var(--faint); font: 400 13px/1.5 var(--sans); letter-spacing: 0.02em; }
.lead { max-width: 31em; color: var(--soft); }
.aside { margin-top: 28px; color: var(--faint); font: 400 14px/1.5 var(--sans); }

.more { display: inline-block; color: inherit; font: 500 15px/1.4 var(--sans); text-decoration: none; border-bottom: 1px solid currentcolor; padding-bottom: 2px; }
.more::after { content: " →"; }
.more:hover { color: var(--link); }

.skip { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 8px 14px; background: var(--paper); }
.skip:focus { top: 12px; }

.bar { display: flex; align-items: center; gap: 30px; min-height: 84px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font: 400 21px/1 var(--display); letter-spacing: -0.005em; text-decoration: none; }
.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a, .langs a { color: var(--soft); font: 400 14px/1 var(--sans); text-decoration: none; }
.nav a:hover, .langs a:hover { color: var(--ink); }
.langs { display: flex; gap: 12px; padding-left: 26px; border-left: 1px solid var(--line); }
.theme { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-left: -6px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--soft); cursor: pointer; }
.theme[hidden] { display: none; }
.theme:hover { color: var(--ink); }
.theme svg { transition: rotate 0.45s cubic-bezier(0.3, 0.7, 0.2, 1); }
.theme[aria-pressed="true"] svg { rotate: 180deg; }
.langs a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }

.hero { padding-top: clamp(52px, 8vw, 116px); }
h1 { margin-top: 22px; }
h1 em { font-weight: 300; }
:lang(zh-Hans) h1 em, :lang(ja) h1 em { font-style: normal; }
.lit-dot { display: inline-block; width: 0.135em; height: 0.135em; margin-left: 0.06em; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0.32em 0.05em var(--dot-glow); animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0.5em 0.1em var(--dot-glow); } }
.hero-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 32px clamp(32px, 6vw, 96px); margin-top: clamp(40px, 6vw, 80px); }
.trust { font-size: clamp(25px, 2.6vw, 33px); font-style: italic; line-height: 1.25; letter-spacing: -0.008em; }
:lang(zh-Hans) .trust, :lang(ja) .trust { font-size: clamp(21px, 2.1vw, 26px); font-style: normal; font-weight: 400; line-height: 1.5; letter-spacing: 0.03em; }
.actions { display: flex; flex-wrap: wrap; gap: 14px 30px; margin-top: 24px; }

.sheet { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(36px, 6vw, 96px); margin-top: clamp(68px, 9vw, 128px); padding-top: clamp(36px, 4.6vw, 56px); padding-bottom: clamp(44px, 6vw, 76px); border-top: 1px solid var(--line); }
.sheet-file { margin-bottom: 26px; color: var(--faint); font: 13px var(--mono); }
.md { color: var(--faint); font: 0.72em var(--mono); }
.sheet-title { font-size: clamp(29px, 3vw, 38px); line-height: 1.2; }
.sheet-line { margin-block: 12px 18px; font-size: 1.12em; }
del { color: var(--faint); text-decoration-thickness: 1px; }
ins { text-decoration: none; background: linear-gradient(transparent 62%, rgb(255 214 0 / 42%) 62%); }
.sheet-todo { color: var(--soft); }
.sheet-log { align-self: end; }
.sheet-log ol { margin-top: 14px; }
.sheet-log li { position: relative; display: flex; justify-content: space-between; gap: 16px; padding: 7px 0 7px 20px; font: 400 14px/1.45 var(--sans); }
.sheet-log li::before { content: ""; position: absolute; left: 0; top: 14px; width: 7px; height: 7px; border: 1px solid var(--faint); border-radius: 50%; background: var(--paper); }
.sheet-log li:not(:last-child)::after { content: ""; position: absolute; left: 3px; top: 21px; bottom: -14px; width: 1px; background: var(--line); }
.sheet-log li.lit::before { border-color: var(--dot); background: var(--dot); box-shadow: 0 0 9px 1px var(--dot-glow); }
.sheet-log time { flex: none; color: var(--faint); }

.thread { display: grid; grid-template-columns: minmax(130px, 1fr) 4fr; gap: 0 clamp(24px, 4vw, 56px); border-left: 1px solid var(--line); }
.chapter .thread { padding-block: clamp(76px, 10vw, 136px); }
.marker { position: relative; padding-left: clamp(20px, 2.6vw, 34px); padding-top: 0.75em; }
.marker::before { content: ""; position: absolute; left: -4px; top: calc(0.75em + 6px); width: 7px; height: 7px; border: 1px solid var(--faint); border-radius: 50%; background: var(--paper); }
.chapter-body > h2 { margin-bottom: clamp(36px, 5vw, 64px); }
.shot { max-width: 1000px; margin: clamp(48px, 6vw, 76px) auto 0; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.shot figcaption { margin-top: 12px; color: var(--faint); font: 400 13px/1.5 var(--sans); }
.shot-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shot-light { display: none !important; }
  :root:not([data-theme="light"]) .shot-dark { display: block !important; }
}
:root[data-theme="dark"] .shot-light { display: none !important; }
:root[data-theme="dark"] .shot-dark { display: block !important; }

.pillars { counter-reset: pillar; }
.pillars li { counter-increment: pillar; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px clamp(28px, 4vw, 56px); padding-block: clamp(24px, 3vw, 34px); border-top: 1px solid var(--line); }
.pillars h3 { font-size: clamp(27px, 3vw, 38px); line-height: 1.15; letter-spacing: -0.012em; }
.pillars h3::before { content: counter(pillar, lower-roman) "."; display: block; margin-bottom: 6px; color: var(--faint); font: italic 400 16px/1.4 Newsreader, Georgia, serif; letter-spacing: 0; }
:lang(zh-Hans) .pillars h3, :lang(ja) .pillars h3 { font-size: clamp(21px, 2.1vw, 25px); font-weight: 400; line-height: 1.4; }
.pillars p, .entries p { color: var(--soft); }

.entries { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 4vw, 46px) clamp(36px, 5vw, 72px); }
.entries h3 { margin-bottom: 4px; }
.specimen { display: flex; align-items: center; gap: 10px; height: 36px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--ink); font: 400 15px/1.4 var(--serif); }
.entries .specimen { font-size: 15px; color: var(--ink); }
.specimen strong { font-weight: 600; }
.sp-arrow { color: var(--faint); font-family: var(--sans); }
.sp-del { color: var(--faint); }
.sp-add { color: var(--link); }
.sp-hit { background: linear-gradient(transparent 62%, rgb(255 214 0 / 42%) 62%); }
.entries p { font-size: 0.95em; }

.night { background: var(--night); color: var(--night-ink); --ink: var(--night-ink); --soft: var(--night-soft); --line: var(--night-line); --faint: #918f88; --paper: var(--night); --link: #d4dbff; }
.night .lead { margin-block: -16px clamp(40px, 5vw, 60px); }
.tools { display: flex; flex-direction: column; color: var(--soft); font: 13px/1.75 var(--mono); }
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 4px clamp(36px, 5vw, 72px); align-items: end; margin-top: clamp(40px, 5vw, 60px); padding-top: 30px; border-top: 1px solid var(--line); }
.skills p { grid-column: 1; color: var(--soft); font-size: 0.95em; }
.skills .more { grid-column: 2; grid-row: 1 / span 2; justify-self: start; align-self: center; }

.chapter-body { container-type: inline-size; }
.os-list { display: flex; flex-wrap: wrap; gap: 0.1em 0; font-size: clamp(30px, 6.2cqi, 68px); line-height: 1.2; letter-spacing: -0.02em; }
.os-list li:not(:last-child)::after { content: "·"; margin-inline: 0.22em; color: var(--dot); text-shadow: 0 0 0.3em var(--dot-glow); }
:lang(zh-Hans) .os-list, :lang(ja) .os-list { letter-spacing: -0.012em; }
.os-list.small { font-size: clamp(26px, 3vw, 38px); color: var(--soft); letter-spacing: -0.01em; }
.os-list.small li:not(:last-child)::after { color: var(--faint); text-shadow: none; }
.os-next { margin-top: 30px; margin-bottom: 6px; color: var(--faint); font: 400 13px/1.5 var(--sans); }

.no-title .chapter-body > h2 { display: none; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 24px; padding-block: 18px; list-style: none; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; color: var(--faint); font-family: var(--sans); font-weight: 300; }
.faq details[open] summary::after { content: "−"; }
.faq details p { max-width: 34em; padding-bottom: 22px; color: var(--soft); font-size: 0.95em; }

.closing .thread { --lead-in: clamp(40px, 8vw, 110px); display: block; padding-block: var(--lead-in) clamp(84px, 11vw, 150px); border-left: 0; }
.closing-line { position: relative; padding-left: clamp(20px, 2.6vw, 34px); font-size: clamp(36px, 6vw, 80px); font-style: italic; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
:lang(zh-Hans) .closing-line, :lang(ja) .closing-line { font-size: clamp(30px, 4.8vw, 62px); font-style: normal; font-weight: 400; line-height: 1.3; letter-spacing: 0.02em; }
:lang(ja) .closing-line { word-break: auto-phrase; }
.thread-end { position: absolute; left: -5px; top: 0.52em; width: 11px; height: 11px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 18px 4px var(--dot-glow); }
.thread-end::before { content: ""; position: absolute; left: 5px; bottom: 100%; width: 1px; height: calc(var(--lead-in) + 0.52em); background: var(--line); }

.site-footer .bar { justify-content: space-between; border-top: 1px solid var(--line); }
.site-footer p { color: var(--faint); font: 400 14px/1 var(--sans); }
.site-footer p a { margin-left: 18px; color: var(--soft); }

.not-found { display: grid; gap: 32px; padding-block: 80px; }
.not-found h1 { margin: 0; font-size: 42px; letter-spacing: -0.012em; }

@media (max-width: 900px) {
  .wrap { width: calc(100% - 48px); }
  .nav { display: none; }
  .langs { margin-left: auto; padding-left: 0; border-left: 0; }
  .thread { grid-template-columns: 1fr; gap: 14px; }
  .marker { padding-top: 0; }
  .marker::before { top: 6px; }
  .chapter-body { padding-left: clamp(20px, 2.6vw, 34px); }
  .hero-foot, .sheet { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 32px); }
  .bar { min-height: 68px; }
  .pillars li, .entries, .skills { grid-template-columns: 1fr; }
  .os-list { display: block; }
  .os-list:not(.small) li::after { content: none; }
  .os-list.small { display: flex; }
  .skills .more { grid-column: 1; grid-row: auto; margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lit-dot { animation: none; }
}

/* 动效：都是渐进增强，不支持或要求减少动态效果时就是静态页面 */
@media (prefers-reduced-motion: no-preference) {
  .hero .label, h1, .hero-foot { animation: rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  h1 { animation-delay: 0.08s; }
  .hero-foot { animation-delay: 0.3s; }
  .lit-dot { animation: ignite 1.1s 0.95s cubic-bezier(0.2, 0.7, 0.2, 1) both, breathe 5s 2.1s ease-in-out infinite; }

  @keyframes rise { from { opacity: 0; translate: 0 14px; } }
  @keyframes ignite {
    from { background: transparent; box-shadow: 0 0 0 0 transparent; }
    55% { box-shadow: 0 0 0.75em 0.2em var(--dot-glow); }
  }

  @supports (animation-timeline: view()) {
    /* 墨线的笔尖停在视口 70% 处，所以页面滚到底时能走到收尾的光点 */
    .thread { --tip: 70vh; position: relative; }
    .chapter .thread::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 1px; background: currentcolor; transform-origin: top; animation: ink linear both; animation-timeline: view(); animation-range: cover calc(100vh - var(--tip)) cover calc(100% - var(--tip)); }
    .chapter .marker::before { animation: mark linear both; animation-timeline: view(); animation-range: cover calc(100vh - var(--tip)) cover calc(100vh - var(--tip) + 12px); }
    .thread-end { animation: lit linear both; animation-timeline: view(); animation-range: cover calc(100vh - var(--tip) - 40px) cover calc(100vh - var(--tip)); }
    .thread-end::after { content: ""; position: absolute; left: 5px; bottom: 100%; width: 1px; height: calc(var(--lead-in) + 0.52em); background: currentcolor; transform-origin: top; animation: ink linear both; animation-timeline: view(); animation-range: cover calc(100vh - var(--tip) - 120px) cover calc(100vh - var(--tip)); }

    @keyframes ink { from { transform: scaleY(0); } to { transform: scaleY(1); } }
    @keyframes mark { to { background: var(--ink); border-color: var(--ink); } }
    @keyframes lit { from { background: var(--paper); box-shadow: 0 0 0 1px var(--faint); } }

    /* 手稿改稿：划掉旧词，点亮新词 */
    del { text-decoration: none; background: linear-gradient(currentcolor, currentcolor) 0 56% / 100% 1px no-repeat; animation: strike linear both; animation-timeline: view(); animation-range: entry 40% cover 32%; }
    ins { background: linear-gradient(rgb(255 214 0 / 42%), rgb(255 214 0 / 42%)) 0 100% / 100% 38% no-repeat; animation: highlight linear both; animation-timeline: view(); animation-range: cover 32% cover 42%; }
    @keyframes strike { from { background-size: 0 1px; color: var(--ink); } }
    @keyframes highlight { from { background-size: 0 38%; opacity: 0.25; } }
  }
}
