/* =========================================================================
   Scrape Diary — "Terminal Log" design system
   Near-black canvas · fine technical grid · monospace metadata ·
   single signal-green accent · live data-stream motif.
   ========================================================================= */

:root {
  --bg: #0a0b0e;
  --bg-panel: #070809;
  --accent: #c8f23a;

  --text: #e7e8ea;
  --text-strong: #f2f3f5;
  --text-muted: #a4a6ab;
  --text-dim: #9a9ca1;
  --text-faint: #7a7c81;
  --text-ghost: #5f6166;

  --code-blue: #7fa6d8;
  --code-purple: #c084fc;
  --code-string: #a3e635;
  --code-fn: #c8f23a;
  --code-arg: #f0a87a;
  --code-comment: #6a6c70;

  --surface: rgba(255, 255, 255, .025);
  --surface-2: rgba(255, 255, 255, .04);
  --hairline: rgba(255, 255, 255, .07);
  --hairline-strong: rgba(255, 255, 255, .1);
  --divider: rgba(255, 255, 255, .06);
  --accent-border: rgba(200, 242, 58, .3);
  --accent-border-hover: rgba(200, 242, 58, .45);
  --row-wash: rgba(200, 242, 58, .05);

  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', Menlo, Consolas, Monaco, monospace;

  --maxw: 1200px;
  --pad: 32px;
}

@keyframes sd-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes sd-scroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@keyframes sd-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 54px 54px;
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(200, 242, 58, .25); }

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

/* ---- Layout helpers ---------------------------------------------------- */
.sd-wrap { max-width: var(--maxw); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.sd-narrow { max-width: 760px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.sd-mid { max-width: 980px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.sd-mid-1100 { max-width: 1100px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

.sd-eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0;
}
.sd-rule { height: 1px; flex: 1; background: rgba(255, 255, 255, .09); }
.sd-sec-head { display: flex; align-items: baseline; gap: 12px; }
.sd-sec-head--split { justify-content: space-between; border-bottom: 1px solid rgba(255, 255, 255, .09); padding-bottom: 16px; }
.sd-viewall { font-family: var(--font-mono); font-size: 12px; color: var(--accent); text-decoration: none; }

/* Recurring pill tag */
.sd-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent-border);
  padding: 3px 9px;
  border-radius: 20px;
  text-decoration: none;
  line-height: 1.4;
}

/* Hatch placeholder / cover */
.sd-cover {
  background: repeating-linear-gradient(135deg, #0e1014 0 16px, #121419 16px 32px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.sd-cover img { width: 100%; height: 100%; object-fit: cover; }
.sd-cover-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #3f4248;
  letter-spacing: .08em;
  padding: 18px;
}

/* =========================================================================
   Header
   ========================================================================= */
.sd-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(10, 11, 14, .82);
  border-bottom: 1px solid var(--hairline);
}
.sd-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad);
  gap: 24px;
}
.sd-logo { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.sd-logo-mark {
  width: 13px; height: 13px;
  background: var(--accent);
  border-radius: 3px;
  box-shadow: 0 0 14px rgba(200, 242, 58, .6);
  flex: none;
}
.sd-logo-name { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.sd-logo-tag { font-family: var(--font-mono); font-size: 11px; color: var(--code-comment); align-self: flex-start; margin-top: 2px; }

.sd-nav { display: flex; align-items: center; gap: 30px; font-family: var(--font-mono); font-size: 13px; }
.sd-nav a { color: var(--text-dim); text-decoration: none; transition: color .15s; }
.sd-nav a:hover { color: var(--text); }
.sd-nav a.is-active { color: var(--accent); }

.sd-header-actions { display: flex; align-items: center; gap: 16px; }
.sd-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  padding: 0;
}
.sd-icon-btn:hover { border-color: rgba(200, 242, 58, .5); color: var(--accent); }

.sd-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  padding: 9px 16px;
  border-radius: 8px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

/* Hamburger + mobile menu — hidden on desktop, shown via the ≤768px block */
.sd-burger { display: none; }
.sd-burger-close { display: none; }
.sd-mobile-nav { display: none; }

/* =========================================================================
   Hero (homepage)
   ========================================================================= */
.sd-hero {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  padding: 72px var(--pad) 60px;
  align-items: center;
}
.sd-hero-left { animation: sd-rise .7s ease both; }
.sd-hero-kicker { font-family: var(--font-mono); font-size: 13px; color: var(--accent); margin-bottom: 22px; }
.sd-hero-title { font-size: 62px; line-height: 1.02; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 22px; }
.sd-hero-title span { color: var(--accent); }
.sd-hero-lede { font-size: 17px; line-height: 1.6; color: var(--text-muted); max-width: 460px; margin: 0 0 32px; }
.sd-cta-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sd-btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  color: var(--bg); background: var(--accent);
  padding: 13px 22px; border-radius: 10px; text-decoration: none;
  border: none; cursor: pointer;
}
.sd-link-muted { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); text-decoration: none; padding: 13px 4px; transition: color .15s; }
.sd-link-muted:hover { color: var(--text); }

