/* =====================================================================
   BYTE — a crisp engineering journal / developer blog template
   Design: blue-black ink + cool paper + coral "signal" accent,
           syntax-lit code blocks, monospace datalines. Light + dark.
   Type:   Bricolage Grotesque (display) · IBM Plex Sans (body)
           · JetBrains Mono (code + metadata accents)
   Author: uiCookies — free for personal & commercial use
   ===================================================================== */

/* ---------------------------------------------------------------------
   0. Tokens — light is the default; dark overrides below
   ------------------------------------------------------------------- */
:root {
  /* neutral ink ramp (blue-tinted, never pure grey) */
  --ink:        #12151d;   /* headings / primary text */
  --ink-2:      #2b323f;   /* strong body            */
  --ink-soft:   #58616f;   /* muted body / meta      */
  --ink-faint:  #8b93a1;   /* captions               */

  /* surfaces */
  --paper:      #f5f6f9;   /* page background (cool)  */
  --paper-2:    #eceff4;   /* alt band                */
  --card:       #ffffff;   /* card surface            */
  --line:       #dce0e8;   /* hairline rules          */
  --line-2:     #c8cedb;   /* stronger rule           */

  /* brand — coral "signal" */
  --brand:      #e5484d;
  --brand-2:    #cf3b40;   /* hover / pressed         */
  --brand-tint: #fdecec;   /* soft coral wash         */
  --brand-ink:  #a12a2e;   /* coral text on light     */

  /* code surface (always dark, both themes) */
  --code-bg:    #14181f;
  --code-bg-2:  #1b212b;
  --code-line:  #262d3a;
  --code-text:  #c9d3e0;
  --code-dim:   #6b7688;
  --tok-key:    #ff7b72;   /* keyword    */
  --tok-str:    #9ecb6b;   /* string     */
  --tok-num:    #e6a15a;   /* number     */
  --tok-fn:     #6cb6ff;   /* function   */
  --tok-var:    #f2a86b;   /* variable   */
  --tok-com:    #718096;   /* comment    */
  --tok-punc:   #9fb0c4;   /* punctuation*/
  --tok-tag:    #7ee787;   /* tag/attr   */

  /* fonts */
  --font-display: "Bricolage Grotesque", "Bricolage Grotesque Placeholder", Georgia, serif;
  --font-body:    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* type scale */
  --fs-mega:  clamp(2.55rem, 6vw, 4.4rem);
  --fs-h1:    clamp(1.95rem, 4.2vw, 3rem);
  --fs-h2:    clamp(1.5rem, 3vw, 2.1rem);
  --fs-h3:    clamp(1.15rem, 2vw, 1.42rem);
  --fs-kick:  0.72rem;

  /* layout */
  --maxw:   1200px;
  --gutter: clamp(1.1rem, 3.4vw, 2.2rem);
  --radius: 8px;
  --radius-sm: 5px;
  --shadow-sm: 0 1px 2px rgba(18,21,29,.06), 0 1px 1px rgba(18,21,29,.04);
  --shadow: 0 14px 36px -22px rgba(18,21,29,.32);
  --shadow-lift: 0 26px 54px -28px rgba(18,21,29,.42);
  --ease: cubic-bezier(.22,.61,.36,1);
}

:root[data-theme="dark"] {
  --ink:        #e9edf3;
  --ink-2:      #cbd3de;
  --ink-soft:   #98a2b2;
  --ink-faint:  #6f7a8b;

  --paper:      #0d0f14;
  --paper-2:    #12151c;
  --card:       #161a22;
  --line:       #242a35;
  --line-2:     #2f3644;

  --brand:      #ff5f63;
  --brand-2:    #ff787c;
  --brand-tint: #241417;
  --brand-ink:  #ff8c8f;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 18px 40px -22px rgba(0,0,0,.7);
  --shadow-lift: 0 30px 60px -28px rgba(0,0,0,.75);
}

