:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --text: #20221f;
  --muted: #73766f;
  --line: #dfe1da;
  --accent: #555650;
  --accent-soft: #eeeeeb;
  --max: 1080px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1d211f;
  --surface: #252a27;
  --text: #e8ebe5;
  --muted: #a4aaa1;
  --line: #3b433e;
  --accent: #c9cbc3;
  --accent-soft: #30312e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.7;
}
a { color: inherit; }
.shell { width: min(calc(100% - 48px), var(--max)); margin: 0 auto; }
.site-header {
  display: flex;
  align-items: center;
  min-height: 86px;
  border-bottom: 1px solid var(--line);
  gap: 32px;
}
.wordmark { color: var(--text); font: 700 1.1rem/1 Arial, sans-serif; letter-spacing: .02em; text-decoration: none; }
.wordmark span { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: 22px; margin-left: auto; font: .83rem/1 Arial, sans-serif; }
.site-nav a, .site-footer a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"], .site-footer a:hover { color: var(--accent); }
.theme-toggle { border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 50%; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.home-layout { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); gap: 88px; padding: 94px 0 110px; }
.home-intro { padding-top: 24px; }
.eyebrow { margin: 0 0 20px; color: var(--accent); font: .72rem/1.4 Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 570px; margin-bottom: 22px; font-size: clamp(2.5rem, 5vw, 4.2rem); font-weight: 400; line-height: 1.08; letter-spacing: 0; }
.lede { max-width: 440px; color: var(--muted); font-size: 1.12rem; }
.home-links { display: flex; gap: 24px; margin-top: 34px; }
.text-link { color: var(--accent); font: .84rem/1.4 Arial, sans-serif; text-decoration: none; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
h2 { font-size: 1.05rem; font-weight: 400; }
.post-list { border-top: 1px solid var(--line); }
.post-item { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 18px; padding: 17px 0 19px; border-bottom: 1px solid var(--line); text-decoration: none; }
.post-item:hover .post-title { color: var(--accent); }
.post-date { color: var(--muted); font: .72rem/1.5 Arial, sans-serif; text-transform: uppercase; }
.post-title { margin-bottom: 3px; font-size: 1.08rem; }
.post-summary { margin: 0; color: var(--muted); font-size: .9rem; }
.post-meta { margin-top: 7px; color: var(--muted); font: .68rem/1.4 Arial, sans-serif; }
.home-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-tile { min-height: 142px; padding: 20px 18px; border-right: 1px solid var(--line); text-decoration: none; }
.section-tile:last-child { border-right: 0; }
.section-tile:hover { background: var(--accent-soft); }
.section-tile span, .section-tile small { display: block; color: var(--muted); font: .7rem/1.4 Arial, sans-serif; }
.section-tile strong { display: block; margin: 25px 0 2px; font-size: 1.1rem; font-weight: 400; }
.site-footer { display: flex; justify-content: space-between; padding: 22px 0 30px; color: var(--muted); font: .72rem/1.5 Arial, sans-serif; }
.page-main { padding: 72px 0 110px; }
.page-heading { max-width: 690px; margin-bottom: 54px; }
.page-heading h1 { font-size: clamp(2.5rem, 5vw, 4.6rem); }
.page-heading p { color: var(--muted); font-size: 1.1rem; }
.category-list { max-width: 820px; }
.article-layout { max-width: 760px; margin: 0 auto; padding: 72px 0 110px; }
.article-header { margin-bottom: 42px; }
.article-header h1 { max-width: none; font-size: clamp(2.4rem, 5vw, 4.4rem); }
.article-meta { color: var(--muted); font: .75rem/1.5 Arial, sans-serif; }
.article-body { font-size: 1.08rem; }
.article-body h2 { margin: 2.6em 0 .7em; font-size: 1.65rem; }
.article-body h3 { margin: 2em 0 .5em; font-size: 1.25rem; }
.article-body a { color: var(--accent); }
.article-body blockquote { margin: 1.5em 0; padding: 0 0 0 22px; border-left: 2px solid var(--accent); color: var(--muted); }
.article-body pre { overflow-x: auto; padding: 18px; background: var(--accent-soft); font-size: .85rem; }
.article-body code { padding: .12em .3em; background: var(--accent-soft); font-size: .88em; }
.article-body pre code { padding: 0; background: transparent; }
.article-body img { max-width: 100%; height: auto; }
.article-back { display: inline-block; margin-bottom: 28px; }
.empty-state { padding: 20px 0; color: var(--muted); }
.portal-page { min-height: 100vh; display: flex; flex-direction: column; }
.portal { flex: 1; padding: 15vh 0 8vh; }
.portal h1 { max-width: 720px; margin-bottom: 18px; }
.portal-lede { max-width: 530px; color: var(--muted); font-size: 1.12rem; }
.version-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; max-width: 900px; margin-top: 58px; border: 1px solid var(--line); background: var(--line); }
.version-card { min-height: 190px; padding: 24px; background: var(--surface); text-decoration: none; }
.version-card:hover { background: var(--accent-soft); }
.version-code { display: block; color: var(--accent); font: .72rem/1.4 Arial, sans-serif; letter-spacing: .12em; }
.version-card strong { display: block; margin: 52px 0 3px; font-size: 1.13rem; font-weight: 400; }
.version-card small { display: block; color: var(--muted); font: .76rem/1.5 Arial, sans-serif; }
.version-card-peer { background: var(--surface); }
.portal-note { margin-top: 24px; color: var(--muted); font: .74rem/1.5 Arial, sans-serif; }
.profile-band { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; max-width: 820px; margin: -10px 0 68px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-band h2 { margin-bottom: 7px; }
.profile-band p { margin: 0; color: var(--muted); }
.profile-sections { margin-top: 68px; }
@media (max-width: 760px) {
  .shell { width: min(calc(100% - 32px), var(--max)); }
  .site-header { min-height: 72px; gap: 15px; align-items: flex-start; padding: 20px 0 16px; }
  .site-nav { justify-content: flex-end; gap: 8px 14px; }
  .theme-toggle { flex: 0 0 auto; }
  .home-layout { display: block; padding: 58px 0 75px; }
  .home-intro { padding: 0 0 62px; }
  h1 { font-size: clamp(2.8rem, 15vw, 4.2rem); }
  .home-grid { grid-template-columns: repeat(2, 1fr); margin-top: 64px; }
  .section-tile:nth-child(2) { border-right: 0; }
  .section-tile:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .page-main, .article-layout { padding-top: 52px; }
  .post-item { grid-template-columns: 65px minmax(0, 1fr); gap: 10px; }
  .portal { padding-top: 10vh; }
  .version-grid { grid-template-columns: 1fr; }
  .version-card { min-height: 150px; }
  .version-card strong { margin-top: 32px; }
  .profile-band { grid-template-columns: 1fr; gap: 22px; }
}