/* Terminal panel */
.sd-terminal {
  background: var(--bg-panel);
  border: 1px solid var(--hairline-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
  animation: sd-rise .7s ease .12s both;
}
.sd-term-bar { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sd-dot { width: 11px; height: 11px; border-radius: 50%; background: #3a3c40; flex: none; }
.sd-term-name { font-family: var(--font-mono); font-size: 11px; color: var(--code-comment); margin-left: 8px; }
.sd-term-live { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.sd-term-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: sd-blink 1.4s infinite; }
.sd-term-body {
  position: relative;
  height: 300px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.85;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
}
.sd-term-scroll { position: absolute; inset: 0 0 auto; padding: 14px 18px; animation: sd-scroll 16s linear infinite; }
.sd-term-scroll div { white-space: pre; }

/* =========================================================================
   Stat strip
   ========================================================================= */
.sd-stats {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, .015);
}
.sd-stat { padding: 22px 26px; border-right: 1px solid var(--hairline); }
.sd-stat:last-child { border-right: none; }
.sd-stat-num { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--accent); }
.sd-stat-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-top: 4px; }

/* =========================================================================
   Featured
   ========================================================================= */
.sd-featured {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color .2s;
}
.sd-featured:hover { border-color: var(--accent-border-hover); }
.sd-featured-body { padding: 38px 40px; display: flex; flex-direction: column; justify-content: center; }
.sd-featured-body .sd-tag { align-self: flex-start; margin-bottom: 18px; }
.sd-featured-title { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; margin: 0 0 14px; }
.sd-featured-title a { color: inherit; text-decoration: none; transition: color .15s; }
.sd-featured-title a:hover { color: var(--accent); }
.sd-featured-dek { font-size: 16px; line-height: 1.6; color: var(--text-muted); margin: 0 0 24px; }
.sd-byline { display: flex; align-items: center; gap: 11px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.sd-avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(140deg, #c8f23a, #7fa30f); flex: none; }
.sd-featured-cover { min-height: 300px; border-left: 1px solid var(--divider); padding: 0; }
.sd-featured-cover .sd-cover-label { align-self: flex-end; }

/* =========================================================================
   Entry list (homepage + category + author)
   ========================================================================= */
.sd-list { display: flex; flex-direction: column; }
.sd-row {
  display: grid;
  grid-template-columns: 48px 1fr auto auto auto;
  align-items: center;
  gap: 24px;
  padding: 18px 12px;
  border-bottom: 1px solid var(--divider);
  transition: background .15s;
}
.sd-row:hover { background: var(--row-wash); }
.sd-row-num { font-family: var(--font-mono); font-size: 13px; color: var(--text-ghost); }
.sd-row-title { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; color: inherit; text-decoration: none; transition: color .15s; }
.sd-row-title:hover { color: var(--accent); }
.sd-row .sd-tag { justify-self: start; }
.sd-row-read { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); width: 64px; text-align: right; }
.sd-row-date { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); width: 60px; text-align: right; }

