/* ============================================================
   DocuTray Blog — shared theme
   Editorial, dev-first, light/dark. Built on the DocuTray system.
   Ported from the Claude Design handoff to a real Ghost theme.
   ============================================================ */

/* ---------- Fonts ----------
   Lexend, Inter y JetBrains Mono se cargan desde Google Fonts (WOFF2 +
   unicode-range subset + CDN) vía el <link> en default.hbs. Las familias se
   referencian abajo en --font-display / --font-sans / --font-mono. */

/* ---------- Brand constants ---------- */
:root {
  --mint:        #56b394;
  --mint-light:  #C2E5D3;
  --mint-50:     #ECF7F1;
  --navy:        #1a1731;

  --font-display: "Lexend", ui-sans-serif, system-ui, sans-serif;
  --font-sans:    "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --maxw: 1200px;
  --read: 720px;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);

  /* Code window is ALWAYS dark (premium, consistent across themes) */
  --code-bg:      #14121f;
  --code-bar:     #1d1a2b;
  --code-border:  rgba(255,255,255,0.07);
  --code-fg:      #cdcad9;
  --code-dim:     #6f6b82;
  --code-mint:    #74d7af;
  --code-mint-2:  #a8e6cd;
  --code-key:     #74d7af;
  --code-str:     #b9e8d4;
  --code-num:     #e8e4f2;
  --code-prop:    #efedf6;
  --code-comment: #6f6b82;
}

/* ---------- Light theme (default) ---------- */
:root, [data-theme="light"] {
  --bg:        #ffffff;
  --bg-soft:   #f7f8f9;
  --bg-sunken: #f1f2f4;
  --card:      #ffffff;
  --card-hover:#fbfcfc;
  --border:    #e7e8ec;
  --border-strong: #d8dade;
  --fg:        #16131f;
  --fg-2:      #4b5563;
  --fg-3:      #8a8f99;
  --accent:        var(--mint);
  --accent-text:   #1f8d68;   /* AA-contrast mint for small text on white */
  --accent-soft:   #ECF7F1;
  --accent-border: rgba(86,179,148,0.30);
  --shadow-sm: 0 1px 2px rgba(20,18,31,0.05);
  --shadow:    0 4px 14px -6px rgba(20,18,31,0.12);
  --shadow-lg: 0 24px 48px -24px rgba(20,18,31,0.22);
  --ring:      rgba(86,179,148,0.20);
  color-scheme: light;
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg:        #0d0b16;
  --bg-soft:   #131120;
  --bg-sunken: #100e1b;
  --card:      #181527;
  --card-hover:#1d1a2d;
  --border:    rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --fg:        #f4f3f8;
  --fg-2:      #b4b1c4;
  --fg-3:      #817d94;
  --accent:        #74d7af;
  --accent-text:   #79dcb4;
  --accent-soft:   rgba(86,179,148,0.12);
  --accent-border: rgba(116,215,175,0.30);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow:    0 8px 24px -12px rgba(0,0,0,0.6);
  --shadow-lg: 0 30px 60px -28px rgba(0,0,0,0.75);
  --ring:      rgba(116,215,175,0.25);
  color-scheme: dark;
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--mint); color: #08110d; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }
.muted { color: var(--fg-2); }
.accent { color: var(--accent-text); font-style: normal; }
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; background: var(--card); color: var(--fg); padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 16px; height: 1px;
  background: var(--accent);
  display: inline-block;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 28px;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { width: 30px; height: 30px; }
.brand .wm {
  font-family: var(--font-display);
  font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
  color: var(--fg);
}
.brand .wm .t { color: var(--navy); }
[data-theme="dark"] .brand .wm .t { color: #cfe9df; }
.brand .tag {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-full);
  padding: 2px 9px;
  letter-spacing: 0.04em;
}

