/* ============================================================
   Prefetch Technologies — Option E (archive × publication)
   Self-contained: system fonts, no third-party requests.
   ============================================================ */

:root {
  /* Surfaces */
  --bg:        #0a0b0e;
  --bg-soft:   #11131a;
  --bg-card:   #14171f;
  --bg-code:   #000000;

  /* Text */
  --ink:       #ece8db;
  --ink-soft:  #9d9685;
  --ink-faint: #645e51;

  /* Lines */
  --line:      #1f2229;
  --line-hi:   #2a2d36;

  /* Accent */
  --accent:    #e08a4f;

  /* Category palette */
  --c-linux:   #e08a4f;
  --c-k8s:     #6dc7b9;
  --c-tf:      #b69adf;
  --c-storage: #d77a8a;
  --c-net:     #79b3e1;
  --c-other:   #c2a76b;

  /* Layout */
  --maxwide:   1180px;
  --maxread:   720px;

  /* Type */
  --sans: ui-sans-serif, system-ui, -apple-system, "Inter", "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono",
          "Roboto Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Source Serif Pro", "Charter",
           Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.wrap { width: 100%; max-width: var(--maxwide); margin: 0 auto; padding: 0 28px; }

/* ---------- Masthead ---------- */
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 18px; gap: 24px; flex-wrap: wrap;
}
.brand {
  font-family: var(--serif); font-size: 1.25rem; font-weight: 700;
  letter-spacing: -.3px; color: var(--ink);
  display: inline-flex; align-items: baseline; gap: 12px;
}
.brand:hover { text-decoration: none; }
.brand .em { color: var(--accent); }
.brand .slash { color: var(--ink-faint); font-family: var(--mono); font-size: .82rem; }
.brand .tag {
  color: var(--ink-faint); font-family: var(--mono); font-size: .78rem;
  background: none; border: 0; padding: 0; border-radius: 0;
}

/* ---------- Navigation (slash-prefixed) ---------- */
nav.main {
  display: flex; gap: 0; flex-wrap: wrap;
  font-family: var(--mono); font-size: .82rem;
}
nav.main a {
  color: var(--ink-soft);
  padding: 4px 14px 4px 0;
  letter-spacing: .02em;
  white-space: nowrap;
}
nav.main a::before { content: "/"; color: var(--ink-faint); margin-right: 1px; }
nav.main a:hover { color: var(--ink); text-decoration: none; }
nav.main a:hover::before { color: var(--accent); }
nav.main a.active { color: var(--accent); }
nav.main a.active::before { color: var(--accent); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 260px;
  gap: 48px;
  padding: 36px 0 56px;
  align-items: start;
}

/* ---------- Category tags ---------- */
.cat-tag {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .12em;
  text-transform: lowercase; font-weight: 600;
  display: inline-flex; align-items: center;
}
.cat-tag::before { content: "["; color: var(--ink-faint); margin-right: 1px; }
.cat-tag::after  { content: "]"; color: var(--ink-faint); margin-left: 1px; }
.cat-linux   { color: var(--c-linux); }
.cat-k8s     { color: var(--c-k8s); }
.cat-tf      { color: var(--c-tf); }
.cat-storage { color: var(--c-storage); }
.cat-net     { color: var(--c-net); }
.cat-other   { color: var(--c-other); }
a.cat-tag:hover { text-decoration: none; filter: brightness(1.15); }

/* ---------- Page head (archive listings) ---------- */
.page-head {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}
.page-head h1 {
  font-family: var(--serif); font-size: 2rem; font-weight: 700;
  letter-spacing: -.4px; margin: 0;
}
.page-head .eyebrow {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 6px;
}

