/* Design tokens */
:root {
  --ink: #172f43;
  --body: #3d5264;
  --muted: #5c7083;
  --accent: #245f90;
  --accent-dark: #17486f;
  --line: #dce5ec;
  --bg: #f8fafc;
  --panel: #ffffff;
  --pale: #edf3f8;
  --radius: 14px;
}

/* Base and accessibility */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 28px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; text-underline-offset: 4px; }
a:hover { color: var(--accent); }
a:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
  border-radius: 3px;
}
::selection { color: var(--ink); background: #d6e7f4; }
.skip-link { position: absolute; top: -100px; left: 20px; z-index: 10; padding: 12px 20px; background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; color: #fff; }
.site-shell { width: min(100%, 1120px); margin: auto; padding: 0 48px; }
main { min-height: 65vh; }
.section-kicker { margin: 0; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .16em; line-height: 1.6; }
.text-link { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--accent); font-size: 14px; font-weight: 600; }
.text-link:hover { text-decoration: underline; }
.primary-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 46px; padding: 12px 21px; border: 1px solid var(--accent-dark); border-radius: 8px; color: #fff; background: var(--accent-dark); font-size: 14px; font-weight: 600; }
.primary-button:hover { color: #fff; background: var(--accent); }

/* Shared header and footer */
.header { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 750; letter-spacing: -.6px; white-space: nowrap; }
.brand-mark { width: 37px; height: 37px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; color: #fff; background: var(--ink); font-size: 22px; }
.brand-mark span { margin: -8px 0 0 2px; color: #b4d4ea; font-size: 13px; }
.brand-suffix { color: var(--muted); font-size: 15px; font-weight: 400; letter-spacing: 0; }
.nav { display: flex; align-items: center; gap: 27px; }
.nav a { position: relative; display: grid; place-items: center; min-width: 44px; min-height: 48px; font-size: 14px; color: var(--muted); }
.nav a[aria-current] { color: var(--accent); font-weight: 700; }
.nav a[aria-current]::after { position: absolute; bottom: 4px; width: 16px; height: 2px; background: var(--accent); content: ""; }
.footer { display: flex; justify-content: space-between; gap: 24px; padding: 32px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.footer > div { display: flex; flex-direction: column; gap: 7px; }
.footer-name { color: var(--ink); font-size: 14px; font-weight: 700; }
.footer-links { text-align: right; }
.footer-links > a { color: var(--accent); font-weight: 600; }
.footer a:hover { text-decoration: underline; }

/* Homepage */
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: center; gap: 64px; padding: 40px 0; border-bottom: 1px solid var(--line); }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.status-dot { flex: 0 0 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero h1 { margin: 22px 0 18px; font-size: clamp(42px, 5.3vw, 60px); line-height: 1.23; letter-spacing: -.045em; font-weight: 800; }
.accent { color: var(--accent); }
.hero-description { margin: 0; color: var(--body); font-size: 16px; line-height: 1.9; }
.hero-description span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 26px; }
.notebook { position: relative; padding: 27px; border: 1px solid #d3e0ea; border-radius: var(--radius); background: linear-gradient(140deg, #f2f7fb, #e7eff6); }
.notebook-top { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid #cbdbe7; color: var(--accent); }
.notebook-top > span:last-child { font-size: 23px; }
.notebook-title { margin: 20px 0 12px; font-size: 23px; font-weight: 650; line-height: 1.7; letter-spacing: -.035em; }
.notebook-topics { margin: 0 0 19px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.notebook-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid #cbdbe7; color: var(--muted); font-size: 12px; }
.notebook-bottom strong { margin-right: 6px; color: var(--ink); font-size: 23px; font-variant-numeric: tabular-nums; }
.notebook-bottom a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.latest { padding: 36px 0 72px; }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-header h2 { margin: 7px 0 0; font-size: 27px; letter-spacing: -.04em; }
.section-count { display: inline-block; margin-left: 13px; color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: 0; vertical-align: middle; font-variant-numeric: tabular-nums; }

/* Article lists and taxonomy */
.post-list { border-top: 1px solid var(--line); }
.post-row { border-bottom: 1px solid var(--line); }
.post-link { display: grid; grid-template-columns: 125px minmax(0, 1fr) 28px; gap: 24px; align-items: start; padding: 27px 8px; border-radius: 4px; }
.post-link:hover { background: var(--pale); }
.post-date { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.post-date time { color: var(--body); font-weight: 500; letter-spacing: .035em; }
.post-copy { min-width: 0; }
.post-copy h3 { margin: 0 0 8px; color: var(--ink); font-size: 21px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.post-copy p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.post-arrow { padding-top: 2px; color: var(--accent); font-size: 23px; }
.post-link:hover h3 { color: var(--accent); }
.list-page { padding: 58px 0 88px; }
.page-heading { margin-bottom: 34px; }
.page-heading h1 { margin: 12px 0; font-size: 38px; letter-spacing: -.04em; }
.list-intro { margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.9; }
.section-content { margin-bottom: 32px; }
.empty { padding: 24px 0; color: var(--muted); font-size: 15px; line-height: 1.9; }
.empty a { color: var(--accent); }
.term-list { display: flex; flex-wrap: wrap; gap: 16px; }
.term-list > a { display: flex; align-items: center; gap: 24px; min-height: 48px; padding: 12px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.term-list > a span { color: var(--muted); font-size: 12px; }

/* Article page */
.article { max-width: 744px; margin: auto; padding: 42px 0 72px; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.article-header { padding-bottom: 27px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.article-header h1 { margin: 13px 0 16px; font-size: clamp(30px, 4vw, 42px); font-weight: 750; line-height: 1.45; letter-spacing: -.04em; overflow-wrap: anywhere; }
.article-description { margin: 0 0 19px; color: var(--muted); font-size: 17px; line-height: 1.8; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.meta span { color: #7b8b99; }
.toc { margin-bottom: 30px; padding: 14px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--pale); font-size: 14px; }
.toc summary { min-height: 28px; padding: 4px 0; color: var(--ink); font-weight: 600; cursor: pointer; }
.toc nav > ul { margin: 10px 0 3px; padding-left: 21px; }
.toc ul ul { padding-left: 21px; }
.toc li { padding: 4px 0; color: var(--muted); }
.toc a { line-height: 1.8; overflow-wrap: anywhere; }
.toc a:hover { text-decoration: underline; }
.prose { color: var(--body); font-size: 17px; line-height: 1.95; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { color: var(--ink); line-height: 1.5; scroll-margin-top: 28px; }
.prose h1 { margin: 42px 0 16px; font-size: 30px; }
.prose h2 { margin: 38px 0 14px; font-size: 25px; letter-spacing: -.025em; }
.prose h3 { margin: 30px 0 12px; font-size: 20px; }
.prose h4, .prose h5, .prose h6 { margin: 24px 0 12px; font-size: 17px; }
.prose p { margin: 19px 0; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose ul, .prose ol { padding-left: 1.6em; }
.prose li { margin: 7px 0; padding-left: 3px; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: 27px 0; padding: 5px 22px; border-left: 3px solid #6f97b8; border-radius: 0 8px 8px 0; color: var(--body); background: var(--pale); }
.prose code { padding: .15em .35em; border-radius: 4px; background: #e9eff5; color: #214e72; font-family: "Cascadia Code", Consolas, "SFMono-Regular", monospace; font-size: .86em; }
.prose .highlight { min-width: 0; margin: 24px 0; }
.prose pre { max-width: 100%; margin: 24px 0; padding: 21px 23px; overflow-x: auto; border: 1px solid #23394d; border-radius: 10px; color: #e6edf3; background: #0d1117; font-size: 14px; line-height: 1.8; tab-size: 2; }
.prose .highlight pre { margin: 0; }
.prose pre code { padding: 0; border-radius: 0; background: none; color: inherit; font-size: inherit; white-space: pre; overflow-wrap: normal; word-break: normal; }
.prose img, .prose video { display: block; max-width: 100%; height: auto; margin: 24px auto; border-radius: 10px; }
.prose figure { margin: 28px 0; }
.prose figcaption { margin-top: 9px; text-align: center; color: var(--muted); font-size: 13px; }
.prose hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); }
.prose table { display: block; max-width: 100%; margin: 24px 0; overflow-x: auto; overflow-wrap: normal; border-collapse: collapse; font-size: 14px; line-height: 1.8; }
.prose th, .prose td { padding: 11px 16px; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--pale); color: var(--ink); font-weight: 600; }
.prose input[type="checkbox"] { accent-color: var(--accent); }
.footnotes { margin-top: 38px; font-size: 14px; }
.post-pagination { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 44px; }
.post-pagination a { display: flex; flex-direction: column; gap: 9px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.post-pagination a:hover { border-color: #9ebbd2; }
.post-pagination span { color: var(--muted); font-size: 12px; }
.post-pagination strong { font-size: 15px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.next-post { grid-column: 2; text-align: right; }
.article-end { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--accent); font-size: 13px; }
.article-end a { display: inline-flex; align-items: center; min-height: 44px; }
.not-found { padding: 100px 0 120px; }
.not-found h1 { font-size: clamp(28px, 4vw, 44px); }

/* Responsive layouts */
@media (max-width: 900px) {
  .site-shell { padding: 0 32px; }
  .hero { gap: 32px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .notebook { padding: 21px; }
  .notebook-title { font-size: 20px; }
}
@media (max-width: 700px) {
  .site-shell { padding: 0 22px; }
  .header { min-height: 78px; gap: 16px; }
  .brand { font-size: 17px; gap: 9px; }
  .brand-mark { width: 31px; height: 33px; border-radius: 9px; font-size: 20px; }
  .brand-suffix { font-size: 12px; }
  .nav { gap: 8px; }
  .nav a { font-size: 13px; }
  .hero { grid-template-columns: 1fr; gap: 30px; padding: 38px 0 34px; }
  .hero h1 { margin: 18px 0; font-size: 47px; }
  .hero-description { font-size: 15px; }
  .hero-description span { max-width: 330px; }
  .hero-actions { gap: 20px; margin-top: 22px; }
  .notebook { display: none; }
  .latest { padding: 28px 0 48px; }
  .section-header { gap: 12px; margin-bottom: 16px; }
  .section-header h2 { font-size: 25px; }
  .text-link { gap: 8px; font-size: 13px; }
  .post-link { grid-template-columns: minmax(0, 1fr) 24px; gap: 9px 12px; padding: 22px 0; }
  .post-date { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 15px; padding: 0; font-size: 11px; }
  .post-copy h3 { margin-bottom: 7px; font-size: 19px; }
  .post-copy p { font-size: 13px; }
  .post-arrow { font-size: 21px; }
  .footer { flex-direction: column; gap: 20px; padding: 24px 0 30px; }
  .footer-links { text-align: left; }
  .list-page { padding: 38px 0 55px; }
  .page-heading { margin-bottom: 26px; }
  .page-heading h1 { font-size: 31px; }
  .list-intro { font-size: 15px; }
  .article { padding: 22px 0 48px; }
  .back { margin-bottom: 14px; }
  .article-header { margin-bottom: 25px; padding-bottom: 22px; }
  .article-header h1 { font-size: 30px; }
  .article-description { font-size: 15px; }
  .meta { gap: 7px; font-size: 11px; }
  .prose { font-size: 16px; }
  .prose h2 { margin-top: 30px; font-size: 23px; }
  .prose h3 { font-size: 19px; }
  .prose pre { padding: 17px; font-size: 12px; }
  .prose blockquote { padding: 3px 17px; }
  .toc { padding: 12px 16px; font-size: 13px; }
  .post-pagination { gap: 12px; }
  .post-pagination a { padding: 14px; }
  .post-pagination strong { font-size: 14px; }
}
@media (max-width: 380px) {
  .site-shell { padding: 0 18px; }
  .header { flex-wrap: wrap; justify-content: center; gap: 4px; padding: 15px 0 8px; }
  .nav { width: 100%; justify-content: center; gap: 28px; }
  .nav a { min-height: 44px; }
  .hero h1 { font-size: 42px; }
  .notebook-title { font-size: 17px; }
  .post-pagination { grid-template-columns: 1fr; }
  .next-post { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  body { background: #fff; }
  .site-shell { width: 100%; padding: 0; }
  .header, .footer, .skip-link, .back, .toc, .post-pagination, .article-end { display: none; }
  .article { max-width: none; padding: 0; }
  .prose { font-size: 11pt; }
  .prose pre { white-space: pre-wrap; border-color: #ccc; }
  .prose pre code { white-space: pre-wrap; }
}