/* Follow OS preference when the user hasn't chosen (no data-theme set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ink:        #e9edf3;
    --ink-2:      #cbd3de;
    --ink-soft:   #98a2b2;
    --ink-faint:  #6f7a8b;
    --paper:      #0d0f14;
    --paper-2:    #12151c;
    --card:       #161a22;
    --line:       #242a35;
    --line-2:     #2f3644;
    --brand:      #ff5f63;
    --brand-2:    #ff787c;
    --brand-tint: #241417;
    --brand-ink:  #ff8c8f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 18px 40px -22px rgba(0,0,0,.7);
    --shadow-lift: 0 30px 60px -28px rgba(0,0,0,.75);
  }
}

/* ---------------------------------------------------------------------
   1. Base
   ------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.62;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

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

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -.015em;
  margin: 0;
  color: var(--ink);
}

a { color: var(--brand-ink); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--brand-2); }

p { margin: 0 0 1.1rem; }
p:last-child { margin-bottom: 0; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); width: 100%; }
.section { padding-block: clamp(3rem, 7vw, 5.4rem); }
.section--tight { padding-block: clamp(2.2rem, 4.5vw, 3.4rem); }

/* skip link */
.skip-link {
  position: absolute; left: .7rem; top: -3.2rem;
  background: var(--brand); color: #fff; padding: .6rem 1rem;
  border-radius: var(--radius-sm); z-index: 1200; font-weight: 600;
  font-size: .88rem; transition: top .18s var(--ease);
  font-family: var(--font-mono);
}
.skip-link:focus { top: .7rem; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------------
   2. Reusable atoms
   ------------------------------------------------------------------- */
.mono { font-family: var(--font-mono); }

.kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-kick);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brand-ink);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.kicker::before {
  content: "";
  width: 1.5rem; height: 2px;
  background: var(--brand);
  display: inline-block;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.sec-head { margin-bottom: clamp(1.6rem, 3vw, 2.4rem); }
.sec-head h2 { font-size: var(--fs-h2); margin-top: .5rem; }
.sec-head p { color: var(--ink-soft); margin-top: .6rem; max-width: 54ch; }
.sec-head--row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
}

/* buttons */
.btn {
  --_bg: var(--brand); --_fg: #fff; --_bd: var(--brand);
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-weight: 600; font-size: .86rem;
  letter-spacing: .01em;
  padding: .72rem 1.15rem; border-radius: var(--radius-sm);
  background: var(--_bg); color: var(--_fg);
  border: 1px solid var(--_bd);
  cursor: pointer; transition: transform .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
  text-decoration: none; line-height: 1;
}
.btn:hover { color: var(--_fg); background: var(--brand-2); border-color: var(--brand-2); transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(229,72,77,.6); }
.btn:active { transform: translateY(0); }
.btn svg { width: 1.05em; height: 1.05em; }

.btn--ghost {
  --_bg: transparent; --_fg: var(--ink); --_bd: var(--line-2);
}
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-soft); box-shadow: none; }

