/* Site stylesheet */
:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #eae8df;
  --ink: #1c2420;
  --muted: #5d6862;
  --accent: #1e5645;
  --accent-2: #c98a2c;
  --border: #d6d4c9;
  --radius: 10px;
  --code-bg: #16202b;
  --code-fg: #e9f1f7;
  --font-body: system-ui,-apple-system,"PingFang SC","Noto Sans SC",sans-serif;
  --font-head: Georgia,"Noto Serif SC","Songti SC",serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f5f4efe8;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-sub {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 10px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}
.nav-links a { color: var(--muted); font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); text-decoration: none; }
.nav-links a.active { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

/* Hero */
.hero {
  padding: 46px 0 38px;
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 32px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.hero-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.25;
  margin: 0 0 14px;
  letter-spacing: -0.015em;
}
.hero p.hero-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 16px;
  max-width: 580px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.fact-pill {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
}
.hero-visual svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

/* Controls: Search & Category Filter */
.toolbar {
  padding: 24px 0 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  cursor: pointer;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s ease;
}
.filter-btn:hover { color: var(--ink); border-color: var(--accent); }
.filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}
.search-box {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13.5px;
  min-width: 220px;
  outline: none;
  font-family: inherit;
}
.search-box:focus { border-color: var(--accent); }

/* Layout variants for home feed */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 32px;
  padding: 8px 0 60px;
  align-items: start;
}
.cards-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
body.layout-swiss-sidebar .cards-list,
body.layout-bibliographic-index .cards-list,
body.layout-terminal-docs .cards-list {
  grid-template-columns: 1fr;
  gap: 14px;
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.post-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.cat-tag {
  color: var(--accent);
  font-weight: 600;
}
.post-card h2 {
  font-family: var(--font-head);
  font-size: 19px;
  line-height: 1.4;
  margin: 2px 0;
}
.post-card h2 a { color: var(--ink); }
.post-card h2 a:hover { color: var(--accent); text-decoration: none; }
.post-card p.summary {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.7;
  flex: 1;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
}
.read-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
  display: inline-block;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.side-card h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-family: var(--font-mono);
}
.side-card p { margin: 0 0 10px; font-size: 14px; color: var(--muted); line-height: 1.7; }
.side-list { list-style: none; padding: 0; margin: 0; }
.side-list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.side-list li:last-child { border-bottom: none; }

/* Article Page */
.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 36px;
  padding: 36px 0 72px;
  align-items: start;
}
.article-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 44px);
}
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.article-main h1 {
  font-family: var(--font-head);
  font-size: clamp(26px, 3.8vw, 38px);
  line-height: 1.3;
  margin: 0 0 14px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}
.article-lead {
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 15px 18px;
  border-radius: 6px;
  margin: 0 0 28px;
}
.article-main h2 {
  font-family: var(--font-head);
  font-size: 22px;
  line-height: 1.35;
  margin: 34px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.article-main section:first-of-type h2 { border-top: none; padding-top: 0; margin-top: 10px; }
.article-main p { margin: 0 0 15px; }
.article-main ul { padding-left: 22px; margin: 12px 0 18px; }
.article-main li { margin: 7px 0; }
.code-wrap { position: relative; margin: 16px 0 20px; }
.code-lang {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8aa2b8;
  text-transform: uppercase;
}
.copy-btn {
  position: absolute;
  top: 6px;
  right: 54px;
  background: rgba(255,255,255,0.08);
  color: #cfe4f5;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.copy-btn:hover { background: rgba(255,255,255,0.18); }
pre {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 18px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
}
.table-scroll { overflow-x: auto; margin: 18px 0 22px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border);
}
th {
  background: var(--surface-2);
  font-weight: 600;
}
.callout {
  margin: 18px 0 22px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 8px;
  font-size: 14.5px;
}
.toc-box {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.toc-box h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-family: var(--font-mono);
}
.toc-box ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.65;
}
.toc-box li { margin: 5px 0; }
.toc-box a { color: var(--muted); }
.toc-box a:hover { color: var(--accent); }
.post-nav {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.post-nav a {
  display: block;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13.5px;
}
.post-nav a:hover { border-color: var(--accent); text-decoration: none; }
.post-nav small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }

/* Archive & About pages */
.page-shell {
  max-width: 820px;
  margin: 34px auto 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 42px);
}
.page-shell h1 {
  font-family: var(--font-head);
  font-size: clamp(26px, 4vw, 34px);
  margin: 0 0 12px;
}
.archive-group { margin-top: 26px; }
.archive-group h2 {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 0 0 12px;
}
.archive-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.archive-row:last-child { border-bottom: none; }
.archive-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.empty-msg {
  grid-column: 1 / -1;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 42px;
  font-size: 13px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); }

@media (max-width: 900px) {
  .hero, .content-grid, .article-wrap { grid-template-columns: 1fr; }
  .toc-box { position: static; order: -1; }
}
@media (max-width: 640px) {
  .cards-list, .post-nav { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .search-box { width: 100%; }
}
