/*
Theme Name: Telemetry Compass
Theme URI: https://telemetry-compass.com/
Author: Vidyasagar Machani
Author URI: https://telemetry-compass.com/
Description: An editorial-technical theme for thoughtful, text-first writing about engineering and observability. Warm ink-on-paper light mode with a deep-ink dark mode, set in Newsreader, Geist, and JetBrains Mono. Includes a sticky table of contents on long posts, reading-progress bar, monospace metadata, and a quiet share rail.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: telemetry-compass
Tags: blog, one-column, two-columns, custom-colors, custom-menu, editor-style, featured-images, full-width-template, rtl-language-support, sticky-post, threaded-comments, translation-ready, dark-mode
*/

/* ─────────────────────────────────────────────────────────────────────────
   Telemetry Compass — design tokens + base styles
   editorial-technical: warm ink-on-paper + deep ink dark mode
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* type stacks — overridden per pairing */
  --f-serif: "Newsreader", "Source Serif 4", Georgia, serif;
  --f-sans:  "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --f-head: var(--f-serif);
  --f-body: var(--f-serif);
  --f-ui:   var(--f-sans);
  --f-meta: var(--f-mono);

  /* light theme (default) */
  --bg:        #f7f4ee;
  --bg-2:      #efeae0;
  --bg-3:      #e6dfd2;
  --paper:    #fbf8f2;
  --fg:        #1a1814;
  --fg-mute:   #5a554b;
  --fg-faint:  #8b8576;
  --rule:      #d9d2c3;
  --rule-soft: #e7e0d0;

  /* accent — compass-needle oxide red */
  --accent:      oklch(0.58 0.16 30);
  --accent-soft: oklch(0.58 0.16 30 / 0.12);
  --accent-fg:   #ffffff;

  /* density */
  --gap: 1.5rem;
  --pad-y: 6rem;
  --measure: 38rem;
  --col-pad: 1.75rem;
  --leading: 1.6;

  /* utility */
  --radius: 4px;
  --radius-lg: 10px;
  --shadow-card: 0 1px 0 var(--rule-soft);
}

[data-theme="dark"] {
  --bg:        #0e0f12;
  --bg-2:      #15171b;
  --bg-3:      #1c1f25;
  --paper:     #111317;
  --fg:        #ebe7df;
  --fg-mute:   #9b958a;
  --fg-faint:  #6b6760;
  --rule:      #292d34;
  --rule-soft: #20242a;
  --accent-soft: oklch(0.65 0.15 30 / 0.16);
  --accent: oklch(0.7 0.15 30);
}

[data-density="compact"] {
  --gap: 1.1rem;
  --pad-y: 4rem;
  --leading: 1.5;
  --col-pad: 1.25rem;
}

[data-type="sans"] {
  --f-head: var(--f-sans);
  --f-body: var(--f-sans);
}
[data-type="mono"] {
  --f-head: var(--f-mono);
  --f-body: var(--f-serif);
}

/* ── reset / base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); color: var(--fg); }
body {
  font-family: var(--f-body);
  font-size: 17px;
  line-height: var(--leading);
  font-feature-settings: "kern", "liga", "calt";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  transition: background-color 240ms ease, color 240ms ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-fg); }

/* ── chrome ────────────────────────────────────────────────────────────── */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--col-pad);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--rule-soft);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.85rem var(--col-pad);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
}
.brand .glyph {
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.brand .glyph svg { width: 100%; height: 100%; }
.brand .mark {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
  padding-left: 0.6rem;
  margin-left: 0.2rem;
  border-left: 1px solid var(--rule);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-family: var(--f-ui);
  font-size: 0.88rem;
  margin-left: auto;
}
.nav a {
  color: var(--fg-mute);
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
.nav a:hover { color: var(--fg); }
.nav a.active { color: var(--fg); border-bottom-color: var(--accent); }
.nav .icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--fg-mute);
  cursor: pointer;
}
.nav .icon-btn:hover { color: var(--fg); background: var(--bg-2); }

/* ── footer ────────────────────────────────────────────────────────────── */
.footer {
  margin-top: 6rem;
  border-top: 1px solid var(--rule-soft);
  padding: 3rem 0 4rem;
  font-family: var(--f-ui);
  font-size: 0.86rem;
  color: var(--fg-mute);
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--col-pad);
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
}
.footer h4 {
  margin: 0 0 0.9rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 500;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.footer a:hover { color: var(--fg); }
.footer .colophon { max-width: 32ch; line-height: 1.55; }
.footer .colophon p { margin: 0 0 0.8rem; }
.footer .bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--fg-faint);
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--col-pad);
  padding-right: var(--col-pad);
}