.btn--code {
  --_bg: var(--code-bg-2); --_fg: var(--code-text); --_bd: var(--code-line);
}
.btn--code:hover { background: #232b37; color: #fff; border-color: #384252; box-shadow: none; }

/* language chip (github-style colored dot) */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .02em;
  padding: .28rem .55rem; border-radius: 999px;
  background: var(--paper-2); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.chip .dot { width: .58rem; height: .58rem; border-radius: 50%; background: var(--dot, var(--brand)); flex: none; }
.chip--plain { background: transparent; }

/* language dot palette */
.lang-js   { --dot: #e3c220; }
.lang-ts   { --dot: #3178c6; }
.lang-rust { --dot: #d08b5b; }
.lang-go   { --dot: #00add8; }
.lang-py   { --dot: #4b8bbe; }
.lang-cpp  { --dot: #ef476f; }
.lang-sh   { --dot: #57a64a; }
.lang-sql  { --dot: #d67e2b; }

/* meta line */
.meta {
  font-family: var(--font-mono); font-size: .76rem; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-faint); display: inline-block; }

/* byline w/ avatar */
.byline { display: inline-flex; align-items: center; gap: .55rem; }
.byline img {
  width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line-2); background: var(--paper-2); flex: none;
}
.byline b { font-weight: 600; color: var(--ink); font-size: .82rem; }
.byline .m { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-faint); }

/* ---------------------------------------------------------------------
   3. Header
   ------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.site-header.scrolled { box-shadow: var(--shadow-sm); border-bottom-color: var(--line-2); }
.site-header .bar {
  display: flex; align-items: center; gap: 1.25rem;
  height: 64px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: .05rem;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.28rem;
  letter-spacing: -.02em; color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand .b-accent { color: var(--brand); }
.brand .caret {
  display: inline-block; width: .55rem; height: 1.05rem; margin-left: .12rem;
  background: var(--brand); border-radius: 1px;
  transform: translateY(.12rem);
  animation: blink 1.15s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .brand .caret { animation: none; } }

.main-nav { display: flex; align-items: center; gap: .25rem; margin-left: .5rem; }
.main-nav a {
  font-family: var(--font-mono); font-size: .82rem; font-weight: 500;
  color: var(--ink-soft); padding: .5rem .7rem; border-radius: var(--radius-sm);
  letter-spacing: .01em;
}
.main-nav a:hover { color: var(--ink); background: var(--paper-2); }
.main-nav a[aria-current="page"] { color: var(--brand-ink); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); cursor: pointer;
  transition: background-color .15s var(--ease), color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* theme toggle icon swap */
.theme-toggle .i-sun { display: none; }
.theme-toggle .i-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .i-moon { display: none; }
}

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .main-nav {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: .6rem var(--gutter) 1rem; margin: 0;
    transform: translateY(-135%); transition: transform .28s var(--ease);
    box-shadow: var(--shadow);
  }
  .main-nav.open { transform: translateY(0); }
  .main-nav a { padding: .8rem .4rem; border-bottom: 1px solid var(--line); font-size: .95rem; }
  .nav-toggle { display: inline-grid; }
}

/* ---------------------------------------------------------------------
   4. Hero — featured post + terminal snippet
   ------------------------------------------------------------------- */
.hero { padding-block: clamp(2.2rem, 5vw, 3.8rem); }
.hero-grid {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(1.4rem, 3vw, 2.4rem);
  align-items: stretch;
}
@media (max-width: 940px) { .hero-grid { grid-template-columns: 1fr; } }

.feature-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.feature-media {
  position: relative; aspect-ratio: 16 / 9; background: var(--paper-2);
  overflow: hidden;
}
.feature-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature-media .tag-abs {
  position: absolute; left: .9rem; top: .9rem; z-index: 2;
}
.feature-body { padding: clamp(1.2rem, 2.4vw, 1.7rem); display: flex; flex-direction: column; gap: .85rem; flex: 1; }
.feature-body h1 { font-size: var(--fs-h1); }
.feature-body h1 a { color: var(--ink); }
.feature-body h1 a:hover { color: var(--brand-ink); }
.feature-body .excerpt { color: var(--ink-soft); font-size: 1.02rem; }
.feature-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .4rem; flex-wrap: wrap; }

/* terminal window */
.terminal {
  display: flex; flex-direction: column;
  background: var(--code-bg); border: 1px solid var(--code-line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  min-height: 100%;
}
.term-bar {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .95rem; background: var(--code-bg-2);
  border-bottom: 1px solid var(--code-line);
}
.term-dots { display: inline-flex; gap: .42rem; }
.term-dots i { width: .72rem; height: .72rem; border-radius: 50%; display: block; }
.term-dots i:nth-child(1){ background:#ff5f57; } .term-dots i:nth-child(2){ background:#febc2e; } .term-dots i:nth-child(3){ background:#28c840; }
.term-title { font-family: var(--font-mono); font-size: .74rem; color: var(--code-dim); margin-left: .3rem; }
.term-title .fn { color: #9aa7bb; }

.code {
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.75;
  color: var(--code-text); margin: 0; padding: 1.1rem 1.2rem;
  overflow-x: auto; tab-size: 2; flex: 1;
}
.code::-webkit-scrollbar { height: 8px; }
.code::-webkit-scrollbar-thumb { background: #2c3644; border-radius: 4px; }
.code .ln { display: block; white-space: pre; }
.code .gutter { color: var(--code-dim); user-select: none; display: inline-block; width: 2.1em; text-align: right; margin-right: 1.1em; opacity: .8; }
.tk-key { color: var(--tok-key); }
.tk-str { color: var(--tok-str); }
.tk-num { color: var(--tok-num); }
.tk-fn  { color: var(--tok-fn); }
.tk-var { color: var(--tok-var); }
.tk-com { color: var(--tok-com); font-style: italic; }
.tk-punc{ color: var(--tok-punc); }
.tk-tag { color: var(--tok-tag); }
.term-foot {
  display: flex; align-items: center; gap: .6rem; justify-content: space-between;
  padding: .6rem .95rem; border-top: 1px solid var(--code-line);
  background: var(--code-bg-2); font-family: var(--font-mono); font-size: .72rem; color: var(--code-dim);
}
.term-foot .ok { color: #28c840; }

/* copy button */
.copy-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-mono); font-size: .7rem; font-weight: 500;
  color: var(--code-dim); background: transparent; border: 1px solid var(--code-line);
  border-radius: 4px; padding: .3rem .5rem; cursor: pointer;
  transition: color .15s, border-color .15s, background-color .15s;
}
.copy-btn:hover { color: #fff; border-color: #3a4556; background: #232b37; }
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn.copied { color: #28c840; border-color: #28c840; }

/* ---------------------------------------------------------------------
   5. Post cards / grid
   ------------------------------------------------------------------- */
.post-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.1rem, 2.4vw, 1.7rem);
}
@media (max-width: 900px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .post-grid { grid-template-columns: 1fr; } }

.pcard {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-2); }
.pcard-media { position: relative; aspect-ratio: 3 / 2; background: var(--paper-2); overflow: hidden; }
.pcard-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.pcard:hover .pcard-media img { transform: scale(1.04); }
.pcard-body { padding: 1.05rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.pcard-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.pcard h3 { font-size: 1.12rem; line-height: 1.22; }
.pcard h3 a { color: var(--ink); }
.pcard h3 a:hover { color: var(--brand-ink); }
.pcard .excerpt { color: var(--ink-soft); font-size: .9rem; margin: 0; }
.pcard-foot { margin-top: auto; padding-top: .5rem; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* ---------------------------------------------------------------------
   6. Code showcase section
   ------------------------------------------------------------------- */
.showcase {
  display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(1.6rem, 3vw, 3rem);
  align-items: center;
}
@media (max-width: 900px) { .showcase { grid-template-columns: 1fr; } }
.showcase .lede h2 { font-size: var(--fs-h2); }
.showcase .lede p { color: var(--ink-soft); margin-top: .9rem; }
.feature-list { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; gap: .85rem; }
.feature-list li { display: flex; gap: .75rem; align-items: flex-start; }
.feature-list .ic {
  flex: none; width: 1.9rem; height: 1.9rem; border-radius: var(--radius-sm);
  display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-ink);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
}
.feature-list .ic svg { width: 1rem; height: 1rem; }
.feature-list b { color: var(--ink); font-weight: 600; }
.feature-list span { color: var(--ink-soft); font-size: .92rem; display: block; }

.code-panel { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--code-line); box-shadow: var(--shadow-lift); }

/* ---------------------------------------------------------------------
   7. Categories / topics
   ------------------------------------------------------------------- */
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(.9rem, 2vw, 1.3rem); }
@media (max-width: 820px) { .topic-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .topic-grid { grid-template-columns: 1fr; } }

.topic {
  display: flex; align-items: center; gap: .9rem;
  padding: 1.05rem 1.1rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none;
  transition: transform .16s var(--ease), border-color .16s, box-shadow .16s;
}
.topic:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-sm); color: inherit; }
.topic .tic {
  flex: none; width: 2.7rem; height: 2.7rem; border-radius: var(--radius-sm);
  display: grid; place-items: center; color: #fff;
  background: var(--tc, var(--brand));
}
.topic .tic svg { width: 1.35rem; height: 1.35rem; }
.topic .t-name { font-family: var(--font-display); font-weight: 700; color: var(--ink); font-size: 1.05rem; line-height: 1.1; }
.topic .t-count { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-faint); margin-top: .18rem; display: block; }
.tc-js   { --tc: #b7900b; } .tc-rust { --tc: #b5622f; } .tc-devops{ --tc: #2c7a5f; }
.tc-sys  { --tc: #37507a; } .tc-web  { --tc: #b4394d; } .tc-ai   { --tc: #6d4aa3; }

/* ---------------------------------------------------------------------
   8. Series + sidebar
   ------------------------------------------------------------------- */
.split { display: grid; grid-template-columns: 1.7fr 1fr; gap: clamp(1.6rem, 3.4vw, 3rem); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.series-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.3rem, 2.6vw, 2rem); box-shadow: var(--shadow-sm);
}
.series-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.series-badge {
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: var(--ink); padding: .3rem .55rem; border-radius: 4px;
}
:root[data-theme="dark"] .series-badge { background: var(--brand); }
.series-head h3 { font-size: var(--fs-h3); }
.series-list { list-style: none; margin: 0; padding: 0; counter-reset: ep; }
.series-list li { display: flex; gap: 1rem; padding: .95rem 0; border-top: 1px solid var(--line); }
.series-list li:first-child { border-top: 0; }
.series-list .num {
  counter-increment: ep; flex: none;
  font-family: var(--font-mono); font-size: .78rem; font-weight: 700; color: var(--brand-ink);
  width: 2.2rem; height: 2.2rem; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper);
}
.series-list .num::before { content: counter(ep, decimal-leading-zero); }
.series-list .txt { display: flex; flex-direction: column; gap: .25rem; }
.series-list .txt a { color: var(--ink); font-weight: 600; font-family: var(--font-display); font-size: 1.02rem; letter-spacing: -.01em; }
.series-list .txt a:hover { color: var(--brand-ink); }
.series-list .done a { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--line-2); }
.series-list .m { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-faint); }

