/* ==========================================================================
   GPKumar 3.0: fast developer blog
   System fonts (zero font requests) · indigo accent · light + dark
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, 'Liberation Mono', monospace;

  --container: 1160px;
  --narrow: 700px;
  --wide: 1000px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 60px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-full: 999px;

  --ease: cubic-bezier(.2, .7, .2, 1);

  /* light */
  --bg: #fafafa;
  --bg-raised: #ffffff;
  --bg-sunken: #f2f2f4;
  --line: #e4e4e8;
  --line-strong: #d0d0d7;
  --fg: #0b0b0f;
  --fg-muted: #52525b;
  --fg-dim: #75757f;
  --accent: #4f46e5;
  --accent-fg: #ffffff;
  --accent-soft: #eeedfd;
  --code-bg: #0f1117;
  --code-fg: #e4e6ee;
  --code-head: #161922;
  --code-line: #232634;
  --code-inline-bg: #ececf1;
  --selection: #d9d7fb;
  --dot: #d4d4da;
  --shadow: 0 1px 2px rgba(15, 15, 25, .04), 0 10px 30px -12px rgba(15, 15, 25, .12);
}

:root[data-theme="dark"] {
  --bg: #09090b;
  --bg-raised: #111114;
  --bg-sunken: #0d0d10;
  --line: #222228;
  --line-strong: #2f2f37;
  --fg: #ececf1;
  --fg-muted: #a1a1aa;
  --fg-dim: #71717a;
  --accent: #8b8bff;
  --accent-fg: #0b0b1a;
  --accent-soft: rgba(139, 139, 255, .12);
  --code-bg: #0c0d12;
  --code-fg: #e4e6ee;
  --code-head: #121420;
  --code-line: #1e2130;
  --code-inline-bg: #1b1b21;
  --selection: rgba(139, 139, 255, .3);
  --dot: #26262d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 40px -16px rgba(0, 0, 0, .6);
}

/* No-JS fallback: follow the OS */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #09090b; --bg-raised: #111114; --bg-sunken: #0d0d10;
    --line: #222228; --line-strong: #2f2f37;
    --fg: #ececf1; --fg-muted: #a1a1aa; --fg-dim: #71717a;
    --accent: #8b8bff; --accent-fg: #0b0b1a; --accent-soft: rgba(139, 139, 255, .12);
    --code-bg: #0c0d12; --code-head: #121420; --code-line: #1e2130; --code-inline-bg: #1b1b21;
    --selection: rgba(139, 139, 255, .3); --dot: #26262d;
  }
}

/* Legacy aliases: keep collection.css and older post markup working */
:root, :root[data-theme] {
  --color-primary: var(--accent);
  --color-primary-text: var(--accent);
  --color-primary-hover: var(--accent);
  --bg-body: var(--bg);
  --bg-surface: var(--bg-raised);
  --bg-surface-secondary: var(--bg-sunken);
  --bg-surface-elevated: var(--bg-raised);
  --bg-surface-subtle: var(--bg-sunken);
  --border-subtle: var(--line);
  --border-card: var(--line);
  --text-main: var(--fg);
  --text-muted: var(--fg-muted);
  --text-dim: var(--fg-dim);
  --code-header-bg: var(--code-head);
  --code-text: var(--code-fg);
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --radius-xl: var(--r-lg);
  --radius-full: var(--r-full);
  --shadow-sm: var(--shadow);
  --shadow-md: var(--shadow);
  --shadow-lg: var(--shadow);
  --header-height: var(--header-h);
  --grad-badge: var(--accent-soft);
  --grad-text: linear-gradient(var(--fg), var(--fg));
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--selection); }
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, h6 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 650; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
kbd {
  font: 500 11px/1 var(--font-mono);
  padding: 3px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--fg-muted);
}
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-fg);
  padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600;
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container-narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }
.container-wide { max-width: calc(var(--wide) + 2 * var(--gutter)); }
.site-main { min-height: 60vh; padding-bottom: 72px; }

/* 3. Small parts ----------------------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 12px/1.4 var(--font-mono);
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg-dim);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.lead { font-size: clamp(17px, 2vw, 19px); color: var(--fg-muted); max-width: 62ch; }

.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  font: 400 13px/1.5 var(--font-mono); color: var(--fg-dim);
}
.post-meta > * + *::before { content: '·'; margin-right: 14px; color: var(--line-strong); }
.post-meta .tag + *::before { display: none; }

.tag {
  display: inline-flex; align-items: center;
  font: 500 12px/1 var(--font-mono);
  padding: 5px 8px; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--accent);
  transition: background .15s var(--ease);
}
.tag:hover { background: var(--accent); color: var(--accent-fg); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r-full);
  font-size: 14px; color: var(--fg-muted); background: var(--bg-raised);
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--fg); }
.chip-count { font: 400 12px var(--font-mono); color: var(--fg-dim); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-md);
  font-weight: 550; font-size: 14px; border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--accent-fg); }
.btn-ghost { border-color: var(--line-strong); color: var(--fg); }
.btn-ghost:hover { border-color: var(--accent); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; min-width: 36px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg-raised); color: var(--fg-muted);
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { color: var(--fg); border-color: var(--line-strong); }

/* 4. Header ---------------------------------------------------------------- */
#reading-progress-bar {
  position: fixed; inset: 0 auto auto 0; height: 2px; width: 0; z-index: 60;
  background: var(--accent);
}
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; height: var(--header-h); }

.brand { display: inline-flex; align-items: baseline; font: 600 17px/1 var(--font-mono); letter-spacing: -.02em; }
.brand-prompt { color: var(--accent); }
.brand-name { color: var(--fg); }
.brand-cursor {
  width: 8px; height: 16px; margin-left: 3px; align-self: center;
  background: var(--accent); animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }
.custom-logo { max-height: 36px; width: auto; }

.primary-navigation { margin-left: auto; }
.nav-menu { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-menu li { position: relative; }
.nav-menu a {
  display: block; padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; color: var(--fg-muted);
  transition: color .15s var(--ease), background .15s var(--ease);
}
.nav-menu a:hover, .nav-menu .current-menu-item > a, .nav-menu .current-menu-parent > a { color: var(--fg); background: var(--bg-sunken); }
.nav-menu .sub-menu {
  position: absolute; top: 100%; left: 0; min-width: 210px; padding: 6px; margin: 0;
  list-style: none; background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s var(--ease), transform .15s var(--ease), visibility .15s;
}
.nav-menu li:hover > .sub-menu, .nav-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.submenu-toggle { display: none; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.mobile-nav-toggle { display: none; }

@media (max-width: 860px) {
  .kbd-hint { display: none; }
  .mobile-nav-toggle { display: inline-flex; }
  .header-actions { margin-left: auto; }
  .primary-navigation {
    position: fixed; inset: var(--header-h) 0 auto 0; margin: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 12px var(--gutter) 20px;
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    display: none;
  }
  .primary-navigation.is-open { display: block; }
  .nav-menu { flex-direction: column; }
  .nav-menu a { padding: 12px; font-size: 16px; }
  .nav-menu .sub-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; padding: 0 0 0 12px; display: none;
  }
  .nav-menu .submenu-open > .sub-menu { display: block; }
  .submenu-toggle {
    display: inline-flex; position: absolute; right: 0; top: 4px;
    width: 40px; height: 40px; align-items: center; justify-content: center;
    background: none; border: 0; color: var(--fg-muted);
  }
  .submenu-toggle svg { width: 18px; transition: transform .15s var(--ease); }
  .submenu-open > .submenu-toggle svg { transform: rotate(180deg); }
}

/* 5. Search modal ---------------------------------------------------------- */
.search-modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 8, 12, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.search-modal-backdrop[hidden] { display: none; }
.search-modal-window {
  width: 100%; max-width: 620px;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.search-modal-form { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--fg-dim); }
.search-input-field { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg); font: 400 17px var(--font-sans); }
.search-close-btn { background: none; border: 0; padding: 0; }
.search-modal-topics { padding: 16px; display: grid; gap: 10px; }

/* 6. Home ------------------------------------------------------------------ */
.home-intro {
  position: relative; isolation: isolate;
  padding: clamp(56px, 10vw, 120px) 0 48px;
}
.home-intro::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(var(--dot) 1px, transparent 1px) 0 0 / 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 30% 0%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 80% at 30% 0%, #000 30%, transparent 75%);
}
.home-intro .eyebrow { margin-bottom: 20px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--bg-raised); text-transform: none; letter-spacing: 0; color: var(--fg-muted); }
.display {
  font-size: clamp(36px, 6vw, 64px); font-weight: 700; letter-spacing: -.04em; line-height: 1.02;
  max-width: 17ch; text-wrap: balance; margin-bottom: 20px;
}
.home-intro .lead { margin-bottom: 32px; }

.featured-post {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(20px, 4vw, 48px); align-items: center;
  padding: clamp(14px, 2vw, 20px); margin: 8px 0 64px;
  border: 1px solid var(--line); border-radius: calc(var(--r-lg) + 4px); background: var(--bg-raised);
}
.featured-media { display: block; aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden; background: var(--bg-sunken); border: 1px solid var(--line); }
.featured-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.featured-post:hover .featured-media img { transform: scale(1.02); }
.featured-body { display: grid; gap: 14px; justify-items: start; padding: 8px 12px 8px 0; }
@media (max-width: 760px) { .featured-body { padding: 4px 4px 8px; } }
.featured-title { font-size: clamp(24px, 3.2vw, 36px); letter-spacing: -.03em; text-wrap: balance; }
.featured-title a:hover { color: var(--accent); }
.featured-excerpt { color: var(--fg-muted); font-size: 17px; }
@media (max-width: 760px) { .featured-post { grid-template-columns: 1fr; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-title { font-size: 20px; letter-spacing: -.02em; margin-bottom: 24px; }
.section-head .section-title { margin: 0; }

/* 7. Cards ----------------------------------------------------------------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.post-card {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-raised);
  overflow: hidden; transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.post-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.post-card-title a::after { content: ''; position: absolute; inset: 0; }
.post-card .tag { position: relative; z-index: 1; }
.post-card-media {
  display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-bottom: 1px solid var(--line); background: var(--bg-sunken);
}
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.post-card:hover .post-card-media img { transform: scale(1.03); }
.post-card-fallback {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  font: 500 15px var(--font-mono); color: var(--fg-dim);
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--bg-sunken);
}
.post-card-fallback::before { content: '#'; color: var(--accent); margin-right: 4px; }
.post-card-body { display: grid; gap: 10px; padding: 18px 20px 22px; align-content: start; }
.post-card-title { font-size: 19px; line-height: 1.3; letter-spacing: -.02em; }
.post-card-title { text-wrap: balance; }
.post-card:hover .post-card-title a { color: var(--accent); }
.post-card-excerpt { color: var(--fg-muted); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* 8. Page heads, archives, empty --------------------------------------------- */
.page-head { padding: clamp(40px, 7vw, 80px) 0 40px; border-bottom: 1px solid var(--line); margin-bottom: 48px;
  background: radial-gradient(var(--dot) 1px, transparent 1px) 0 0 / 22px 22px; }
.page-title { font-size: clamp(30px, 4.4vw, 46px); letter-spacing: -.035em; margin: 8px 0 12px; }
.page-title span { color: var(--fg-dim); font-weight: 500; }
.page-count { font: 400 13px var(--font-mono); color: var(--fg-dim); margin-top: 12px; }
.page-search { margin-top: 24px; max-width: 520px; }
.empty-state { padding: 64px 0; display: grid; gap: 16px; justify-items: start; }

.gpkumar-breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; font: 400 13px var(--font-mono); color: var(--fg-dim); margin-bottom: 12px; }
.gpkumar-breadcrumbs a:hover { color: var(--accent); }
.breadcrumb-current { color: var(--fg-muted); }

.search-form { display: flex; gap: 8px; width: 100%; }
.search-form label { flex: 1; }
.search-field, .search-form input[type="search"] {
  width: 100%; height: 42px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--bg-raised); color: var(--fg); font: inherit;
}
.search-submit, .search-form button[type="submit"], .search-form input[type="submit"] {
  height: 42px; padding: 0 16px; border: 0; border-radius: var(--r-md);
  background: var(--fg); color: var(--bg); font-weight: 550;
}

.pagination { margin-top: 56px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination .page-numbers {
  min-width: 40px; height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  font: 500 14px var(--font-mono); color: var(--fg-muted);
}
.pagination .page-numbers:hover { border-color: var(--accent); color: var(--fg); }
.pagination .page-numbers.current { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pagination .dots { border: 0; }

/* 9. Single post ----------------------------------------------------------- */
.post-header { padding-top: clamp(32px, 6vw, 72px); padding-bottom: 32px; display: grid; gap: 20px; }
.post-title { font-size: clamp(32px, 5vw, 52px); font-weight: 700; letter-spacing: -.04em; line-height: 1.06; text-wrap: balance; }
.post-byline { display: flex; align-items: center; gap: 12px; }
.post-byline .avatar, .author-card .avatar { border-radius: 50%; }
.byline-author { font-weight: 600; font-size: 15px; }
.byline-author:hover { color: var(--accent); }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-hero-media { margin: 0 auto 48px; }
.post-hero-media img { width: 100%; border-radius: var(--r-lg); border: 1px solid var(--line); }

.post-layout { display: grid; grid-template-columns: minmax(0, var(--narrow)); justify-content: center; gap: 56px; }
@media (min-width: 1024px) {
  .post-layout.has-sidebar { grid-template-columns: minmax(0, 1fr) 300px; max-width: calc(var(--narrow) + 300px + 56px + 2 * var(--gutter)); }
}

/* Sidebar: sticky TOC on top, widgets below (widgets drop under the article on small screens) */
.site-sidebar { display: grid; gap: 16px; align-content: start; min-width: 0; }
.sidebar-widgets { display: grid; gap: 16px; }
.sidebar-widget + .sidebar-widget { margin-top: 0; }
@media (min-width: 1024px) {
  .site-sidebar { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; scrollbar-width: thin; }
}
.post-toc { display: none; }
@media (min-width: 1024px) { .post-toc:not([hidden]) { display: block; } }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc-link { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.45; color: var(--fg-muted); transition: color .15s var(--ease), border-color .15s var(--ease); }
.toc-subitem .toc-link { padding-left: 26px; font-size: 13px; color: var(--fg-dim); }
.toc-link:hover { color: var(--fg); }
.toc-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 550; }
.toc-top { display: inline-block; margin-top: 14px; font: 400 12px var(--font-mono); color: var(--fg-dim); }
.toc-top:hover { color: var(--accent); }

/* Mobile TOC: collapsible box above the article */
.toc-mobile { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-raised); }
.toc-mobile[hidden] { display: none; }
.toc-mobile summary { padding: 12px 16px; cursor: pointer; font: 500 13px var(--font-mono); color: var(--fg-muted); }
.toc-mobile .toc-list { margin: 0 16px 14px; }
@media (min-width: 1024px) { .toc-mobile { display: none !important; } }

.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagcloud a { font-size: 12px !important; font-family: var(--font-mono); padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--fg-muted); }
.tagcloud a:hover { border-color: var(--accent); color: var(--accent); }
.sidebar-widget ul { list-style: none; margin: 0; padding: 0; }

.post-main { min-width: 0; }
.post-main > * + * { margin-top: 40px; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 20px 0; border-block: 1px solid var(--line); font-size: 14px; color: var(--fg-muted); }
.share-row a:hover, .share-row button:hover { color: var(--accent); }
.share-row button { background: none; border: 0; padding: 0; color: inherit; font-size: 14px; }
.share-row button.copied { color: var(--accent); }

.author-card { display: flex; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-raised); }
.author-card-name { font-size: 18px; margin: 4px 0 8px; }
.author-card p:last-child { color: var(--fg-muted); font-size: 15px; }

.post-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.post-nav-link { display: grid; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); transition: border-color .15s var(--ease); }
.post-nav-link:hover { border-color: var(--accent); }
.post-nav-link.is-next { text-align: right; justify-items: end; }
.post-nav-title { font-weight: 600; line-height: 1.35; }

.related { margin-top: 80px; padding-top: 56px; border-top: 1px solid var(--line); }

/* 10. Prose ---------------------------------------------------------------- */
.prose { font-size: 18px; line-height: 1.75; text-wrap: pretty; color: var(--fg); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.25em; }
.prose h2 { font-size: 1.6em; margin-top: 2.2em; letter-spacing: -.025em; }
.prose h3 { font-size: 1.28em; margin-top: 1.9em; }
.prose h4 { font-size: 1.08em; margin-top: 1.6em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: .6em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--fg-dim); }
.prose blockquote { margin-inline: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--fg-muted); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 3em 0; }
.prose img { border-radius: var(--r-md); }
.prose figure { margin-inline: 0; }
.prose figcaption, .prose .wp-element-caption { margin-top: 8px; font-size: 14px; color: var(--fg-dim); text-align: center; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { font-weight: 600; background: var(--bg-sunken); }
.prose iframe { max-width: 100%; border: 0; border-radius: var(--r-md); }
.prose .alignwide { margin-inline: calc(50% - min(50vw - var(--gutter), var(--wide) / 2)); }
.prose .alignfull { margin-inline: calc(50% - 50vw); max-width: 100vw; }
.prose .aligncenter { margin-inline: auto; }
.prose .alignleft { float: left; margin: .3em 1.5em 1em 0; }
.prose .alignright { float: right; margin: .3em 0 1em 1.5em; }

.prose :not(pre) > code {
  font: 500 .86em var(--font-mono);
  padding: .15em .4em; border-radius: 5px;
  background: var(--code-inline-bg); color: var(--fg);
}
.prose pre, pre.wp-block-code {
  margin: 0; padding: 18px 20px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-fg);
  border: 1px solid var(--code-line); border-radius: var(--r-md);
  font: 400 14px/1.7 var(--font-mono); tab-size: 2; color-scheme: dark;
}
.prose pre code { font: inherit; background: none; padding: 0; color: inherit; }
.gpkumar-code-box { border: 1px solid var(--code-line); border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); box-shadow: var(--shadow); }
.gpkumar-code-box pre, .gpkumar-code-box .wp-block-code { border: 0; border-radius: 0; }
.code-box-header { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--code-line); background: var(--code-head); }
.code-box-header::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; box-shadow: 15px 0 #febc2e, 30px 0 #28c840; margin-right: 32px; opacity: .85; }
.code-box-lang-badge { font: 500 11px var(--font-mono); text-transform: lowercase; letter-spacing: .04em; color: #8a8fa3; margin-right: auto; }
.copy-code-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid transparent; border-radius: var(--r-sm); background: none; font: 500 12px var(--font-mono); color: #8a8fa3; }
.copy-code-btn:hover { border-color: var(--code-line); color: #fff; }
.copy-code-btn.copied { color: #8bf0b4; }

/* Shortcodes from inc/shortcodes.php */
.gpkumar-callout { display: flex; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-md); background: var(--bg-raised); font-size: 16px; }
.howto-step-item { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.step-indicator { grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 600 14px var(--font-mono); }
.step-title { font-weight: 600; }
.codepen-embed-wrapper { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.codepen-embed-footer, .info-box { padding: 10px 14px; font-size: 14px; color: var(--fg-muted); }

/* 11. Comments ------------------------------------------------------------- */
.comments-area { padding-top: 8px; }
.section-headline, .comment-reply-title { font-size: 20px; display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.comment-list, .comment-list .children { list-style: none; margin: 0; padding: 0; }
.comment-list .children { padding-left: 24px; border-left: 1px solid var(--line); margin-top: 16px; }
.comment-body { padding: 18px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.comment-author { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.comment-author .avatar { border-radius: 50%; width: 32px; height: 32px; }
.comment-metadata { font: 400 12px var(--font-mono); color: var(--fg-dim); margin: 4px 0 8px; }
.comment-content p + p { margin-top: .8em; }
.reply a { font-size: 13px; color: var(--accent); }
.comment-form { display: grid; gap: 14px; }
.comment-form label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--bg-raised); color: var(--fg); font: inherit;
}
.comment-form .submit { height: 42px; padding: 0 18px; border: 0; border-radius: var(--r-md); background: var(--fg); color: var(--bg); font-weight: 600; }
.comment-form .submit:hover { background: var(--accent); color: var(--accent-fg); }

/* 12. 404 ------------------------------------------------------------------ */
.not-found { padding-top: clamp(48px, 10vw, 120px); display: grid; gap: 16px; }
.not-found-code { margin: 0 0 16px; padding: 18px 20px; border: 1px solid var(--code-line); border-radius: var(--r-md); background: var(--code-bg); color: var(--code-fg); font: 400 14px/1.7 var(--font-mono); overflow-x: auto; }
.tok-muted { color: var(--fg-dim); }
.tok-accent { color: #ff7b72; font-weight: 500; }

/* 13. Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 32px; font-size: 14px; color: var(--fg-muted); }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 40px; }
.footer-about { display: grid; gap: 14px; align-content: start; max-width: 340px; }
.footer-heading { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--fg-dim); margin-bottom: 14px; }
.footer-col ul, .social-row { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.social-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-col a:hover, .social-row a:hover, .back-to-top-link:hover { color: var(--accent); }
.footer-note { margin-bottom: 12px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); font: 400 13px var(--font-mono); color: var(--fg-dim); }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }

/* 14. Widgets (still available for the collection template / custom use) --- */
.sidebar-widget { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-raised); }
.sidebar-widget + .sidebar-widget { margin-top: 16px; }
.widget-title { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--fg-dim); margin-bottom: 14px; }
.popular-posts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.popular-post-item { display: flex; gap: 12px; }
.popular-post-rank { font: 600 14px var(--font-mono); color: var(--accent); }
.popular-post-title { font-weight: 550; font-size: 14px; line-height: 1.4; }
.popular-post-title:hover { color: var(--accent); }
.popular-post-meta { font: 400 12px var(--font-mono); color: var(--fg-dim); margin-top: 4px; }
.widget-item-badge { font: 500 11px var(--font-mono); color: var(--accent); display: block; margin-bottom: 2px; }
.multi-tab-headers, .widget-filter-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.multi-tab-btn, .widget-filter-tab { padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--r-full); background: none; font-size: 13px; color: var(--fg-muted); }
.multi-tab-btn.active, .widget-filter-tab.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.filtered-out { display: none !important; }

/* 15. Motion preferences --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* 16. Rendering performance ------------------------------------------------ */
/* Skip layout/paint for below-the-fold sections until they near the viewport. */
.site-footer, .related, .comments-area { content-visibility: auto; contain-intrinsic-size: auto 600px; }
.post-grid > .post-card:nth-child(n+7) { content-visibility: auto; contain-intrinsic-size: auto 420px; }

/* 17. Blog layout (v3.1) ---------------------------------------------------- */
.slash-label { font: 500 13px var(--font-mono); color: var(--fg-dim); letter-spacing: .02em; text-transform: lowercase; }
.slash-label::before { content: '// '; color: var(--accent); }
.section-label { display: block; font-size: 15px; color: var(--fg); padding-bottom: 12px; margin: 0 0 24px; border-bottom: 1px dashed var(--line-strong); }
.prose h2 { padding-bottom: .35em; border-bottom: 1px dashed var(--line-strong); }

.display em { font-style: italic; color: var(--accent); font-family: Georgia, 'Times New Roman', serif; font-weight: 500; letter-spacing: -.02em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }
.btn-accent { background: var(--accent); color: var(--accent-fg); border: 0; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-accent kbd { border-color: rgba(255,255,255,.35); color: inherit; opacity: .85; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.topic-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-raised); font-size: 14px; font-weight: 550; transition: border-color .15s var(--ease), transform .15s var(--ease); }
.topic-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.topic-mono { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 600 12px var(--font-mono); }
.topic-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.home-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; margin: 8px 0 64px; }
.home-top .featured-post { grid-template-columns: 1fr; margin: 0; align-items: start; gap: 18px; }
.home-top .featured-media { aspect-ratio: 2 / 1; }
.home-top .featured-body { padding: 0 6px 6px; }
@media (max-width: 960px) { .home-top { grid-template-columns: 1fr; } }
.featured-labels { display: flex; align-items: center; gap: 10px; }

.hash-cat { font: 500 13px var(--font-mono); color: var(--accent); position: relative; z-index: 1; justify-self: start; }
.hash-cat:hover { text-decoration: underline; text-underline-offset: 3px; }

.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font: 400 12.5px var(--font-mono); color: var(--fg-dim); }
.card-meta .avatar { width: 22px; height: 22px; border-radius: 50%; }
.card-meta .card-author { font-family: var(--font-sans); font-weight: 600; font-size: 13px; color: var(--fg-muted); }
.card-meta span + span::before { content: '·'; margin-right: 12px; color: var(--line-strong); }
.post-card-body { grid-template-rows: auto auto 1fr auto; }

.trending-box { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-raised); }
.trending-box .slash-label { margin-bottom: 14px; }
.trending-list { list-style: none; margin: 0; padding: 0; display: grid; }
.trending-list li { display: flex; gap: 14px; padding: 12px 0; border-top: 1px dashed var(--line); }
.trending-list li:first-child { border-top: 0; padding-top: 0; }
.trending-rank { font: 700 20px/1.1 var(--font-mono); color: var(--line-strong); min-width: 28px; }
.trending-list li:first-child .trending-rank { color: var(--accent); }
.trending-title { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.trending-title:hover { color: var(--accent); }
.trending-views { display: block; margin-top: 4px; font: 400 12px var(--font-mono); color: var(--fg-dim); }
.view-all { display: inline-block; margin-top: 12px; font: 500 13px var(--font-mono); color: var(--accent); }

.newsletter { border-top: 1px solid var(--line); padding: 56px 0; background: radial-gradient(var(--dot) 1px, transparent 1px) 0 0 / 22px 22px; content-visibility: auto; contain-intrinsic-size: auto 240px; }
.newsletter-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.newsletter-title { font-size: clamp(22px, 3vw, 28px); letter-spacing: -.03em; margin: 8px 0 6px; }
.newsletter-sub { color: var(--fg-muted); }
.newsletter-form { display: flex; gap: 8px; width: min(100%, 440px); }
.newsletter-form input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--bg-raised); color: var(--fg); font: inherit; }
.newsletter-form .btn { height: 44px; }
.site-footer { border-top: 1px solid var(--line); }

.post-header .hash-cat { margin-bottom: -8px; }
.author-card .view-all { margin-top: 10px; }

/* 18. Gradient titles ------------------------------------------------------- */
:root { --grad-title: linear-gradient(100deg, #4f46e5 0%, #9333ea 45%, #db2777 100%); }
:root[data-theme="dark"] { --grad-title: linear-gradient(100deg, #8b8bff 0%, #c084fc 45%, #f472b6 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --grad-title: linear-gradient(100deg, #8b8bff 0%, #c084fc 45%, #f472b6 100%); } }
:root, :root[data-theme] { --grad-text: var(--grad-title); }

.display, .post-title, .page-title, .featured-title a, .newsletter-title,
.post-card:hover .post-card-title a, .trending-title:hover, .display em {
  background: var(--grad-title);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.page-title span { -webkit-text-fill-color: var(--fg-dim); }
/* Windows high-contrast / forced colours: fall back to solid text */
@media (forced-colors: active) {
  .display, .post-title, .page-title, .featured-title a, .newsletter-title, .post-card-title a, .trending-title, .display em { background: none; -webkit-text-fill-color: currentColor; color: CanvasText; }
}

/* 19. Light / dark logos ---------------------------------------------------- */
.brand-logo { align-items: center; }
.site-logo { display: block; max-width: 220px; object-fit: contain; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .logo-light { display: none; }
  :root:not([data-theme]) .logo-dark { display: block; }
}
@media (max-width: 480px) { .site-logo { max-width: 150px; } }