/* ---------- Featured hero card (first post on blog listing) ---------- */
.feature {
  display: block; color: inherit;
  padding-bottom: 30px; margin-bottom: 30px;
  border-bottom: 1px dashed var(--line);
}
.feature:hover { text-decoration: none; }
.feature h2 {
  font-family: var(--serif); font-size: 2.1rem; font-weight: 700;
  letter-spacing: -.5px; line-height: 1.18; margin: 0 0 12px;
  color: var(--ink); text-wrap: balance;
}
.feature:hover h2 { color: var(--accent); }
.feature .meta {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  font-family: var(--mono); font-size: .76rem; color: var(--ink-faint);
  margin-bottom: 16px;
}
.feature p {
  color: var(--ink-soft); font-size: 1.02rem; margin: 0 0 14px;
}
.feature .read {
  font-family: var(--mono); font-size: .82rem; color: var(--ink-soft);
}
.feature .read .sigil { color: var(--accent); font-weight: 700; }
.feature:hover .read { color: var(--accent); }

/* ---------- Section label ---------- */
.section-label {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-faint);
  letter-spacing: .14em; text-transform: uppercase;
  margin: 0 0 18px;
  display: flex; align-items: center; gap: 10px;
}
.section-label::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ---------- Grid of secondary cards (blog listing) ---------- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px 32px;
}
.card {
  display: block; color: inherit;
  padding-bottom: 24px; border-bottom: 1px dashed var(--line);
}
.card:hover { text-decoration: none; }
.card h3 {
  font-family: var(--serif); font-size: 1.22rem; font-weight: 700;
  letter-spacing: -.2px; line-height: 1.28; margin: 0 0 8px; color: var(--ink);
  text-wrap: balance;
}
.card:hover h3 { color: var(--accent); }
.card .meta {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  font-family: var(--mono); font-size: .72rem; color: var(--ink-faint);
  margin-bottom: 12px;
}
.card p {
  color: var(--ink-soft); font-size: .92rem; margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .read {
  font-family: var(--mono); font-size: .76rem; color: var(--ink-faint);
}
.card .read .sigil { color: var(--accent); font-weight: 700; }
.card:hover .read { color: var(--accent); }

/* ---------- Single-column listing (articles, refs, presentations) ---------- */
.post-list { display: flex; flex-direction: column; }
.post-list .post-card {
  padding-bottom: 24px; margin-bottom: 24px;
  border-bottom: 1px dashed var(--line);
}
.post-list .post-card:last-of-type { border-bottom: none; margin-bottom: 0; }
.post-list .post-card h2 {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 700;
  letter-spacing: -.3px; line-height: 1.25; margin: 0 0 8px;
}
.post-list .post-card h2 a { color: var(--ink); }
.post-list .post-card h2 a:hover { color: var(--accent); text-decoration: none; }
.post-list .post-meta {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  font-family: var(--mono); font-size: .72rem; color: var(--ink-faint);
  margin-bottom: 10px;
}
.post-list .summary { color: var(--ink-soft); font-size: .94rem; margin: 0 0 12px; }
.post-list .readmore-row { display: flex; justify-content: flex-start; }
.post-list .readmore {
  font-family: var(--mono); font-size: .82rem; color: var(--ink-soft); font-weight: 500;
}
.post-list .readmore:hover { color: var(--accent); text-decoration: none; }
.post-list .readmore .sigil { color: var(--accent); font-weight: 700; }

/* ---------- Clamp utilities ---------- */
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.empty-state { color: var(--ink-soft); }

/* ---------- Sidebar (terminal index) ---------- */
aside { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 20px; }
.idx { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg-soft); }
.idx .hd {
  padding: 7px 12px; background: var(--bg-card);
  color: var(--ink-faint); font-family: var(--mono); font-size: .72rem;
  letter-spacing: .12em; text-transform: uppercase;
  border-bottom: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.idx .hd .sigil { color: var(--accent); }
.idx .bd { padding: 10px 12px; }
.idx a {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; color: var(--ink-soft);
  font-family: var(--mono); font-size: .82rem;
}
.idx a:hover { color: var(--accent); text-decoration: none; }
.idx a .n { color: var(--ink-faint); }
.idx.years .bd { display: flex; flex-wrap: wrap; gap: 6px; }
.idx.years a {
  display: inline-block; padding: 3px 9px; border: 1px solid var(--line);
  border-radius: 3px; font-size: .78rem; background: var(--bg);
}
.idx.years a:hover { border-color: var(--accent); }
.idx.feed .bd { font-family: var(--mono); font-size: .82rem; }
.idx.about .bd { color: var(--ink-soft); font-size: .85rem; line-height: 1.55; font-family: var(--sans); }
.swatch { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.swatch.cat-linux { background: var(--c-linux); }
.swatch.cat-k8s { background: var(--c-k8s); }
.swatch.cat-tf { background: var(--c-tf); }
.swatch.cat-storage { background: var(--c-storage); }
.swatch.cat-net { background: var(--c-net); }
.swatch.cat-other { background: var(--c-other); }

/* ---------- Pagination ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 36px; padding-top: 22px; border-top: 1px dashed var(--line);
  font-family: var(--mono); font-size: .82rem;
}
.pager .pages { color: var(--ink-faint); }
.pager .btn {
  border: 1px solid var(--line); padding: 7px 14px; border-radius: 4px;
  color: var(--ink-soft); font-weight: 500;
}
.pager .btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pager .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* ---------- Post page ---------- */
.post-wrap { max-width: none; margin: 0; padding-top: 8px; }
.post-title {
  font-family: var(--serif); font-size: clamp(1.8rem, 4.4vw, 2.5rem);
  font-weight: 700; letter-spacing: -.5px;
  line-height: 1.15; margin: 0 0 16px;
}
.post-byline {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding-bottom: 22px; border-bottom: 1px dashed var(--line); margin-bottom: 26px;
  font-family: var(--mono); font-size: .76rem; color: var(--ink-faint);
}
.post-byline .byline-cat {
  font-size: .72rem; letter-spacing: .08em; text-transform: lowercase;
  display: inline-flex; align-items: center;
}
.post-byline .byline-cat::before { content: "["; color: var(--ink-faint); margin-right: 1px; }
.post-byline .byline-cat::after  { content: "]"; color: var(--ink-faint); margin-left: 1px; }
.post-byline .byline-cat:hover { filter: brightness(1.15); text-decoration: none; }

.post-body { font-size: 1.04rem; color: var(--ink); }
.post-body p { margin: 1.15em 0; }
/* h1 used as a section header in some reference pages — style it consistently
   with h2 so browser defaults (2em) don't produce oversized headings. */
.post-body h1 {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  letter-spacing: -.3px; margin: 1.9em 0 .5em; line-height: 1.3;
}
.post-body h2 {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  letter-spacing: -.3px; margin: 1.9em 0 .5em; line-height: 1.3;
}
.post-body h3 {
  font-family: var(--serif); font-size: 1.22rem; font-weight: 700;
  margin: 1.6em 0 .4em;
}
.post-body a {
  color: var(--accent); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.post-body code {
  font-family: var(--mono); font-size: .9em;
  background: var(--bg-code); padding: 2px 6px; border-radius: 4px;
}
.post-body pre code {
  padding: 0; background: transparent; border-radius: 0; font-size: inherit;
}
.post-body ul, .post-body ol { margin: 1em 0; padding-left: 1.5em; }
.post-body li { margin: .35em 0; }
.post-body blockquote {
  margin: 1.4em 0; padding: 2px 18px;
  border-left: 3px solid var(--line);
  color: var(--ink-soft); font-style: italic;
}
.post-body img { max-width: 100%; height: auto; border-radius: 4px; }

/* ---------- Post tags + prev/next ---------- */
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 36px 0 0; }
.tag {
  font-family: var(--mono); font-size: .72rem;
  color: var(--ink-soft); background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 3px;
}
.tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.prevnext {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 40px; padding-top: 26px; border-top: 1px dashed var(--line);
}
.prevnext a {
  display: block; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--bg-soft);
}
.prevnext a:hover { border-color: var(--accent); text-decoration: none; }
.prevnext .dir { font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); }
.prevnext .t {
  color: var(--ink); font-weight: 600; font-size: .95rem; margin-top: 4px;
  font-family: var(--serif);
}
.prevnext .next { text-align: right; }