.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav a {
  font-size: 14.5px; font-weight: 500; color: var(--fg-2);
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav a:hover { color: var(--fg); background: var(--bg-soft); }
.nav a.active { color: var(--accent-text); }
.nav a.ext { color: var(--fg-3); }
.nav a.ext::after { content: " ↗"; font-size: 11px; opacity: 0.7; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg-2);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .moon { display: none; }
[data-theme="dark"] .icon-btn .sun { display: none; }
[data-theme="dark"] .icon-btn .moon { display: block; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.btn-primary { background: var(--mint); color: #08110d; }
.btn-primary:hover { background: #4aa888; transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(86,179,148,0.6); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); }

.menu-btn { display: none; }

/* mobile drawer */
.drawer[hidden] { display: none !important; }
.drawer { position: fixed; inset: 68px 0 0; z-index: 40; background: var(--bg); padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.drawer a { padding: 14px 8px; font-size: 18px; font-weight: 600; border-bottom: 1px solid var(--border); }
.drawer a.ext { color: var(--fg-3); border-bottom: none; }

/* ============================================================
   Tag chips
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 4px 11px;
  border-radius: var(--radius-full);
  transition: all 0.18s var(--ease);
}
.chip.solid { background: var(--mint); color: #08110d; border-color: transparent; }
a.chip:hover { background: var(--mint); color: #08110d; border-color: transparent; }
button.chip { cursor: pointer; }

/* tag filter row */
.tag-filter { display: flex; flex-wrap: wrap; gap: 9px; }
.tag-filter .chip { font-size: 12.5px; padding: 7px 15px; cursor: pointer; }

/* ============================================================
   Article cards
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.post-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
/* Stretched-link pattern: the title link covers the whole card, so the card is
   fully clickable to the post, while the author and tag remain real, separate
   links sitting above the overlay (avoids invalid nested anchors). */
.post-card .card-link { color: inherit; }
.post-card .card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.post-card .meta-top .chip,
.post-card .byline-author { position: relative; z-index: 2; }
.post-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.post-card .thumb {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.post-card .thumb .ph { position: absolute; inset: 0; }
.post-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-card .body { padding: 22px 22px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.post-card .meta-top { display: flex; align-items: center; gap: 10px; }
.post-card h3 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0; color: var(--fg);
  text-wrap: balance;
}
.post-card:hover h3 { color: var(--accent-text); }
.post-card .excerpt {
  font-size: 14.5px; line-height: 1.6; color: var(--fg-2);
  margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card .foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 10px; }

.byline { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--fg-3); }
.byline-author { display: inline-flex; align-items: center; gap: 9px; color: inherit; transition: color 0.16s var(--ease); }
.byline-author:hover { color: var(--accent-text); }
.author-link { color: inherit; display: inline-flex; align-items: center; transition: color 0.16s var(--ease); }
.author-link:hover { color: var(--accent-text); }
.byline .ava { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--mint), var(--navy)); display: grid; place-items: center; font-family: var(--font-sans); font-size: 11px; font-weight: 700; color: #fff; flex: none; overflow: hidden; }
.byline .ava img { width: 100%; height: 100%; object-fit: cover; }
.byline .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; }

/* ============================================================
   Home — hero + listing
   ============================================================ */
.hero { padding: 64px 0 24px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.hero-feature .label { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.hero-feature .label .chip { font-size: 12px; }
.hero-feature h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  font-weight: 700; line-height: 1.08; letter-spacing: -0.025em;
  margin: 0 0 20px; text-wrap: balance;
}
.hero-feature h1 a { transition: color 0.18s var(--ease); }
.hero-feature h1 a:hover { color: var(--accent-text); }
.hero-feature .lede { font-size: 18px; line-height: 1.6; color: var(--fg-2); margin: 0 0 28px; max-width: 46ch; }
.hero-feature .cta-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-feature .read-link { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; color: var(--accent-text); }
.hero-feature .read-link svg { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.hero-feature .read-link:hover svg { transform: translateX(4px); }
.hero-feature .byline { font-size: 13.5px; }

/* hero visual (feature image or branded placeholder) */
.hero-visual { position: relative; }
.hero-visual::before {
  content: ""; position: absolute; inset: -40px -30px;
  background: radial-gradient(60% 60% at 70% 30%, var(--accent-soft), transparent 70%);
  z-index: -1; opacity: 0.9;
}
.hero-visual .frame {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: rotate(0.4deg);
  aspect-ratio: 16 / 11;
}
.hero-visual .frame img { width: 100%; height: 100%; object-fit: cover; }
.hero-visual .frame .ph { width: 100%; height: 100%; }
.hero-visual .cap {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-3);
  margin-top: 14px; display: flex; align-items: center; gap: 8px; justify-content: center;
}

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 28px; }
.section-head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 0; }
.listing { padding: 40px 0 8px; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 34px; }
.count { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-3); }

/* ============================================================
   Tag / author archive hero
   ============================================================ */
.tag-hero { padding: 64px 0 8px; border-bottom: 1px solid var(--border); }
.tag-hero .top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.tag-hero h1 { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 700; letter-spacing: -0.03em; margin: 0 0 16px; line-height: 1.05; }
.tag-hero h1 .hash { color: var(--accent-text); font-family: var(--font-mono); font-weight: 500; }
.tag-hero p { font-size: 18px; color: var(--fg-2); max-width: 60ch; margin: 0 0 30px; line-height: 1.6; }
.tag-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 24px 0; }
.empty { text-align: center; padding: 80px 0; color: var(--fg-3); font-family: var(--font-mono); font-size: 14px; }

