/* ============================================================
   Blog Main — screen.css
   shared across index.html, post.html, tag.html
   light-first, dark-toggle via [data-theme="dark"]
   ============================================================ */

/* -- Fonts (placeholder files; system-stack fallback renders while woff2 missing) -- */
@font-face {
  font-family: 'Inter var';
  src: url('../fonts/Inter.var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces.var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   Tokens (from design-tokens.json)
   Light first; dark-theme override below
   ============================================================ */
:root {
  /* brand */
  --brand:        #22d3ee;
  --brand-light:  #67e8f9;
  --brand-dark:   #0891b2;

  /* edition (informational color accents, used on a few tag-chip variants) */
  --edition-universal: #22d3ee;
  --edition-chatgpt:   #10b981;
  --edition-claude:    #f97316;
  --edition-gemini:    #3b82f6;
  --edition-bundle:    #eab308;

  /* LIGHT palette (active by default) */
  --bg:           #f5f6f8;
  --bg-elev-1:    #ffffff;
  --bg-elev-2:    #ffffff;
  --bg-elev-3:    #f9fafb;
  --border:       rgba(15,23,42,0.08);
  --border-strong:rgba(15,23,42,0.14);
  --text:         #0b1220;
  --text-muted:   #4a5568;
  --text-dim:     #7b8596;

  /* accents */
  --success: #10b981;
  --warning: #facc15;
  --danger:  #ef4444;

  /* typography */
  --font-sans:    'Inter var', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Fraunces', 'Newsreader', ui-serif, Georgia, serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;

  /* scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;
  --space-3xl: 100px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --shadow-soft: 0 1px 2px rgba(11,18,32,.06), 0 8px 30px rgba(11,18,32,.05);
  --shadow-lift: 0 2px 6px rgba(11,18,32,.06), 0 14px 40px rgba(11,18,32,.08);

  --container-wide:    1200px;
  --container-reading: 720px;

  /* rule-colors tuned per theme */
  --rule: currentColor;
  --grain-opacity: 0.03;
}

[data-theme="dark"] {
  --bg:           #05070b;
  --bg-elev-1:    #0a0e14;
  --bg-elev-2:    #0f141c;
  --bg-elev-3:    #151b26;
  --border:       rgba(148,163,184,0.08);
  --border-strong:rgba(148,163,184,0.16);
  --text:         #e6edf7;
  --text-muted:   #8995a8;
  --text-dim:     #5b6475;
  --shadow-soft:  0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35);
  --shadow-lift:  0 2px 6px rgba(0,0,0,.5), 0 14px 40px rgba(0,0,0,.45);
  --grain-opacity: 0.05;
}

/* ============================================================
   Reset + base
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body {
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  font-size: 17px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color .2s ease, color .2s ease;
}
@supports (font-variation-settings: normal) {
  body { font-family: 'Inter var', system-ui, sans-serif; }
}

a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: transparent; cursor: pointer; color: inherit; }
img, svg { max-width: 100%; display: block; }
::selection { background: var(--brand); color: #05070b; }

/* variable font axes, dialed in per usage site */
.font-display {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 0;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* ============================================================
   Layout containers
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 24px;
}
.container-reading {
  width: 100%;
  max-width: var(--container-reading);
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
}

/* atmosphere: subtle grid + paper grain */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.page-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, currentColor 1px, transparent 1px),
    linear-gradient(to bottom, currentColor 1px, transparent 1px);
  background-size: 80px 80px;
  color: var(--text);
  opacity: var(--grain-opacity);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 10%, black, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 10%, black, transparent 80%);
}
.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 1100px 600px at 80% -200px, color-mix(in oklab, var(--brand) 8%, transparent), transparent 60%),
    radial-gradient(ellipse 900px 500px at -10% 15%, color-mix(in oklab, var(--edition-claude) 5%, transparent), transparent 65%);
}
[data-theme="dark"] .page-bg::after {
  background:
    radial-gradient(ellipse 1100px 600px at 80% -200px, color-mix(in oklab, var(--brand) 12%, transparent), transparent 60%),
    radial-gradient(ellipse 900px 500px at -10% 15%, color-mix(in oklab, var(--edition-claude) 6%, transparent), transparent 65%);
}

