/* ========================================
   CSS Custom Properties (Light/Dark)
   ======================================== */
:root {
  --bg: #fafbfc;
  --bg-secondary: #f6f8fa;
  --bg-card: #ffffff;
  --bg-code: #f1f3f6;
  --bg-code-inline: #f8f9fa;
  --bg-header: #fff;
  --bg-blockquote: #f6f8fa;
  --bg-input: #fff;

  --text: #24292e;
  --text-secondary: #586069;
  --text-muted: #6a737d;
  --text-heading: #24292e;
  --text-code: #24292e;
  --text-code-inline: #e83e8c;
  --text-blockquote: #444;

  --link: #0366d6;
  --link-hover: #024c9e;
  --link-visited: #0366d6;

  --border: #e1e4e8;
  --border-light: #e9ecef;
  --border-code: #e9ecef;
  --border-header-top: #0366d6;
  --border-header-bottom: #e1e4e8;
  --border-blockquote: #0366d6;

  --accent: #0366d6;

  --tag-ml-bg: #dbeafe; --tag-ml-text: #1e40af;
  --tag-cv-bg: #fce7f3; --tag-cv-text: #9d174d;
  --tag-cuda-bg: #d1fae5; --tag-cuda-text: #065f46;
  --tag-tools-bg: #fef3c7; --tag-tools-text: #92400e;
  --tag-sys-bg: #e5e7eb; --tag-sys-text: #374151;
  --tag-dsa-bg: #e5e7eb; --tag-dsa-text: #374151;

  --toggle-border: #d0d7de;
  --toggle-color: #57606a;

  --share-fill: #828282;
  --shadow-card: rgba(0,0,0,0.08);
  --img-opacity: 1;

  /* Syntax - hljs light */
  --syn-keyword: #0033B3;
  --syn-builtin: #00627A;
  --syn-function: #7A3E9D;
  --syn-class: #00A550;
  --syn-invoke: #9E3600;
  --syn-variable: #871094;
  --syn-string: #067D17;
  --syn-number: #1750EB;
  --syn-comment: #8C8C8C;
  --syn-params: #5C4C79;
  --syn-punctuation: #666666;
  --syn-literal: #0033B3;
  --syn-meta: #3B7C87;
  --syn-attr: #756BB1;
  --syn-subst: #2E7D32;
  --syn-template: #A44185;

  /* Syntax - Rouge light */
  --rouge-keyword: #0033B3;
  --rouge-string: #067D17;
  --rouge-comment: #8C8C8C;
  --rouge-func: #7A3E9D;
  --rouge-class: #00A550;
  --rouge-module: #9E3600;
  --rouge-number: #1750EB;
  --rouge-op: #666666;
  --rouge-name: #24292e;
  --rouge-builtin: #0033B3;

  /* Copy button */
  --copy-bg: rgba(255,255,255,0.1);
  --copy-border: #ddd;
  --copy-color: #555;
  --copy-hover-bg: #fff;
  --copy-hover-color: #000;

  /* Anchor */
  --anchor-color: #a0a0a0;
  --anchor-hover: #0366d6;

  /* Progress bar */
  --progress-bg: #0366d6;

}