/* ---- Author profile hero (enriched) ---- */
.author-hero { position: relative; padding: 64px 0 36px; border-bottom: 1px solid var(--border); }
.author-hero.has-cover { padding-top: 0; }
.author-cover { height: 220px; margin-bottom: -64px; background-size: cover; background-position: center; position: relative; }
.author-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, var(--bg)); }
.author-hero.has-cover .container { position: relative; padding-top: 24px; }
.author-card { display: flex; align-items: flex-start; gap: 28px; }
.author-avatar {
  width: 88px; height: 88px; flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--navy));
  display: grid; place-items: center;
  font-family: var(--font-sans); font-weight: 700; color: #fff; font-size: 30px;
  overflow: hidden;
  border: 3px solid var(--bg);
  box-shadow: var(--shadow);
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-info { flex: 1; min-width: 0; }
.author-info h1 { font-family: var(--font-display); font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin: 8px 0 0; }
.author-bio { font-size: 18px; line-height: 1.6; color: var(--fg-2); max-width: 60ch; margin: 16px 0 0; }
.author-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 22px; font-family: var(--font-mono); font-size: 13px; }
.author-meta-item { display: inline-flex; align-items: center; gap: 7px; color: var(--fg-3); transition: color 0.16s var(--ease); }
.author-meta-item svg { width: 15px; height: 15px; flex: none; }
a.author-meta-item:hover { color: var(--accent-text); }
.author-meta-item.count { color: var(--accent-text); }

@media (max-width: 600px) {
  .author-card { flex-direction: column; gap: 18px; }
  .author-avatar { width: 72px; height: 72px; font-size: 26px; }
}

/* ============================================================
   Article / prose (reading column)
   ============================================================ */
.progress-track { position: sticky; top: 68px; z-index: 30; height: 2px; background: transparent; }
.progress-bar { height: 2px; background: var(--mint); transform: scaleX(0); transform-origin: 0 50%; }
.article-head { padding: 56px 0 32px; }
.article-head .wrap { max-width: var(--read); margin: 0 auto; }
.article-head .crumbs { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.article-head h1 { font-family: var(--font-display); font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 20px; text-wrap: balance; }
.article-head .lede { font-size: 20px; line-height: 1.55; color: var(--fg-2); margin: 0 0 28px; }
.article-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 22px; border-top: 1px solid var(--border); }
.article-meta .author { display: flex; align-items: center; gap: 12px; }
.article-meta .author .ava { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--mint), var(--navy)); display: grid; place-items: center; font-family: var(--font-sans); font-weight: 700; color: #fff; font-size: 15px; flex: none; overflow: hidden; }
.article-meta .author .ava img { width: 100%; height: 100%; object-fit: cover; }
.article-meta .author .name { font-weight: 600; font-size: 15px; color: var(--fg); }
.article-meta .author .sub { font-size: 13px; color: var(--fg-3); }
.share-row { display: flex; gap: 8px; }
.feature-img { max-width: 1000px; margin: 8px auto 0; }
.feature-img img { aspect-ratio: 21 / 9; object-fit: cover; border-radius: var(--radius-lg); border: 1px solid var(--border); width: 100%; }
.feature-img .ph { aspect-ratio: 21 / 9; border-radius: var(--radius-lg); border: 1px solid var(--border); }