/* ============================================================
   Typography utilities
   ============================================================ */
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--text);
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.5rem, 5.8vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 1;
}
h2 {
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
h3 {
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  line-height: 1.2;
}
h4 {
  font-size: 1.125rem;
  line-height: 1.3;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  font-weight: 500;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}
.eyebrow--center::before { display: none; }

.lede {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 56ch;
  text-wrap: pretty;
}
.accent { color: var(--brand-dark); }
[data-theme="dark"] .accent { color: var(--brand); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 550;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform .15s ease, background .2s, border-color .2s, color .2s, box-shadow .25s;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--text);
  color: var(--bg-elev-1);
  box-shadow: var(--shadow-soft);
}
.btn-primary:hover {
  background: var(--brand-dark);
  color: #ffffff;
}
[data-theme="dark"] .btn-primary {
  background: var(--text);
  color: var(--bg);
}
[data-theme="dark"] .btn-primary:hover {
  background: var(--brand);
  color: #05070b;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}
[data-theme="dark"] .btn-ghost:hover { color: var(--brand); }
.btn-sm {
  height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Site Header / Nav
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 68px;
}
.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 120, "SOFT" 20, "WONK" 0;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.nav-brand-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 2px 6px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-self: center;
  margin-left: 6px;
}
.nav-links {
  display: flex;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-elev-3);
}
.nav-cta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color .2s, border-color .2s, background .2s;
}
.theme-toggle:hover {
  color: var(--brand-dark);
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 6%, transparent);
}
[data-theme="dark"] .theme-toggle:hover { color: var(--brand); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun,
html:not([data-theme="dark"]) .theme-toggle .sun { display: none; }

.nav-mobile-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  place-items: center;
}
.nav-mobile-toggle svg { width: 18px; height: 18px; }
.nav-mobile-menu { display: none; }

@media (max-width: 840px) {
  .nav-links { display: none; }
  .nav-brand-tag { display: none; }
  .nav-mobile-toggle { display: grid; }
  .nav-mobile-menu {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    top: 68px;
    z-index: 49;
    background: color-mix(in oklab, var(--bg) 96%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px 20px;
    transform: translateY(-120%);
    transition: transform .25s ease;
  }
  .nav-mobile-menu.open { transform: translateY(0); }
  .nav-mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .nav-mobile-menu a {
    display: block;
    padding: 14px 14px;
    font-size: 15px;
    color: var(--text);
    border-radius: var(--radius-md);
    min-height: 44px;
  }
  .nav-mobile-menu a[aria-current="page"] { background: var(--bg-elev-3); }
}

/* ============================================================
   A11y utilities
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-md);
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus { left: 10px; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   HOME — Hero
   asymmetric: text column wide, decorative glyph column as echo
   ============================================================ */
.hero {
  position: relative;
  padding: 96px 0 64px;
  overflow: hidden;
}
@media (max-width: 720px) { .hero { padding: 56px 0 40px; } }

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-text {
  max-width: 56rem;
}

.hero-title {
  font-size: clamp(2.75rem, 7.5vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 144, "SOFT" 70, "WONK" 1;
  font-weight: 500;
  margin-top: 24px;
  max-width: 22ch;
}
.hero-title em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  color: var(--brand-dark);
}
[data-theme="dark"] .hero-title em { color: var(--brand); }

.hero-lede {
  margin-top: 28px;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 52ch;
}

.hero-meta-row {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.hero-meta-row .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.hero-meta-row .status-dot {
  color: var(--success);
}
.hero-meta-row em {
  font-style: normal;
  color: var(--text-muted);
  font-weight: 500;
}

/* decorative glyph: large Fraunces watermark behind the hero text */
.hero-glyph {
  position: absolute;
  top: 50%;
  right: -4%;
  transform: translateY(-50%);
  z-index: 0;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  font-weight: 600;
  font-size: clamp(18rem, 38vw, 32rem);
  line-height: 0.85;
  letter-spacing: -0.08em;
  color: transparent;
  -webkit-text-stroke: 1px var(--border-soft);
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}
[data-theme="dark"] .hero-glyph {
  -webkit-text-stroke: 1px var(--border-strong);
  opacity: 0.4;
}
@media (max-width: 720px) {
  .hero-glyph {
    right: -12%;
    font-size: clamp(14rem, 70vw, 22rem);
    opacity: 0.35;
  }
}

/* ============================================================
   Section heads (editorial rule + mono label)
   ============================================================ */
.section {
  padding: 56px 0;
  position: relative;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 40px;
}
.section-head .rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border-strong), transparent);
}
.section-head-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
}
.section-head-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Featured Post Card
   ============================================================ */