/* ---------- Code blocks: explicit .code / .shell / .highlight ---------- */
.code {
  position: relative; margin: 1.4em .84em;
  background: var(--bg-code); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
.code pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: .85rem; line-height: 1.6; color: var(--ink);
}
.code .copy {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  color: var(--ink-soft); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 9px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center;
}
.code .copy:hover { color: var(--accent); border-color: var(--accent); }
.code .copy svg { width: 13px; height: 13px; }
.cmd { font-family: var(--mono); font-size: .9rem; color: var(--ink-soft); margin: 1.2em .84em .3em; }
.cmd .sigil { color: var(--accent); }

.shell {
  position: relative; margin: 1.4em .84em;
  background: var(--bg-code); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
  font-family: var(--mono); font-size: .85rem; line-height: 1.6;
}
.shell pre { margin: 0; padding: 14px 18px; overflow-x: auto; white-space: pre; color: var(--ink); }
.shell .cmd { padding-right: 70px; }
.shell .cmd::before { content: "$ "; color: var(--accent); font-weight: 700; user-select: none; }
.shell .out { color: var(--ink-soft); border-top: 1px solid var(--line); background: rgba(255,255,255,.015); }
.shell .out:first-child { border-top: none; }
.shell .copy {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  color: var(--ink-soft); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 9px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; z-index: 1;
}
.shell .copy:hover { color: var(--accent); border-color: var(--accent); }
.shell .copy svg { width: 13px; height: 13px; }