.dark-mode {
  --bg: #1a1b26;
  --bg-secondary: #16161e;
  --bg-card: #1f2335;
  --bg-code: #16161e;
  --bg-code-inline: #292e42;
  --bg-header: #16161e;
  --bg-blockquote: #1f2335;
  --bg-input: #1f2335;

  --text: #a9b1d6;
  --text-secondary: #787c99;
  --text-muted: #6b7280;
  --text-heading: #c0caf5;
  --text-code: #c0caf5;
  --text-code-inline: #bb9af7;
  --text-blockquote: #787c99;

  --link: #7aa2f7;
  --link-hover: #7dcfff;
  --link-visited: #9d7cd8;

  --border: #292e42;
  --border-light: #292e42;
  --border-code: #33384d;
  --border-header-top: #3d59a1;
  --border-header-bottom: #292e42;
  --border-blockquote: #3d59a1;

  --accent: #7aa2f7;

  --tag-ml-bg: #1f2e50; --tag-ml-text: #7aa2f7;
  --tag-cv-bg: #30203a; --tag-cv-text: #bb9af7;
  --tag-cuda-bg: #1a2e28; --tag-cuda-text: #9ece6a;
  --tag-tools-bg: #2e2820; --tag-tools-text: #ff9e64;
  --tag-sys-bg: #24283b; --tag-sys-text: #a9b1d6;
  --tag-dsa-bg: #24283b; --tag-dsa-text: #a9b1d6;

  --toggle-border: #33384d;
  --toggle-color: #787c99;

  --share-fill: #565f89;
  --shadow-card: rgba(0,0,0,0.6);
  --img-opacity: 0.9;

  /* Syntax - hljs dark (Tokyo Night) */
  --syn-keyword: #bb9af7;
  --syn-builtin: #7aa2f7;
  --syn-function: #7aa2f7;
  --syn-class: #9ece6a;
  --syn-invoke: #ff9e64;
  --syn-variable: #c0caf5;
  --syn-string: #9ece6a;
  --syn-number: #ff9e64;
  --syn-comment: #565f89;
  --syn-params: #a9b1d6;
  --syn-punctuation: #787c99;
  --syn-literal: #ff9e64;
  --syn-meta: #7dcfff;
  --syn-attr: #bb9af7;
  --syn-subst: #7dcfff;
  --syn-template: #ff9e64;

  /* Syntax - Rouge dark (Tokyo Night) */
  --rouge-keyword: #bb9af7;
  --rouge-string: #9ece6a;
  --rouge-comment: #565f89;
  --rouge-func: #7aa2f7;
  --rouge-class: #9ece6a;
  --rouge-module: #ff9e64;
  --rouge-number: #ff9e64;
  --rouge-op: #89ddff;
  --rouge-name: #a9b1d6;
  --rouge-builtin: #7dcfff;

  /* Copy button */
  --copy-bg: rgba(255,255,255,0.04);
  --copy-border: #33384d;
  --copy-color: #565f89;
  --copy-hover-bg: rgba(255,255,255,0.08);
  --copy-hover-color: #a9b1d6;

  /* Anchor */
  --anchor-color: #3d59a1;
  --anchor-hover: #7aa2f7;

  /* Progress bar */
  --progress-bg: #7aa2f7;

}

/* ========================================
   Smooth theme transition
   ======================================== */
body,
body .site-header,
body .site-footer,
body .site-nav,
body .post-content,
body blockquote,
body .search-input,
body .theme-toggle,
body .copy-btn {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ========================================
   Base styles
   ======================================== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.7;
  background-color: var(--bg);
  color: var(--text);
}

code, pre, .highlight code, .post-content code, .post-content pre code {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
}

a, a:visited { color: var(--link); }
a:hover { color: var(--link-hover); }

/* Constrain prose width for readability */
.post-content p,
.post-content > ul,
.post-content > ol,
.post-content > blockquote,
.post-content > h1,
.post-content > h2,
.post-content > h3,
.post-content > h4,
.post-content > h5,
.post-content > h6 {
  max-width: 750px;
}

hr {
  margin-top: 30px;
  margin-bottom: 20px;
  border-color: var(--border);
}

img { opacity: var(--img-opacity); }

/* ========================================
   Header & Footer
   ======================================== */
.site-header {
  background-color: var(--bg-header);
  border-top-color: var(--border-header-top);
  border-bottom-color: var(--border-header-bottom);
}

.site-title, .site-title:visited { color: var(--text); }
.site-title { font-weight: 700; font-size: 1.2rem; }
.site-nav .page-link { color: var(--text-secondary); }
.site-nav { background-color: var(--bg-header); border-color: var(--border); }