/* Category variant with dek */
.sd-row--cat { grid-template-columns: 56px 1fr 150px auto auto; padding: 20px 14px; }
.sd-row-main { min-width: 0; }
.sd-row--cat .sd-row-title { display: block; font-size: 19px; margin-bottom: 4px; }
.sd-row-dek { font-size: 14px; color: var(--text-faint); }
.sd-row--cat .sd-row-date { width: 64px; }

/* =========================================================================
   Topics chips
   ========================================================================= */
.sd-chips { display: flex; flex-wrap: wrap; gap: 12px; }
.sd-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 13px;
  color: #c5c6cb;
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  padding: 10px 16px;
  border-radius: 9px;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.sd-chip:hover { border-color: var(--accent); color: var(--accent); }
.sd-chip .sd-hash { color: var(--accent); }
.sd-chip .sd-count { color: var(--text-ghost); }
.sd-chip--sm { font-size: 12px; padding: 6px 12px; border-radius: 8px; }
.sd-chip--sm .sd-hash { color: var(--text-ghost); }

/* =========================================================================
   Subscribe band
   ========================================================================= */
.sd-subscribe-panel {
  position: relative;
  border: 1px solid rgba(200, 242, 58, .25);
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(200, 242, 58, .07), rgba(200, 242, 58, .01));
  padding: 54px 48px;
}
.sd-subscribe-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(200, 242, 58, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 242, 58, .04) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}
.sd-subscribe-grid { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
.sd-sub-kicker { font-family: var(--font-mono); font-size: 12px; color: var(--accent); margin-bottom: 12px; }
.sd-sub-title { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 10px; }
.sd-sub-text { font-size: 16px; color: var(--text-muted); margin: 0; max-width: 460px; }
.sd-sub-form { display: flex; flex-wrap: wrap; gap: 10px; }
.sd-sub-input {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 240px;
  outline: none;
}
.sd-sub-input:focus { border-color: var(--accent-border); }
.sd-sub-btn {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--bg); background: var(--accent);
  border: none; padding: 0 22px; border-radius: 10px; cursor: pointer; white-space: nowrap;
}
.sd-sub-btn:disabled { opacity: .65; cursor: default; }
.sd-sub-success { font-family: var(--font-mono); font-size: 14px; color: var(--accent); padding: 12px 2px; }
.sd-sub-error { flex-basis: 100%; font-family: var(--font-mono); font-size: 12px; color: var(--code-arg); margin-top: 2px; }

/* =========================================================================
   Footer
   ========================================================================= */
.sd-footer { border-top: 1px solid var(--hairline); }
.sd-footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--code-comment);
  flex-wrap: wrap;
  gap: 16px;
}
.sd-footer-brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.sd-footer-mark { width: 11px; height: 11px; background: var(--accent); border-radius: 3px; }
.sd-footer-nav { display: flex; gap: 24px; }
.sd-footer-nav a { color: var(--text-dim); text-decoration: none; transition: color .15s; }
.sd-footer-nav a:hover { color: var(--accent); }

/* =========================================================================
   Article
   ========================================================================= */
.sd-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); z-index: 100; width: 0; box-shadow: 0 0 12px rgba(200, 242, 58, .6); }