.highlight {
  position: relative; margin: 1.4em .84em;
  background: var(--bg-code); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
.highlight pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: .85rem; line-height: 1.6;
}
.highlight .copy {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  color: var(--ink-soft); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 9px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; z-index: 1;
}
.highlight .copy:hover { color: var(--accent); border-color: var(--accent); }
.highlight .copy svg { width: 13px; height: 13px; }
.highlight { background: var(--bg-code) !important; }
.highlight span { background: transparent !important; }

/* Show a vertical scrollbar when code block output exceeds 4 lines.
   Formula: 4 lines × line-height(1.6) × font-size(.85rem) + top+bottom padding(2rem).
   Excluded from slide-deck mode where fitFontSize() already manages overflow. */
.post-body:not(.slide-deck) .highlight pre,
.post-body:not(.slide-deck) .code pre,
.post-body:not(.slide-deck) .shell pre {
  max-height: calc(4 * 1.6 * .85rem + 2rem);
  overflow-y: auto;
}

/* Invisible separator the preprocessor inserts between distinct command/output
   pairs. Breaks the .highlight + .highlight adjacency so each pair is its
   own unified box. */
.shell-break { display: none; }

/* Adjacent .highlight blocks (command + output from the shell preprocessor)
   render as one unified box with a solid 1px divider between them. */
.post-body .highlight + .highlight {
  margin-top: 0;
  border-top: 1px solid var(--line);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.post-body .highlight:has(+ .highlight) {
  margin-bottom: 0;
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ---------- YouTube lite embed ---------- */
.yt-embed {
  position: relative; margin: 1.4em 0;
  aspect-ratio: 16 / 9; background: #000;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line);
}
.yt-embed img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; border-radius: 0;
}
.yt-embed .yt-play {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); border: none; cursor: pointer;
  transition: background .2s;
}
.yt-embed .yt-play:hover { background: rgba(0,0,0,.15); }
.yt-embed .yt-play svg { width: 68px; height: 48px; }
.yt-embed iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}

/* ---------- Shelf (reading list) ---------- */
.shelf-wrap { max-width: none; margin: 0; padding-top: 0; }
.shelf-desc { color: var(--ink-soft); font-size: .9rem; margin: 0 0 2rem; }

.book-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.2rem; }

.book-card {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-card);
}
.book-main { flex: 1; min-width: 0; }