.featured-card {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 48px;
  align-items: center;
  padding: 36px 36px 36px 40px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .3s ease, border-color .3s, box-shadow .3s;
}
.featured-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift);
}
.featured-card::before {
  content: "★ FEATURED";
  position: absolute;
  top: 22px;
  left: 40px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--brand-dark);
  font-weight: 600;
}
[data-theme="dark"] .featured-card::before { color: var(--brand); }

.featured-card-body {
  padding-top: 44px;
}
.featured-card h2 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 1;
  font-weight: 500;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-top: 16px;
}
.featured-card-dek {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 48ch;
}
.featured-card-meta {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.featured-card-meta strong {
  color: var(--text);
  font-weight: 500;
}
.featured-card-meta .sep { color: var(--border-strong); }

.featured-card-image {
  aspect-ratio: 4/5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elev-3);
  position: relative;
}
.featured-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 960px) {
  .featured-card {
    grid-template-columns: 1fr;
    padding: 28px 24px;
    gap: 28px;
  }
  .featured-card::before { left: 24px; top: 16px; }
  .featured-card-image { aspect-ratio: 16/9; order: -1; }
  .featured-card-body { padding-top: 28px; }
}

/* ============================================================
   Posts Grid — Recent + Tag Archive
   ============================================================ */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
}
@media (max-width: 960px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 32px 24px; }
}
@media (max-width: 560px) {
  .posts-grid { grid-template-columns: 1fr; gap: 32px; }
}

.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  isolation: isolate;
  position: relative;
}
.post-card-image {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  transition: transform .4s ease, border-color .3s;
}
.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.2,.8,.2,1);
}
.post-card:hover .post-card-image {
  border-color: var(--border-strong);
}
.post-card:hover .post-card-image img {
  transform: scale(1.03);
}