.sd-crumbs { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-bottom: 24px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sd-crumbs a { color: var(--text-dim); text-decoration: none; transition: color .15s; }
.sd-crumbs a:hover { color: var(--accent); }
.sd-crumbs .sd-sep { color: #4f5156; }
.sd-crumbs .sd-current { color: var(--accent); }

.sd-article-head { padding-top: 56px; }
.sd-article-title { font-size: 46px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; margin: 20px 0 18px; color: var(--text-strong); }
.sd-lede { font-size: 20px; line-height: 1.55; color: var(--text-muted); margin: 0 0 30px; }

.sd-byline-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex-wrap: wrap; gap: 16px;
}
.sd-byline-author { display: flex; align-items: center; gap: 12px; }
.sd-avatar-lg { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(140deg, #c8f23a, #7fa30f); flex: none; }
.sd-byline-name { font-size: 14px; font-weight: 500; }
.sd-byline-name a { color: inherit; text-decoration: none; }
.sd-byline-name a:hover { color: var(--accent); }
.sd-byline-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.sd-share { display: flex; gap: 10px; }
.sd-share-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 9px; color: var(--text-dim);
  cursor: pointer; background: none;
  transition: border-color .15s, color .15s;
}
.sd-share-btn:hover { border-color: rgba(200, 242, 58, .5); color: var(--accent); }

.sd-article-hero { margin-top: 32px; }
.sd-article-hero .sd-cover { border: 1px solid var(--hairline); border-radius: 14px; height: 360px; }

/* ---- Prose ------------------------------------------------------------- */
.sd-prose { padding-top: 50px; }
.sd-prose > *:first-child { margin-top: 0; }
.sd-prose p { font-size: 18px; line-height: 1.75; color: #c3c5ca; margin: 0 0 26px; }
.sd-prose h2 { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-strong); margin: 52px 0 18px; scroll-margin-top: 90px; }
.sd-prose h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-strong); margin: 38px 0 14px; scroll-margin-top: 90px; }
.sd-prose h4 { font-size: 19px; font-weight: 600; color: var(--text-strong); margin: 30px 0 12px; }
.sd-prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(200, 242, 58, .35); }
.sd-prose a:hover { border-bottom-color: var(--accent); }
.sd-prose strong { color: var(--text-strong); font-weight: 600; }
.sd-prose em { font-style: italic; }
.sd-prose hr { border: 0; height: 1px; background: var(--hairline-strong); margin: 40px 0; }

.sd-prose ul, .sd-prose ol { font-size: 18px; line-height: 1.7; color: #c3c5ca; margin: 0 0 26px; padding-left: 4px; list-style: none; }
.sd-prose ul li { position: relative; padding-left: 28px; margin-bottom: 12px; }
.sd-prose ul li::before { content: "›"; position: absolute; left: 6px; top: -1px; color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.sd-prose ol { counter-reset: sd; }
.sd-prose ol li { position: relative; padding-left: 38px; margin-bottom: 12px; counter-increment: sd; }
.sd-prose ol li::before { content: counter(sd, decimal-leading-zero); position: absolute; left: 0; top: 2px; color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.sd-prose li > ul, .sd-prose li > ol { margin: 12px 0 0; }

.sd-prose code:not(pre code) {
  font-family: var(--font-mono); font-size: .85em;
  color: var(--accent);
  background: rgba(200, 242, 58, .1);
  border: 1px solid rgba(200, 242, 58, .16);
  padding: 2px 6px; border-radius: 5px;
}

/* Dark code panel — wraps Shiki output (.astro-code) and any raw <pre> */
.sd-prose pre {
  position: relative;
  margin: 0 0 30px;
  padding: 44px 22px 20px;
  background: var(--bg-panel) !important;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: 0 16px 44px -20px rgba(0, 0, 0, .6);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
}
.sd-prose pre::before {
  content: "";
  position: absolute; top: 16px; left: 18px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #3a3c40;
  box-shadow: 18px 0 #3a3c40, 36px 0 #3a3c40;
}
.sd-prose pre code { font-family: var(--font-mono); background: none; border: none; padding: 0; color: var(--text); }

/* Tables */
.sd-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 30px;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  overflow: hidden;
}
.sd-prose thead tr { background: rgba(255, 255, 255, .03); }
.sd-prose th {
  text-align: left; padding: 14px 18px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 500;
  border-bottom: 1px solid var(--hairline-strong);
}
.sd-prose td { padding: 13px 18px; color: var(--text-muted); border-bottom: 1px solid var(--divider); }
.sd-prose tbody tr:last-child td { border-bottom: none; }
.sd-prose td:first-child { color: var(--text); font-weight: 500; }

/* Blockquote */
.sd-prose blockquote { margin: 0 0 30px; padding: 6px 0 6px 26px; border-left: 3px solid var(--accent); }
.sd-prose blockquote p { font-size: 21px; line-height: 1.55; color: var(--text); font-style: italic; margin: 0 0 10px; }
.sd-prose blockquote cite { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); font-style: normal; }

/* Figures / images in content (Ghost kg-card classes) */
.sd-prose figure { margin: 30px 0; }
.sd-prose figure img, .sd-prose p img, .sd-prose > img { border-radius: 12px; border: 1px solid var(--hairline); width: 100%; }
.sd-prose figcaption { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-top: 10px; text-align: center; line-height: 1.5; }

/* Callout */
.sd-callout {
  display: flex; gap: 16px;
  background: rgba(200, 242, 58, .06);
  border: 1px solid rgba(200, 242, 58, .22);
  border-radius: 12px; padding: 22px 24px;
  margin: 8px 0 0;
}
.sd-callout-glyph { font-family: var(--font-mono); color: var(--accent); font-size: 18px; line-height: 1.5; }
.sd-callout-title { font-weight: 600; color: var(--text-strong); margin-bottom: 6px; }
.sd-callout p { font-size: 15px; line-height: 1.6; color: var(--text-muted); margin: 0; }
.sd-callout a { color: var(--accent); border-bottom: 1px solid rgba(200, 242, 58, .4); text-decoration: none; }

/* Article footer navigation (prev/next) */
.sd-artnav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin-top: 12px; padding-top: 36px;
  border-top: 1px solid var(--hairline);
}
.sd-artnav-link { text-decoration: none; color: inherit; display: block; }
.sd-artnav-label { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sd-artnav-next { text-align: right; }
.sd-artnav-next .sd-artnav-label { justify-content: flex-end; }
.sd-artnav-title { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; margin: 0; transition: color .15s; }
.sd-artnav-link:hover .sd-artnav-title { color: var(--accent); }

/* Related entries */
.sd-related { border-top: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .012); margin-top: 50px; }
.sd-related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sd-related-card {
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--hairline-strong);
  border-radius: 14px; overflow: hidden;
  text-decoration: none; color: inherit;
  transition: border-color .2s;
}
.sd-related-card:hover { border-color: var(--accent-border-hover); }
.sd-related-cover { height: 130px; }
.sd-related-body { padding: 18px 20px 20px; }
.sd-related-tag { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.sd-related-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.22; margin: 8px 0 12px; }
.sd-related-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

