/* ── Tokens ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --radius-sm:  2px;
  --radius-md:  4px;
  --radius-lg:  6px;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono:  "SF Mono", "Fira Code", "Cascadia Code", monospace;
  --transition: 0.1s ease-out;
}

[data-theme="dark"] {
  --bg:               #303030;
  --dominant:         #202020;
  --accent:           #1A2B3C;
  --text:             #fff;
  --muted:            rgba(255,255,255,0.72);
  --muted-soft:       rgba(255,255,255,0.38);
  --surface:          #252525;
  --surface-raised:   #2c2c2c;
  --border:           rgba(255,255,255,0.06);
  --border-strong:    rgba(255,255,255,0.12);
  --tag-bg:           rgba(26,43,60,0.7);
  --tag-text:         rgba(160,200,255,0.9);
  --code-bg:          #1b1b1bb3;
  --code-text:        #cfcfcf;
  --link:             #6ab0f5;
  --link-hover:       #90c8ff;
  --pill-active-bg:   #fff;
  --pill-active-text: #202020;
  --shadow:           0 2px 12px rgba(0,0,0,.4);
  --shadow-hover:     0 6px 24px rgba(0,0,0,.55);
  --blockquote-border:#6ab0f5;
}

[data-theme="light"] {
  --bg:               #f5f4f0;
  --dominant:         #fff;
  --accent:           #e8f0fe;
  --text:             #1a1a1a;
  --muted:            rgba(0,0,0,.6);
  --muted-soft:       rgba(0,0,0,.35);
  --surface:          #fff;
  --surface-raised:   #fafafa;
  --border:           rgba(0,0,0,.06);
  --border-strong:    rgba(0,0,0,.14);
  --tag-bg:           rgba(26,43,60,.08);
  --tag-text:         #1A4A7C;
  --code-bg:          #eef2fa;
  --code-text:        #1a4a7c;
  --link:             #1a6bb5;
  --link-hover:       #0d4e8a;
  --pill-active-bg:   #1a1a1a;
  --pill-active-text: #fff;
  --shadow:           0 2px 8px rgba(0,0,0,.08);
  --shadow-hover:     0 6px 20px rgba(0,0,0,.14);
  --blockquote-border:#1a6bb5;
}

/* ── Lucide icons ─────────────────────────────────────────────────────────── */
/* default inline icon size — inherits current colour */
[data-lucide] {
  display: inline-block;
  vertical-align: middle;
  width:  1em;
  height: 1em;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}
/* slightly larger when used inside nav links */
.nav-link [data-lucide],
.theme-btn [data-lucide] {
  width:  14px;
  height: 14px;
}
/* inline icons dropped into prose via :icon-name: */
.md-icon {
  width:  1.1em;
  height: 1.1em;
  margin: 0 2px;
  position: relative;
  top: -1px;
}
/* steps badge icon */
.steps-badge [data-lucide] {
  width:  11px;
  height: 11px;
  margin-right: 3px;
}
/* read button arrow */
.read-btn [data-lucide] {
  width:  14px;
  height: 14px;
  transition: transform 0.08s ease-out;
}
.read-btn:hover [data-lucide] { transform: translateX(4px); }

/* back link arrow */
.back [data-lucide] {
  width:  14px;
  height: 14px;
  transition: transform 0.08s ease-out;
}
.back:hover [data-lucide] { transform: translateX(-3px); }

/* ── Base ─────────────────────────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--link-hover); }

/* ── Nav ──────────────────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background 0.15s ease-out, border-color 0.15s ease-out, backdrop-filter 0.15s ease-out;
}
nav.scrolled {
  background: var(--dominant);
  border-bottom: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--link);
  display: inline-block;
}

/* ── Site info modal (triggered by the nav brand on the home page) ───────── */
.site-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.site-modal[hidden] { display: none; }
.site-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.site-modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  max-width: 420px;
  width: 100%;
  padding: 32px 32px 28px;
  color: var(--text);
}
.site-modal-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-modal-card h2 .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--link);
}
.site-modal-about {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 22px;
}
.site-modal-stats {
  margin: 0;
  display: grid;
  gap: 12px;
}
.site-modal-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.site-modal-stats dt {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}
.site-modal-stats dd {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0;
}
.site-modal-stats a { color: var(--link); text-decoration: none; }
.site-modal-stats a:hover { text-decoration: underline; }
.site-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.site-modal-close:hover { color: var(--text); background: var(--tag-bg); }

.nav-right { display: flex; align-items: center; gap: 8px; }

.nav-link {
  font-size: .875rem;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover { background: var(--border); color: var(--text); }

.theme-btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition);
}
.theme-btn:hover { color: var(--text); background: var(--surface-raised); }