.prose { max-width: var(--read); margin: 0 auto; padding: 40px 0 8px; font-size: 18px; line-height: 1.75; color: var(--fg-2); }
.prose > * { margin-left: auto; margin-right: auto; }
.prose p { margin: 0 0 24px; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose a { color: var(--accent-text); text-decoration: underline; text-decoration-color: var(--accent-border); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose h2 { font-family: var(--font-display); font-size: 27px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--fg); margin: 48px 0 18px; scroll-margin-top: 90px; }
.prose h3 { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--fg); margin: 36px 0 14px; }
.prose h4 { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--fg); margin: 28px 0 12px; }
.prose ul, .prose ol { margin: 0 0 24px; padding-left: 24px; }
.prose li { margin: 0 0 10px; }
.prose li::marker { color: var(--accent-text); }
.prose img { border-radius: var(--radius); margin: 8px auto 28px; }
.prose .code-window { max-width: 100%; }
.prose blockquote { margin: 32px 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--mint); font-size: 19px; line-height: 1.6; color: var(--fg); font-weight: 500; }
.prose blockquote p { margin: 0 0 12px; }
.prose figcaption, .prose .cap { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-3); text-align: center; margin-top: -16px; margin-bottom: 28px; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 44px auto; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 28px; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.prose th { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-3); }

/* pull callout */
.callout { max-width: var(--read); margin: 32px auto; padding: 20px 22px; background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--radius); font-size: 16.5px; line-height: 1.6; color: var(--fg); }
.callout .k { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); display: block; margin-bottom: 6px; }

/* ============================================================
   Koenig editor cards (Ghost-native content) — match the design system
   ============================================================ */
.kg-card { margin: 0 auto 28px; }
.prose .kg-width-wide { max-width: 1000px; }
.prose .kg-width-full { max-width: var(--maxw); }
.kg-image-card img { border-radius: var(--radius); width: 100%; }
.kg-image-card figcaption, .kg-embed-card figcaption { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-3); text-align: center; margin-top: 10px; }

/* Koenig callout → reuse .callout look */
.kg-callout-card {
  max-width: var(--read); margin: 32px auto; padding: 20px 22px;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: var(--radius); font-size: 16.5px; line-height: 1.6; color: var(--fg);
  display: flex; gap: 14px; align-items: flex-start;
}
.kg-callout-emoji { font-size: 20px; line-height: 1.4; flex: none; }
.kg-callout-text { margin: 0; }
.kg-callout-card-grey, .kg-callout-card-gray { background: var(--bg-soft); border-color: var(--border); }

