/* =====================================================
   ignorantforager.com — base theme
   Adapted from system_design.md: dark-first, flat surfaces,
   color-encodes-meaning, minimal chrome. Scaled up from the
   dashboard-density spec (11-12px) to comfortable long-form
   reading sizes (16-18px body) since this is prose, not a UI.
   ===================================================== */

:root {
  --bg: #0f1117;
  --card-bg: #161820;
  --card-header-bg: #1e2030;
  --row-sep: #1a1c24;
  --border: #2a2c35;

  --text-primary: #c8c6be;
  --text-bright: #dddbd3;
  --text-highlight: #e8e6de;
  --text-muted: #6b6960;
  --text-secondary: #5a5c66;
  --text-row-label: #8a887e;

  --teal: #1d9e75;
  --teal-text: #5dcaa5;
  --blue: #378add;
  --blue-text: #85b7eb;
  --purple: #7f77dd;
  --amber: #ba7517;
  --red: #e24b4a;
  --gray: #3a3c46;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a { color: var(--blue-text); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* ---------- Header / Nav ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-highlight);
  text-decoration: none;
}
.site-title:hover { text-decoration: none; color: var(--teal-text); }

.site-nav {
  display: flex;
  gap: 20px;
}

.site-nav a {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--text-bright); }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text-bright); }

/* ---------- Homepage: latest post excerpt ---------- */

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.latest-post {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.latest-post-title {
  font-size: 26px;
  font-weight: 500;
  margin: 4px 0 10px;
  line-height: 1.3;
}
.latest-post-title a { color: var(--text-highlight); }
.latest-post-title a:hover { color: var(--teal-text); text-decoration: none; }

.latest-post-excerpt {
  margin-top: 14px;
  color: var(--text-primary);
}
.latest-post-excerpt p { margin: 0; }

.read-more {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal-text);
}
.read-more:hover { text-decoration: underline; }

/* ---------- Homepage: other articles (title list) ---------- */

.other-articles-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 0 14px;
}

.post-title-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-title-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--row-sep);
}
.post-title-list li:last-child { border-bottom: none; }

.post-title-list a {
  color: var(--text-bright);
  font-size: 15px;
}
.post-title-list a:hover { color: var(--teal-text); text-decoration: none; }

.post-title-list time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- Category dots ---------- */

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.dot-networking { background: var(--purple); }
.dot-homelab    { background: var(--teal); }
.dot-security   { background: var(--red); }
.dot-default    { background: var(--blue); }

/* ---------- Pills / tags ---------- */

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 10px;
  background: #1e2030;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 9px;
  color: var(--text-row-label);
  letter-spacing: 0.03em;
}

/* ---------- Article content (post + page) ---------- */

.post-header { margin-bottom: 36px; }

.post-title {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--text-highlight);
  margin: 0 0 14px;
  line-height: 1.25;
}

.post-content, .page-content {
  font-size: 16px;
}

.post-content h1, .page-content h1 { display: none; } /* titles come from frontmatter/header */

.post-content h2, .page-content h2 {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-highlight);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.post-content h3, .page-content h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-bright);
  margin: 32px 0 12px;
}

.post-content h4, .page-content h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 24px 0 10px;
}

.post-content p, .page-content p {
  margin: 0 0 18px;
  color: var(--text-primary);
}

.post-content ul, .post-content ol,
.page-content ul, .page-content ol {
  margin: 0 0 18px;
  padding-left: 24px;
  color: var(--text-primary);
}
.post-content li, .page-content li { margin-bottom: 6px; }
.post-content li > ul, .post-content li > ol,
.page-content li > ul, .page-content li > ol {
  margin-top: 6px;
  margin-bottom: 0;
}

.post-content strong, .page-content strong { color: var(--text-bright); font-weight: 600; }
.post-content em, .page-content em { color: var(--text-bright); }

.post-content hr, .page-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.post-content blockquote, .page-content blockquote {
  margin: 0 0 18px;
  padding: 4px 18px;
  border-left: 3px solid var(--purple);
  background: #121220;
  color: var(--text-row-label);
}
.post-content blockquote p:last-child,
.page-content blockquote p:last-child { margin-bottom: 0; }