/* ── typography primitives ────────────────────────────────────────────── */
.h1, h1 {
  font-family: var(--f-head);
  font-weight: 500;
  font-size: clamp(2.2rem, 4.2vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.h2, h2 {
  font-family: var(--f-head);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
.h3, h3 {
  font-family: var(--f-head);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}

.meta {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.lede {
  font-family: var(--f-body);
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--fg-mute);
  text-wrap: pretty;
}

/* ── home: hero ───────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  align-items: start;
}
.hero-left .h1 { margin-bottom: 1.5rem; }
.hero-left .lede { max-width: 30ch; margin-bottom: 2rem; }
.hero-meta {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-mute);
}
.hero-meta .dot { width: 4px; height: 4px; background: var(--accent); border-radius: 50%; }

.hero-right {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-mute);
  padding-top: 0.6rem;
}
.hero-right .ascii {
  border: 1px solid var(--rule);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  white-space: pre;
  line-height: 1.45;
  color: var(--fg-mute);
  overflow: hidden;
  font-size: 0.72rem;
}
.hero-right .ascii .hl { color: var(--accent); }
.hero-right .caption { margin-top: 0.6rem; color: var(--fg-faint); font-size: 0.72rem; }

/* ── post list ────────────────────────────────────────────────────────── */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2.6rem 0 1.2rem;
  border-bottom: 1px solid var(--rule-soft);
  margin-bottom: 0.5rem;
}
.section-head .meta { color: var(--fg-mute); }
.section-head .right {
  font-family: var(--f-ui);
  font-size: 0.85rem;
  color: var(--fg-mute);
  display: flex; align-items: center; gap: 0.4rem;
}

.post-row {
  display: grid;
  grid-template-columns: 100px 1fr 8rem;
  gap: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule-soft);
  cursor: pointer;
  transition: background-color 120ms ease;
}
.post-row:hover { background: color-mix(in oklab, var(--bg-2) 60%, transparent); }
.post-row .idx {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
  padding-top: 0.35rem;
}
.post-row .title {
  font-family: var(--f-head);
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin-bottom: 0.4rem;
  color: var(--fg);
}
.post-row:hover .title { color: var(--accent); }
.post-row .excerpt {
  font-family: var(--f-body);
  color: var(--fg-mute);
  font-size: 0.97rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  max-width: 56ch;
}
.post-row .tags {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
}
.post-row .tags .tag {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}
.post-row .read {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--fg-mute);
  text-align: right;
  padding-top: 0.35rem;
  line-height: 1.5;
}
.post-row .read .num { color: var(--fg); font-size: 0.86rem; }

/* ── featured row ─────────────────────────────────────────────────────── */
.featured {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  padding: 2rem 0 2rem;
  border-bottom: 1px solid var(--rule);
}
.featured-main {
  padding-right: 1rem;
  border-right: 1px solid var(--rule-soft);
  cursor: pointer;
}
.featured-main .eyebrow { color: var(--accent); margin-bottom: 0.8rem; display: block; }
.featured-main .title {
  font-family: var(--f-head);
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 0.8rem;
}
.featured-main:hover .title { color: var(--accent); }
.featured-main .excerpt {
  color: var(--fg-mute);
  margin-bottom: 1rem;
  max-width: 48ch;
}
.featured-side { display: flex; flex-direction: column; gap: 1.6rem; }
.featured-side .item { cursor: pointer; }
.featured-side .item .title {
  font-family: var(--f-head);
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin-bottom: 0.3rem;
}
.featured-side .item:hover .title { color: var(--accent); }
.featured-side .item .meta { font-size: 0.7rem; }

