/* ============================================================
   GABEROY THEME — Main Stylesheet
   ============================================================ */

/* ----------------------------------------------------------
   1. Design Tokens / CSS Custom Properties
   ---------------------------------------------------------- */
:root {
  /* Colors — Light */
  --color-bg: #f4f5f8;
  --color-bg-alt: #ffffff;
  --color-surface: #eceef3;
  --color-text: #09090b;
  --color-text-secondary: #555a66;
  --color-text-muted: #7c818d;
  --color-accent: #2f5bea;
  --color-accent-hover: #1f45c4;
  --color-accent-subtle: rgba(47, 91, 234, 0.08);
  --color-border: rgba(15, 23, 42, 0.08);
  --color-border-strong: rgba(15, 23, 42, 0.18);

  /* Semantic */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ed4337;
  --color-info: #3b82f6;
  --color-tip: #10b981;
  --color-note: #8b5cf6;

  /* Code — always dark */
  --color-code-bg: #0f1117;
  --color-code-text: #e8e8e8;
  --color-code-border: #1e2230;
  --color-inline-code-bg: rgba(47, 91, 234, 0.08);
  --color-inline-code-text: #1f3fae;

  /* Nav */
  --color-nav-bg: #ffffff;
  --color-nav-text: #09090b;
  --color-nav-border: #e5e5e5;

  /* Footer */
  --color-footer-bg: transparent;
  --color-footer-text: var(--color-text-muted);
  --color-footer-heading: var(--color-text);
  --color-footer-link: var(--color-text-secondary);
  --color-footer-border: var(--color-border);

  /* Glass surfaces */
  --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.36));
  --glass-bg-strong: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.64));
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-edge: rgba(15, 23, 42, 0.07);
  /* Specular rim: bright top/left edge, softer bottom/right */
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 1px 0 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(255, 255, 255, 0.3), inset -1px 0 0 rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 1px 2px rgba(30, 41, 90, 0.05), 0 12px 40px rgba(30, 41, 90, 0.12);
  --glass-blur: blur(26px) saturate(190%);
  --backdrop-a: rgba(96, 128, 255, 0.42);
  --backdrop-b: rgba(178, 120, 255, 0.34);
  --backdrop-c: rgba(45, 212, 191, 0.26);
  --backdrop-d: rgba(255, 138, 190, 0.24);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  /* Typography */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Newsreader', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'Geist Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
  --font-size-base: 16px;
  --line-height-base: 1.65;
  --line-height-heading: 1.15;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Sizing */
  --max-width: 1200px;
  --content-width: 690px;
  --toc-width: 260px;
  --nav-height: 64px;
  --banner-height: 40px;

  /* Borders */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* Dark mode — explicit toggle */
:root[data-theme="dark"] {
  --color-bg: #0b0c10;
  --color-bg-alt: #15171d;
  --color-surface: #1b1e26;
  --color-text: #f1f2f5;
  --color-text-secondary: #a9adb8;
  --color-text-muted: #7d8290;
  --color-accent: #7c9bff;
  --color-accent-hover: #a3b8ff;
  --color-accent-subtle: rgba(124, 155, 255, 0.12);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.18);

  --color-code-bg: #0f1117;
  --color-code-border: rgba(255, 255, 255, 0.08);
  --color-inline-code-bg: rgba(124, 155, 255, 0.14);
  --color-inline-code-text: #c3d0ff;

  --color-nav-bg: #15171d;
  --color-nav-text: #f1f2f5;
  --color-nav-border: rgba(255, 255, 255, 0.08);

  --glass-bg: linear-gradient(135deg, rgba(44, 48, 62, 0.58), rgba(22, 24, 32, 0.42));
  --glass-bg-strong: linear-gradient(135deg, rgba(48, 53, 68, 0.82), rgba(26, 28, 38, 0.7));
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-edge: rgba(0, 0, 0, 0.45);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 1px 0 0 rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 40px rgba(0, 0, 0, 0.45);
  --backdrop-a: rgba(70, 100, 255, 0.30);
  --backdrop-b: rgba(150, 80, 255, 0.24);
  --backdrop-c: rgba(20, 184, 166, 0.16);
  --backdrop-d: rgba(236, 72, 153, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* ----------------------------------------------------------
   2. Reset
   ---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-height) + 2rem);
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* `clip` (not `hidden`) — `hidden` creates a scroll container and breaks position:sticky */
  overflow-x: clip;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

ul, ol {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-2xl) 0;
}

::selection {
  background: var(--color-accent);
  color: #ffffff;
}

/* ----------------------------------------------------------
   3. Typography
   ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: var(--line-height-heading);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }

p {
  margin-bottom: 1.25em;
}

strong { font-weight: 600; }

code, kbd, samp, pre {
  font-family: var(--font-mono);
}

/* ----------------------------------------------------------
   4. Layout
   ---------------------------------------------------------- */
.site-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  width: 100%;
}

.site-main {
  flex: 1;
  padding-top: var(--nav-height);
}

.has-banner .site-main {
  padding-top: calc(var(--nav-height) + var(--banner-height));
}

.post-layout {
  display: grid;
  grid-template-columns: 1fr var(--toc-width);
  gap: 60px;
  align-items: start;
  max-width: calc(var(--content-width) + var(--toc-width) + 60px);
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .post-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Match the post-layout width so header and body share a left edge */
.post {
  max-width: calc(var(--content-width) + var(--toc-width) + 60px);
  margin: 0 auto;
  padding: 0 24px;
  /* `clip` keeps the mobile overflow fix without breaking the sticky TOC */
  overflow-x: clip;
}

/* ----------------------------------------------------------
   5. Banner
   ---------------------------------------------------------- */
.site-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--banner-height);
  background: var(--color-text);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 1001;
  letter-spacing: 0.02em;
}

.site-banner a {
  color: var(--color-accent);
  font-weight: 600;
}

.site-banner .banner-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.has-banner .nav {
  top: var(--banner-height);
}

/* ----------------------------------------------------------
   6. Navigation
   ---------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-nav-border);
  z-index: 1000;
  transition: background-color var(--transition-base);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-links a {
  color: var(--color-nav-text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-nav-text);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--color-nav-text);
}

.nav-logo img {
  height: 32px;
  width: auto;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  padding: 2px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-nav-text);
  border-radius: 1px;
  transition: transform var(--transition-base), opacity var(--transition-fast);
}

.nav-toggle.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg);
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--space-2xl) var(--space-lg);
    gap: var(--space-lg);
    transform: translateX(100%);
    transition: transform var(--transition-base);
    z-index: 999;
  }

  .has-banner .nav-links {
    top: calc(var(--nav-height) + var(--banner-height));
  }

  .nav-links.is-open {
    transform: translateX(0);
  }

  .nav-links a {
    font-size: 1.2rem;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
    width: 100%;
  }

  .nav-toggle {
    display: flex;
  }
}

/* ----------------------------------------------------------
   7. Theme Toggle
   ---------------------------------------------------------- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  transition: background-color var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--color-border);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--color-text-secondary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----------------------------------------------------------
   8. Breadcrumb
   ---------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--color-border);
}

.breadcrumb a {
  color: var(--color-text-secondary);
}

.breadcrumb a:hover {
  color: var(--color-accent);
}

.breadcrumb .separator {
  color: var(--color-text-muted);
}

.breadcrumb .current {
  color: var(--color-text-secondary);
}

/* ----------------------------------------------------------
   9. Post Header
   ---------------------------------------------------------- */
.post-header {
  margin-bottom: var(--space-2xl);
}

.post-header .post-title {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4.6vw, 3.2rem);
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
  letter-spacing: -0.015em;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.post-meta .meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.post-meta .meta-label {
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

.post-hero {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-2xl);
}

.post-hero img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.post-categories {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.post-category {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------
   10. Post Content (Prose)
   ---------------------------------------------------------- */
.post-content {
  max-width: var(--content-width);
  min-width: 0;
  overflow-wrap: anywhere;
}

.post-content h2 {
  margin-top: 2.5em;
  margin-bottom: 0.8em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--color-border);
}

.post-content h3 {
  margin-top: 2em;
  margin-bottom: 0.6em;
}

.post-content h4 {
  margin-top: 1.6em;
  margin-bottom: 0.5em;
}

.post-content h5 {
  margin-top: 1.4em;
  margin-bottom: 0.4em;
}

.post-content p {
  margin-bottom: 1.25em;
}

/* Body links read as dark underlined text, not colored */
.post-content a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--transition-fast);
}

.post-content a:hover {
  color: var(--color-accent);
  text-decoration-thickness: 2px;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }

.post-content ul ul { list-style: circle; }
.post-content ol ol { list-style: lower-alpha; }

.post-content li {
  margin-bottom: 0.4em;
}

.post-content li > ul,
.post-content li > ol {
  margin-top: 0.4em;
  margin-bottom: 0;
}

.post-content blockquote {
  margin: 1.5em 0;
  padding: var(--space-md) var(--space-lg);
  border-left: 2px solid var(--color-border-strong);
  background: var(--color-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
  font-style: italic;
}

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

.post-content code:not(pre code) {
  background: var(--color-inline-code-bg);
  color: var(--color-inline-code-text);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  font-weight: 500;
}

.post-content img {
  border-radius: var(--radius-md);
  margin: 1.5em 0;
}

.post-content figure {
  margin: 2em 0;
}

.post-content figure img {
  margin: 0;
}

.post-content figcaption {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  text-align: center;
  margin-top: var(--space-sm);
  font-style: italic;
}

.post-content table {
  margin: 1.5em 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.post-content thead {
  background: var(--color-surface);
}

.post-content th,
.post-content td {
  padding: 0.6em 1em;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: 0.95rem;
}

.post-content th {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-secondary);
}

.post-content .table-wrapper {
  overflow-x: auto;
}

/* ----------------------------------------------------------
   11. Code Blocks
   ---------------------------------------------------------- */
.post-content pre,
pre.chroma,
.highlight pre {
  background: var(--color-code-bg) !important;
  color: var(--color-code-text);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 1.5em 0;
  border: 1px solid var(--color-code-border);
  tab-size: 4;
}

.post-content pre code,
pre.chroma code,
.highlight pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
  font-weight: normal;
}

.highlight {
  position: relative;
  margin: 1.5em 0;
}

/* Line numbers */
.highlight .lnt,
.highlight .ln {
  color: #585b70;
  padding-right: 1em;
  user-select: none;
}