/* sidebar widgets */
.widget { margin-bottom: 1.8rem; }
.widget:last-child { margin-bottom: 0; }
.widget-title {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 .9rem; display: flex; align-items: center; gap: .5rem;
}
.widget-title::before { content: ">"; color: var(--brand); font-weight: 700; }
.popular { list-style: none; margin: 0; padding: 0; counter-reset: pop; }
.popular li { display: flex; gap: .9rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.popular li:last-child { border-bottom: 0; }
.popular .rank { counter-increment: pop; font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem; color: var(--line-2); flex: none; width: 1.5rem; }
.popular .rank::before { content: counter(pop); }
.popular a { color: var(--ink); font-weight: 600; font-size: .92rem; line-height: 1.3; }
.popular a:hover { color: var(--brand-ink); }
.popular .m { display: block; font-family: var(--font-mono); font-size: .7rem; color: var(--ink-faint); margin-top: .3rem; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: .45rem; }
.tag-cloud a {
  font-family: var(--font-mono); font-size: .74rem; color: var(--ink-soft);
  padding: .32rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
}
.tag-cloud a:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-tint); }

.spec-card {
  background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; font-family: var(--font-mono); font-size: .78rem; color: var(--code-text);
}
.spec-card .row { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; }
.spec-card .row + .row { border-top: 1px dashed var(--code-line); }
.spec-card .k { color: var(--code-dim); }
.spec-card .v { color: var(--code-text); }
.spec-card .v.up { color: #28c840; }

/* ---------------------------------------------------------------------
   9. Contributors strip
   ------------------------------------------------------------------- */
.people-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(.9rem, 2vw, 1.4rem); }
@media (max-width: 820px) { .people-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .people-grid { grid-template-columns: 1fr; } }
.person {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .55rem;
  transition: border-color .16s, transform .16s var(--ease);
}
.person:hover { border-color: var(--line-2); transform: translateY(-3px); }
.person img { width: 4.2rem; height: 4.2rem; border-radius: 50%; object-fit: cover; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line-2); background: var(--paper-2); }
.person b { color: var(--ink); font-family: var(--font-display); font-size: 1.02rem; }
.person .role { font-family: var(--font-mono); font-size: .72rem; color: var(--brand-ink); letter-spacing: .02em; }
.person .bio { font-size: .82rem; color: var(--ink-soft); margin: 0; }
.person .socials { display: flex; gap: .5rem; margin-top: .1rem; }
.person .socials a { color: var(--ink-faint); }
.person .socials a:hover { color: var(--brand-ink); }
.person .socials svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------------
   10. Newsletter (terminal input)
   ------------------------------------------------------------------- */