/* ── Shared atoms ─────────────────────────────────────────────────────────── */
.tag {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 3px 10px;
  border-radius: 999px;
}
.card-tags  { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-sep   { color: var(--muted-soft); font-size: .75rem; }
.meta-date  { font-size: .8rem; color: var(--muted-soft); }
.divider    { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

.pill {
  font-size: .8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.pill:hover  { color: var(--text); border-color: var(--muted-soft); }
.pill.active { background: var(--pill-active-bg); color: var(--pill-active-text); border-color: transparent; }

/* ── Feed layout ──────────────────────────────────────────────────────────── */
.feed-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.feed-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0 14px;
  transition: border-color var(--transition);
}
.search-wrap:focus-within { border-color: var(--link); }
.search-wrap [data-lucide] { width: 15px; height: 15px; color: var(--muted-soft); flex-shrink: 0; }

#search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .9rem;
  padding: 10px 0;
}
#search::placeholder { color: var(--muted-soft); }

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  height: 42px;
  font-size: .85rem;
  font-family: var(--font-sans);
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
}
.filter-toggle:hover   { color: var(--text); border-color: var(--muted-soft); }
.filter-toggle.active  { color: var(--link); border-color: var(--link); background: var(--tag-bg); }
.filter-toggle [data-lucide] { width: 14px; height: 14px; }

.tag-tray {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.15s ease-out, margin-bottom 0.15s ease-out;
  margin-bottom: 0;
}
.tag-tray.open {
  max-height: 400px;
  margin-bottom: 20px;
}

/* "More" pill — looks like a regular pill plus a chevron that flips when open. */
.pill-more { display: inline-flex; align-items: center; gap: 4px; }
.pill-more [data-lucide] { width: 12px; height: 12px; transition: transform 0.15s ease-out; }
.pill-more[aria-expanded="true"] [data-lucide] { transform: rotate(180deg); }

/* Second row of pills revealed by the "More" button. The [hidden] attribute
   (set by the server, removed by JS on click) drives visibility. The explicit
   [hidden] selector wins over the display: flex declaration. */
.tag-more-tray {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.tag-more-tray[hidden] { display: none; }

.feed { display: flex; flex-direction: column; gap: 12px; }

/* ── shared card base ─────────────────────────────────────────────────────── */
.fc-hero, .feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  /* layout + opacity both transition so the search collapse fades cleanly */
  transition: box-shadow 0.1s ease-out, border-color 0.1s ease-out,
              transform 0.08s ease-out, opacity 0.15s ease-out;
}
.fc-hero:hover,  .feed-card:hover  { box-shadow: var(--shadow-hover); border-color: var(--border-strong); transform: scale(1.008); }
.fc-hero:active, .feed-card:active { transform: scale(0.996); transition-duration: 0.05s; }
.fc-hero.hidden, .feed-card.hidden { display: none; }

/* ── Tier 1: hero (first 3) ──────────────────────────────────────────────── */
.fc-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.fc-hero-img {
  background: var(--accent);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  overflow: hidden;
  position: relative;
}
/* Default (fit-fit): image fills the standard box, cropping if needed.
   position: absolute keeps the img from forcing the flex box to balloon
   to the image's natural aspect ratio on desktop. */
.fc-hero-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
/* image_fit: scaled — same fixed-size box, but show the whole image. */
.fc-hero-img.fit-scaled img {
  object-fit: contain;
}
/* image_fit: free — image at its native pixel size, but scaled down if wider
   than the column. Box grows vertically to fit the image. */
.fc-hero-img.fit-free {
  min-height: 0;
  height: auto;
}
.fc-hero-img.fit-free img {
  position: static;
  inset: auto;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.fc-hero-body {
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
}
.fc-hero-body h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.fc-hero-body p {
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* ── Tier 2: compact feed ─────────────────────────────────────────────────── */
.feed-card {
  display: grid;
  grid-template-columns: 100px 1fr;
}
.feed-card-img {
  background: var(--accent);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
  position: relative;
}
.feed-card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
/* image_fit: scaled — same fixed-size box, but show the whole image. */
.feed-card-img.fit-scaled img {
  object-fit: contain;
}
/* image_fit: free — image at its native pixel size, but scaled down if wider
   than the column. Box grows vertically to fit the image. */
.feed-card-img.fit-free {
  min-height: 0;
  height: auto;
}
.feed-card-img.fit-free img {
  position: static;
  inset: auto;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.feed-card-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 100px;
  overflow: hidden;
}
.feed-card-body h2 {
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
  color: var(--text);
  max-height: calc(.875rem * 1.3 * 2);
  overflow: hidden;
}
.feed-card-body p {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.5;
  max-height: calc(.78rem * 1.5 * 1);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.feed-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Feed section labels ──────────────────────────────────────────────────── */
.feed-section-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-soft);
  margin-bottom: 2px;
}

.feed-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  color: var(--muted-soft);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.feed-divider::before,
.feed-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* hide labels when searching */
.feed.searching .feed-section-label,
.feed.searching .feed-divider { display: none; }

/* ── Search mode: collapse hero cards to compact size ─────────────────────── */
.feed.searching .fc-hero {
  grid-template-columns: 100px 1fr;
}
.feed.searching .fc-hero-img {
  min-height: 100px;
  font-size: 2rem;
}
.feed.searching .fc-hero-body {
  padding: 16px 20px;
  gap: 4px;
  min-height: 80px;
}
.feed.searching .fc-hero-body h2 {
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.3;
  -webkit-line-clamp: 1;
}
.feed.searching .fc-hero-body p {
  font-size: .78rem;
  line-height: 1.5;
  -webkit-line-clamp: 1;
  white-space: unset;
  text-overflow: unset;
}
.feed.searching .read-btn { display: none; }

.feed-card-body h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.3;
  color: var(--text);
}