.site-footer {
  background-color: var(--bg-header);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 20px 0;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-name {
  font-weight: 600;
  color: var(--text);
}
.footer-sep {
  opacity: 0.3;
}
.footer-desc {
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 16px;
  align-items: center;
}
.footer-link {
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.footer-link:hover {
  color: var(--accent);
}
.footer-link svg {
  display: block;
}
@media screen and (max-width: 600px) {
  .footer-content {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ========================================
   Post navigation
   ======================================== */
.post_navi { display: flex; }
.post_navi-label { font-size: 0.8em; opacity: 0.5; }
.post_navi .post_navi-item { padding: 0 2.2em; width: 50%; position: relative; color: inherit; }
.post_navi .nav_prev { text-align: left; }
.post_navi .nav_next { text-align: right; }
.post_navi .nav_prev .post_navi-arrow { left: 0; }
.post_navi .nav_next .post_navi-arrow { right: 0; }
.post_navi .post_navi-arrow { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2.5em; opacity: 0.3; }

/* ========================================
   Profile layout
   ======================================== */
.profile-container {
  display: flex;
  align-items: flex-start;
  gap: 30px;
  margin-bottom: 30px;
  max-width: 750px;
}

.profile-image {
  width: 180px;
  height: 180px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.profile-content { flex: 1; }

@media screen and (max-width: 600px) {
  .profile-container { flex-direction: column; align-items: center; text-align: center; }
  .profile-image { margin-bottom: 20px; }
}

/* ========================================
   Post list (homepage) - flat style
   ======================================== */
.post-list-flat {
  list-style: none;
  padding: 0;
  margin-top: 20px;
}

.post-list-flat li {
  display: flex;
  gap: 1.5em;
  padding: 4px 0;
  align-items: baseline;
}

.post-date-flat {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85em;
  color: var(--text-muted);
  min-width: 6.5em;
  flex-shrink: 0;
}

.post-list-flat a {
  color: var(--text);
  text-decoration: none;
}

.post-list-flat a:hover {
  color: var(--link);
}

@media screen and (max-width: 600px) {
  .post_navi { flex-wrap: wrap; }
  .post_navi-item { width: 100%; padding: 0.5em 0; }
}

/* ========================================
   Content headings
   ======================================== */
.post-content { color: var(--text); }
.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 { color: var(--text-heading); }
.page-heading, .post-title { color: var(--text-heading); }

.post-content a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.post-content a:hover {
  text-decoration-thickness: 2px;
}

/* ========================================
   Layout width
   ======================================== */
.wrapper { max-width: calc(1000px - (30px * 2)); }

@media screen and (max-width: 1000px) {
  .wrapper {
    max-width: calc(1000px - (30px));
    padding-right: 15px;
    padding-left: 15px;
  }
}

/* ========================================
   Code blocks
   ======================================== */
pre code.hljs { padding: 0; background: transparent; }

.hljs-keyword { color: var(--syn-keyword) !important; }
.hljs-built_in { color: var(--syn-builtin) !important; }
.hljs-title.function_ { color: var(--syn-function) !important; }
.hljs-title.class_ { color: var(--syn-class) !important; }
.hljs-title.function_.invoke { color: var(--syn-invoke) !important; }
.hljs-variable, .hljs-property { color: var(--syn-variable) !important; }
.language-python .hljs-variable:first-child { color: var(--syn-keyword) !important; }
.hljs-string { color: var(--syn-string) !important; }
.hljs-number { color: var(--syn-number) !important; }
.hljs-comment { color: var(--syn-comment) !important; font-style: italic; }
.hljs-params { color: var(--syn-params) !important; }
.hljs-punctuation, .hljs-operator { color: var(--syn-punctuation) !important; }
.hljs-literal { color: var(--syn-literal) !important; }
.hljs-meta { color: var(--syn-meta) !important; }
.hljs-attr { color: var(--syn-attr) !important; }
.hljs-subst { color: var(--syn-subst) !important; }
.hljs-template-variable { color: var(--syn-template) !important; }

/* Rouge/Pygments syntax - !important needed to override Minima defaults */
.highlight .k, .highlight .kd, .highlight .kn,
.highlight .kp, .highlight .kr, .highlight .kt { color: var(--rouge-keyword) !important; }
.highlight .s, .highlight .s1, .highlight .s2,
.highlight .se, .highlight .sh, .highlight .si,
.highlight .sx { color: var(--rouge-string) !important; }
.highlight .c, .highlight .c1, .highlight .cm,
.highlight .cs { color: var(--rouge-comment) !important; }
.highlight .nf, .highlight .nb { color: var(--rouge-func) !important; }
.highlight .nc { color: var(--rouge-class) !important; }
.highlight .nn { color: var(--rouge-module) !important; }
.highlight .mi, .highlight .mf, .highlight .mh { color: var(--rouge-number) !important; }
.highlight .o, .highlight .p { color: var(--rouge-op) !important; }
.highlight .n, .highlight .na, .highlight .nv { color: var(--rouge-name) !important; }
.highlight .bp { color: var(--rouge-builtin) !important; }

.post-content pre, .post-content code,
.highlight pre, .highlight code {
  font-size: 0.80em !important;
}

.post-content pre, .highlight {
  background-color: var(--bg-code) !important;
  border-radius: 12px !important;
  padding: 16px !important;
  margin-bottom: 1em !important;
  overflow-x: auto !important;
  position: relative;
}

.post-content pre {
  border: 1px solid var(--border-code) !important;
}

.post-content pre code, .highlight code {
  background-color: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  font-size: inherit !important;
  color: var(--text-code) !important;
}

.highlight, .highlight pre, .highlight table {
  background: var(--bg-code) !important;
  border: none !important;
  margin-bottom: 0 !important;
}

.post-content code.highlighter-rouge {
  background-color: var(--bg-code-inline) !important;
  color: var(--text-code-inline) !important;
  padding: 2px 4px !important;
  border-radius: 4px !important;
  font-size: 0.80em !important;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.post-content video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  margin: 1.5em 0;
}

/* Code language badge - disabled */

/* ========================================
   Projects page
   ======================================== */
.proj-cat {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  margin-top: 1.8em;
  margin-bottom: 0.3em;
}

.proj-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.proj-list li {
  padding: 3px 0;
  font-size: 0.95rem;
  color: var(--text);
}

.proj-list a {
  color: var(--link);
  font-weight: 500;
  text-decoration: none;
}

.proj-list a::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.6;
  vertical-align: super;
}

.proj-list a:hover {
  text-decoration: underline;
  text-decoration-style: dotted;
}

.proj-divider {
  margin: 2.2em 0 1.2em;
}

.proj-wip {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* ========================================
   Theme toggle
   ======================================== */
.theme-toggle {
  background: none;
  border: 1px solid var(--toggle-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 5px 7px;
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
  color: var(--toggle-color);
  transition: all 0.2s;
  vertical-align: middle;
}

.theme-toggle svg {
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.icon-moon { display: none; }
.icon-sun { display: block; }
.dark-mode .icon-moon { display: block; }
.dark-mode .icon-sun { display: none; }

/* ========================================
   Blockquote & Callouts
   ======================================== */
blockquote {
  border-left: 4px solid var(--border-blockquote);
  padding: 12px 20px;
  margin: 1.5em 0;
  background-color: var(--bg-blockquote);
  border-radius: 0 6px 6px 0;
  color: var(--text-blockquote);
}

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

/* Callout/admonition boxes */
blockquote.callout {
  padding: 14px 20px 14px 48px;
  position: relative;
}

blockquote.callout::before {
  position: absolute;
  left: 16px;
  top: 14px;
  font-size: 1.1rem;
}

blockquote.callout-note {
  border-left-color: #0366d6;
  background-color: rgba(3, 102, 214, 0.06);
}

blockquote.callout-note::before { content: "i"; font-weight: 700; color: #0366d6; font-style: italic; font-family: Georgia, serif; }

blockquote.callout-tip {
  border-left-color: #28a745;
  background-color: rgba(40, 167, 69, 0.06);
}

blockquote.callout-tip::before { content: "~"; font-weight: 700; color: #28a745; }

blockquote.callout-warning {
  border-left-color: #d29922;
  background-color: rgba(210, 153, 34, 0.06);
}

blockquote.callout-warning::before { content: "!"; font-weight: 700; color: #d29922; }

.dark-mode blockquote.callout-note { background-color: rgba(109, 179, 242, 0.08); border-left-color: #6db3f2; }
.dark-mode blockquote.callout-note::before { color: #6db3f2; }
.dark-mode blockquote.callout-tip { background-color: rgba(126, 231, 135, 0.08); border-left-color: #7ee787; }
.dark-mode blockquote.callout-tip::before { color: #7ee787; }
.dark-mode blockquote.callout-warning { background-color: rgba(255, 166, 87, 0.08); border-left-color: #ffa657; }
.dark-mode blockquote.callout-warning::before { color: #ffa657; }

/* ========================================
   Tables
   ======================================== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1em;
}

table {
  color: var(--text);
  width: 100%;
  border-collapse: collapse;
}
table th, table td {
  padding: 8px 12px;
  text-align: left;
}
table th {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  font-weight: 600;
}
table td {
  border: 1px solid var(--border);
}

/* ========================================
   Search
   ======================================== */
.search-input {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 20px;
  background-color: var(--bg-input);
  color: var(--text);
}

.search-input::placeholder { color: var(--text-muted); }

.search-results { list-style: none; padding: 0; }
.search-results li { margin-bottom: 1em; }

/* ========================================
   Share links
   ======================================== */
.share-label { color: var(--text-muted); }
#share-buttons { display: inline-block; vertical-align: middle; }
#share-buttons:after { content: ""; display: block; clear: both; }
#share-buttons > button { position: relative; text-align: center; height: 36px; width: 32px; float: left; background: none; border: none; padding: 0; }
#share-buttons > button > svg { height: 16px; fill: var(--share-fill); margin-top: 10px; }
#share-buttons > button:hover { cursor: pointer; }
#share-buttons > button.twitter:hover > svg { fill: #55ACEE; }
#share-buttons > button.linkedin:hover > svg { fill: #0077b5; }
#share-buttons > button.mail:hover > svg { fill: #e74c3c; }
#share-buttons > button.twitter > svg { height: 20px; margin-top: 8px; }
#share-buttons > button.linkedin > svg { height: 19px; margin-top: 7px; }
#share-buttons > button.mail > svg { height: 14px; margin-top: 11px; }

/* ========================================
   Copy button (overrides utils.css)
   ======================================== */
.copy-btn {
  background: var(--copy-bg);
  border-color: var(--copy-border);
  color: var(--copy-color);
}

.copy-btn:hover {
  background: var(--copy-hover-bg);
  color: var(--copy-hover-color);
  border-color: var(--copy-border);
}

.copy-btn.copied {
  background: #28a745;
  color: white;
  border-color: #28a745;
}

.dark-mode .copy-btn.copied {
  background: #238636;
  border-color: #238636;
}

/* Anchor links */
.anchor-link { color: var(--anchor-color); }
h2:hover .anchor-link, h3:hover .anchor-link, h4:hover .anchor-link { color: var(--anchor-hover); }

/* Reading progress bar - removed */

/* ========================================
   Table of Contents
   ======================================== */
.toc-wrapper {
  position: fixed;
  top: 100px;
  right: max(calc((100vw - 940px) / 2 - 240px), 20px);
  width: 220px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  z-index: 100;
  font-size: 0.78rem;
  line-height: 1.5;
}

.toc-wrapper::-webkit-scrollbar {
  width: 3px;
}

.toc-wrapper::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.toc-title {
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 4px;
}

.toc-list a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 2px 0 2px 0;
  border-left: 2px solid transparent;
  padding-left: 10px;
  transition: all 0.2s;
}

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

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

.toc-list .toc-h3 { padding-left: 22px; }
.toc-list .toc-h4 { padding-left: 34px; }

/* Hide TOC on smaller screens or when content is narrow */
@media screen and (max-width: 1300px) {
  .toc-wrapper { display: none; }
}

/* Mobile TOC (collapsible) */
.toc-mobile {
  display: none;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
}

.toc-mobile-toggle {
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toc-mobile-toggle::after {
  content: "+";
  font-size: 1rem;
  transition: transform 0.2s;
}

.toc-mobile-toggle.open::after {
  content: "-";
}

.toc-mobile-content {
  display: none;
  padding: 10px 16px;
  background: var(--bg);
}

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

.toc-mobile-content .toc-list a {
  padding: 4px 0 4px 10px;
}

@media screen and (max-width: 1300px) {
  .toc-mobile { display: block; }
}

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

/* ========================================
   Focus styles (accessibility)
   ======================================== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Show anchor links on focus too, not just hover */
h2 .anchor-link:focus-visible,
h3 .anchor-link:focus-visible,
h4 .anchor-link:focus-visible {
  opacity: 1;
}

/* Copy Code Button */
.code-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -30px; /* Pull button into the code block area */
  position: relative;
  z-index: 10;
  padding-right: 10px;
  padding-top: 10px;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  color: #555;
  transition: all 0.2s;
}

/* Heading Anchors */
.anchor-link {
  text-decoration: none;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 0.8em;
  color: var(--anchor-color, #a0a0a0);
  user-select: none;
}

h2:hover .anchor-link,
h3:hover .anchor-link,
h4:hover .anchor-link {
  opacity: 1;
}

/* ========================================
   Collapsible Code Blocks
   ======================================== */
.code-collapsible {
  position: relative;
}

.code-collapsible.collapsed .highlight {
  max-height: 300px;
  overflow: hidden;
}

.code-collapsible.collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--bg-code));
  pointer-events: none;
  border-radius: 0 0 12px 12px;
  z-index: 5;
}

.code-expand-btn {
  display: block;
  width: 100%;
  padding: 6px 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-code);
  border-top: none;
  border-radius: 0 0 12px 12px;
  cursor: pointer;
  font-size: 0.78em;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  text-align: center;
  transition: background 0.2s;
  margin-top: -8px;
  margin-bottom: 1em;
}

.code-expand-btn:hover {
  background: var(--bg-code);
}

/* ========================================
   Image Captions
   ======================================== */
.image-figure {
  margin: 1.5em 0;
  padding: 0;
}

.image-figure img {
  display: block;
}

.image-caption {
  font-size: 0.82em;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
  line-height: 1.4;
}

/* ========================================
   Scroll Animations
   ======================================== */


