:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #20242a;
  --muted: #69717c;
  --line: #e1e4e8;
  --line-strong: #cbd0d6;
  --accent: #2563eb;
  --accent-soft: #eaf0ff;
  --green: #18845f;
  --green-soft: #e5f4ee;
  --orange: #c86420;
  --orange-soft: #fff0e4;
  --purple: #7555a5;
  --purple-soft: #f0eafb;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --container: 1120px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16191d;
  --panel: #20242a;
  --ink: #eef1f4;
  --muted: #a4abb4;
  --line: #343941;
  --line-strong: #464d57;
  --accent: #7da3ff;
  --accent-soft: #263650;
  --green: #71c5a5;
  --green-soft: #263f36;
  --orange: #e99a61;
  --orange-soft: #493429;
  --purple: #bea3e6;
  --purple-soft: #3c334a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: var(--sans); font-size: 16px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 7px 10px; color: white; background: var(--accent); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(14px); }
.header-inner { display: grid; grid-template-columns: 1fr auto auto; gap: 35px; align-items: center; min-height: 68px; }
.brand { display: inline-flex; gap: 10px; align-items: center; justify-self: start; font-size: 18px; font-weight: 750; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 7px; color: white; background: var(--accent); font-family: Georgia, serif; font-size: 19px; }
.main-nav { display: flex; gap: 27px; color: var(--muted); font-size: 13px; }
.main-nav a { padding: 23px 0 20px; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav .is-current { color: var(--accent); border-color: var(--accent); }
.theme-toggle { display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: var(--panel); cursor: pointer; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.blog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 42px; align-items: start; padding-block: 48px 70px; }
.page-heading { display: flex; justify-content: space-between; gap: 30px; align-items: baseline; margin-bottom: 20px; }
.page-heading h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.post-grid { display: grid; gap: 18px; }
.post-card { padding: 28px 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 1px 2px rgba(20, 24, 30, 0.03); }
.post-card.is-hidden { display: none; }
.post-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--muted); font-size: 11px; }
.topic { display: inline-flex; width: fit-content; padding: 2px 8px; align-items: center; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 700; }
.topic-agent { color: var(--purple); background: var(--purple-soft); }
.topic-ride { color: var(--orange); background: var(--orange-soft); }
.topic-life { color: var(--green); background: var(--green-soft); }
.post-card h2 { margin: 15px 0 10px; font-size: clamp(23px, 2.9vw, 31px); line-height: 1.32; letter-spacing: -0.035em; }
.post-card h2 a:hover { color: var(--accent); }
.post-card > p { margin: 0; color: var(--muted); font-size: 14px; }
.read-more { display: inline-block; margin-top: 20px; color: var(--accent); font-size: 12px; font-weight: 650; }
.read-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.pagination { display: flex; justify-content: space-between; gap: 20px; margin-top: 28px; color: var(--muted); font-size: 12px; }
.pagination .is-disabled { opacity: 0.45; }

.sidebar { display: grid; gap: 18px; }
.widget { padding: 21px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.widget h2 { margin: 0 0 15px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 15px; }
.category-list { display: grid; }
.filter-button { display: flex; justify-content: space-between; gap: 18px; width: 100%; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; text-align: left; }
.filter-button:last-child { border-bottom: 0; }
.filter-button b { font-family: var(--mono); font-size: 10px; font-weight: 500; }
.filter-button:hover, .filter-button.is-active { color: var(--accent); }
.link-list { margin: 0; padding: 0; list-style: none; }
.link-list li { display: flex; justify-content: space-between; gap: 15px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.link-list li:last-child { border-bottom: 0; }
.link-list small { color: var(--muted); font-size: 10px; }
.widget-copy { margin: 0; color: var(--muted); font-size: 12px; }
.subscribe-widget { background: var(--accent-soft); }

.site-footer { border-top: 1px solid var(--line); background: var(--panel); }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; padding-block: 24px; color: var(--muted); font-size: 11px; }

/* Article */
.article-layout { display: grid; grid-template-columns: minmax(0, 760px) 250px; gap: 54px; align-items: start; justify-content: center; padding-block: 42px 72px; }
.article { min-width: 0; padding: 32px 38px 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.back-link { display: inline-block; margin-bottom: 28px; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--accent); }
.article-header { padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.article-kicker { display: flex; flex-wrap: wrap; gap: 13px; align-items: center; color: var(--muted); font-size: 11px; }
.article h1 { margin: 19px 0 0; font-size: clamp(36px, 5vw, 52px); line-height: 1.16; letter-spacing: -0.05em; }
.article-deck { margin: 20px 0 0; color: var(--muted); font-size: 16px; }
.article-notice { width: fit-content; max-width: 100%; margin-top: 22px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--bg); font-size: 9px; }
.prose { margin-top: 38px; font-family: var(--serif); font-size: 18px; line-height: 1.95; }
.prose p { margin: 0 0 25px; }
.prose .lead-paragraph { font-size: 20px; }
.prose h2 { margin: 58px 0 20px; scroll-margin-top: 95px; font-family: var(--sans); font-size: 29px; line-height: 1.3; letter-spacing: -0.03em; }
.prose blockquote { margin: 34px 0; padding: 18px 22px; border-left: 4px solid var(--accent); color: var(--ink); background: var(--accent-soft); font-size: 18px; }
.prose ul { margin: 0 0 28px; padding-left: 1.4em; }
.prose li { margin-bottom: 8px; padding-left: 0.2em; }
.concept-flow { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; align-items: center; margin: 34px 0; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); font-family: var(--sans); font-size: 11px; }
.concept-flow span { padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 999px; }
.concept-flow i { color: var(--accent); font-style: normal; }
.article-footer { display: flex; justify-content: space-between; gap: 30px; margin-top: 55px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.article-footer p { margin: 0; }
.article-footer a { color: var(--accent); }
.article-sidebar { position: sticky; top: 92px; display: grid; gap: 18px; }
.article-toc ol { margin: 0; padding: 0; list-style: none; }
.article-toc li { margin-bottom: 10px; }
.article-toc li:last-child { margin-bottom: 0; }
.article-toc a { color: var(--muted); font-size: 11px; line-height: 1.45; }
.article-toc a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .blog-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 25px; }
  .article-layout { grid-template-columns: minmax(0, 720px); }
  .article-sidebar { position: static; grid-row: 1; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .container { width: min(calc(100% - 28px), var(--container)); }
  .header-inner { grid-template-columns: 1fr auto; gap: 15px; min-height: 62px; }
  .main-nav { display: none; }
  .brand { font-size: 16px; }
  .blog-layout { display: block; padding-block: 30px 50px; }
  .page-heading h1 { font-size: 25px; }
  .post-card { padding: 22px 20px; }
  .post-card h2 { font-size: 25px; }
  .sidebar { margin-top: 35px; }
  .article-layout { display: block; padding-block: 22px 50px; }
  .article { padding: 25px 20px 32px; }
  .article h1 { font-size: 37px; }
  .article-deck { font-size: 15px; }
  .article-sidebar { display: grid; grid-template-columns: 1fr; margin-top: 22px; }
  .prose { font-size: 17px; line-height: 1.9; }
  .prose .lead-paragraph { font-size: 19px; }
  .prose h2 { margin-top: 48px; font-size: 27px; }
  .prose blockquote { padding: 16px; font-size: 17px; }
  .article-footer { display: block; }
  .article-footer a { display: inline-block; margin-top: 10px; }
}

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