/* Koenig button card */
.kg-button-card { display: flex; margin: 28px auto; max-width: var(--read); }
.kg-button-card.kg-align-center { justify-content: center; }
.kg-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-size: 14px; font-weight: 600;
  padding: 11px 22px; border-radius: var(--radius-full);
  background: var(--mint); color: #08110d;
}
.kg-btn:hover { background: #4aa888; }

/* Koenig bookmark card */
.kg-bookmark-card { max-width: var(--read); margin: 28px auto; }
.kg-bookmark-container { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); color: inherit; }
.kg-bookmark-content { flex: 1; padding: 18px 20px; }
.kg-bookmark-title { font-weight: 600; color: var(--fg); }
.kg-bookmark-description { color: var(--fg-2); font-size: 14px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kg-bookmark-metadata { font-size: 13px; color: var(--fg-3); margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.kg-bookmark-thumbnail { width: 180px; flex: none; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   Placeholder thumbnail art (dotted, branded)
   ============================================================ */
.ph {
  background:
    radial-gradient(circle at 1px 1px, var(--ph-dot, rgba(86,179,148,0.28)) 1px, transparent 0) 0 0 / 16px 16px,
    linear-gradient(135deg, var(--ph-a, var(--accent-soft)), var(--ph-b, var(--bg-soft)));
  display: grid; place-items: center;
}
.ph .glyph { font-family: var(--font-mono); font-size: 13px; color: var(--accent-text); opacity: 0.8; background: var(--bg); padding: 5px 12px; border-radius: var(--radius-full); border: 1px solid var(--accent-border); }

/* ============================================================
   Code blocks — always dark, window chrome, copy button
   ============================================================ */
.code-window {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 16px 40px -24px rgba(0,0,0,0.6);
  margin: 28px 0;
}
.code-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--code-bar);
  border-bottom: 1px solid var(--code-border);
}
.code-bar .fname {
  font-family: var(--font-mono); font-size: 12.5px; color: #b8b4c8;
  display: flex; align-items: center; gap: 8px;
}
.code-bar .fname svg { width: 14px; height: 14px; color: var(--code-mint); }
.code-bar .lang {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--code-mint);
  border: 1px solid rgba(116,215,175,0.3);
  border-radius: var(--radius-full);
  padding: 2px 9px;
}
.code-bar .copy {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--code-dim); background: transparent;
  border: 1px solid var(--code-border); border-radius: var(--radius-sm);
  padding: 4px 10px; cursor: pointer;
  transition: all 0.18s var(--ease);
}
.code-bar .copy:hover { color: #d6d3e2; border-color: rgba(116,215,175,0.4); }
.code-bar .copy.copied { color: var(--code-mint); border-color: rgba(116,215,175,0.5); }
.code-bar .copy svg { width: 13px; height: 13px; }

/* base pre (no-JS fallback before wrapping) + wrapped */
.prose pre {
  background: var(--code-bg);
  border-radius: var(--radius);
  margin: 28px 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px; line-height: 1.7;
  color: var(--code-fg);
  tab-size: 2;
}
.code-window pre { margin: 0; border-radius: 0; }
.prose pre code { font-family: inherit; background: none; padding: 0; font-size: inherit; color: inherit; }

/* monochrome-mint syntax theme (overrides hljs) */
.hljs { color: var(--code-fg); background: transparent; }
.hljs-comment, .hljs-quote { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name, .hljs-section, .hljs-bullet { color: var(--code-key); font-weight: 500; }
.hljs-string, .hljs-attr, .hljs-template-tag, .hljs-symbol, .hljs-meta-string { color: var(--code-str); }
.hljs-number, .hljs-literal { color: var(--code-num); }
.hljs-attribute, .hljs-title, .hljs-title.class_, .hljs-title.function_, .hljs-property { color: var(--code-prop); }
.hljs-meta, .hljs-punctuation { color: var(--code-dim); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* inline code */
.prose code:not(.hljs) {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--accent-soft);
  color: var(--accent-text);
  padding: 0.12em 0.42em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-border);
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  margin-top: 96px;
}
.footer-top { padding: 64px 0 48px; display: flex; gap: 72px; align-items: start; flex-wrap: wrap; }
.footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.footer-links .col h4 { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 14px; }
.footer-links .col a { display: block; font-size: 14px; color: var(--fg-2); padding: 5px 0; transition: color 0.16s var(--ease); }
.footer-links .col a:hover { color: var(--accent-text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 13px; color: var(--fg-3);
}
.footer-bottom .brand .wm { font-size: 16px; }
.footer-bottom .brand img { width: 24px; height: 24px; }

/* ============================================================
   Reveal-on-load (respects reduced motion)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   Pagination (Ghost {{pagination}})
   ============================================================ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 56px 0 8px; font-family: var(--font-mono); font-size: 13px; color: var(--fg-3); }
.pagination a { color: var(--accent-text); font-weight: 600; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); transition: all 0.18s var(--ease); }
.pagination a:hover { border-color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-top { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-visual { order: -1; }
}
@media (max-width: 720px) {
  .container { padding: 0 20px; }
  .nav { display: none; }
  .menu-btn { display: grid; }
  .card-grid { grid-template-columns: 1fr; }
  .header-right .btn-text { display: none; }
}