/* ── article ──────────────────────────────────────────────────────────── */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 38rem) minmax(0, 1fr);
  gap: 2rem;
  padding: 3rem 0 2rem;
  align-items: start;
}
.article-toc {
  position: sticky;
  top: 5rem;
  font-family: var(--f-ui);
  font-size: 0.82rem;
  padding-top: 8rem;
}
.article-toc h5 {
  margin: 0 0 0.8rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 500;
}
.article-toc ol {
  list-style: none;
  margin: 0; padding: 0;
  display: grid; gap: 0.55rem;
  counter-reset: toc;
}
.article-toc li {
  counter-increment: toc;
  padding-left: 1.7rem;
  position: relative;
  color: var(--fg-mute);
  cursor: pointer;
  line-height: 1.35;
}
.article-toc li::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--fg-faint);
}
.article-toc li:hover { color: var(--fg); }
.article-toc li.active { color: var(--accent); }
.article-toc li.active::before { color: var(--accent); }

.article-body {
  min-width: 0;
}
.article-aside {
  position: sticky;
  top: 5rem;
  padding-top: 8rem;
  font-family: var(--f-ui);
  font-size: 0.85rem;
  color: var(--fg-mute);
}
.share-rail {
  display: flex; flex-direction: column; gap: 0.5rem;
}
.share-rail .label {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.4rem;
}
.share-rail button {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-mute);
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 0.8rem;
  width: max-content;
}
.share-rail button:hover { color: var(--fg); border-color: var(--fg-mute); }
.share-rail button svg { width: 14px; height: 14px; }

.article-header { padding-bottom: 2rem; border-bottom: 1px solid var(--rule); margin-bottom: 2rem; }
.article-header .eyebrow { color: var(--accent); margin-bottom: 1rem; display: block; }
.article-header h1 { font-size: clamp(1.9rem, 3.5vw, 2.8rem); margin-bottom: 1rem; }
.article-header .lede { margin-bottom: 1.4rem; }
.byline {
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--f-mono);
  font-size: 0.76rem;
  color: var(--fg-mute);
}
.byline .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: grid; place-items: center;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 0.7rem;
}
.byline .sep { color: var(--fg-faint); }

.prose {
  font-family: var(--f-body);
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--fg);
}
.prose > * + * { margin-top: 1.1rem; }
.prose h2 {
  font-size: 1.6rem;
  margin-top: 3rem;
  scroll-margin-top: 5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-soft);
}
.prose h2 .num {
  font-family: var(--f-mono);
  font-size: 0.7em;
  color: var(--fg-faint);
  margin-right: 0.7rem;
  vertical-align: 0.15em;
}
.prose h3 { font-size: 1.2rem; margin-top: 2rem; }
.prose p { margin: 0; }
.prose a {
  color: var(--fg);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}
.prose a:hover { color: var(--accent); }
.prose blockquote {
  margin: 2rem 0;
  padding: 0.4rem 0 0.4rem 1.4rem;
  border-left: 2px solid var(--accent);
  color: var(--fg-mute);
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.5;
}
.prose blockquote cite {
  display: block;
  margin-top: 0.7rem;
  font-style: normal;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-faint);
}
.prose code {
  font-family: var(--f-mono);
  font-size: 0.88em;
  background: var(--bg-2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: var(--accent);
}
.prose pre {
  font-family: var(--f-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  margin: 1.6rem 0;
  color: var(--fg);
}
.prose pre code { background: transparent; padding: 0; color: inherit; }
.prose pre .c-kw { color: var(--accent); }
.prose pre .c-co { color: var(--fg-faint); font-style: italic; }
.prose pre .c-st { color: oklch(0.65 0.12 145); }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 1rem 0; }
.prose li { margin-bottom: 0.4rem; }
.prose .figure {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.prose .figure .caption {
  margin-top: 0.8rem;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--fg-faint);
  text-align: center;
}
.prose hr {
  border: 0;
  margin: 3rem auto;
  width: 6rem;
  border-top: 1px solid var(--rule);
}
.prose .pullquote {
  font-family: var(--f-head);
  font-size: 1.6rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.5rem 0;
  color: var(--fg);
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}
.prose .callout {
  margin: 1.8rem 0;
  padding: 1.1rem 1.3rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 0.96rem;
  display: flex; gap: 0.9rem;
}
.prose .callout .label {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
  padding-top: 0.15rem;
}
.prose .callout p { margin: 0; }

.article-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.article-tags {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 2rem;
}
.tag-chip {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  color: var(--fg-mute);
  cursor: pointer;
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── comments ─────────────────────────────────────────────────────────── */
.comments {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.comments-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.comments-head h3 { font-family: var(--f-head); }
.comments-head .count {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-faint);
}
.comment {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0.9rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--rule-soft);
}
.comment .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--fg-mute);
  display: grid; place-items: center;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 0.85rem;
}
.comment .hdr {
  display: flex; gap: 0.6rem; align-items: baseline;
  margin-bottom: 0.4rem;
  font-family: var(--f-ui);
  font-size: 0.85rem;
}
.comment .hdr .name { font-weight: 600; color: var(--fg); }
.comment .hdr .ts {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
}
.comment .body { color: var(--fg); line-height: 1.55; }
.comment .actions {
  margin-top: 0.5rem;
  display: flex; gap: 1rem;
  font-family: var(--f-ui);
  font-size: 0.78rem;
  color: var(--fg-mute);
}
.comment .actions button {
  background: none; border: 0; padding: 0;
  color: inherit; cursor: pointer;
}
.comment .actions button:hover { color: var(--accent); }
.comment.reply { margin-left: 3rem; }
.comment-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.5rem;
}
.comment-form textarea {
  width: 100%;
  min-height: 90px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 0.98rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.comment-form textarea:focus { border-color: var(--fg-mute); }
.comment-form .row {
  display: flex; justify-content: space-between; align-items: center;
}
.comment-form .row .hint {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
}

/* ── buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--f-ui);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { border-color: var(--fg-mute); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border: 0; background: transparent; padding-left: 0; padding-right: 0; }
.btn.ghost:hover { color: var(--accent); }

/* ── related ──────────────────────────────────────────────────────────── */
.related {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.2rem;
}
.related-card {
  padding: 1.4rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}
.related-card:hover { border-color: var(--accent); }
.related-card .num {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--fg-faint);
  margin-bottom: 0.7rem;
}
.related-card .title {
  font-family: var(--f-head);
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin-bottom: 0.6rem;
}
.related-card .meta { font-size: 0.7rem; }