.feed-card-body p {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.feed-empty {
  text-align: center;
  color: var(--muted-soft);
  font-size: .9rem;
  padding: 48px 0;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero { max-width: 1100px; margin: 0 auto; padding: 64px 24px 40px; text-align: center; }

.hero-label {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.hero p { font-size: 1.05rem; color: var(--muted); max-width: 520px; margin: 0 auto 32px; }

/* ── Filter bar ───────────────────────────────────────────────────────────── */
.filter-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 32px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Featured card ────────────────────────────────────────────────────────── */
.featured-wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px 40px; }

.featured-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  box-shadow: var(--shadow);
  transition: box-shadow 0.1s ease-out, border-color 0.1s ease-out, transform 0.08s ease-out;
  color: inherit;
}
.featured-card:hover  { box-shadow: var(--shadow-hover); border-color: var(--border-strong); transform: scale(1.008); }
.featured-card:active { transform: scale(0.995); transition-duration: 0.05s; }

.featured-img {
  background: var(--accent);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}
.featured-body {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.featured-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.featured-body h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.featured-body p  { font-size: .95rem; color: var(--muted); line-height: 1.7; }

.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--link);
  transition: gap 0.08s ease-out, color 0.08s ease-out;
}
.read-btn:hover { gap: 12px; color: var(--link-hover); }

/* ── Article grid ─────────────────────────────────────────────────────────── */
.grid-wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px 80px; }

.section-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-soft);
  margin-bottom: 20px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.1s ease-out, border-color 0.1s ease-out, transform 0.08s ease-out;
  color: inherit;
  text-decoration: none;
}
.card:hover  { box-shadow: var(--shadow-hover); border-color: var(--border-strong); transform: scale(1.015); }
.card:active { transform: scale(0.985); box-shadow: var(--shadow); transition-duration: 0.05s; }

.card-icon   { font-size: 1.5rem; margin-bottom: 4px; }
.card h3     { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.35; }
.card p      { font-size: .875rem; color: var(--muted); line-height: 1.65; flex: 1; }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.card-date   { font-size: .78rem; color: var(--muted-soft); }
.steps-badge { font-size: .72rem; font-weight: 600; color: var(--muted-soft); }

/* ── Article page ─────────────────────────────────────────────────────────── */
.article-page { max-width: 680px; margin: 0 auto; padding: 48px 24px 96px; }

/* row that holds .back and .share-btn side by side */
.article-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.article-page .back {
  font-size: .85rem;
  color: var(--muted-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition);
}
.article-page .back:hover { color: var(--text); }

/* share button */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  font-family: inherit;
}
.share-btn:hover { color: var(--text); background: var(--border); }
.share-btn [data-lucide] { width: 15px; height: 15px; stroke-width: 2; }
.share-btn.copied { color: var(--link); }

.article-header { margin-bottom: 32px; }
.article-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.2;
  color: var(--text);
  margin: 12px 0 8px;
}
.article-byline {
  font-size: .85rem;
  color: var(--muted-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Prose ────────────────────────────────────────────────────────────────── */
.prose p          { font-size: 1rem; line-height: 1.85; color: var(--muted); margin-bottom: 1.2em; }
.prose h2         { font-size: 1.35rem; font-weight: 700; color: var(--text); margin: 2em 0 .6em; letter-spacing: -.015em; }
.prose h3         { font-size: 1.1rem;  font-weight: 700; color: var(--text); margin: 1.8em 0 .5em; letter-spacing: -.01em; }
.prose ul         { padding-left: 1.4em; margin-bottom: 1.2em; }
.prose li         { font-size: 1rem; line-height: 1.75; color: var(--muted); margin-bottom: .3em; }
.prose strong     { color: var(--text); font-weight: 600; }
.prose del        { color: var(--muted-soft); }
.prose hr.divider { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* ── Images ──────────────────────────────────────────────────────────────── */
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.75em auto;
  display: block;
  border: 1px solid var(--border);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin: 1.75em 0;
  overflow-x: auto;
  display: block;
}
.prose thead tr {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}
.prose th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.prose td {
  padding: 9px 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.prose tbody tr:last-child td { border-bottom: none; }
.prose tbody tr:hover { background: var(--surface); }

.prose code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2px 6px;
  border-radius: 4px;
}

.prose blockquote {
  border-left: 3px solid var(--blockquote-border);
  padding: 10px 16px;
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  font-size: .95rem;
  color: var(--muted);
}

/* ── Step blocks ──────────────────────────────────────────────────────────── */
.step-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--link);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
}
.step-num { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--link); margin-bottom: 4px; }
.step-block p { margin: 0; font-size: .9rem; color: var(--muted); }