/* =========================================================================
   Category controls
   ========================================================================= */
.sd-cat-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 30px; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.sd-cat-hero-left { max-width: 640px; }
.sd-cat-kicker { font-family: var(--font-mono); font-size: 13px; color: var(--accent); margin-bottom: 14px; }
.sd-cat-kicker .sd-hash { color: var(--accent); }
.sd-cat-title { font-size: 48px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 16px; }
.sd-cat-desc { font-size: 18px; line-height: 1.6; color: var(--text-muted); margin: 0; }
.sd-cat-count { font-family: var(--font-mono); text-align: right; }
.sd-cat-count-num { font-size: 42px; font-weight: 600; color: var(--accent); letter-spacing: -0.02em; }
.sd-cat-count-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-top: 2px; }

.sd-related-rail { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sd-related-rail-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-right: 4px; }

.sd-controls { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.sd-filter {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px; padding: 0 14px;
  flex: 1; min-width: 240px; max-width: 380px;
}
.sd-filter:focus-within { border-color: var(--accent-border); }
.sd-filter input { background: none; border: none; outline: none; color: var(--text); font-family: var(--font-mono); font-size: 13px; padding: 12px 0; width: 100%; }
.sd-sort { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; }
.sd-sort-label { color: var(--text-faint); margin-right: 4px; }
.sd-sort-btn {
  font-family: var(--font-mono); font-size: 12px;
  color: #c5c6cb; background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, .12);
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  transition: all .15s;
}
.sd-sort-btn:hover { border-color: var(--accent-border); }
.sd-sort-btn.is-active { color: var(--bg); background: var(--accent); border-color: var(--accent); }

.sd-count-line { display: flex; justify-content: center; padding: 40px 0 0; }
.sd-count-line span { font-family: var(--font-mono); font-size: 11px; color: var(--text-ghost); }
.sd-empty { text-align: center; padding: 60px 20px; font-family: var(--font-mono); color: var(--text-faint); }
.sd-empty-head { font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.sd-empty-body { font-size: 14px; }

/* =========================================================================
   Search overlay (Pagefind) — dark theme
   ========================================================================= */
.search-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center; align-items: flex-start;
  padding-top: 10vh;
}
.search-overlay.active { display: flex; }
.search-modal {
  background: var(--bg-panel);
  border: 1px solid var(--hairline-strong);
  border-radius: 14px;
  width: 90%; max-width: 680px; max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .6);
  padding: 8px;
  --pagefind-ui-primary: #c8f23a;
  --pagefind-ui-text: #e7e8ea;
  --pagefind-ui-background: #070809;
  --pagefind-ui-border: rgba(255, 255, 255, .1);
  --pagefind-ui-tag: #16181d;
  --pagefind-ui-font: 'Space Grotesk', sans-serif;
}
.search-modal .pagefind-ui__search-input { font-family: var(--font-mono); font-size: 16px; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 900px) {
  .sd-hero { grid-template-columns: 1fr; gap: 36px; padding-top: 48px; }
  .sd-hero-title { font-size: 46px; }
  .sd-featured { grid-template-columns: 1fr; }
  .sd-featured-cover { min-height: 200px; border-left: none; border-top: 1px solid var(--divider); }
  .sd-stats { grid-template-columns: repeat(2, 1fr); }
  .sd-stat:nth-child(2) { border-right: none; }
  .sd-related-grid { grid-template-columns: 1fr; }
  .sd-subscribe-grid { grid-template-columns: 1fr; gap: 24px; }
  .sd-sub-form { flex-direction: column; }
  .sd-sub-input { width: 100%; }
  .sd-sub-btn { padding: 14px 22px; }
}