/* ── about page ───────────────────────────────────────────────────────── */
.about {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  padding: 4rem 0;
  max-width: 64rem;
  margin: 0 auto;
}
.about-side .portrait {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--fg-faint);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  position: relative;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0,
    transparent 8px,
    color-mix(in oklab, var(--fg-faint) 8%, transparent) 8px,
    color-mix(in oklab, var(--fg-faint) 8%, transparent) 9px
  );
}
.about-side .factsheet {
  margin-top: 1.5rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  display: grid;
  gap: 0.5rem;
}
.about-side .factsheet .row { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; }
.about-side .factsheet .row .k { color: var(--fg-faint); }
.about-side .factsheet .row .v { color: var(--fg); }

.about-main .h1 { margin-bottom: 1rem; }
.about-main .lede { margin-bottom: 2rem; }
.about-main .prose { max-width: 38rem; }

/* ── archive ──────────────────────────────────────────────────────────── */
.archive-year {
  margin: 3rem 0;
}
.archive-year-head {
  display: flex; align-items: baseline; gap: 1.2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.archive-year-head .year {
  font-family: var(--f-head);
  font-size: 3.2rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.archive-year-head .count {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-faint);
}
.archive-list { display: grid; }
.archive-row {
  display: grid;
  grid-template-columns: 5rem 1fr auto;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule-soft);
  align-items: baseline;
  cursor: pointer;
}
.archive-row .date {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-faint);
}
.archive-row .title {
  font-family: var(--f-head);
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--fg);
}
.archive-row:hover .title { color: var(--accent); }
.archive-row .tag {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--fg-mute);
}