.post-card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--bg-elev-1);
  background: color-mix(in oklab, var(--text) 85%, transparent);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(6px);
}
.post-card-tag[data-edition="chatgpt"] { background: color-mix(in oklab, var(--edition-chatgpt) 88%, transparent); color: #fff; }
.post-card-tag[data-edition="claude"]  { background: color-mix(in oklab, var(--edition-claude)  88%, transparent); color: #fff; }
.post-card-tag[data-edition="gemini"]  { background: color-mix(in oklab, var(--edition-gemini)  88%, transparent); color: #fff; }
.post-card-tag[data-edition="bundle"]  { background: color-mix(in oklab, var(--edition-bundle)  90%, transparent); color: #1a1200; }

.post-card-body { padding-top: 22px; }
.post-card-title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 40, "SOFT" 30, "WONK" 0;
  font-weight: 500;
  font-size: 1.375rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  transition: color .2s;
}
.post-card:hover .post-card-title {
  color: var(--brand-dark);
}
[data-theme="dark"] .post-card:hover .post-card-title { color: var(--brand); }

.post-card-dek {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 42ch;
}
.post-card-meta {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.post-card-meta .sep { color: var(--border-strong); }

/* ============================================================
   Tag Cloud — horizontal strip
   ============================================================ */
.tagcloud-section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tag-cloud {
  display: flex;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .tag-cloud {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .tag-cloud::-webkit-scrollbar { display: none; }
  .tag-cloud li { flex-shrink: 0; }
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: border-color .2s, color .2s, background .2s;
  text-decoration: none;
  white-space: nowrap;
}
.tag-chip::before {
  content: "#";
  color: var(--text-dim);
  font-weight: 500;
}
.tag-chip:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: color-mix(in oklab, var(--brand) 6%, var(--bg-elev-3));
}
[data-theme="dark"] .tag-chip:hover { color: var(--brand); }
.tag-chip-count {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  padding-left: 4px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}

/* ============================================================
   Subscribe Teaser
   ============================================================ */
.subscribe {
  padding: 80px 0;
  position: relative;
}
.subscribe-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: 48px 32px;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  position: relative;
}
.subscribe-inner::before,
.subscribe-inner::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
}
.subscribe-inner::before {
  top: -5px;
  left: -5px;
}
.subscribe-inner::after {
  bottom: -5px;
  right: -5px;
}
.subscribe h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  line-height: 1.1;
}
.subscribe p {
  margin: 14px auto 0;
  max-width: 46ch;
  color: var(--text-muted);
  line-height: 1.55;
}
.subscribe-form {
  margin-top: 28px;
  display: flex;
  gap: 8px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}
.subscribe-form input[type="email"] {
  flex: 1;
  height: 46px;
  padding: 0 16px;
  font: inherit;
  font-family: var(--font-sans);
  background: var(--bg-elev-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: border-color .2s;
}
.subscribe-form input[type="email"]:focus {
  outline: none;
  border-color: var(--brand);
}
.subscribe-footnote {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 560px) {
  .subscribe-form { flex-direction: column; }
  .subscribe-form .btn { width: 100%; }
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  padding: 56px 0 44px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
@media (max-width: 720px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 460px) {
  .footer-top { grid-template-columns: 1fr; }
}
.footer-brand {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 100, "SOFT" 50, "WONK" 1;
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
.footer-brand + p {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 32ch;
  line-height: 1.55;
}
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  margin-bottom: 18px;
  font-weight: 500;
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col a {
  color: var(--text-muted);
  font-size: 14px;
  transition: color .2s;
}
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.footer-bottom a {
  color: var(--text-dim);
  transition: color .2s;
}
.footer-bottom a:hover { color: var(--text); }

/* ============================================================
   POST DETAIL
   ============================================================ */
.post-header {
  padding: 72px 0 40px;
  text-align: center;
}
@media (max-width: 720px) { .post-header { padding: 48px 0 32px; } }

.post-eyebrow {
  justify-content: center;
}
.post-eyebrow::before { display: none; }

.post-title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 80, "WONK" 1;
  font-weight: 500;
  font-size: clamp(2.25rem, 5.5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 20px auto 0;
  max-width: 22ch;
  text-wrap: balance;
}
.post-title em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

.post-dek {
  margin: 24px auto 0;
  max-width: 52ch;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text-muted);
  text-wrap: pretty;
}
.post-meta {
  margin: 32px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.post-meta-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  overflow: hidden;
}
.post-meta-author {
  color: var(--text);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-sans);
  font-size: 14px;
}
.post-meta .sep { color: var(--border-strong); }

/* Feature image: breakout breadcrumb */
.post-feature {
  max-width: 1040px;
  margin: 48px auto 0;
  padding: 0 24px;
}
.post-feature figure {
  margin: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  background: var(--bg-elev-3);
}
.post-feature figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-feature figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-align: center;
}

/* Post body */
.post-body {
  padding: 56px 0 40px;
  font-size: 18px;
  line-height: 1.75;
}
.post-body p {
  margin: 0 0 24px;
  color: var(--text);
  text-wrap: pretty;
}
.post-body > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  font-weight: 500;
  font-size: 5.5em;
  line-height: 0.9;
  float: left;
  margin: 0.02em 0.12em -0.05em 0;
  color: var(--brand-dark);
  letter-spacing: -0.04em;
}
[data-theme="dark"] .post-body > p:first-of-type::first-letter { color: var(--brand); }

.post-body h2,
.post-body h3 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 80, "SOFT" 40, "WONK" 0;
  font-weight: 500;
  margin-top: 48px;
  margin-bottom: 18px;
  letter-spacing: -0.025em;
}
.post-body h2 { font-size: 1.75rem; line-height: 1.15; }
.post-body h3 { font-size: 1.35rem; line-height: 1.25; }

.post-body ul,
.post-body ol {
  padding-left: 1.3em;
  margin: 0 0 28px;
}
.post-body li {
  margin: 10px 0;
  color: var(--text);
}
.post-body li::marker {
  color: var(--text-dim);
}
.post-body ol li::marker {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--brand-dark);
}
[data-theme="dark"] .post-body ol li::marker { color: var(--brand); }

.post-body a {
  color: var(--brand-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, var(--brand-dark) 40%, transparent);
  transition: text-decoration-color .2s;
}
.post-body a:hover {
  text-decoration-color: currentColor;
}
[data-theme="dark"] .post-body a {
  color: var(--brand);
  text-decoration-color: color-mix(in oklab, var(--brand) 40%, transparent);
}