.book-title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; margin-bottom: .2rem; }
a.book-title {
  font-family: var(--serif); font-size: 1.05rem; font-weight: 700;
  color: var(--ink); text-decoration: none;
}
a.book-title:hover { color: var(--accent); text-decoration: underline; }
span.book-title { font-family: var(--serif); font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.book-subtitle { font-family: var(--serif); font-size: .88rem; color: var(--ink-soft); }
.book-author { font-size: .82rem; color: var(--ink-faint); font-family: var(--mono); margin: .2rem 0 .5rem; }
.book-notes { font-size: .88rem; color: var(--ink-soft); margin: 0; line-height: 1.5; }

.book-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: .55rem; flex-shrink: 0; padding-top: .1rem;
}
.book-status {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  padding: 3px 8px; border-radius: 4px; white-space: nowrap;
}
.book-status.reading { color: var(--accent); border: 1px solid var(--accent); }
.book-status.finished { color: var(--ink-faint); border: 1px solid var(--line); }

/* Two-layer star rating: filled stars overlay empty ones, clipped by width */
.star-wrap {
  position: relative; display: inline-block;
  font-size: 1.15rem; letter-spacing: 3px; line-height: 1;
}
.stars-bg { display: block; color: var(--line-hi); user-select: none; }
.stars-fg {
  position: absolute; top: 0; left: 0;
  display: block; overflow: hidden; white-space: nowrap;
  color: #f5c518; pointer-events: none; user-select: none;
}
.rating-0 .stars-fg { width: 0%; }
.rating-1 .stars-fg { width: 2%; }
.rating-2 .stars-fg { width: 4%; }
.rating-3 .stars-fg { width: 6%; }
.rating-4 .stars-fg { width: 8%; }
.rating-5 .stars-fg { width: 10%; }
.rating-6 .stars-fg { width: 12%; }
.rating-7 .stars-fg { width: 14%; }
.rating-8 .stars-fg { width: 16%; }
.rating-9 .stars-fg { width: 18%; }
.rating-10 .stars-fg { width: 20%; }
.rating-11 .stars-fg { width: 22%; }
.rating-12 .stars-fg { width: 24%; }
.rating-13 .stars-fg { width: 26%; }
.rating-14 .stars-fg { width: 28%; }
.rating-15 .stars-fg { width: 30%; }
.rating-16 .stars-fg { width: 32%; }
.rating-17 .stars-fg { width: 34%; }
.rating-18 .stars-fg { width: 36%; }
.rating-19 .stars-fg { width: 38%; }
.rating-20 .stars-fg { width: 40%; }
.rating-21 .stars-fg { width: 42%; }
.rating-22 .stars-fg { width: 44%; }
.rating-23 .stars-fg { width: 46%; }
.rating-24 .stars-fg { width: 48%; }
.rating-25 .stars-fg { width: 50%; }
.rating-26 .stars-fg { width: 52%; }
.rating-27 .stars-fg { width: 54%; }
.rating-28 .stars-fg { width: 56%; }
.rating-29 .stars-fg { width: 58%; }
.rating-30 .stars-fg { width: 60%; }
.rating-31 .stars-fg { width: 62%; }
.rating-32 .stars-fg { width: 64%; }
.rating-33 .stars-fg { width: 66%; }
.rating-34 .stars-fg { width: 68%; }
.rating-35 .stars-fg { width: 70%; }
.rating-36 .stars-fg { width: 72%; }
.rating-37 .stars-fg { width: 74%; }
.rating-38 .stars-fg { width: 76%; }
.rating-39 .stars-fg { width: 78%; }
.rating-40 .stars-fg { width: 80%; }
.rating-41 .stars-fg { width: 82%; }
.rating-42 .stars-fg { width: 84%; }
.rating-43 .stars-fg { width: 86%; }
.rating-44 .stars-fg { width: 88%; }
.rating-45 .stars-fg { width: 90%; }
.rating-46 .stars-fg { width: 92%; }
.rating-47 .stars-fg { width: 94%; }
.rating-48 .stars-fg { width: 96%; }
.rating-49 .stars-fg { width: 98%; }
.rating-50 .stars-fg { width: 100%; }

.book-link {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-faint);
  text-decoration: none; white-space: nowrap;
}
.book-link:hover { color: var(--accent); }