@media (max-width: 768px) {
  :root { --pad: 20px; }
  .sd-nav { display: none; }

  /* Hamburger menu */
  .sd-burger { display: flex; }
  .sd-header-actions .sd-btn { display: none; } /* Subscribe lives in the menu on mobile */
  .sd-header.is-open .sd-burger-open { display: none; }
  .sd-header.is-open .sd-burger-close { display: block; }
  .sd-header.is-open .sd-mobile-nav {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--hairline);
    background: rgba(10, 11, 14, .98);
    padding: 6px var(--pad) 18px;
  }
  .sd-mobile-nav a {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text-dim);
    text-decoration: none;
    padding: 15px 2px;
    border-bottom: 1px solid var(--divider);
    transition: color .15s;
  }
  .sd-mobile-nav a:hover { color: var(--text); }
  .sd-mobile-nav a.is-active { color: var(--accent); }
  .sd-mobile-nav .sd-mobile-subscribe {
    border-bottom: none;
    margin-top: 16px;
    text-align: center;
    color: var(--bg);
    background: var(--accent);
    font-size: 13px;
    font-weight: 600;
    padding: 14px;
    border-radius: 10px;
  }
  .sd-article-title { font-size: 34px; }
  .sd-cat-title { font-size: 36px; }
  .sd-hero-title { font-size: 38px; }
  .sd-sub-title { font-size: 26px; }

  /* Collapse list rows to a stacked, readable layout */
  .sd-row, .sd-row--cat { grid-template-columns: 1fr; gap: 6px; padding: 16px 8px; }
  .sd-row-num { display: none; }
  .sd-row .sd-tag, .sd-row--cat .sd-tag { justify-self: start; }
  .sd-row-read, .sd-row-date { width: auto; text-align: left; display: inline; }
  .sd-row-read::after { content: " ·"; color: var(--text-ghost); }

  .sd-artnav { grid-template-columns: 1fr; }
  .sd-artnav-next, .sd-artnav-next .sd-artnav-label { text-align: left; justify-content: flex-start; }
  .sd-footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .sd-stats { grid-template-columns: 1fr; }
  .sd-stat { border-right: none; border-bottom: 1px solid var(--hairline); }
  .sd-stat:last-child { border-bottom: none; }
}

/* =========================================================================
   Reduced motion
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sd-term-scroll { animation: none; }
  .sd-term-live-dot { animation: none; }
  .sd-hero-left, .sd-terminal { animation: none; }
}