.post-body blockquote {
  margin: 40px 0;
  padding: 0 0 0 28px;
  border-left: 3px solid var(--brand);
  font-family: var(--font-display);
  font-variation-settings: "opsz" 80, "SOFT" 100, "WONK" 1;
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.45;
  color: var(--text);
  letter-spacing: -0.01em;
}
.post-body blockquote cite {
  display: block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-style: normal;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post-body blockquote cite::before { content: "— "; }

.post-body pre {
  margin: 28px 0;
  padding: 22px 24px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  overflow-x: auto;
}
[data-theme="dark"] .post-body pre {
  background: #0b0f15;
}
.post-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}
.post-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.post-body kbd {
  font-family: var(--font-mono);
  font-size: 0.82em;
  padding: 2px 7px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

.post-body figure {
  margin: 40px 0;
}
.post-body figure img {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.post-body figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-align: center;
}

/* Section divider (mono dingbat) */
.post-body hr,
.post-divider {
  border: 0;
  margin: 48px 0;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.8em;
}
.post-divider::before {
  content: "※ ※ ※";
}

/* Marginalia — floats into the gutter on wide viewports */
.post-body .margin-note {
  display: block;
  margin: 14px 0;
  padding: 14px 16px;
  background: color-mix(in oklab, var(--warning) 8%, var(--bg));
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}
.post-body .margin-note::before {
  content: "NOTE — ";
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--warning);
  font-weight: 600;
}
@media (min-width: 1180px) {
  .post-body .margin-note {
    float: right;
    clear: right;
    width: 220px;
    margin-right: -260px;
    margin-top: 6px;
    background: transparent;
    border-left: 1px solid var(--border-strong);
    padding: 4px 0 4px 14px;
    font-size: 13px;
  }
  .post-body .margin-note::before {
    display: block;
    margin-bottom: 4px;
  }
}

/* Post footer: tags + share + bio */
.post-footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}
.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.post-share {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.post-share-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--bg-elev-3);
  font: inherit;
  letter-spacing: 0.06em;
  transition: border-color .2s, color .2s;
  cursor: pointer;
}
.post-share-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}
[data-theme="dark"] .post-share-btn:hover { color: var(--brand); }

.author-bio {
  margin-top: 40px;
  padding: 24px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 20px;
  align-items: center;
}
.author-bio-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand-light), var(--edition-gemini));
  display: grid;
  place-items: center;
  color: #05070b;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
}
.author-bio h3 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 72, "SOFT" 60, "WONK" 1;
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0 0 4px;
}
.author-bio p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.5;
}
@media (max-width: 520px) {
  .author-bio { grid-template-columns: 1fr; text-align: center; }
  .author-bio-avatar { margin: 0 auto; }
}

/* Related section reuses posts-grid; render 3 cards */
.related-section {
  padding: 72px 0 40px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TAG ARCHIVE
   ============================================================ */
.tag-hero {
  padding: 72px 0 40px;
}
.tag-hero-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 20px;
}
.tag-hero-label::before {
  content: "#";
  font-size: 14px;
  color: var(--brand-dark);
  font-weight: 600;
}
[data-theme="dark"] .tag-hero-label::before { color: var(--brand); }

.tag-title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  font-weight: 500;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0 0 20px;
}
.tag-description {
  max-width: 56ch;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.tag-meta-row {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tag-meta-row strong {
  color: var(--text);
  font-weight: 500;
}
.tag-meta-row .sep { color: var(--border-strong); }

.pagination {
  padding: 56px 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.pagination a,
.pagination span {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background .2s, color .2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.pagination a:hover { background: var(--bg-elev-3); color: var(--brand-dark); }
[data-theme="dark"] .pagination a:hover { color: var(--brand); }
.pagination .pg-disabled {
  color: var(--text-dim);
  pointer-events: none;
}
.pagination-center {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Animations (entrance, reduced-motion safe)
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-eyebrow,
  .hero-title,
  .hero-lede,
  .hero-meta-row {
    animation: fadeUp .6s cubic-bezier(.2,.8,.2,1) both;
  }
  .hero-title  { animation-delay: .08s; }
  .hero-lede   { animation-delay: .16s; }
  .hero-meta-row { animation-delay: .24s; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .site-header, .site-footer, .subscribe, .page-bg { display: none; }
  body { background: #fff; color: #000; }
  .post-body { font-size: 12pt; }
}

/* ============================================================
   Koenig (Ghost editor) content-layout classes
   Required by gscan — apply to wide/full images in post body
   ============================================================ */
.post-body .kg-width-wide {
  max-width: calc(var(--reading-width, 72ch) + 12rem);
  margin-left: 50%;
  transform: translateX(-50%);
}
.post-body .kg-width-full {
  max-width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}
.post-body .kg-width-wide img,
.post-body .kg-width-full img {
  width: 100%;
  height: auto;
}