@media (max-width: 560px) {
  .book-card { flex-direction: column; gap: .8rem; }
  .book-meta { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 20px 0; margin-top: auto; }
.foot-inner {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--ink-faint); font-family: var(--mono); font-size: .8rem;
  gap: 14px 24px; flex-wrap: wrap;
}
.foot-inner .hash { color: var(--ink-faint); }
.foot-inner .sigil { color: var(--accent); font-weight: 700; }
.foot-inner .stat { color: var(--ink-faint); }
.foot-inner a { color: var(--ink-soft); }
.foot-inner a:hover { color: var(--accent); }

/* ---------- About page: terminal window ---------- */
.about-wrap { margin: 0; padding-top: 0; }

.terminal {
  background: var(--bg-code);
  border: 1px solid rgba(224,138,79,.35);
  border-radius: 10px;
  overflow: hidden;
  margin: 0 0 28px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.04) inset,
    0 12px 36px rgba(0,0,0,.55),
    0 0 0 1px rgba(224,138,79,.12),
    0 0 24px rgba(224,138,79,.15);
  transition: box-shadow .25s ease, border-color .25s ease;
}
.terminal:hover {
  border-color: rgba(224,138,79,.6);
  box-shadow:
    0 1px 0 rgba(255,255,255,.04) inset,
    0 12px 36px rgba(0,0,0,.55),
    0 0 0 1px rgba(224,138,79,.3),
    0 0 36px rgba(224,138,79,.3);
}
.terminal-bar {
  display: flex; align-items: center;
  padding: 9px 14px;
  background: linear-gradient(180deg, #23262e 0%, #181a22 100%);
  border-bottom: 1px solid #0c0d11;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--ink-faint);
  position: relative;
  min-height: 28px;
}
.terminal-bar .lights {
  display: inline-flex; gap: 7px; align-items: center;
}
.terminal-bar .lights span {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.35) inset, 0 1px 0 rgba(255,255,255,.15) inset;
}
.terminal-bar .lights .red    { background: #ff5f56; }
.terminal-bar .lights .yellow { background: #febc2e; }
.terminal-bar .lights .green  { background: #27c93f; }
.terminal-bar .title {
  position: absolute; left: 50%; transform: translateX(-50%);
  letter-spacing: .02em;
  white-space: nowrap;
}

.motd {
  background: transparent;
  border: none; border-radius: 0;
  padding: 20px 24px 22px;
  font-family: var(--mono);
  font-size: .88rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}
.motd .sigil { color: var(--accent); font-weight: 700; }
.motd .dim { color: var(--ink-faint); }
.motd a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.motd a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

@media (max-width: 520px) {
  .terminal-bar .title { display: none; }
  .motd { padding: 16px 18px; font-size: .82rem; }
}


/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 12px; }
  aside { position: static; margin-top: 24px; }
  .grid { grid-template-columns: 1fr; }
  .feature h2 { font-size: 1.7rem; }
  .post-title { font-size: 1.7rem; }
  .brand { font-size: 1.15rem; }
}
@media (max-width: 520px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 16px; }
  .prevnext { grid-template-columns: 1fr; }
  .brand .slash, .brand .tag { display: none; }
}

/* ============================================================
   Slide presentation mode
   JS adds .slide-mode to <body> and .slide-deck to .post-body.
   A CSS flex chain from body → wrap → layout → main → article
   → slide-deck fills the viewport exactly — no JS pixel math.
   ============================================================ */

/* ── Viewport lock ─────────────────────────────────────────── */
body.slide-mode {
  height: 100vh;
  overflow: hidden;
}

/* Footer not needed while viewing slides */
body.slide-mode footer { display: none; }

/* The .wrap between masthead and footer fills the remaining height */
body.slide-mode > .wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* grid-template-rows:1fr doesn't resolve when the grid container's height
   comes from flexbox — browsers treat it as indefinite and expand to content.
   Solution: JS sets main.style.height directly (one level above slide-deck),
   then the flex chain below it works. overflow:hidden prevents page scroll. */
body.slide-mode {
  overflow: hidden;
}