.post-content img, .page-content img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  margin: 8px 0 18px;
}

/* Inline code (not inside a fenced code block) */
.post-content p code, .post-content li code, .post-content td code,
.page-content p code, .page-content li code, .page-content td code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.87em;
  background: #1e2030;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--teal-text);
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  vertical-align: bottom;
}

/* Code inside a fenced block: flat, no pill styling, just the font */
.post-content .codehilite code, .page-content .codehilite code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
}

/* Fenced code blocks (Pygments/codehilite) — markdown always wraps
   fenced blocks in <div class="codehilite"><pre><code>...
   Only the outer div gets the box; pre/code inside are reset flat
   to avoid stacking padding/border on top of each other. */
.post-content .codehilite, .page-content .codehilite {
  background: #1c1e26;
  border: 1px solid var(--row-sep);
  border-radius: 5px;
  padding: 10px 14px;
  overflow-x: auto;
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
}
.post-content .codehilite pre, .page-content .codehilite pre {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}
/* Standalone <pre> not produced by codehilite (fallback) */
.post-content pre:not(.codehilite pre), .page-content pre:not(.codehilite pre) {
  background: #1c1e26;
  border: 1px solid var(--row-sep);
  border-radius: 5px;
  padding: 10px 14px;
  overflow-x: auto;
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
}
.post-content table, .page-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 20px;
}
.post-content th, .page-content th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.post-content td, .page-content td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--row-sep);
  color: var(--text-row-label);
}

.post-content a, .page-content a { color: var(--blue-text); }
.post-content a:hover, .page-content a:hover { text-decoration: underline; }

.post-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

/* ---------- Pygments overrides — recolored to palette ---------- */
.codehilite .c, .codehilite .c1, .codehilite .cm, .codehilite .ch,
.codehilite .cp, .codehilite .cpf, .codehilite .cs { color: var(--text-secondary); font-style: italic; }

.codehilite .k, .codehilite .kc, .codehilite .kd, .codehilite .kn,
.codehilite .kp, .codehilite .kr, .codehilite .kt, .codehilite .ow { color: var(--purple); }

.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sa,
.codehilite .sb, .codehilite .sc, .codehilite .dl, .codehilite .sd,
.codehilite .se, .codehilite .sh, .codehilite .si, .codehilite .sx,
.codehilite .sr, .codehilite .ss { color: var(--teal-text); }

.codehilite .m, .codehilite .mb, .codehilite .mf, .codehilite .mh,
.codehilite .mi, .codehilite .mo, .codehilite .il { color: var(--amber); }

.codehilite .nf, .codehilite .nc, .codehilite .fm, .codehilite .na,
.codehilite .nd, .codehilite .ne { color: var(--blue-text); }

.codehilite .nt { color: var(--red); }
.codehilite .err { color: var(--red); background: #1a0e0e; }
.codehilite .o { color: var(--text-bright); }
.codehilite .n, .codehilite .nb, .codehilite .nv, .codehilite .nx,
.codehilite .vc, .codehilite .vg, .codehilite .vi, .codehilite .vm,
.codehilite .bp, .codehilite .p { color: var(--text-primary); }
.codehilite .hll { background: #1e2030; }
.codehilite .gp { color: var(--amber); font-weight: bold; }

/* ---------- Books page ---------- */

.book-year {
  margin-bottom: 32px;
}
.book-year-heading {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-highlight);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.book-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--row-sep);
}
.book-entry:last-child { border-bottom: none; }

.book-title { color: var(--text-primary); }
.book-title a { color: var(--blue-text); }

/* Star rating: two identical rows of 5 stars stacked - a muted
   background row, and a colored row clipped to a % width equal to
   rating/5. The clip-by-width approach supports any fractional
   precision (quarter, half, whatever) with no extra icon variants. */
.star-rating {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 3px;
  white-space: nowrap;
  cursor: default;
}
.star-track {
  display: block;
  color: var(--border);
}
.star-fill {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  color: var(--amber);
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .site-shell { padding: 24px 16px 40px; }
  .post-title { font-size: 26px; }
  body { font-size: 15px; }
  .book-entry { flex-direction: column; gap: 4px; }
}