/* Hugo Chroma syntax classes */
.chroma .k,   /* Keyword */
.chroma .kc,  /* KeywordConstant */
.chroma .kd,  /* KeywordDeclaration */
.chroma .kn,  /* KeywordNamespace */
.chroma .kp,  /* KeywordPseudo */
.chroma .kr,  /* KeywordReserved */
.chroma .kt   /* KeywordType */
  { color: #cba6f7; }

.chroma .n    /* Name */
  { color: #cdd6f4; }

.chroma .na   /* NameAttribute */
  { color: #89dceb; }

.chroma .nb   /* NameBuiltin */
  { color: #f9e2af; }

.chroma .nc   /* NameClass */
  { color: #f9e2af; }

.chroma .nd   /* NameDecorator */
  { color: #89b4fa; }

.chroma .nf,  /* NameFunction */
.chroma .fm   /* NameFunctionMagic */
  { color: #89b4fa; }

.chroma .ni   /* NameEntity */
  { color: #94e2d5; }

.chroma .nn   /* NameNamespace */
  { color: #f9e2af; }

.chroma .nt   /* NameTag */
  { color: #f38ba8; }

.chroma .nv,  /* NameVariable */
.chroma .vm   /* NameVariableMagic */
  { color: #cdd6f4; }

.chroma .s,   /* String */
.chroma .sa,  /* StringAffix */
.chroma .sb,  /* StringBacktick */
.chroma .sc,  /* StringChar */
.chroma .dl,  /* StringDelimiter */
.chroma .sd,  /* StringDoc */
.chroma .s2,  /* StringDouble */
.chroma .se,  /* StringEscape */
.chroma .sh,  /* StringHeredoc */
.chroma .si,  /* StringInterpol */
.chroma .sx,  /* StringOther */
.chroma .sr,  /* StringRegex */
.chroma .s1,  /* StringSingle */
.chroma .ss   /* StringSymbol */
  { color: #a6e3a1; }

.chroma .m,   /* Number */
.chroma .mb,  /* NumberBin */
.chroma .mf,  /* NumberFloat */
.chroma .mh,  /* NumberHex */
.chroma .mi,  /* NumberInteger */
.chroma .il,  /* NumberIntegerLong */
.chroma .mo   /* NumberOct */
  { color: #fab387; }

.chroma .o,   /* Operator */
.chroma .ow   /* OperatorWord */
  { color: #89dceb; }

.chroma .p    /* Punctuation */
  { color: #6c7086; }

.chroma .c,   /* Comment */
.chroma .ch,  /* CommentHashbang */
.chroma .cm,  /* CommentMultiline */
.chroma .c1,  /* CommentSingle */
.chroma .cs,  /* CommentSpecial */
.chroma .cp,  /* CommentPreproc */
.chroma .cpf  /* CommentPreprocFile */
  { color: #6c7086; font-style: italic; }

.chroma .gd   /* GenericDeleted */
  { color: #f38ba8; background: rgba(243, 139, 168, 0.1); }

.chroma .gi   /* GenericInserted */
  { color: #a6e3a1; background: rgba(166, 227, 161, 0.1); }

.chroma .ge   /* GenericEmph */
  { font-style: italic; }

.chroma .gs   /* GenericStrong */
  { font-weight: bold; }

.chroma .gh   /* GenericHeading */
  { color: #89b4fa; font-weight: bold; }

.chroma .gu   /* GenericSubheading */
  { color: #94e2d5; }

.chroma .gl   /* GenericUnderline */
  { text-decoration: underline; }

/* Copy button on code blocks */
.highlight .copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(205, 214, 244, 0.1);
  border: 1px solid rgba(205, 214, 244, 0.15);
  color: #6c7086;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.highlight:hover .copy-btn {
  opacity: 1;
}

.highlight .copy-btn:hover {
  background: rgba(205, 214, 244, 0.2);
  color: #cdd6f4;
}

/* ----------------------------------------------------------
   12. TOC Sidebar
   ---------------------------------------------------------- */
.toc-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
  max-height: calc(100vh - var(--nav-height) - 4rem);
  overflow-y: auto;
  padding-left: var(--space-lg);
  border-left: 1px solid var(--color-border);
}

.has-banner .toc-sidebar {
  top: calc(var(--nav-height) + var(--banner-height) + 2rem);
}

.toc-sidebar .toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

/* Hugo emits <nav id="TableOfContents">, so both selectors are needed */
.toc-list,
#TableOfContents {
  font-size: 0.82rem;
  line-height: 1.5;
}

.toc-list ul,
#TableOfContents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li,
#TableOfContents li {
  margin: 0;
}

.toc-list a,
#TableOfContents a {
  display: block;
  padding: 4px 0 4px 12px;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.toc-list a:hover,
#TableOfContents a:hover {
  color: var(--color-text);
  border-left-color: var(--color-border-strong);
}

.toc-list a.active,
#TableOfContents a.active {
  color: var(--color-text);
  border-left-color: var(--color-accent);
  font-weight: 500;
}

/* Nesting depth indentation: h2=0, h3=+12px, h4=+24px, h5=+36px */
.toc-list .toc-h3 a, #TableOfContents ul ul a { padding-left: 24px; }
.toc-list .toc-h4 a, #TableOfContents ul ul ul a { padding-left: 36px; }
.toc-list .toc-h5 a, #TableOfContents ul ul ul ul a { padding-left: 48px; }

/* Scrollbar for TOC */
.toc-sidebar::-webkit-scrollbar {
  width: 3px;
}
.toc-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.toc-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

/* Mobile TOC */
.toc-mobile {
  display: none;
  margin-bottom: var(--space-xl);
}

.toc-mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.toc-mobile-toggle svg {
  width: 16px;
  height: 16px;
  stroke: var(--color-text-secondary);
  transition: transform var(--transition-fast);
}

.toc-mobile-toggle.is-open svg {
  transform: rotate(180deg);
}

.toc-mobile-content {
  display: none;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.toc-mobile-content.is-open {
  display: block;
}

@media (max-width: 1024px) {
  .toc-sidebar {
    display: none;
  }
  .toc-mobile {
    display: block;
  }
}

/* ----------------------------------------------------------
   13. Cards
   ---------------------------------------------------------- */
.card {
  background: var(--color-bg-alt);
  border: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.card-media {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.card:hover .card-media img {
  transform: scale(1.03);
}

.card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg-alt) 100%);
  border-bottom: 1px solid var(--color-border);
}

.card-placeholder span {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-text-muted);
  opacity: 0.4;
  letter-spacing: 0.05em;
  user-select: none;
}

.card-body {
  padding: 16px 20px 12px;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.card-meta time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-arrow {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 20px 16px;
}

.card-arrow svg {
  width: 18px;
  height: 18px;
  stroke: var(--color-text-muted);
  transition: stroke var(--transition-fast), transform var(--transition-fast);
}

.card:hover .card-arrow svg {
  stroke: var(--color-accent);
  transform: translateX(4px);
}

/* Continue reading / related posts section */
.related-posts {
  margin-top: var(--space-4xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}

.related-posts .section-title,
.related-posts h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: var(--space-xl);
}

/* ----------------------------------------------------------
   13b. Post List View
   ---------------------------------------------------------- */
.post-list {
  max-width: 100%;
  margin: 0 auto;
}

.post-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
}

.post-row:first-child {
  border-top: 1px solid var(--color-border);
}

.post-row-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* Meta line sits above the title, mono + uppercase */
.post-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.post-row-meta time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.post-row-title {
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.post-row:hover .post-row-title {
  color: var(--color-accent);
}

/* Square arrow button card affordance */
.post-row-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.post-row:hover .post-row-arrow {
  background: var(--color-text);
  color: var(--color-bg);
}

@media (max-width: 768px) {
  .post-row {
    gap: 16px;
    padding: 22px 0;
  }

  .post-row-arrow {
    width: 32px;
    height: 32px;
  }
}

/* ----------------------------------------------------------
   14. Pagination
   ---------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-3xl);
  padding: var(--space-xl) 0;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.pagination a:hover {
  background: var(--color-border-strong);
  color: var(--color-text);
}

.pagination .active {
  background: var(--color-text);
  color: var(--color-bg);
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ----------------------------------------------------------
   15. Footer
   ---------------------------------------------------------- */
.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  margin-top: var(--space-4xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-2xl);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 32px;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand {
  max-width: 280px;
}

.footer-brand-link {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-footer-heading);
  text-decoration: none;
  margin-bottom: 8px;
}

.footer-brand-link:hover {
  color: #ffffff;
}

.footer-brand p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--color-footer-text);
  margin: 0;
}

.footer-col h4 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-footer-heading);
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 6px;
}

.footer-col a {
  color: var(--color-footer-link);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: #ffffff;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  border-top: 1px solid var(--color-footer-border);
  font-size: 0.78rem;
  color: var(--color-footer-text);
}

/* ----------------------------------------------------------
   16. Shortcodes — Alert / Admonition
   ---------------------------------------------------------- */
.admonition {
  margin: 1.5em 0;
  padding: var(--space-md) var(--space-lg);
  border-left: 4px solid var(--color-info);
  background: var(--color-accent-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.admonition-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admonition-header svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.admonition-body p:last-child {
  margin-bottom: 0;
}

.admonition.note    { border-left-color: #8b5cf6; background: rgba(139, 92, 246, 0.06); }
.admonition.note .admonition-header { color: #8b5cf6; }

.admonition.tip     { border-left-color: #10b981; background: rgba(16, 185, 129, 0.06); }
.admonition.tip .admonition-header { color: #10b981; }

.admonition.info    { border-left-color: #3b82f6; background: rgba(59, 130, 246, 0.06); }
.admonition.info .admonition-header { color: #3b82f6; }

.admonition.warning { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.06); }
.admonition.warning .admonition-header { color: #f59e0b; }

.admonition.danger  { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.06); }
.admonition.danger .admonition-header { color: #ef4444; }

.admonition.success { border-left-color: #22c55e; background: rgba(34, 197, 94, 0.06); }
.admonition.success .admonition-header { color: #22c55e; }

.admonition.abstract { border-left-color: #06b6d4; background: rgba(6, 182, 212, 0.06); }
.admonition.abstract .admonition-header { color: #06b6d4; }

.admonition.question { border-left-color: #8b5cf6; background: rgba(139, 92, 246, 0.06); }
.admonition.question .admonition-header { color: #8b5cf6; }

.admonition.quote   { border-left-color: var(--color-text-muted); background: var(--color-surface); }
.admonition.quote .admonition-header { color: var(--color-text-secondary); }

.admonition.example { border-left-color: #a855f7; background: rgba(168, 85, 247, 0.06); }
.admonition.example .admonition-header { color: #a855f7; }

.admonition.bug     { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.06); }
.admonition.bug .admonition-header { color: #ef4444; }

/* Alert shortcode (simpler version) */
.alert {
  margin: 1.5em 0;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

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

/* ----------------------------------------------------------
   17. Shortcodes — Accordion
   ---------------------------------------------------------- */
.accordion {
  margin: 1em 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion + .accordion {
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.accordion.separated + .accordion {
  margin-top: 0.5em;
  border-radius: var(--radius-md);
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  background: var(--color-surface);
  transition: background var(--transition-fast);
}

.accordion-trigger:hover {
  background: var(--color-border);
}

.accordion-trigger svg {
  width: 16px;
  height: 16px;
  stroke: var(--color-text-secondary);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}

.accordion.is-open .accordion-trigger svg {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.accordion.is-open .accordion-content {
  max-height: 2000px;
}

.accordion-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.accordion-body p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------
   18. Shortcodes — Badge
   ---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border: 1px solid transparent;
}

.badge.info    { background: rgba(59, 130, 246, 0.1);  color: #3b82f6; }
.badge.success { background: rgba(34, 197, 94, 0.1);   color: #22c55e; }
.badge.warning { background: rgba(245, 158, 11, 0.1);  color: #f59e0b; }
.badge.danger  { background: rgba(239, 68, 68, 0.1);   color: #ef4444; }
.badge.neutral { background: var(--color-surface);      color: var(--color-text-secondary); border-color: var(--color-border); }

/* ----------------------------------------------------------
   19. Shortcodes — Button
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.55em 1.25em;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 2px solid transparent;
  line-height: 1.4;
}

.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #ffffff;
}

.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-secondary:hover {
  background: var(--color-accent);
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  border-color: var(--color-text);
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* ----------------------------------------------------------
   20. Shortcodes — Gallery
   ---------------------------------------------------------- */
.gallery {
  display: grid;
  gap: var(--space-sm);
  margin: 1.5em 0;
}

.gallery.grid-2 { grid-template-columns: repeat(2, 1fr); }
.gallery.grid-3 { grid-template-columns: repeat(3, 1fr); }
.gallery.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 480px) {
  .gallery.grid-3,
  .gallery.grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.gallery img:hover {
  transform: scale(1.02);
}

/* ----------------------------------------------------------
   21. Shortcodes — GitHub Card
   ---------------------------------------------------------- */
.github-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: 1.5em 0;
  transition: box-shadow var(--transition-fast);
}

.github-card:hover {
  box-shadow: var(--shadow-md);
}

.github-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.github-card-header svg {
  width: 20px;
  height: 20px;
  fill: var(--color-text-secondary);
  flex-shrink: 0;
}

.github-card-name {
  font-weight: 600;
  color: var(--color-accent);
}

.github-card-desc {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.github-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.github-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.github-card-lang-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* ----------------------------------------------------------
   22. Shortcodes — Lead
   ---------------------------------------------------------- */
.lead {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  font-weight: 400;
}

/* ----------------------------------------------------------
   23. Shortcodes — Tabs
   ---------------------------------------------------------- */
.tabs-container {
  margin: 1.5em 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tabs-nav {
  display: flex;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.tab-btn {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  background: var(--color-bg);
}

.tab-panel {
  display: none;
  padding: var(--space-lg);
}

.tab-panel.active {
  display: block;
}

.tab-panel p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------
   24. Shortcodes — Timeline
   ---------------------------------------------------------- */
.timeline {
  position: relative;
  margin: 1.5em 0;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-2rem + 3px);
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
  z-index: 1;
}

.timeline-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.timeline-header {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.timeline-subheader {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.timeline-body p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------
   25. Shortcodes — Steps
   ---------------------------------------------------------- */
.steps {
  counter-reset: step-counter;
  margin: 1.5em 0;
  padding-left: 0;
}

.step {
  display: flex;
  gap: var(--space-lg);
  padding-bottom: var(--space-xl);
  position: relative;
  counter-increment: step-counter;
}

.step::before {
  content: counter(step-counter);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
}

.step::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.step:last-child::after {
  display: none;
}

.step-content {
  padding-top: 4px;
  flex: 1;
}

.step-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.step-body p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------
   26. Shortcodes — Carousel
   ---------------------------------------------------------- */
.carousel {
  position: relative;
  margin: 1.5em 0;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.carousel-track {
  display: flex;
  transition: transform var(--transition-slow);
}

.carousel-slide {
  min-width: 100%;
  flex-shrink: 0;
}

.carousel-slide img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background var(--transition-fast);
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }

.carousel-btn svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: var(--space-md);
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
  transition: background var(--transition-fast);
}

.carousel-dot.active {
  background: var(--color-accent);
}

.carousel-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  padding: var(--space-sm) var(--space-md);
  font-style: italic;
}

/* ----------------------------------------------------------
   27. Shortcodes — Stats
   ---------------------------------------------------------- */
.stats-grid {
  display: grid;
  gap: var(--space-lg);
  margin: 1.5em 0;
}

.stats-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .stats-grid.cols-3,
  .stats-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  text-align: center;
  padding: var(--space-xl);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ----------------------------------------------------------
   28. Shortcodes — Feature Grid
   ---------------------------------------------------------- */
.feature-grid {
  display: grid;
  gap: var(--space-xl);
  margin: 1.5em 0;
}

.feature-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.feature-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.feature-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .feature-grid.cols-3,
  .feature-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .feature-grid.cols-2,
  .feature-grid.cols-3,
  .feature-grid.cols-4 {
    grid-template-columns: 1fr;
  }
}

.feature-item {
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: box-shadow var(--transition-fast);
}

.feature-item:hover {
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-md);
  color: var(--color-accent);
}

.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.feature-desc {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.feature-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-md);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ----------------------------------------------------------
   29. Shortcodes — Swatches
   ---------------------------------------------------------- */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: 1.5em 0;
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.swatch-color {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.swatch-label {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

/* ----------------------------------------------------------
   30. Shortcodes — Keyword
   ---------------------------------------------------------- */
.keyword {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* ----------------------------------------------------------
   31. Shortcodes — KaTeX
   ---------------------------------------------------------- */
.katex-display {
  overflow-x: auto;
  padding: var(--space-md) 0;
}

.katex-display > .katex {
  text-align: center;
}

/* ----------------------------------------------------------
   32. Shortcodes — Video
   ---------------------------------------------------------- */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-sm);
  font-style: italic;
}

/* ----------------------------------------------------------
   33. Shortcodes — YouTube Lite
   ---------------------------------------------------------- */
.youtube-lite {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: #000;
}

.youtube-lite img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.youtube-lite .play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.youtube-lite:hover .play-btn {
  background: #ff0000;
}

.youtube-lite .play-btn svg {
  width: 24px;
  height: 24px;
  fill: #ffffff;
}

/* ----------------------------------------------------------
   34. Shortcodes — CTA Button
   ---------------------------------------------------------- */
.cta-section {
  text-align: center;
  padding: var(--space-2xl);
  margin: 1.5em 0;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.cta-section .btn {
  font-size: 1rem;
}

/* ----------------------------------------------------------
   35. Shortcodes — Email
   ---------------------------------------------------------- */
.email-link {
  unicode-bidi: bidi-override;
  direction: ltr;
}

/* ----------------------------------------------------------
   36. Shortcodes — Code Importer
   ---------------------------------------------------------- */
.code-importer-source {
  font-size: 0.75rem;
  text-align: right;
  color: var(--color-text-muted);
  margin-top: -0.5em;
  margin-bottom: 1.5em;
}

.code-importer-source a {
  color: var(--color-text-muted);
  text-decoration: underline;
}

/* ----------------------------------------------------------
   37. Shortcodes — Chart (Chart.js)
   ---------------------------------------------------------- */
.chart-container {
  position: relative;
  margin: 1.5em 0;
  padding: var(--space-lg);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.chart-container canvas {
  max-width: 100%;
}

/* ----------------------------------------------------------
   38. Shortcodes — List (article list)
   ---------------------------------------------------------- */
.article-list {
  margin: 1.5em 0;
}

.article-list .article-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}

.article-list .article-item:last-child {
  border-bottom: none;
}

.article-list .article-thumb {
  width: 80px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.article-list .article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-list .article-info {
  flex: 1;
}

.article-list .article-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.article-list .article-title a {
  color: var(--color-text);
  text-decoration: none;
}

.article-list .article-title a:hover {
  color: var(--color-accent);
}

.article-list .article-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ----------------------------------------------------------
   39. Shortcodes — TypeIt
   ---------------------------------------------------------- */
.typeit-cursor {
  display: inline-block;
  width: 2px;
  margin-left: 1px;
  background: var(--color-accent);
  animation: blink-cursor 0.8s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ----------------------------------------------------------
   40. Shortcodes — Mermaid
   ---------------------------------------------------------- */
/* The shortcode emits <pre class="mermaid">, which otherwise inherits the
   dark code-block background and renders the diagram on black. */
.mermaid,
.post-content pre.mermaid {
  margin: 1.5em 0;
  padding: 0;
  text-align: center;
  background: transparent !important;
  border: none;
  overflow-x: auto;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ----------------------------------------------------------
   41. Shortcodes — Figure (enhanced)
   ---------------------------------------------------------- */
.figure {
  margin: 2em 0;
}

.figure.align-center { text-align: center; }
.figure.align-left   { float: left; margin-right: var(--space-xl); max-width: 50%; }
.figure.align-right  { float: right; margin-left: var(--space-xl); max-width: 50%; }

.figure img {
  border-radius: var(--radius-md);
}

.figure figcaption {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  text-align: center;
  margin-top: var(--space-sm);
  font-style: italic;
}

/* ----------------------------------------------------------
   42. Tags
   ---------------------------------------------------------- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-xl) 0;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ----------------------------------------------------------
   43. Search (basic)
   ---------------------------------------------------------- */
.search-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

/* ----------------------------------------------------------
   44. Animations
   ---------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }

/* ----------------------------------------------------------
   45. Utility Classes
   ---------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.gap-xl  { gap: var(--space-xl); }
.gap-2xl { gap: var(--space-2xl); }

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.text-sm     { font-size: 0.85rem; }
.text-muted  { color: var(--color-text-secondary); }
.text-accent { color: var(--color-accent); }

.mt-0  { margin-top: 0; }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-0  { margin-bottom: 0; }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.mx-auto { margin-left: auto; margin-right: auto; }

.w-full { width: 100%; }

/* ----------------------------------------------------------
   46. Responsive Overrides
   ---------------------------------------------------------- */
@media (max-width: 1200px) {
  :root {
    --max-width: 960px;
  }
}

@media (max-width: 1024px) {
  .post-content {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.2rem; }

  .post-header .post-title {
    font-size: 1.8rem;
  }

  .site-container {
    padding: 0 var(--space-md);
  }

  .post-meta {
    gap: var(--space-sm);
  }

  .post-meta .post-meta-sep {
    display: none;
  }

  .section-header {
    padding: var(--space-2xl) 0 var(--space-xl);
  }

  .section-header h1 {
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  :root {
    --font-size-base: 16px;
  }

  h1 { font-size: 1.6rem; }

  .post-header .post-title {
    font-size: 1.5rem;
  }

  .card-body {
    padding: 12px 16px 8px;
  }
}

/* ----------------------------------------------------------
   47. Print
   ---------------------------------------------------------- */
@media print {
  .nav,
  .site-banner,
  .theme-toggle,
  .toc-sidebar,
  .toc-mobile,
  .site-footer,
  .related-posts,
  .nav-toggle {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  .site-main {
    padding-top: 0;
  }

  .post-content a {
    text-decoration: underline;
  }

  .post-content a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ============================================================
   TEMPLATE-ALIGNED ADDITIONS
   Classes used by layout templates and shortcodes
   ============================================================ */

/* ----------------------------------------------------------
   Nav / Header
   ---------------------------------------------------------- */
/* Floating pill nav, centered */
.nav-wrapper {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: transparent;
  border-bottom: none;
  padding: 14px 24px;
  transition: padding 0.3s;
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 620px; margin: 0 auto; padding: 0 20px; height: 52px;
  background: var(--color-nav-bg);
  border: 1px solid var(--color-nav-border);
  border-radius: var(--radius-md);
  transition: box-shadow 0.3s;
}
.nav-wrapper.scrolled .nav { box-shadow: var(--shadow-md); }
.nav-links { display: flex; align-items: center; justify-content: center; gap: 26px; flex: 1; }
.nav-link {
  color: var(--color-text-secondary); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: color 0.2s; letter-spacing: 0.01em;
}
.nav-link:hover, .nav-link.active { color: var(--color-text); }
.nav-icon-link { display: flex; align-items: center; }
.nav-logo-link { padding: 0 32px; text-decoration: none; flex-shrink: 0; }
.nav-logo-text {
  font-family: var(--font-mono); font-size: 14px; font-weight: 700;
  color: var(--color-text); letter-spacing: 0.08em; text-transform: uppercase;
}
.nav-logo { height: 28px; }

/* ----------------------------------------------------------
   Mobile Menu
   ---------------------------------------------------------- */
.mob-menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  padding: 8px; z-index: 1001;
}
.mob-menu-bar {
  display: block; width: 20px; height: 2px; background: var(--color-text);
  margin: 4px 0; transition: transform 0.3s, opacity 0.3s; border-radius: 1px;
}
.mob-menu-btn.is-active .mob-menu-bar:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.mob-menu-btn.is-active .mob-menu-bar:nth-child(2) { opacity: 0; }
.mob-menu-btn.is-active .mob-menu-bar:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}
.mob-menu {
  position: fixed; top: 0; right: -100%; width: 280px; height: 100vh;
  background: var(--color-bg); z-index: 999; transition: right 0.3s ease;
  padding: 80px 24px 24px; box-shadow: -4px 0 24px rgba(0,0,0,0.1);
}
.mob-menu.is-open { right: 0; }
.mob-menu-inner { display: flex; flex-direction: column; gap: 8px; }
.mob-menu-link {
  display: block; padding: 12px 0; color: var(--color-text); font-size: 18px;
  font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--color-border);
}
.mob-theme-toggle {
  margin-top: 16px; display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--color-text-secondary);
}
body.menu-open { overflow: hidden; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  /* With the wordmark gone the toggle is the only child, so keep it right-aligned */
  .mob-menu-btn { display: block; margin-left: auto; }
  .nav { justify-content: flex-end; }
}

/* ----------------------------------------------------------
   Theme Toggle Icon Visibility
   ---------------------------------------------------------- */
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun,
:root:not([data-theme="dark"]) .icon-sun { display: none; }
[data-theme="light"] .icon-moon,
:root:not([data-theme="dark"]) .icon-moon { display: block; }

/* ----------------------------------------------------------
   Site Main
   ---------------------------------------------------------- */
.site-main { padding-top: 96px; min-height: 60vh; }
.has-banner .site-main { padding-top: 132px; }

/* ----------------------------------------------------------
   Hero Section
   ---------------------------------------------------------- */
.hero {
  text-align: center;
  padding: 72px 24px 48px;
  max-width: 720px;
  margin: 0 auto;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.3rem, 5.5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--color-text);
}
.hero-desc {
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--color-accent); color: #fff; padding: 10px 20px;
  border-radius: 8px; font-weight: 600; font-size: 14px;
  text-decoration: none; transition: background 0.2s; margin-top: 20px;
}
.hero-cta:hover { background: var(--color-accent-hover); }

/* ----------------------------------------------------------
   Section Headers / Post Grid / Recent Posts
   ---------------------------------------------------------- */
.section-list { max-width: 860px; margin: 0 auto; padding: 40px 24px 80px; }
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 32px; flex-wrap: wrap; gap: 16px;
}
.section-title {
  font-size: 1.9rem; font-weight: 400; color: var(--color-text);
  letter-spacing: -0.01em;
}
.section-desc { color: var(--color-text-secondary); font-size: 1rem; }
.section-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--color-text-secondary); font-family: var(--font-mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  text-decoration: none; transition: gap 0.2s, color 0.2s;
}
.section-link:hover { color: var(--color-accent); }
.section-link:hover { gap: 10px; }
.recent-posts { max-width: 860px; margin: 0 auto; padding: 0 24px 64px; }
.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
@media (max-width: 768px) {
  .post-grid { grid-template-columns: 1fr; }
}
.no-posts { color: var(--color-text-secondary); text-align: center; padding: 60px 0; }

/* ----------------------------------------------------------
   Post Tags
   ---------------------------------------------------------- */
.post-tags {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 48px;
  padding-top: 24px; border-top: 1px solid var(--color-border);
}
.post-tag {
  display: inline-block; padding: 5px 10px; background: var(--color-surface);
  color: var(--color-text-secondary); font-family: var(--font-mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  border-radius: var(--radius-sm);
  text-decoration: none; transition: background 0.2s, color 0.2s;
}
.post-tag:hover { background: var(--color-accent-subtle); color: var(--color-accent); }

/* ----------------------------------------------------------
   TOC Wrapper (sticky inner)
   ---------------------------------------------------------- */
/* Stickiness lives on .toc-sidebar; a second sticky here would be inert
   anyway since the sidebar is itself a scroll container. */
.toc-wrapper { position: static; }

/* ----------------------------------------------------------
   Related Posts
   ---------------------------------------------------------- */
.related-posts {
  margin-top: 64px; padding-top: 48px;
  border-top: 1px solid var(--color-border);
}
.related-header { margin-bottom: 32px; }
.related-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--color-text); }

/* (Post card additions removed — using .card classes now) */

/* ----------------------------------------------------------
   Banner
   ---------------------------------------------------------- */
.banner {
  background: var(--color-accent); color: #fff; padding: 8px 24px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  font-size: 13px; position: relative; z-index: 1001;
}
.banner-content { display: flex; align-items: center; gap: 12px; }
.banner-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.banner-text { font-weight: 400; }
.banner-cta {
  display: inline-flex; align-items: center; gap: 6px; color: #fff;
  text-decoration: none; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 12px; border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px; transition: background 0.2s;
}
.banner-cta:hover { background: rgba(255,255,255,0.15); }
.has-banner .nav-wrapper { top: 36px; }

/* ----------------------------------------------------------
   Breadcrumb Separator
   ---------------------------------------------------------- */
.breadcrumb-sep { color: var(--color-text-muted); margin: 0 4px; }

/* ----------------------------------------------------------
   Taxonomy Pages
   ---------------------------------------------------------- */
.taxonomy-list { display: flex; flex-wrap: wrap; gap: 12px; }
.taxonomy-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.taxonomy-item:hover { border-color: var(--color-accent); background: var(--color-accent-subtle); }
.taxonomy-name { color: var(--color-text); font-weight: 500; }
.taxonomy-count {
  font-size: 13px; color: var(--color-text-muted);
  background: var(--color-border); padding: 2px 8px; border-radius: 12px;
}

/* ----------------------------------------------------------
   Pagination
   ---------------------------------------------------------- */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 4px; margin-top: 48px; padding-top: 24px;
}
.pagination-link {
  display: flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 8px; border-radius: 6px;
  font-size: 14px; font-weight: 500; color: var(--color-text-secondary);
  text-decoration: none; transition: background 0.2s, color 0.2s;
}
.pagination-link:hover { background: var(--color-surface); color: var(--color-text); }
.pagination-link.active { background: var(--color-accent); color: #fff; }
.pagination-prev, .pagination-next {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pagination-link.disabled { opacity: 0.4; pointer-events: none; }
.pagination-pages { display: flex; gap: 4px; }

/* ----------------------------------------------------------
   Shortcode Class Aliases
   Templates use shortcode-* prefix
   ---------------------------------------------------------- */

/* Lead */
.shortcode-lead {
  font-size: 1.25rem; line-height: 1.7;
  color: var(--color-text-secondary); margin-bottom: 1.5rem;
}

/* Keyword */
.shortcode-keyword {
  background: var(--color-accent-subtle); color: var(--color-accent);
  padding: 2px 6px; border-radius: 4px; font-weight: 600;
}

/* GitHub Card */
.shortcode-github-card {
  border: 1px solid var(--color-border); border-radius: 12px;
  padding: 20px; margin: 16px 0; background: var(--color-bg-alt);
}
.shortcode-github-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.shortcode-github-card-name {
  font-weight: 600; font-size: 1.1rem; color: var(--color-accent);
  text-decoration: none;
}
.shortcode-github-card-name:hover { text-decoration: underline; }
.shortcode-github-card-desc {
  color: var(--color-text-secondary); font-size: 14px;
  line-height: 1.5; margin-bottom: 12px;
}
.shortcode-github-card-stats { display: flex; gap: 16px; }
.shortcode-github-card-stat {
  display: flex; align-items: center; gap: 4px; font-size: 13px;
  color: var(--color-text-secondary);
}
.shortcode-github-card-lang { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.shortcode-github-card-lang-dot {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
}

/* Stats */
.shortcode-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px; margin: 16px 0;
}
.shortcode-stat {
  text-align: center; padding: 24px 16px; background: var(--color-surface);
  border-radius: 12px; border: 1px solid var(--color-border);
}
.shortcode-stat-value {
  font-size: 2rem; font-weight: 800; color: var(--color-text); line-height: 1.2;
}
.shortcode-stat-label {
  font-size: 13px; color: var(--color-text-secondary); margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* Steps */
/* step.html emits an empty <span>; the digit comes from this counter */
.shortcode-steps { position: relative; padding-left: 40px; margin: 24px 0; counter-reset: shortcode-step; }
.shortcode-step { counter-increment: shortcode-step; }
.shortcode-step-number::before { content: counter(shortcode-step); }
.shortcode-steps::before {
  content: ''; position: absolute; left: 15px; top: 0; bottom: 0;
  width: 2px; background: var(--color-border);
}
.shortcode-step { position: relative; margin-bottom: 32px; }
.shortcode-step:last-child { margin-bottom: 0; }
.shortcode-step-indicator { position: absolute; left: -40px; top: 0; }
.shortcode-step-number {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-text); color: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500; position: relative; z-index: 1;
}
.shortcode-step-title {
  font-weight: 600; font-size: 1.1rem; margin-bottom: 8px;
  color: var(--color-text);
}
.shortcode-step-content { color: var(--color-text-secondary); line-height: 1.6; }

/* Timeline */
.shortcode-timeline { position: relative; padding-left: 40px; margin: 24px 0; }
.shortcode-timeline::before {
  content: ''; position: absolute; left: 15px; top: 0; bottom: 0;
  width: 2px; background: var(--color-border);
}
.shortcode-timeline-event { position: relative; margin-bottom: 32px; }
.shortcode-timeline-event:last-child { margin-bottom: 0; }
.shortcode-timeline-marker { position: absolute; left: -40px; top: 0; }
.shortcode-timeline-dot {
  display: block;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--color-text); border: 3px solid var(--color-bg);
  position: relative; left: 7px; z-index: 1;
}
/* Row so the title, badge and date don't run together */
.shortcode-timeline-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-weight: 500; font-size: 1rem; color: var(--color-text);
  margin-bottom: 4px;
}
.shortcode-timeline-date {
  font-family: var(--font-mono);
  font-size: 0.7rem; letter-spacing: 0.07em;
  color: var(--color-text-muted); margin-left: auto;
}
.shortcode-timeline-content { color: var(--color-text-secondary); line-height: 1.6; }

/* Tabs */
.shortcode-tabs {
  margin: 24px 0; border: 1px solid var(--color-border);
  border-radius: 12px; overflow: hidden;
}
.shortcode-tabs-nav {
  display: flex; background: var(--color-surface);
  border-bottom: 1px solid var(--color-border); overflow-x: auto;
}
.shortcode-tabs-nav button {
  padding: 12px 20px; background: none; border: none;
  border-bottom: 2px solid transparent; color: var(--color-text-secondary);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.shortcode-tabs-nav button:hover { color: var(--color-text); }
.shortcode-tabs-nav button.active {
  color: var(--color-accent); border-bottom-color: var(--color-accent);
}
.shortcode-tabs-content { padding: 20px; }
.shortcode-tab-panel { display: none; }
.shortcode-tab-panel.active { display: block; }

/* Swatches */
.shortcode-swatches { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.shortcode-swatch { text-align: center; }
.shortcode-swatch-color {
  width: 60px; height: 60px; border-radius: 8px;
  border: 1px solid var(--color-border); margin-bottom: 4px;
}
.shortcode-swatch-label {
  font-size: 11px; font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

/* Video */
.shortcode-video { position: relative; margin: 24px 0; border-radius: 12px; overflow: hidden; }
.shortcode-video video { width: 100%; display: block; }

/* YouTube Lite */
.shortcode-youtube-lite {
  position: relative; margin: 24px 0; border-radius: 12px;
  overflow: hidden; cursor: pointer; background: #000;
}
.shortcode-youtube-placeholder { position: relative; padding-top: 56.25%; }
.shortcode-youtube-placeholder img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.shortcode-youtube-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 68px; height: 48px; background: rgba(255,0,0,0.8);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
}
.shortcode-youtube-play svg { fill: #fff; }

/* List */
.shortcode-list { margin: 24px 0; }
.shortcode-list-title {
  font-weight: 600; font-size: 1.25rem; margin-bottom: 16px;
  color: var(--color-text);
}
.shortcode-list-item {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--color-border);
}
.shortcode-list-item-title a {
  color: var(--color-text); text-decoration: none; font-weight: 500;
}
.shortcode-list-item-title a:hover { color: var(--color-accent); }
.shortcode-list-item-date { font-size: 13px; color: var(--color-text-muted); }

/* Feature Grid */
.shortcode-feature-grid {
  display: grid; gap: 24px; margin: 24px 0;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.shortcode-feature {
  padding: 24px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: 12px;
}
.shortcode-feature-icon { margin-bottom: 12px; color: var(--color-text); }
.shortcode-feature-title {
  font-weight: 600; font-size: 1.1rem; margin-bottom: 8px;
  color: var(--color-text);
}
.shortcode-feature-body {
  color: var(--color-text-secondary); font-size: 14px; line-height: 1.6;
}

/* ----------------------------------------------------------
   Animation Keyframes
   ---------------------------------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Shortcode styles that were missing entirely
   ============================================================ */

/* The global `svg { display: block }` reset pushed inline icons onto
   their own line. Icons inside prose and shortcodes must stay inline. */
.post-content svg,
.shortcode-admonition svg,
.shortcode-accordion svg,
.shortcode-alert svg,
.shortcode-button svg,
.shortcode-cta svg,
.shortcode-feature svg,
.shortcode-timeline svg {
  display: inline-block;
  vertical-align: -0.125em;
}

/* --- Admonition / Alert --------------------------------- */
.shortcode-admonition,
.shortcode-alert {
  margin: 1.5em 0;
  padding: 14px 18px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.shortcode-admonition-title {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text);
}

.shortcode-admonition-title::-webkit-details-marker { display: none; }

.shortcode-admonition-icon,
.shortcode-alert-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.shortcode-admonition-chevron {
  margin-left: auto;
  display: inline-flex;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.shortcode-admonition[open] .shortcode-admonition-chevron {
  transform: rotate(90deg);
}

.shortcode-admonition-content,
.shortcode-alert-content {
  margin-top: 10px;
  color: var(--color-text-secondary);
}

.shortcode-admonition-content > :last-child,
.shortcode-alert-content > :last-child { margin-bottom: 0; }

/* Alert is a single row: icon beside content */
.shortcode-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.shortcode-alert .shortcode-alert-content { margin-top: 0; }

/* Type accents */
.admonition-note    { border-left-color: var(--color-note); }
.admonition-tip,
.admonition-success { border-left-color: var(--color-tip); }
.admonition-warning { border-left-color: var(--color-warning); }
.admonition-danger,
.admonition-failure,
.admonition-bug     { border-left-color: var(--color-danger); }
.admonition-info,
.admonition-question,
.admonition-abstract,
.admonition-example,
.admonition-quote   { border-left-color: var(--color-info); }

.admonition-note .shortcode-admonition-icon    { color: var(--color-note); }
.admonition-tip .shortcode-admonition-icon,
.admonition-success .shortcode-admonition-icon { color: var(--color-tip); }
.admonition-warning .shortcode-admonition-icon { color: var(--color-warning); }
.admonition-danger .shortcode-admonition-icon,
.admonition-failure .shortcode-admonition-icon,
.admonition-bug .shortcode-admonition-icon     { color: var(--color-danger); }
.admonition-info .shortcode-admonition-icon    { color: var(--color-info); }

/* --- Accordion ------------------------------------------ */
.shortcode-accordion {
  margin: 1.25em 0;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.shortcode-accordion-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.shortcode-accordion-title::-webkit-details-marker { display: none; }

.shortcode-accordion-icon {
  display: inline-flex;
  color: var(--color-text-muted);
}

.shortcode-accordion-chevron {
  margin-left: auto;
  display: inline-flex;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.shortcode-accordion[open] .shortcode-accordion-chevron {
  transform: rotate(90deg);
}

.shortcode-accordion-content {
  padding: 0 16px 14px;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.shortcode-accordion-content > :last-child { margin-bottom: 0; }

/* --- Buttons -------------------------------------------- */
.shortcode-button,
.shortcode-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--color-text);
  color: var(--color-bg);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.shortcode-button:hover,
.shortcode-cta-btn:hover { opacity: 0.85; color: var(--color-bg); }

/* `.post-content a` (0,1,1) outranks `.shortcode-button` (0,1,0) and would
   otherwise paint the label dark-on-dark, making it invisible. */
.post-content a.shortcode-button,
.post-content a.shortcode-cta-btn {
  color: var(--color-bg);
  text-decoration: none;
}
.post-content a.shortcode-button:hover,
.post-content a.shortcode-cta-btn:hover { color: var(--color-bg); }
.post-content a.shortcode-cta-outline,
.post-content a.shortcode-cta-outline:hover { color: var(--color-text); }

/* markdownify wraps the label in <p>; strip its margins inside the button */
.shortcode-button p,
.shortcode-cta-btn p { margin: 0; }

.shortcode-cta { margin: 1.75em 0; }

.shortcode-cta-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
}
.shortcode-cta-outline:hover { background: var(--color-surface); color: var(--color-text); }

/* --- Badge ---------------------------------------------- */
.shortcode-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  vertical-align: middle;
}

/* --- Email ---------------------------------------------- */
.shortcode-email { text-decoration: underline; text-underline-offset: 3px; }

/* --- Gallery -------------------------------------------- */
.shortcode-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 1.5em 0;
}
.shortcode-gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }

/* --- Chart ---------------------------------------------- */
.shortcode-chart {
  margin: 1.5em 0;
  padding: 16px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

/* --- Carousel ------------------------------------------- */
.shortcode-carousel { position: relative; margin: 1.5em 0; }
.shortcode-carousel-track { display: flex; overflow: hidden; border-radius: var(--radius-sm); }
.shortcode-carousel-track img { width: 100%; flex: 0 0 100%; object-fit: cover; }
.shortcode-carousel-caption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  text-align: center;
}
.shortcode-carousel-prev,
.shortcode-carousel-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--color-bg-alt); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  cursor: pointer;
}
.shortcode-carousel-prev { left: 10px; }
.shortcode-carousel-next { right: 10px; }
.shortcode-carousel-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.shortcode-carousel-dots button {
  width: 7px; height: 7px; padding: 0; border: none; border-radius: 50%;
  background: var(--color-border-strong); cursor: pointer;
}
.shortcode-carousel-dots button.active { background: var(--color-text); }

/* --- Fixes to partially-styled shortcodes --------------- */
/* JS toggles the `hidden` attribute, but the CSS keyed off `.active`,
   so no tab panel was ever visible. */
.shortcode-tab-panel { display: block; }
.shortcode-tab-panel[hidden] { display: none; }

.shortcode-step-body,
.shortcode-timeline-body { color: var(--color-text-secondary); }

.shortcode-feature-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.07em;
  text-decoration: none;
}

/* --- Lightbox ------------------------------------------- */
.shortcode-lightbox { margin: 1.5em 0; }
.shortcode-lightbox img { width: 100%; border-radius: var(--radius-sm); }
.shortcode-lightbox figcaption,
.post-content figcaption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  text-align: center;
}

/* Only advertise the zoom affordance on images the JS actually handles */
.post-content.has-lightbox img { cursor: zoom-in; }
.post-content.has-lightbox a img,
.post-content.has-lightbox .shortcode-youtube img { cursor: default; }

/* Viewer styles live in the "Image viewer" section below */

/* --- YouTube facade ------------------------------------- */
.shortcode-youtube {
  position: relative;
  margin: 1.5em 0;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.shortcode-youtube iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.shortcode-youtube-btn {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: block;
  position: relative;
}

.shortcode-youtube-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.shortcode-youtube-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  opacity: 0.92;
}

.shortcode-youtube-btn:hover .shortcode-youtube-play {
  transform: translate(-50%, -50%) scale(1.08);
  opacity: 1;
}

.shortcode-youtube-caption {
  margin-top: -0.75em;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  text-align: center;
}

.shortcode-github-card-icon { display: inline-flex; color: var(--color-text-muted); }
.shortcode-github-card-meta { display: flex; align-items: center; gap: 14px; margin-top: 8px; }

/* ============================================================
   GLASS REFRESH
   Translucent, blurred surfaces over a soft colour backdrop.
   Loaded last so it settles the earlier overlapping rules.
   ============================================================ */

/* ----------------------------------------------------------
   Backdrop — the glass needs something behind it to refract
   ---------------------------------------------------------- */
html { background: var(--color-bg); }
body { background: transparent; }
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  will-change: transform;
  background:
    radial-gradient(42vw 42vw at 12% 4%, var(--backdrop-a), transparent 62%),
    radial-gradient(38vw 38vw at 92% 18%, var(--backdrop-b), transparent 62%),
    radial-gradient(46vw 40vw at 70% 96%, var(--backdrop-c), transparent 64%),
    radial-gradient(34vw 34vw at 4% 78%, var(--backdrop-d), transparent 62%);
}
::selection { background: var(--color-accent-subtle); color: var(--color-text); }

/* Shared glass surface. Only surfaces that page content scrolls *under*
   (nav, menus) get a real backdrop blur; large panels sit on the already-soft
   gradient backdrop, where translucency alone looks the same and avoids
   re-blurring big areas on every scroll frame. */
.nav,
.mob-menu,
.toc-sidebar,
.toc-mobile,
.site-footer {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--glass-shadow);
}
.nav,
.mob-menu {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

/* ----------------------------------------------------------
   Nav — floating glass pill with wordmark
   ---------------------------------------------------------- */
.nav-wrapper { padding: 14px 16px; }
.nav {
  /* Section 6 fixes .nav to the viewport edge; the wrapper owns placement now */
  position: relative;
  top: auto; left: auto; right: auto;
  max-width: 860px;
  height: 56px;
  padding: 0 8px 0 22px;
  border-radius: var(--radius-full);
  justify-content: space-between;
}
.nav-wrapper.scrolled .nav {
  background: var(--glass-bg-strong);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), 0 12px 36px rgba(15, 23, 42, 0.12);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-decoration: none;
}
.nav-brand::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), #9b6bff);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}
.nav-links { flex: 0 0 auto; gap: 2px; justify-content: flex-end; }
.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-link:hover { background: var(--color-accent-subtle); color: var(--color-text); }
.nav-link.active { background: var(--glass-bg-strong); color: var(--color-text); box-shadow: 0 0 0 0.5px var(--glass-edge), 0 1px 3px rgba(15, 23, 42, 0.08); }
.nav-icon-link { padding: 8px 10px; }
.theme-toggle {
  width: 38px;
  height: 38px;
  margin-left: 4px;
  background: transparent;
  color: var(--color-text-secondary);
}
.theme-toggle:hover { background: var(--color-accent-subtle); color: var(--color-text); }

/* Mobile: glass dropdown card instead of a full-height drawer */
@media (max-width: 768px) {
  .nav { justify-content: space-between; padding: 0 6px 0 20px; height: 52px; }
  .mob-menu-btn { margin-left: 0; border-radius: var(--radius-full); padding: 10px; }
}
.mob-menu {
  top: 76px;
  left: 16px;
  right: 16px;
  width: auto;
  height: auto;
  padding: 10px;
  border-radius: 24px;
  background: var(--glass-bg-strong);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.mob-menu.is-open { right: 16px; opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
/* Faded-out isn't hidden: keep the closed menu out of the tab order too */
.mob-menu:not(.is-open) { visibility: hidden; transition: opacity 0.2s ease, transform 0.25s ease, visibility 0s linear 0.25s; }
.mob-menu-inner { gap: 2px; }
.mob-menu-link {
  padding: 12px 14px;
  border-bottom: none;
  border-radius: 14px;
  font-size: 16px;
}
.mob-menu-link:hover { background: var(--color-accent-subtle); }
.mob-theme-toggle {
  width: 100%;
  height: auto;
  margin: 6px 0 0;
  padding: 12px 14px;
  justify-content: flex-start;
  border-radius: 14px;
  border-top: 1px solid var(--color-border);
}

/* ----------------------------------------------------------
   Home hero + section headers
   ---------------------------------------------------------- */
.hero { padding: 72px 24px 48px; }
.hero-title { font-size: clamp(2.8rem, 7vw, 4.8rem); letter-spacing: -0.025em; }
.hero-desc { font-size: 1.1rem; }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
}
.hero-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 15px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), 0 4px 14px rgba(30, 41, 90, 0.08);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform var(--transition-fast), color var(--transition-fast);
}
.hero-stat strong { color: var(--color-text); font-weight: 650; }
a.hero-stat:hover { color: var(--color-text); transform: translateY(-1px); }
.hero-stat-pulse {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.section-title { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.015em; }
.section-link {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}
.section-link:hover { color: var(--color-accent-hover); }
.section-header { margin-bottom: 16px; }
@media (max-width: 768px) {
  .section-header { padding: 24px 0 8px; }
}

/* ----------------------------------------------------------
   Post rows — grouped glass card, rows light up on hover
   ---------------------------------------------------------- */
.post-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 30px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--glass-shadow);
}
.post-row {
  position: relative;
  align-items: center;
  gap: 24px;
  margin: 0;
  padding: 22px 24px;
  border: none;
  border-radius: 20px;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.post-row:first-child { border-top: none; }
.post-row + .post-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--color-border);
  transition: opacity var(--transition-fast);
}
.post-row:hover::before,
.post-row:hover + .post-row::before { opacity: 0; }
.post-row:hover {
  background: var(--glass-bg-strong);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), 0 6px 20px rgba(30, 41, 90, 0.1);
}
.post-row-main { gap: 6px; }
.post-row-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
}
.post-row:hover .post-row-title { color: var(--color-text); }
.post-row-summary {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-row-meta {
  gap: 8px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.post-row-meta time {
  font-family: var(--font-sans);
  font-size: inherit;
  letter-spacing: 0;
  color: inherit;
  font-variant-numeric: tabular-nums;
}
.post-row-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.post-row-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 6px; }
.post-row-tags .chip,
.post-tag {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  line-height: 1.6;
}
.post-tag:hover { background: var(--color-accent); color: #fff; }
.post-row-arrow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  box-shadow: inset 0 0 0 1px var(--color-border);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-base), box-shadow var(--transition-fast);
}
.post-row:hover .post-row-arrow {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 91, 234, 0.35);
  transform: translateX(3px);
}
@media (max-width: 768px) {
  .post-list { padding: 6px; border-radius: 24px; }
  .post-row { padding: 16px; gap: 14px; border-radius: 18px; }
  .post-row + .post-row::before { left: 16px; right: 16px; }
  .post-row-title { font-size: 1.08rem; }
  .post-row-arrow { display: none; }
  .post-row-tags { margin-left: 0; }
}

/* Staggered entrance */
@keyframes rowIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.post-row, .post-header, .hero { animation: rowIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.post-row:nth-child(2)  { animation-delay: 40ms; }
.post-row:nth-child(3)  { animation-delay: 80ms; }
.post-row:nth-child(4)  { animation-delay: 120ms; }
.post-row:nth-child(5)  { animation-delay: 160ms; }
.post-row:nth-child(6)  { animation-delay: 200ms; }
.post-row:nth-child(n+7) { animation-delay: 240ms; }

/* ----------------------------------------------------------
   Pagination — pill buttons
   ---------------------------------------------------------- */
.pagination a,
.pagination span { border-radius: var(--radius-full); background: transparent; }
.pagination a:hover { background: var(--glass-bg-strong); color: var(--color-text); }
.pagination .active { background: var(--color-accent); color: #fff; }
.pagination-pages,
.pagination .pagination-pages {
  padding: 4px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  box-shadow: 0 0 0 0.5px var(--glass-edge);
}

/* ----------------------------------------------------------
   Post header — title is always the largest thing on the page
   ---------------------------------------------------------- */
.breadcrumb {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 22px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
}
.breadcrumb a { color: var(--color-text-muted); }
.post-header { margin-bottom: 36px; }
.post-header .post-title {
  font-size: clamp(2.3rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  max-width: 22ch;
}
.post-meta {
  gap: 10px;
  margin-bottom: 0;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}
.post-meta .post-meta-sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-muted);
}
.post-header-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.post-hero { margin-top: 28px; border-radius: 20px; }
@media (max-width: 768px) {
  .post-header .post-title { font-size: 2.15rem; }
  .post-meta .post-meta-sep { display: inline-block; }
}
@media (max-width: 480px) {
  .post-header .post-title { font-size: 1.95rem; }
}

/* ----------------------------------------------------------
   Read progress
   ---------------------------------------------------------- */
.read-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 1100;
  pointer-events: none;
}
.read-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), #9b6bff);
  transform: scaleX(0);
  transform-origin: 0 50%;
  border-radius: 0 3px 3px 0;
}

/* ----------------------------------------------------------
   Prose
   ---------------------------------------------------------- */
.post-content > :first-child { margin-top: 0; }
.post-content h2 {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  border-bottom: none;
  padding-bottom: 0;
}
.post-content h3 { font-size: 1.28rem; font-weight: 600; letter-spacing: -0.01em; }
.post-content h4 { font-weight: 600; }
@media (max-width: 768px) {
  .post-content h2 { font-size: 1.4rem; }
  .post-content h3 { font-size: 1.15rem; }
}
.post-content a {
  color: var(--color-accent);
  text-decoration-color: color-mix(in srgb, var(--color-accent) 35%, transparent);
}
.post-content a:hover { color: var(--color-accent-hover); text-decoration-color: currentColor; }
.post-content blockquote {
  padding: 16px 20px;
  border-left: 3px solid var(--color-accent);
  border-radius: 0 16px 16px 0;
  background: var(--color-accent-subtle);
  color: var(--color-text-secondary);
  font-style: normal;
}
.post-content code:not(pre code) { border-radius: 6px; padding: 0.12em 0.42em; }
.post-content img {
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--color-border), 0 6px 24px rgba(15, 23, 42, 0.06);
}
.post-content table { border-radius: 14px; }
.shortcode-alert,
.shortcode-admonition { border-radius: 14px; }

/* ----------------------------------------------------------
   Code blocks — rounded card with a language/copy header
   ---------------------------------------------------------- */
.post-content .highlight {
  overflow: hidden;
  border-radius: 16px;
  background: var(--color-code-bg);
  border: 1px solid var(--color-code-border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.post-content .highlight pre {
  margin: 0;
  border: none;
  border-radius: 0;
  padding: 16px 20px 18px;
}
.post-content pre { border-radius: 16px; }
.highlight .copy-btn { display: none; }
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 4px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b90a0;
}
.code-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: transparent;
  color: #8b90a0;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.code-copy:hover { background: rgba(255, 255, 255, 0.08); color: #e6e8ee; }
.code-copy svg { flex-shrink: 0; }
.code-copy.is-copied { background: rgba(52, 211, 153, 0.18); color: #6ee7b7; }

/* ----------------------------------------------------------
   Table of contents — glass card (sidebar) / disclosure (mobile)
   ---------------------------------------------------------- */
.toc-sidebar {
  top: 24px;
  max-height: calc(100vh - 48px);
  padding: 18px 12px 18px 14px;
  border-radius: 20px;
}
.toc-sidebar .toc-title { padding-left: 10px; color: var(--color-text-muted); font-size: 0.7rem; }
.toc-list a,
#TableOfContents a {
  margin: 1px 0;
  padding: 5px 10px;
  border-left: none;
  border-radius: 9px;
}
.toc-list a:hover,
#TableOfContents a:hover { background: var(--color-accent-subtle); }
.toc-list a.active,
#TableOfContents a.active { color: var(--color-accent); background: var(--color-accent-subtle); }
.toc-list ul ul a, #TableOfContents ul ul a { padding-left: 22px; }
.toc-list ul ul ul a, #TableOfContents ul ul ul a { padding-left: 34px; }
.toc-list ul ul ul ul a, #TableOfContents ul ul ul ul a { padding-left: 46px; }

.toc-mobile { margin-bottom: 32px; padding: 0; border-radius: 18px; overflow: hidden; }
.toc-mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--transition-fast);
}
.toc-mobile[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.toc-mobile .toc-list { padding: 0 10px 12px; max-height: 60vh; overflow-y: auto; }

/* ----------------------------------------------------------
   Related posts
   ---------------------------------------------------------- */
.related-posts { border-top: 1px solid var(--color-border); }
.related-header h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; }

/* ----------------------------------------------------------
   Footer — floating glass panel on the page background
   ---------------------------------------------------------- */
.site-footer {
  width: calc(100% - 32px);
  max-width: 860px;
  margin: 72px auto 20px;
  border-radius: 26px;
}
.footer-main {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px 24px 18px 28px;
}
.footer-brand { max-width: none; flex: 1; min-width: 0; }
.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--color-text);
}
.footer-brand-link::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), #9b6bff);
}
.footer-brand-link:hover { color: var(--color-accent); }
.footer-brand p { margin: 2px 0 0 19px; font-size: 0.82rem; color: var(--color-text-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 2px; }
.footer-links a,
.footer-social a {
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.footer-links a { padding: 6px 12px; font-size: 0.88rem; font-weight: 500; }
.footer-social { display: flex; gap: 2px; padding-left: 14px; border-left: 1px solid var(--color-border); }
.footer-social a { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; }
.footer-links a:hover,
.footer-social a:hover { background: var(--color-accent-subtle); color: var(--color-accent); }
.footer-bottom {
  max-width: none;
  margin: 0 20px;
  padding: 12px 8px 14px;
  border-top: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.footer-top {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.footer-top:hover { background: var(--color-accent-subtle); color: var(--color-accent); }
@media (max-width: 640px) {
  .footer-main { flex-wrap: wrap; padding: 20px 20px 14px; gap: 14px; }
  .footer-brand { flex-basis: 100%; }
  .footer-links { flex: 1; margin-left: -12px; }
  .footer-social { padding-left: 10px; }
  .footer-bottom { margin: 0 14px; }
}

/* ----------------------------------------------------------
   Reduced motion
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .post-row, .post-header, .hero, .hero-stat-pulse { animation: none; }
  .mob-menu { transition: none; }
}

/* ----------------------------------------------------------
   Tags index — glass pills, most used first
   ---------------------------------------------------------- */
.taxonomy-list { gap: 10px; }
.taxonomy-item {
  gap: 10px;
  padding: 9px 10px 9px 18px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), 0 4px 14px rgba(30, 41, 90, 0.06);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.taxonomy-item:hover {
  border-color: var(--glass-border);
  background: var(--glass-bg-strong);
  transform: translateY(-2px);
}
.taxonomy-name { font-size: 0.95rem; }
.taxonomy-count {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

/* ----------------------------------------------------------
   Pages without a TOC (e.g. About) use a single reading column
   ---------------------------------------------------------- */
.post-layout.no-toc { grid-template-columns: minmax(0, var(--content-width)); }

/* ----------------------------------------------------------
   Compact nav. Once scrolled, the bar docks as a vertical glass
   rail on the left (tablet/desktop) so it never covers the text.
   On phones it shrinks to a small pill (dot + menu button);
   JS measures that width into --nav-compact-w.
   ---------------------------------------------------------- */
.nav-wrapper { pointer-events: none; }
.nav { pointer-events: auto; }
.nav {
  width: min(860px, 100%);
  max-width: none;
  margin: 0 0 0 max(0px, calc((100% - 860px) / 2));
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.nav-brand-text { display: inline-block; white-space: nowrap; }
.nav-glyph { display: none; }

/* Measurement pass for the phone pill: final geometry, no animation */
.nav-wrapper.is-measuring .nav { width: max-content !important; }
.nav-wrapper.is-measuring,
.nav-wrapper.is-measuring * { transition: none !important; animation: none !important; }

@media (max-width: 768px) {
  .nav {
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1), height 0.4s ease, padding 0.4s ease, background 0.3s ease, box-shadow 0.3s ease;
  }
  .nav-brand-text { max-width: 200px; overflow: hidden; transition: max-width 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease; }
  .nav-wrapper.compact .nav { width: var(--nav-compact-w, auto); height: 46px; padding: 0 4px 0 14px; }
  .nav-wrapper.compact .nav-brand { gap: 0; }
  .nav-wrapper.compact .nav-brand-text { max-width: 0; opacity: 0; }
  .nav-wrapper.compact .mob-menu-btn { padding: 8px; margin-left: 6px; }
}

@media (min-width: 769px) {
  /* Where the bar's dot sits, relative to the rail's corner; used to
     glide between the two layouts so the dot appears to travel */
  .nav-wrapper { --dock-x: max(0px, calc((100vw - 892px) / 2)); }

  .nav-wrapper.compact .nav {
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    width: 56px;
    height: auto;
    margin-left: 0;
    padding: 12px 0;
    border-radius: 28px;
    animation: navDock 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }
  .nav-wrapper.compact .nav-brand { gap: 0; padding: 6px 0; }
  .nav-wrapper.compact .nav-brand::before { width: 12px; height: 12px; }
  .nav-wrapper.compact .nav-brand-text { display: none; }
  .nav-wrapper.compact .nav-links {
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding-top: 8px;
    position: relative;
  }
  /* Hairline between the logo and the links */
  .nav-wrapper.compact .nav-links::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 22px;
    height: 1px;
    margin-left: -11px;
    background: var(--color-border-strong);
  }
  .nav-wrapper.compact .nav-label { display: none; }
  .nav-wrapper.compact .nav-glyph { display: flex; }
  .nav-wrapper.compact .nav-link,
  .nav-wrapper.compact .theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 14px;
  }
  .nav-wrapper.compact .nav-links > * { animation: railItem 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .nav-wrapper.compact .nav-links > :nth-child(1) { animation-delay: 0.12s; }
  .nav-wrapper.compact .nav-links > :nth-child(2) { animation-delay: 0.16s; }
  .nav-wrapper.compact .nav-links > :nth-child(3) { animation-delay: 0.2s; }
  .nav-wrapper.compact .nav-links > :nth-child(4) { animation-delay: 0.24s; }
  .nav-wrapper.compact .nav-links > :nth-child(5) { animation-delay: 0.28s; }

  /* Tooltip to the right of each rail icon */
  .nav-wrapper.compact [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    padding: 5px 10px;
    border-radius: 9px;
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-4px, -50%);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .nav-wrapper.compact [data-tip]:hover::after,
  .nav-wrapper.compact [data-tip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }

  /* Undocking: the bar unrolls rightwards from the rail's corner */
  .nav-wrapper.was-compact:not(.compact) .nav { animation: navUndock 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
}

@keyframes navDock {
  from { transform: translateX(var(--dock-x)); clip-path: inset(0 0 calc(100% - 56px) 0 round 28px); }
  60%  { clip-path: inset(0 0 calc(100% - 56px) 0 round 28px); transform: none; }
  to   { transform: none; clip-path: inset(0 0 0 0 round 28px); }
}
@keyframes navUndock {
  from { transform: translateX(calc(-1 * var(--dock-x))); clip-path: inset(0 calc(100% - 56px) 0 0 round 28px); }
  to   { transform: none; clip-path: inset(0 0 0 0 round 28px); }
}
@keyframes railItem {
  from { opacity: 0; transform: translateY(-8px) scale(0.85); }
  to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------
   TOC card: header with progress + hide button.
   The list scrolls on its own so the header stays put.
   ---------------------------------------------------------- */
.toc-sidebar { overflow: hidden; }
.toc-sidebar .toc-wrapper {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 84px);
}
.toc-sidebar #TableOfContents {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
.toc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 10px;
  margin-bottom: 10px;
}
.toc-sidebar .toc-title { flex: 1; margin: 0; padding-left: 0; }
.toc-percent {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.toc-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.toc-toggle:hover { background: var(--color-accent-subtle); color: var(--color-text); }
.toc-progress {
  height: 3px;
  margin: 0 10px 12px;
  border-radius: 3px;
  background: var(--color-border);
  overflow: hidden;
}
.toc-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent), #9b6bff);
  transform: scaleX(var(--read, 0));
  transform-origin: 0 50%;
  transition: transform 0.15s linear;
}
.read-progress span { transform: scaleX(var(--read, 0)); }

/* ----------------------------------------------------------
   TOC hidden: sidebar slides away, article widens and recentres
   ---------------------------------------------------------- */
.toc-fab { display: none; }

@media (min-width: 1025px) {
  /* The TOC card carries progress on desktop, so drop the top bar there */
  body:has(.toc-sidebar) .read-progress { display: none; }

  .post,
  .post-layout {
    transition: max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .post-layout {
    grid-template-columns: minmax(0, 1fr) var(--toc-width);
    transition: max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
                grid-template-columns 0.55s cubic-bezier(0.22, 1, 0.36, 1),
                gap 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .post-content { transition: max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1); }
  .toc-sidebar {
    transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
  }

  [data-toc="off"] .post,
  [data-toc="off"] .post-layout { max-width: 900px; }
  [data-toc="off"] .post-layout { grid-template-columns: minmax(0, 1fr) 0px; gap: 0; }
  [data-toc="off"] .post-content { max-width: 100%; }
  [data-toc="off"] .toc-sidebar {
    opacity: 0;
    transform: translateX(32px) scale(0.96);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.45s;
  }

  .toc-fab {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    color: var(--color-text-secondary);
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), var(--glass-shadow);
    opacity: 0;
    transform: scale(0.6);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 0.3s, color var(--transition-fast);
  }
  .toc-fab:hover { color: var(--color-accent); }
  [data-toc="off"] .toc-fab {
    opacity: 1;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.3s ease 0.2s, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s, visibility 0s, color var(--transition-fast);
  }
}

/* Progress ring around the reopen button */
.toc-fab-ring {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  transform: rotate(-90deg);
}
.toc-fab-ring circle { fill: none; stroke-width: 2.5; }
.toc-fab-track { stroke: var(--color-border); }
.toc-fab-fill {
  stroke: var(--color-accent);
  stroke-linecap: round;
  stroke-dasharray: 131.95;
  stroke-dashoffset: calc(131.95px * (1 - var(--read, 0)));
  transition: stroke-dashoffset 0.15s linear;
}

@media (prefers-reduced-motion: reduce) {
  .nav, .nav *, .post, .post-layout, .post-content, .toc-sidebar, .toc-fab { transition: none !important; animation: none !important; }
}

/* ----------------------------------------------------------
   Keep content clear of the docked rail (left 16px + 56px wide)
   on mid-size screens; wide screens already have the margin
   ---------------------------------------------------------- */
@media (min-width: 769px) {
  .post { --post-max: calc(var(--content-width) + var(--toc-width) + 60px); }
  [data-toc="off"] .post { --post-max: 900px; }
  /* Only the margin *beyond* the column counts toward clearance; when the
     viewport is narrower than the column that margin is zero, not negative */
  .post { padding-left: max(24px, calc(88px - max(0px, (100vw - var(--post-max)) / 2))); }
  .recent-posts,
  .section-list { padding-left: max(24px, calc(88px - max(0px, (100vw - 860px) / 2))); }
}

/* ----------------------------------------------------------
   Text selection — visible on both the page and dark code
   ---------------------------------------------------------- */
::selection { background: rgba(47, 91, 234, 0.22); color: inherit; }
[data-theme="dark"] ::selection { background: rgba(124, 155, 255, 0.35); }
.highlight ::selection,
.post-content pre ::selection,
.code-header ::selection { background: rgba(124, 155, 255, 0.45); color: #fff; }

/* ----------------------------------------------------------
   KaTeX — compact display blocks
   ---------------------------------------------------------- */
.post-content .katex-display { margin: 0.35em 0; padding: 0; }
.post-content blockquote:has(.katex-display) { padding: 6px 18px; }
.post-content blockquote:has(.katex-display) p { margin: 0; }

/* ----------------------------------------------------------
   Image viewer
   ---------------------------------------------------------- */
.post-content.has-lightbox img[role="button"] { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.post-content.has-lightbox img[role="button"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--color-border), 0 14px 34px rgba(15, 23, 42, 0.14);
}
.post-content.has-lightbox img[role="button"]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
}
.lb.is-open { display: block; }
.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.78);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.lb.is-visible .lb-backdrop { opacity: 1; }
.lb-img {
  position: absolute;
  max-width: none;
  margin: 0;
  border-radius: 12px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  transform-origin: 0 0;
  will-change: transform;
  cursor: zoom-in;
  -webkit-user-drag: none;
}
.lb.is-zoomed .lb-img { cursor: grab; }
.lb.is-zoomed .lb-img:active { cursor: grabbing; }

/* Controls fade in after the image lands, and out first on close */
.lb-ui { opacity: 0; transition: opacity 0.2s ease; }
.lb.is-visible .lb-ui { opacity: 1; transition: opacity 0.3s ease 0.18s; }
.lb.is-zoomed .lb-caption,
.lb.is-zoomed .lb-prev,
.lb.is-zoomed .lb-next { opacity: 0; pointer-events: none; }

.lb-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.2); }
.lb-btn:active { transform: scale(0.94); }
.lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-close { top: 16px; right: 16px; }
.lb-prev,
.lb-next { top: calc(50% - 22px); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-btn[hidden],
.lb-ui[hidden] { display: none; }

.lb-count {
  position: absolute;
  top: 24px;
  left: 20px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.lb-caption {
  position: absolute;
  bottom: 22px;
  left: 50%;
  max-width: min(720px, calc(100vw - 32px));
  margin: 0;
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
}
/* Touch screens swipe between images instead */
@media (hover: none) {
  .lb-prev,
  .lb-next { display: none; }
}

/* ----------------------------------------------------------
   Theme switch — circular reveal (driven from JS), plus the
   toggle icon spinning in
   ---------------------------------------------------------- */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* Colour transitions would otherwise show half-faded colours inside the reveal */
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after { transition: none !important; }
.theme-switching .theme-toggle svg { animation: themeIcon 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes themeIcon {
  from { transform: rotate(-120deg) scale(0.4); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ----------------------------------------------------------
   Search — nav trigger (pill in the bar, icon in the rail,
   icon beside the menu button on phones) and the dialog
   ---------------------------------------------------------- */
.nav-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 0 8px;
  padding: 6px 7px 6px 12px;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-search:hover { color: var(--color-text); background: var(--glass-bg-strong); box-shadow: 0 0 0 0.5px var(--glass-edge); }
.nav-search svg { flex-shrink: 0; }
.nav-search-kbd,
.search kbd,
.search-esc {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--glass-bg-strong);
  box-shadow: 0 0 0 0.5px var(--glass-edge), 0 1px 0 var(--color-border-strong);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
}
.mob-search-btn { display: none; }

@media (min-width: 769px) {
  .nav-wrapper.compact .nav-search {
    position: relative;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 14px;
    background: transparent;
  }
  .nav-wrapper.compact .nav-search:hover { background: var(--color-accent-subtle); box-shadow: none; }
  .nav-wrapper.compact .nav-search-label,
  .nav-wrapper.compact .nav-search-kbd { display: none; }
}
@media (max-width: 768px) {
  .mob-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-left: auto;
    border-radius: 50%;
    color: var(--color-text);
  }
  .mob-search-btn + .mob-menu-btn { margin-left: 0; }
  .nav-wrapper.compact .mob-search-btn { margin-left: 6px; width: 34px; height: 34px; }
}

.search {
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
}
.search[hidden] { display: none; }
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 30, 0.3);
  opacity: 0;
  transition: opacity 0.2s ease;
}
[data-theme="dark"] .search-backdrop { background: rgba(0, 0, 0, 0.5); }
.search-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(70vh, 640px);
  overflow: hidden;
  border-radius: 24px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), 0 30px 80px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(-10px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.search.is-open .search-backdrop { opacity: 1; }
.search.is-open .search-panel { opacity: 1; transform: none; }

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 1.05rem;
}
.search-field input::placeholder { color: var(--color-text-muted); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-esc { cursor: pointer; }

.search-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 8px; }
.search-label {
  margin: 0;
  padding: 8px 12px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.search-results { list-style: none; margin: 0; padding: 0; }
.search-results li { animation: searchHit 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(var(--i) * 22ms); }
@keyframes searchHit {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.search-hit {
  display: grid;
  gap: 3px;
  padding: 11px 14px;
  border-radius: 14px;
  color: var(--color-text);
  text-decoration: none;
}
.search-results li[aria-selected="true"] .search-hit { background: var(--color-accent-subtle); }
.search-results li[aria-selected="true"] .search-hit-title { color: var(--color-accent); }
.search-hit-title { font-size: 0.98rem; font-weight: 600; letter-spacing: -0.01em; }
.search-hit-text {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-hit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 0.75rem; color: var(--color-text-muted); }
.search-hit-meta .chip {
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.6;
}
.search mark {
  padding: 0 1px;
  border-radius: 3px;
  background: rgba(250, 190, 0, 0.38);
  color: inherit;
}
[data-theme="dark"] .search mark { background: rgba(250, 190, 0, 0.3); }

.search-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--color-border);
  font-size: 0.72rem;
  color: var(--color-text-muted);
}
.search-foot kbd { margin-right: 3px; }
.search-foot-count { margin-left: auto; }
@media (hover: none) {
  .search-foot { display: none; }
}
@media (max-width: 640px) {
  .search { padding: 10px; }
  .search-panel { max-height: calc(100dvh - 20px); border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .search-panel, .search-backdrop { transition: none; }
  .search-results li { animation: none; }
}

/* ----------------------------------------------------------
   Post rows: the title link covers the row; tag chips sit on top
   and link to their tag pages
   ---------------------------------------------------------- */
.post-row { cursor: pointer; }
.post-row-link { color: inherit; text-decoration: none; }
.post-row-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.post-row-link:focus-visible { outline: none; }
.post-row:has(.post-row-link:focus-visible) { box-shadow: 0 0 0 2px var(--color-accent); }
.post-row-tags { position: relative; z-index: 1; }
.post-row-tags .chip { text-decoration: none; transition: background var(--transition-fast), color var(--transition-fast); }
.post-row-tags .chip:hover { background: var(--color-accent); color: #fff; }

/* ----------------------------------------------------------
   Tag page header
   ---------------------------------------------------------- */
.term-header { margin-bottom: 24px; }
.term-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: none;
}
.term-back:hover { color: var(--color-accent); }
.term-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.term-hash {
  margin-right: 2px;
  background: linear-gradient(135deg, var(--color-accent), #9b6bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.term-count { margin: 8px 0 0; color: var(--color-text-secondary); }
.term-siblings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.term-siblings .post-tag { display: inline-flex; align-items: center; gap: 6px; }
.term-sibling-count { opacity: 0.6; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------
   Pagination — prev/next as pills, sans like everything else
   ---------------------------------------------------------- */
.pagination { gap: 10px; margin-top: 40px; padding: 0; }
.pagination .pagination-prev,
.pagination .pagination-next {
  gap: 4px;
  height: 40px;
  padding: 0 14px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}
.pagination .pagination-pages a,
.pagination .pagination-pages span { min-width: 34px; height: 34px; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.pagination .disabled { opacity: 0.35; }
@media (max-width: 640px) {
  .pagination .pagination-prev span,
  .pagination .pagination-next span { display: none; }
  .pagination-pages { overflow-x: auto; max-width: 60vw; }
}

/* ----------------------------------------------------------
   Posts without headings (no TOC): centred, like TOC-hidden
   ---------------------------------------------------------- */
@media (min-width: 769px) {
  .post.post-no-toc { --post-max: 900px; max-width: 900px; }
  .post-no-toc .post-layout.no-toc { max-width: none; grid-template-columns: minmax(0, 1fr); }
  .post-no-toc .post-content { max-width: 100%; }
}

/* ----------------------------------------------------------
   Missing images: JS swaps them for this note
   ---------------------------------------------------------- */
.img-missing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0.5em 0;
  padding: 10px 16px;
  border: 1px dashed var(--color-border-strong);
  border-radius: 12px;
  background: var(--color-accent-subtle);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.img-missing code { font-size: 0.8rem; }

/* ----------------------------------------------------------
   404
   ---------------------------------------------------------- */
.not-found { max-width: 560px; margin: 0 auto; padding: 72px 24px 24px; text-align: center; }
.not-found-code {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(6rem, 22vw, 10rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--color-accent), #9b6bff 55%, #2dd4bf);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.not-found-title { margin-top: 8px; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.015em; }
.not-found-text { margin: 10px auto 28px; max-width: 40ch; color: var(--color-text-secondary); }
.not-found-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-primary { background: var(--color-accent); color: #fff; box-shadow: 0 8px 22px rgba(47, 91, 234, 0.3); }
.btn-primary:hover { background: var(--color-accent-hover); transform: translateY(-1px); }
.btn-ghost {
  background: var(--glass-bg-strong);
  color: var(--color-text);
  box-shadow: var(--glass-highlight), 0 0 0 0.5px var(--glass-edge), 0 4px 14px rgba(30, 41, 90, 0.08);
}
.btn-ghost:hover { transform: translateY(-1px); }

/* ----------------------------------------------------------
   Skip link — first tab stop, visible only when focused
   ---------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 3000;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transform: translate(-50%, -160%);
  transition: transform 0.2s ease;
}
.skip-link:focus { transform: translate(-50%, 0); }
.site-main:focus { outline: none; }

/* ----------------------------------------------------------
   Lists — accent markers, tabular numbers
   ---------------------------------------------------------- */
.post-content li::marker { color: var(--color-accent); }
.post-content ol > li::marker { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------
   YouTube facade — rounded card, glass play button
   ---------------------------------------------------------- */
.post-content .shortcode-youtube {
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--color-border), 0 12px 32px rgba(15, 23, 42, 0.14);
}
.post-content .shortcode-youtube .shortcode-youtube-thumb { margin: 0; border-radius: 0; box-shadow: none; transition: transform 0.5s ease, filter 0.3s ease; }
.shortcode-youtube-btn:hover .shortcode-youtube-thumb { transform: scale(1.03); filter: brightness(0.85); }
.shortcode-youtube-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  padding-left: 4px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}
.shortcode-youtube-btn:hover .shortcode-youtube-play { transform: translate(-50%, -50%) scale(1.08); background: rgba(255, 255, 255, 0.28); }