body.slide-mode main {
  /* height set by slides.js sizeSlides() */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.slide-mode .post-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Slide deck ─────────────────────────────────────────────── */
.slide-deck {
  font-size: clamp(1.2rem, 1.9vw, 1.55rem);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

body.slide-mode .slide-deck {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Individual slides ──────────────────────────────────────── */
/* .slide is a flex item of .slide-deck (flex:1 fills remaining space after
   the nav bar), but uses block layout internally so children stack
   naturally and overflow-y:auto fires a scrollbar when content exceeds
   the slide height.  display:flex would let children flex-shrink to fit,
   preventing overflow — scroll is unreachable even though it is coded. */
.slide {
  display: none;
  flex: 1;
  min-height: 0;
  padding: 20px 0 20px;
  overflow-y: auto;
}

.slide.active { display: block; }

/* Heading: single line with ellipsis */
.slide h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.3vw, 2rem);
  font-weight: 700;
  letter-spacing: -.4px;
  line-height: 1;
  color: var(--accent);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slide ul, .slide ol { margin: 0; padding-left: 1.4em; }
.slide li { margin: .3em 0; }
/* Remove paragraph margins inside list items — prevents the double-gap that
   appears when a blank line before a code block causes Python-Markdown to
   wrap the li content in a <p> tag. */
.slide li > p { margin: 0; }
/* em not rem — propagates into code blocks when fitFontSize scales the slide */
.slide .highlight pre, .slide pre, .slide code {
  font-size: .82em;
}
/* .highlight carries a 1.4em margin from global CSS — collapse it in slides so
   code blocks don't create a huge visual gap next to bullet lists. Also allow
   the wrapper to scroll horizontally so long lines don't get clipped.
   Reduce the inner padding so code blocks don't dominate a dense slide.
   Left margin matches ul padding-left (1.4em) so code blocks align with
   bullet text; right margin equals the same amount for visual balance. */
.slide .highlight {
  margin: .3em .84em;
  overflow-x: auto;
}
.slide .highlight pre {
  padding: 8px 12px;
}
/* slides.js adds .cmd-sep to a .highlight block when it is a command
   following another code block (not output following a command).
   Only those pairs get a gap — command+output pairs keep the global
   merged-box appearance (1px divider, no gap). */
.slide .highlight.cmd-sep {
  margin-top: .8em;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}
.slide .highlight:has(+ .highlight.cmd-sep) {
  margin-bottom: .3em;
  border-bottom: 1px solid var(--line);
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}
/* Tight vertical margins; wrap long lines so they stay visible inside the slide
   without requiring horizontal scroll (pre-wrap preserves indentation). */
.slide pre {
  margin: .3em .84em;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* ── Nav bar ────────────────────────────────────────────────── */
.slide-nav {
  flex-shrink: 0;
  margin-top: 20px;
  border: 1px solid var(--line-hi);
  border-radius: 8px;
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}

/* Meta strip: title · venue · date */
.slide-nav-meta {
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .03em;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  background: var(--bg-soft);
}
.slide-nav-meta .nav-title { color: var(--ink-soft); font-weight: 600; }
.slide-nav-meta .nav-sep   { color: var(--line-hi); margin: 0 2px; }

/* Progress bar */
.slide-progress-bar { height: 2px; background: var(--line); }
.slide-progress {
  height: 100%;
  background: var(--accent);
  transition: width .25s ease;
  width: 0%;
}

/* Controls row */
.slide-nav-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.slide-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--line-hi);
  border-radius: 5px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
  letter-spacing: .02em;
}
.slide-btn .btn-arrow { color: var(--accent); font-size: .9em; }
.slide-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(224,138,79,.07);
}
.slide-btn:disabled { opacity: .25; cursor: default; }

.slide-counter {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink-faint);
  letter-spacing: .15em;
  min-width: 52px;
  text-align: center;
}

@media (max-width: 860px) {
  .slide h2 { font-size: clamp(1.2rem, 5vw, 1.6rem); }
  .slide-deck { font-size: clamp(1rem, 3.5vw, 1.3rem); }
  .slide-nav-meta .nav-venue,
  .slide-nav-meta .nav-sep:last-of-type { display: none; }
}