.newsletter { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.nl-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 3vw, 3rem); align-items: center; }
@media (max-width: 820px) { .nl-wrap { grid-template-columns: 1fr; } }
.nl-copy h2 { font-size: var(--fs-h2); }
.nl-copy p { color: var(--ink-soft); margin-top: .8rem; }
.nl-copy .fineprint { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-faint); margin-top: .9rem; }

.nl-terminal { background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.nl-terminal .term-bar { }
.nl-body { padding: 1.2rem; font-family: var(--font-mono); }
.nl-body .prompt { color: var(--code-dim); font-size: .8rem; margin-bottom: .9rem; }
.nl-body .prompt .cmd { color: var(--tok-str); }
.nl-body .prompt .flag { color: var(--tok-fn); }
.nl-form { display: flex; gap: .55rem; flex-wrap: wrap; }
.nl-input {
  flex: 1 1 12rem; min-width: 0;
  background: var(--code-bg-2); border: 1px solid var(--code-line); border-radius: var(--radius-sm);
  color: var(--code-text); font-family: var(--font-mono); font-size: .84rem; padding: .7rem .8rem;
}
.nl-input::placeholder { color: var(--code-dim); }
.nl-input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.nl-msg { font-family: var(--font-mono); font-size: .74rem; color: #28c840; margin-top: .8rem; min-height: 1rem; }

/* ---------------------------------------------------------------------
   11. Footer
   ------------------------------------------------------------------- */
.site-footer { background: var(--ink); color: #c3ccd8; padding-block: clamp(2.6rem, 5vw, 3.8rem) 1.6rem; }
:root[data-theme="dark"] .site-footer { background: #090b0f; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: clamp(1.4rem, 3vw, 2.6rem); }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer .brand { color: #fff; }
.site-footer .brand .caret { animation: none; }
.footer-about p { color: #8b96a5; font-size: .9rem; margin: .9rem 0 1.1rem; max-width: 34ch; }
.footer-social { display: flex; gap: .55rem; }
.footer-social a {
  width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center;
  border: 1px solid #262d38; color: #aab4c1; background: #14181f;
  transition: color .15s, border-color .15s, background-color .15s;
}
.footer-social a:hover { color: #fff; border-color: var(--brand); background: #1c222c; }
.footer-social svg { width: 17px; height: 17px; }
.fcol h4 { color: #fff; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin-bottom: 1rem; }
.fcol ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.fcol a { color: #97a1af; font-size: .88rem; }
.fcol a:hover { color: #fff; }
.footer-bottom {
  margin-top: clamp(2rem, 4vw, 3rem); padding-top: 1.3rem; border-top: 1px solid #232a34;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.footer-bottom p { margin: 0; color: #7c8797; font-size: .8rem; font-family: var(--font-mono); }
.footer-bottom a { color: #b9c2cf; }
.footer-bottom a:hover { color: var(--brand); }
.footer-bottom .built { display: inline-flex; align-items: center; gap: .4rem; }

/* ---------------------------------------------------------------------
   12. post.html — article layout
   ------------------------------------------------------------------- */
.article-hero { padding-block: clamp(1.8rem, 4vw, 2.8rem) 0; }
.breadcrumb { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-faint); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--brand-ink); }
.breadcrumb .sl { color: var(--line-2); }
.article-title { font-size: var(--fs-mega); font-size: clamp(2rem, 4.6vw, 3.2rem); margin: 1rem 0 1rem; max-width: 20ch; }
.article-lead { font-size: 1.18rem; color: var(--ink-soft); max-width: 62ch; margin-bottom: 1.4rem; }
.article-meta { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding-bottom: 1.6rem; border-bottom: 1px solid var(--line); }
.article-figure { margin: clamp(1.6rem, 3vw, 2.4rem) 0 0; }
.article-figure .frame { position: relative; aspect-ratio: 16 / 8; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); border: 1px solid var(--line); }
.article-figure .frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.article-figure figcaption { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-faint); margin-top: .6rem; }

.article-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(1.6rem, 4vw, 3.4rem); align-items: start; }
@media (max-width: 900px) { .article-shell { grid-template-columns: 1fr; } }

/* TOC */
.toc { position: sticky; top: 84px; }
@media (max-width: 900px) { .toc { position: static; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; background: var(--card); } }
.toc h4 { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: .9rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; display: grid; gap: .1rem; }
.toc a {
  display: block; font-size: .84rem; color: var(--ink-soft); padding: .4rem .6rem;
  border-left: 2px solid var(--line); line-height: 1.3;
}
.toc a:hover { color: var(--ink); border-left-color: var(--line-2); }
.toc a.active { color: var(--brand-ink); border-left-color: var(--brand); font-weight: 600; background: var(--brand-tint); }

/* prose */
.prose { max-width: 68ch; font-size: 1.05rem; color: var(--ink-2); }
.prose > h2 { font-size: var(--fs-h2); margin: 2.4rem 0 1rem; scroll-margin-top: 84px; }
.prose > h3 { font-size: var(--fs-h3); margin: 1.9rem 0 .8rem; scroll-margin-top: 84px; }
.prose p { margin: 0 0 1.2rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .5rem; }
.prose li::marker { color: var(--brand); }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 2px; }
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: .86em; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 4px; padding: .1em .4em; color: var(--brand-ink);
}
.prose strong { color: var(--ink); font-weight: 600; }

/* article code blocks */
.codeblock { margin: 1.6rem 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--code-line); box-shadow: var(--shadow-sm); background: var(--code-bg); }
.codeblock .cb-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .55rem .9rem; background: var(--code-bg-2); border-bottom: 1px solid var(--code-line);
}
.codeblock .cb-name { font-family: var(--font-mono); font-size: .72rem; color: var(--code-dim); display: inline-flex; align-items: center; gap: .5rem; }
.codeblock .cb-name .dot { width: .58rem; height: .58rem; border-radius: 50%; }

/* callouts */
.callout {
  display: flex; gap: .9rem; align-items: flex-start;
  padding: 1rem 1.15rem; border-radius: var(--radius); margin: 1.6rem 0;
  border: 1px solid var(--line); background: var(--card);
  border-left: 3px solid var(--co, var(--brand));
}
.callout .co-ic { flex: none; color: var(--co, var(--brand)); margin-top: .1rem; }
.callout .co-ic svg { width: 1.2rem; height: 1.2rem; }
.callout .co-body { font-size: .95rem; color: var(--ink-2); }
.callout .co-body b { display: block; color: var(--ink); font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: .3rem; }
.callout p:last-child { margin-bottom: 0; }
.callout--note { --co: #37507a; }
.callout--tip  { --co: #2c7a5f; }
.callout--warn { --co: #c07b17; }

/* pullquote */
.pullquote { margin: 1.8rem 0; padding: .2rem 0 .2rem 1.4rem; border-left: 3px solid var(--brand); }
.pullquote p { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.35; color: var(--ink); font-weight: 500; letter-spacing: -.01em; }
.pullquote cite { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-faint); font-style: normal; }

/* author bio */
.author-box {
  display: flex; gap: 1.1rem; align-items: flex-start; margin-top: 2.4rem;
  padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
}
.author-box img { width: 4rem; height: 4rem; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--line-2); }
.author-box h4 { font-size: 1.1rem; }
.author-box .role { font-family: var(--font-mono); font-size: .74rem; color: var(--brand-ink); margin: .15rem 0 .5rem; }
.author-box p { font-size: .92rem; color: var(--ink-soft); margin: 0; }

/* related posts (reuse post-grid) */
.related { border-top: 1px solid var(--line); }

/* terminal output block (article) */
.output {
  font-family: var(--font-mono); font-size: .8rem; line-height: 1.7;
  background: var(--code-bg); color: var(--code-text); border: 1px solid var(--code-line);
  border-radius: var(--radius); padding: 1rem 1.15rem; margin: 1.6rem 0; overflow-x: auto;
}
.output .p { color: #28c840; } .output .dim { color: var(--code-dim); } .output .warn { color: var(--tok-num); }

/* ---------------------------------------------------------------------
   13. utilities
   ------------------------------------------------------------------- */
.band { background: var(--paper-2); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mt-0 { margin-top: 0; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }
