/* ==========================================================================
   SIDDHARTH SABRON — MINIMALIST EDITORIAL & ARCHIVAL RESEARCH INDEX
   Color Architecture: High-Contrast Luminous Text + Crimson & Neon Accents
   Color Binding: Zero-toggle automatic OS light/dark preference
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Light Mode — Warm Archival Paper + Crisp High-Contrast Ink */
  --bg: #FAF9F5;
  --surface: #F2F0E8;
  --surface-hover: #EAE7DC;
  --fg: #111314;
  --fg-bright: #070909;
  --fg-secondary: #2C3333;
  --fg-meta: #3E4848;
  --border: #DEDAD0;
  --border-strong: #C2BDB0;

  /* Signature Minimalist Accents — Light Mode (Editorial Crimson + Deep Teal-Cyan) */
  --heading: #C81E45;
  --neon: #007770;
  --neon-soft: rgba(0, 119, 112, 0.09);
  --neon-border: rgba(0, 119, 112, 0.34);
  --signal: #C81E45;
  --signal-soft: rgba(200, 30, 69, 0.08);
  --signal-ok: #0F6E32;

  /* Glassmorphic Top Bar — Light */
  --glass-bg: rgba(250, 249, 245, 0.74);
  --glass-border: rgba(17, 19, 20, 0.10);
  --glass-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.06);

  /* Code Chrome — Light */
  --code-bg: #F3F1E8;
  --code-header-bg: #E9E6DA;
  --inline-code-fg: #A61B3E;
  --inline-code-bg: rgba(200, 30, 69, 0.06);
  --inline-code-border: rgba(200, 30, 69, 0.22);
  --hl-line-bg: rgba(200, 30, 69, 0.08);
  --hl-line-border: #C81E45;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* Layout */
  --max-w: 840px;
  --gutter: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Mode — Deep Carbon Obsidian + Luminous Crisp Reading Text */
    --bg: #080B0C;
    --surface: #101517;
    --surface-hover: #151C1F;
    --fg: #F4F8F8;
    --fg-bright: #FFFFFF;
    --fg-secondary: #DBE6E5;
    --fg-meta: #B8CECC;
    --border: #1E282B;
    --border-strong: #2E3E42;

    /* Signature Minimalist Accents — Dark Mode (Neon Crimson-Rose + Electric Cyan) */
    --heading: #FF4769;
    --neon: #00FFF2;
    --neon-soft: rgba(0, 255, 242, 0.09);
    --neon-border: rgba(0, 255, 242, 0.36);
    --signal: #FF4769;
    --signal-soft: rgba(255, 71, 105, 0.10);
    --signal-ok: #7EE787;

    /* Glassmorphic Top Bar — Dark */
    --glass-bg: rgba(10, 16, 18, 0.66);
    --glass-border: rgba(0, 255, 242, 0.18);
    --glass-shadow: 0 8px 28px -12px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(0, 255, 242, 0.08);

    /* Code Chrome — Dark */
    --code-bg: #0D1214;
    --code-header-bg: #12191C;
    --inline-code-fg: #66FFF6;
    --inline-code-bg: rgba(0, 255, 242, 0.07);
    --inline-code-border: rgba(0, 255, 242, 0.24);
    --hl-line-bg: rgba(255, 71, 105, 0.12);
    --hl-line-border: #FF4769;
  }
}

/* --------------------------------------------------------------------------
   1. Reset & Base Foundations
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--fg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.985rem;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--neon);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 1.5px solid var(--neon);
  outline-offset: 2px;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.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;
}

/* --------------------------------------------------------------------------
   2. Compact Glassmorphic Sticky Top Bar
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 0.55rem 0;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  min-height: 2.15rem;
}

.brand-name {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--fg-bright);
  line-height: 1.2;
}

.brand-name:hover {
  color: var(--neon);
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  font-variant-numeric: tabular-nums;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.24rem 0.56rem;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--fg-secondary);
}

.nav-code {
  color: var(--signal);
  font-size: 0.71rem;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--neon);
  background-color: var(--neon-soft);
  border-color: var(--neon-border);
}

.nav-link.is-active {
  color: var(--neon);
  background-color: var(--neon-soft);
  border-color: var(--neon-border);
  font-weight: 500;
}

.nav-link.is-active .nav-code {
  color: var(--signal);
}

/* --------------------------------------------------------------------------
   3. Main Content Shell & About Section
   -------------------------------------------------------------------------- */
main.site-main {
  flex: 1;
  padding: 2.25rem 0 4rem;
}

.about-section {
  padding-bottom: 0.5rem;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--neon);
  margin-bottom: 0.75rem;
}

.section-kicker::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--signal);
  box-shadow: 0 0 8px var(--signal);
}

.intro-prose {
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.74;
  max-width: 68ch;
}

.intro-prose h1 {
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.22;
  color: var(--heading);
  margin: 0 0 1rem;
}

.intro-prose h2,
.intro-prose h3 {
  font-family: var(--font-mono);
  font-size: 0.77rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--heading);
  margin: 1.65rem 0 0.65rem;
}

.intro-prose p {
  margin: 0 0 1.05rem;
  color: var(--fg);
}

.intro-prose strong {
  color: var(--fg-bright);
  font-weight: 600;
}

.intro-prose a {
  color: var(--neon);
  border-bottom: 1px solid var(--neon-border);
  padding-bottom: 1px;
}

.intro-prose a:hover {
  border-bottom-color: var(--neon);
}

.stack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0;
  list-style: none;
}

.stack-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.35;
  padding: 0.22rem 0.54rem;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--fg);
  white-space: nowrap;
}

.stack-pill:hover {
  border-color: var(--neon-border);
  color: var(--neon);
}

.channel-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.channel-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.3rem 0.64rem;
  background-color: var(--surface);
  border: 1px solid var(--border-strong) !important;
  border-radius: 4px;
  color: var(--fg) !important;
}

.channel-links a:hover {
  background-color: var(--neon-soft);
  border-color: var(--neon) !important;
  color: var(--neon) !important;
}

.channel-links a.primary-channel {
  background-color: var(--signal-soft);
  color: var(--heading) !important;
  border-color: var(--heading) !important;
  font-weight: 500;
}

.channel-links a.primary-channel:hover {
  background-color: var(--heading);
  color: #FFFFFF !important;
}

/* --------------------------------------------------------------------------
   4. Directory Blocks & Ledger Rows (billiondollarpdf.com Style)
   -------------------------------------------------------------------------- */
.directory-block {
  margin-bottom: 2.75rem;
}

.directory-block:last-child {
  margin-bottom: 0.5rem;
}

.directory-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.58rem;
  border-bottom: 1px solid var(--border-strong);
}

.directory-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.81rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--heading);
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.directory-code {
  color: var(--neon);
  font-weight: 500;
}

.directory-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
}

.directory-meta a {
  color: var(--neon);
}

.directory-meta a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Section Page Hero */
.section-hero {
  margin-bottom: 1.5rem;
}

.section-title {
  margin: 0 0 0.45rem;
  font-size: clamp(1.5rem, 2.8vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.026em;
  line-height: 1.22;
  color: var(--heading);
}

.section-description {
  margin: 0;
  color: var(--fg);
  font-size: 0.96rem;
  max-width: 66ch;
}

/* Instant Client-Side Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.15rem 0 0;
  padding: 0.48rem 0.78rem;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.79rem;
}

.filter-bar:focus-within {
  border-color: var(--neon);
  background-color: var(--bg);
}

.filter-prompt {
  color: var(--signal);
  font-weight: 600;
  user-select: none;
}

.filter-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--fg-bright);
  font-family: var(--font-mono);
  font-size: 0.81rem;
  padding: 0;
  outline: none;
}

.filter-input:focus-visible {
  outline: none;
}

.filter-input::placeholder {
  color: var(--fg-meta);
}

.filter-status {
  color: var(--neon);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
}

/* Ledger List & Rows */
.ledger-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ledger-item {
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background-color 110ms ease;
}

.ledger-item:hover {
  background-color: var(--surface-hover);
}

.ledger-item.is-selected {
  background-color: var(--surface-hover);
  box-shadow: inset 2px 0 0 var(--neon);
}

.ledger-item[hidden] {
  display: none !important;
}

details.ledger-details {
  margin: 0;
}

summary.ledger-row {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.35rem 1rem;
  padding: 0.84rem 0.45rem;
}

summary.ledger-row::-webkit-details-marker {
  display: none;
}

summary.ledger-row::marker {
  content: "";
}

.ledger-date {
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ledger-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
}

.ledger-title {
  font-size: 0.97rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg-bright);
  line-height: 1.42;
}

.ledger-title:hover {
  color: var(--heading);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.ledger-subtitle {
  font-size: 0.85rem;
  color: var(--fg-secondary);
  line-height: 1.48;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ledger-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.32rem;
  margin-top: 0.12rem;
}

.tag-pill {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  line-height: 1.25;
  padding: 0.12rem 0.42rem;
  border: 1px solid var(--neon-border);
  border-radius: 3px;
  background-color: var(--neon-soft);
  color: var(--neon);
  white-space: nowrap;
}

a.tag-pill:hover {
  color: var(--bg);
  border-color: var(--neon);
  background-color: var(--neon);
}

.tag-pill.ext-pill {
  color: var(--neon);
  border-color: var(--neon-border);
  background-color: var(--neon-soft);
}

.ledger-meta {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-reading {
  color: var(--neon);
}

.abstract-toggle {
  color: var(--heading);
  padding: 0.1rem 0.36rem;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

summary.ledger-row:hover .abstract-toggle {
  color: var(--heading);
  border-color: var(--heading);
  background-color: var(--signal-soft);
}

details.ledger-details[open] .when-closed {
  display: none;
}

details.ledger-details:not([open]) .when-open {
  display: none;
}

details.ledger-details[open] .abstract-toggle {
  color: var(--neon);
  border-color: var(--neon-border);
  background-color: var(--neon-soft);
}

.ledger-abstract {
  padding: 0.15rem 0.65rem 0.95rem calc(108px + 1.45rem);
  font-size: 0.91rem;
  line-height: 1.66;
  color: var(--fg);
}

.ledger-abstract p {
  margin: 0 0 0.65rem;
  max-width: 66ch;
}

.ledger-abstract-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.95rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.ledger-abstract-actions a {
  color: var(--neon);
  font-weight: 500;
}

.ledger-abstract-actions a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-ledger {
  padding: 1.5rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-meta);
  border-bottom: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   5. Article / Project / Thought Page View
   -------------------------------------------------------------------------- */
.article-shell {
  max-width: 100%;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--neon);
  margin-bottom: 1.4rem;
}

.article-back:hover {
  color: var(--heading);
}

.article-header {
  padding-bottom: 1.4rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-strong);
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.7rem;
}

.article-meta-bar time {
  color: var(--neon);
  font-weight: 500;
}

.meta-sep {
  color: var(--signal);
}

.article-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.2;
  color: var(--heading);
}

.article-description {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.65;
  color: var(--fg);
  max-width: 66ch;
}

.article-taxonomies-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.project-links-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--neon-border);
  border-radius: 4px;
  background-color: var(--neon-soft);
  color: var(--neon);
}

.project-action-btn:hover {
  border-color: var(--neon);
  background-color: var(--neon);
  color: var(--bg);
}

/* Collapsible Table of Contents */
.toc-box {
  margin: 0 0 2rem;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background-color: var(--surface);
}

.toc-box summary {
  list-style: none;
  cursor: pointer;
  padding: 0.62rem 0.95rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--heading);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.toc-box summary::-webkit-details-marker {
  display: none;
}

.toc-box summary::after {
  content: "[+]";
  color: var(--neon);
}

.toc-box[open] summary {
  border-bottom: 1px solid var(--border-strong);
}

.toc-box[open] summary::after {
  content: "[−]";
}

.toc-list {
  margin: 0;
  padding: 0.75rem 1.1rem 0.85rem 1.85rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.68;
  color: var(--fg);
}

.toc-list ul {
  margin: 0.15rem 0 0.25rem;
  padding-left: 1.15rem;
}

.toc-list li {
  margin: 0.18rem 0;
}

.toc-list a:hover {
  color: var(--neon);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   6. Editorial Prose Typography (High-Brightness Reading + Crimson Headings)
   -------------------------------------------------------------------------- */
.prose {
  color: var(--fg);
  font-size: 1.015rem;
  line-height: 1.78;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose p {
  margin: 0 0 1.3rem;
  color: var(--fg);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: var(--heading);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  scroll-margin-top: 4.5rem;
}

.prose h1 {
  font-size: 1.6rem;
  margin: 2.4rem 0 0.85rem;
}

.prose h2 {
  font-size: 1.3rem;
  margin: 2.3rem 0 0.75rem;
  padding-bottom: 0.36rem;
  border-bottom: 1px solid var(--border-strong);
}

.prose h3 {
  font-size: 1.1rem;
  margin: 1.85rem 0 0.6rem;
}

.prose h4 {
  font-size: 0.99rem;
  margin: 1.5rem 0 0.5rem;
}

.prose a {
  color: var(--neon);
  text-decoration: underline;
  text-decoration-color: var(--neon-border);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.prose a:hover {
  text-decoration-color: var(--neon);
}

.prose strong,
.prose b {
  font-weight: 600;
  color: var(--fg-bright);
}

.prose ul,
.prose ol {
  margin: 0 0 1.35rem;
  padding-left: 1.45rem;
  color: var(--fg);
}

.prose li {
  margin-bottom: 0.42rem;
}

.prose li::marker {
  color: var(--heading);
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.prose blockquote {
  margin: 1.55rem 0;
  padding: 0.65rem 1.15rem;
  border-left: 2px solid var(--heading);
  background-color: var(--surface);
  color: var(--fg);
  font-size: 0.96rem;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border-strong);
  margin: 2.25rem 0;
}

.prose img {
  display: block;
  margin: 1.5rem auto 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
}

.prose figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neon);
  text-align: center;
  margin: 0.35rem 0 1.25rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.prose thead th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 0.58rem 0.78rem;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--heading);
}

.prose tbody td {
  padding: 0.58rem 0.78rem;
  border: 1px solid var(--border);
  color: var(--fg);
  vertical-align: top;
}

/* GitHub-style Alerts (Zola github_alerts = true) */
.markdown-alert {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--neon);
  border-radius: 4px;
  background-color: var(--surface);
  font-size: 0.94rem;
}

.markdown-alert-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--neon);
  margin-bottom: 0.35rem;
}

/* --------------------------------------------------------------------------
   7. Elite Code Blocks, Window Chrome & Syntax Highlighting
   -------------------------------------------------------------------------- */

/* Inline Code Keycaps — Bright & High-Contrast */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background-color: var(--inline-code-bg);
  border: 1px solid var(--inline-code-border);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  color: var(--inline-code-fg);
  word-break: break-word;
}

/* Code Wrapper Chrome */
.code-wrapper {
  margin: 1.6rem 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  background-color: var(--code-bg);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.44rem 0.9rem;
  background-color: var(--code-header-bg);
  border-bottom: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--fg-secondary);
  user-select: none;
}

.code-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--neon);
}

.code-dot {
  color: var(--signal);
  font-size: 0.64rem;
  line-height: 1;
}

.code-copy-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 0.14rem 0.46rem;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.code-copy-btn:hover {
  color: var(--neon);
  border-color: var(--neon);
  background-color: var(--neon-soft);
}

.code-copy-btn.is-copied {
  color: var(--signal-ok);
  border-color: var(--signal-ok);
  background-color: var(--bg);
}

/* Pre & Code Core */
.prose pre,
pre.giallo,
pre.z-code {
  margin: 1.6rem 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background-color: var(--code-bg) !important;
  color: var(--fg-bright) !important;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.845rem;
  line-height: 1.65;
  tab-size: 4;
}

.code-wrapper pre,
.code-wrapper pre.giallo,
.code-wrapper pre.z-code {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.prose pre code {
  font-family: inherit;
  font-size: inherit;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: inherit;
  display: block;
  min-width: fit-content;
}

/* Giallo Line Containers & Line Numbers (Zola 0.22 / 0.23+) */
.prose pre code:has(> .giallo-l),
pre.giallo code:has(> .giallo-l) {
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: 100%;
}

.giallo-l {
  display: block;
  width: 100%;
  min-height: 1.55em;
  white-space: pre;
}

.giallo-ln {
  display: inline-block;
  user-select: none;
  -webkit-user-select: none;
  min-width: 2.4ch;
  padding-right: 1rem;
  margin-right: 0.25rem;
  text-align: right;
  opacity: 0.55;
  color: var(--fg-meta);
  font-variant-numeric: tabular-nums;
}

/* Highlighted Lines */
.giallo-l.z-hl,
.giallo-l.z-l-hl,
.giallo-l.z-d-hl,
.prose pre mark {
  display: block;
  width: calc(100% + 2.3rem);
  margin-left: -1.15rem;
  margin-right: -1.15rem;
  padding-left: calc(1.15rem - 2px);
  padding-right: 1.15rem;
  background-color: var(--hl-line-bg) !important;
  border-left: 2px solid var(--hl-line-border);
  color: inherit;
}

/* Legacy Zola <pre><table> Line Numbers Support */
.prose pre table {
  display: table;
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  font-size: inherit;
}

.prose pre table td {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.prose pre table td:first-child {
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.55;
  padding-right: 1rem;
  text-align: right;
  width: 1%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --- Semantic .z-* Token Highlighting (Light Mode Default) --- */
.z-comment,
.z-punctuation.z-definition.z-comment {
  color: #5C6666;
  font-style: italic;
}

.z-keyword,
.z-storage,
.z-storage.z-type,
.z-storage.z-modifier {
  color: #C81E45;
  font-weight: 500;
}

.z-string,
.z-string.z-quoted,
.z-markup.z-inserted {
  color: #0E6B2E;
}

.z-entity.z-name.z-function,
.z-support.z-function,
.z-variable.z-function {
  color: #0550AE;
}

.z-entity.z-name.z-type,
.z-entity.z-name.z-class,
.z-entity.z-name.z-struct,
.z-entity.z-name.z-enum,
.z-entity.z-name.z-trait,
.z-support.z-type,
.z-support.z-class {
  color: #953800;
}

.z-constant,
.z-constant.z-numeric,
.z-constant.z-language,
.z-constant.z-character,
.z-variable.z-language {
  color: #0550AE;
}

.z-entity.z-name.z-tag,
.z-entity.z-other.z-attribute-name {
  color: #0E6B2E;
}

.z-punctuation,
.z-meta.z-brace {
  color: #2C3333;
}

.z-markup.z-deleted,
.z-invalid {
  color: #C81E45;
}

/* --- Zola 0.23+ Giallo Indexed Tokens (Light Mode) --- */
.z-l-b { font-weight: 600; }
.z-l-i { font-style: italic; }
.z-l-u { text-decoration: underline; }
.z-l-s { text-decoration: line-through; }
.z-l-us { text-decoration: underline line-through; }

.z-l-1 { color: #0550AE; }
.z-l-2 { color: #0E6B2E; }
.z-l-3 { color: #0E6B2E; }
.z-l-4 { color: #2C3333; }
.z-l-5 { color: #5C6666; font-style: italic; }
.z-l-6 { color: #0550AE; }
.z-l-7 { color: #C81E45; }
.z-l-8 { color: #C81E45; font-weight: 500; }
.z-l-9 { color: #953800; }
.z-l-10 { color: #2C3333; }
.z-l-11 { color: #2C3333; }

@media (prefers-color-scheme: dark) {
  /* --- Semantic .z-* Token Highlighting (Dark Mode) --- */
  .z-comment,
  .z-punctuation.z-definition.z-comment {
    color: #88A09E;
    font-style: italic;
  }

  .z-keyword,
  .z-storage,
  .z-storage.z-type,
  .z-storage.z-modifier {
    color: #FF5C7C;
    font-weight: 500;
  }

  .z-string,
  .z-string.z-quoted,
  .z-markup.z-inserted {
    color: #7EE787;
  }

  .z-entity.z-name.z-function,
  .z-support.z-function,
  .z-variable.z-function {
    color: #D2A8FF;
  }

  .z-entity.z-name.z-type,
  .z-entity.z-name.z-class,
  .z-entity.z-name.z-struct,
  .z-entity.z-name.z-enum,
  .z-entity.z-name.z-trait,
  .z-support.z-type,
  .z-support.z-class {
    color: #FFA657;
  }

  .z-constant,
  .z-constant.z-numeric,
  .z-constant.z-language,
  .z-constant.z-character,
  .z-variable.z-language {
    color: #00FFF2;
  }

  .z-entity.z-name.z-tag,
  .z-entity.z-other.z-attribute-name {
    color: #7EE787;
  }

  .z-punctuation,
  .z-meta.z-brace {
    color: #DBE6E5;
  }

  .z-markup.z-deleted,
  .z-invalid {
    color: #FF5C7C;
  }

  /* Reset light classes in dark mode so .z-d-* wins cleanly */
  .z-l-1, .z-l-2, .z-l-3, .z-l-4, .z-l-5, .z-l-6, .z-l-7,
  .z-l-8, .z-l-9, .z-l-10, .z-l-11 {
    color: inherit;
    font-style: normal;
    font-weight: inherit;
  }

  .z-d-b { font-weight: 600; }
  .z-d-i { font-style: italic; }
  .z-d-u { text-decoration: underline; }
  .z-d-s { text-decoration: line-through; }
  .z-d-us { text-decoration: underline line-through; }

  .z-d-1 { color: #F4F8F8; }
  .z-d-2 { color: #DBE6E5; }
  .z-d-3 { color: #88A09E; font-style: italic; }    /* Comments */
  .z-d-4 { color: #00FFF2; }                        /* Constants, numeric, self */
  .z-d-5 { color: #7EE787; }                        /* Tags, inserted */
  .z-d-6 { color: #7EE787; }                        /* Strings */
  .z-d-7 { color: #D2A8FF; }                        /* Functions, entities, types */
  .z-d-8 { color: #DBE6E5; }                        /* Punctuation, secondary */
  .z-d-9 { color: #A5D6FF; }                        /* String escapes / literals */
  .z-d-10 { color: #FF5C7C; font-weight: 500; }     /* Keywords, storage, operators */
  .z-d-11 { color: #FFA198; }                       /* Invalid / deleted */
  .z-d-12 { color: #FFA657; }                       /* Classes, structs, attributes */
}

/* --------------------------------------------------------------------------
   8. Article Bottom Navigation & Taxonomy Grid
   -------------------------------------------------------------------------- */
.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.adjacent-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.adjacent-card {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background-color: var(--surface);
}

.adjacent-card:hover {
  border-color: var(--neon);
  background-color: var(--surface-hover);
}

.adjacent-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neon);
}

.adjacent-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-bright);
}

.tags-cloud {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 0.55rem;
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.tags-cloud-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.58rem 0.78rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background-color: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.79rem;
  color: var(--fg);
}

.tags-cloud-item a:hover {
  border-color: var(--neon);
  color: var(--neon);
  background-color: var(--neon-soft);
}

.tag-count {
  color: var(--heading);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
}

/* 404 Page */
.error-panel {
  padding: 3rem 0;
}

.error-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--neon);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   9. Site Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border-strong);
  padding: 1.5rem 0 2.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-meta);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

.footer-links a {
  color: var(--fg-secondary);
}

.footer-links a:hover {
  color: var(--neon);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   10. Responsive Breakpoints (Mobile / Tablet / Wide)
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  :root {
    --gutter: 1.1rem;
  }

  main.site-main {
    padding: 1.6rem 0 3rem;
  }

  .site-header {
    padding: 0.5rem 0;
  }

  .site-nav {
    width: 100%;
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.22rem 0.46rem;
    font-size: 0.73rem;
  }

  summary.ledger-row {
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.65rem;
    padding: 0.85rem 0.25rem;
  }

  .ledger-date {
    grid-column: 1 / 2;
    font-size: 0.73rem;
  }

  .ledger-meta {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
  }

  .ledger-main {
    grid-column: 1 / -1;
    margin-top: 0.1rem;
  }

  .ledger-abstract {
    padding: 0.1rem 0.35rem 0.9rem 0.35rem;
  }

  .prose pre,
  pre.giallo,
  pre.z-code {
    padding: 0.85rem 0.9rem;
    font-size: 0.79rem;
  }

  .giallo-l.z-hl,
  .giallo-l.z-l-hl,
  .giallo-l.z-d-hl,
  .prose pre mark {
    width: calc(100% + 1.8rem);
    margin-left: -0.9rem;
    margin-right: -0.9rem;
    padding-left: calc(0.9rem - 2px);
    padding-right: 0.9rem;
  }
}