/* ── Code blocks ──────────────────────────────────────────────────────────── */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 16px 0;
  overflow-x: auto;
  position: relative;
}

/* toolbar row: copy button + optional lang label */
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px 10px 0;
  min-height: 28px;
}
.code-lang {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-soft);
  opacity: .7;
}

/* copy button — hidden on desktop until hover, always visible on touch */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted-soft);
  font-family: inherit;
  font-size: .75rem;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.copy-btn [data-lucide] { width: 13px; height: 13px; stroke-width: 2; flex-shrink: 0; }
.code-block:hover .copy-btn  { opacity: 1; }
.copy-btn:hover               { color: var(--text); background: var(--border); }
.copy-btn.copied              { color: var(--link); opacity: 1; }
@media (pointer: coarse) {
  .copy-btn { opacity: 1; } /* touch devices: always show */
}

.code-block code {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--code-text);
  white-space: pre;
  display: block;
  padding: 8px 20px 16px;
  /* reset the inline-pill styles that .prose code adds */
  background: transparent;
  border-radius: 0;
}

/* ── Syntax highlight tokens ──────────────────────────────────────────────── */
.hl-kw   { color: #7ec8e3; }
.hl-str  { color: #f08c5a; }
.hl-cmt  { color: #6a7a6a; font-style: italic; }
.hl-fn   { color: #e8b86d; }
.hl-var  { color: #c792ea; }
.hl-flag { color: #f78c6c; }

[data-theme="light"] .hl-kw   { color: #0550ae; }
[data-theme="light"] .hl-str  { color: #b04400; }
[data-theme="light"] .hl-cmt  { color: #6e7781; }
[data-theme="light"] .hl-fn   { color: #8250df; }
[data-theme="light"] .hl-var  { color: #953800; }
[data-theme="light"] .hl-flag { color: #cf222e; }

/* ── Archive ──────────────────────────────────────────────────────────────── */
.archive-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
.archive-heading {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.025em;
  margin-bottom: 28px;
}
.archive-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}
.archive-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.archive-row:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateX(3px);
}
.archive-row:active { transform: translateX(1px); transition-duration: 0.05s; }
.archive-row.hidden { display: none; }
.archive-row-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.archive-row-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.archive-row-title {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.archive-row-date {
  font-size: .78rem;
  color: var(--muted-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 32px 24px; text-align: center; }
footer p { font-size: .82rem; color: var(--muted-soft); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .featured-card          { grid-template-columns: 1fr; }
  .featured-img           { min-height: 140px; }
  .featured-body          { padding: 24px; }
  .featured-body h2       { font-size: 1.25rem; }
  .fc-hero                { grid-template-columns: 1fr; }
  .fc-hero-img            { min-height: 120px; max-height: 120px; font-size: 2.8rem; }
  .fc-hero-img.fit-free   { min-height: 0; max-height: none; }
  .fc-hero-body           { padding: 18px 20px; min-height: unset; gap: 8px; }
  .fc-hero-body h2        { font-size: 1rem; }
  .fc-hero-body p         { -webkit-line-clamp: 2; }
}

@media (max-width: 600px) {
  /* Nav: stack brand on top, buttons below */
  .nav-inner {
    height: auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px 10px;
    gap: 8px;
  }
  .nav-right {
    gap: 6px;
  }

  /* Hero section: tighten top padding */
  .hero {
    padding: 32px 16px 28px;
  }

  /* Feed + archive: tighten side padding */
  .feed-wrap    { padding: 24px 14px 60px; }
  .filter-bar   { padding: 0 14px 20px; }
  .archive-wrap { padding: 32px 14px 60px; }
  .grid-wrap    { padding: 0 14px 60px; }
  .featured-wrap { padding: 0 14px 28px; }

  /* Article page: tighten side padding */
  .article-page { padding: 32px 14px 72px; }

  /* Archive rows: let title wrap instead of truncating */
  .archive-row-title { white-space: normal; }
}