/* ── newsletter ───────────────────────────────────────────────────────── */
.newsletter {
  max-width: 38rem;
  margin: 0 auto;
  padding: 5rem 0;
  text-align: center;
}
.newsletter .eyebrow { display: block; margin-bottom: 1.5rem; }
.newsletter .h1 { margin-bottom: 1.2rem; }
.newsletter .lede { margin-bottom: 2.5rem; }
.newsletter .form {
  display: flex; gap: 0.5rem;
  max-width: 28rem;
  margin: 0 auto 1.5rem;
}
.newsletter input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  font: inherit;
  font-family: var(--f-ui);
  color: var(--fg);
  outline: none;
}
.newsletter input:focus { border-color: var(--fg-mute); }
.newsletter .form-meta {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--fg-faint);
  margin-top: 0.5rem;
}
.newsletter .stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--rule);
  text-align: left;
}
.newsletter .stat .num {
  font-family: var(--f-head);
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.newsletter .stat .label {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
}
.newsletter .recent {
  margin-top: 4rem;
  text-align: left;
}
.newsletter .recent .h3 { margin-bottom: 1rem; }
.newsletter .recent .item {
  padding: 1rem 0;
  border-top: 1px solid var(--rule-soft);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
}
.newsletter .recent .item .t {
  font-family: var(--f-head);
  font-size: 1rem;
  line-height: 1.3;
}
.newsletter .recent .item .d {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
}

/* ── search ───────────────────────────────────────────────────────────── */
.search {
  padding: 4rem 0 2rem;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  margin-bottom: 1rem;
}
.search-bar svg { color: var(--fg-faint); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-family: var(--f-head);
  font-size: 1.3rem;
  color: var(--fg);
  outline: none;
}
.search-meta {
  font-family: var(--f-mono);
  font-size: 0.76rem;
  color: var(--fg-mute);
  display: flex; gap: 1.5rem; margin-bottom: 2rem;
}
.search-filters {
  display: flex; gap: 0.5rem; margin-bottom: 2rem;
  font-family: var(--f-ui);
  font-size: 0.82rem;
}
.search-filters button {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-mute);
  cursor: pointer;
}
.search-filters button.on {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.search-hit {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule-soft);
  cursor: pointer;
}
.search-hit .breadcrumb {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
  margin-bottom: 0.4rem;
}
.search-hit .title {
  font-family: var(--f-head);
  font-size: 1.2rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.search-hit:hover .title { color: var(--accent); }
.search-hit .snippet {
  color: var(--fg-mute);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 58ch;
}
.search-hit .snippet mark {
  background: var(--accent-soft);
  color: var(--fg);
  padding: 0 2px;
  border-radius: 2px;
}

/* ── 404 ──────────────────────────────────────────────────────────────── */
.notfound {
  max-width: 32rem;
  margin: 0 auto;
  padding: 6rem 0 5rem;
  text-align: center;
}
.notfound .code {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  color: var(--fg-faint);
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
}
.notfound .glyph404 {
  font-family: var(--f-head);
  font-size: clamp(6rem, 14vw, 9rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--fg);
  margin-bottom: 1.5rem;
}
.notfound .glyph404 .needle { color: var(--accent); }
.notfound .h2 { margin-bottom: 1rem; }
.notfound .lede { margin-bottom: 2rem; }
.notfound .links {
  display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap;
}

/* ── tag page ─────────────────────────────────────────────────────────── */
.tag-head {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--rule);
}
.tag-head .eyebrow { display: block; margin-bottom: 0.8rem; }
.tag-head .h1 .hash { color: var(--accent); }
.tag-head .lede { margin-top: 1rem; max-width: 42ch; }
.tag-head .stats {
  display: flex; gap: 2rem; margin-top: 1.5rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--fg-mute);
}
.tag-head .stats .num { color: var(--fg); }

/* ── pagination ───────────────────────────────────────────────────────── */
.pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--f-ui);
  font-size: 0.88rem;
}
.pagination .pages {
  display: flex; gap: 0.4rem;
  font-family: var(--f-mono);
  font-size: 0.82rem;
}
.pagination .pages button {
  width: 28px; height: 28px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-mute);
  cursor: pointer;
}
.pagination .pages button:hover { color: var(--fg); }
.pagination .pages button.on {
  border-color: var(--rule);
  color: var(--fg);
  background: var(--paper);
}

/* ── reading-progress bar ─────────────────────────────────────────────── */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--accent);
  z-index: 40;
  transition: width 80ms linear;
}

/* ── responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-toc, .article-aside { position: static; padding-top: 0; }
  .article-toc { order: -1; padding: 1rem 1.2rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
  .featured { grid-template-columns: 1fr; }
  .featured-main { border-right: 0; padding-right: 0; }
  .hero { grid-template-columns: 1fr; gap: 2rem; padding: 3rem 0 2rem; }
  .about { grid-template-columns: 1fr; padding: 3rem 0; gap: 2rem; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .post-row { grid-template-columns: 60px 1fr; }
  .post-row .read { grid-column: 2; text-align: left; padding-top: 0; }
  .footer-inner { grid-template-columns: 1fr; }
  .newsletter .stats { grid-template-columns: 1fr; gap: 1rem; }
  .nav { gap: 0.8rem; }
}
