@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

/* ── Light theme (default) ── */
:root {
    --color-bg: #FAF9F7;
    --color-surface: #F5F2ED;
    --color-surface-hover: #EDE8E0;
    --color-border: #DCD5CA;
    --color-border-emphasis: #C4BBB0;
    --color-text: #1C1917;
    --color-heading: #0F0D0A;
    --color-muted: #6B6160;
    --color-link: #1A56DB;
    --color-link-hover: #1040B3;
    --color-accent: #15803D;
    --color-accent-hover: #116932;
    --color-code-bg: #EDE8E0;
    --color-code-text: #1C1917;
    --color-inline-code-bg: rgba(107, 97, 96, 0.12);
    --color-inline-code-border: rgba(107, 97, 96, 0.2);
    --color-danger: #DC2626;
    --color-warning: #B45309;
    --color-success: #15803D;
    --color-info: #1A56DB;
    --color-scrollbar-thumb: var(--color-border);
    --color-scrollbar-track: transparent;
    --max-width: 932px;
    --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", monospace;
    --transition: 150ms ease;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-sm: 4px;
}

/* ── Dark theme override ── */
html.dark {
    --color-bg: #0D1117;
    --color-surface: #161B22;
    --color-surface-hover: #1C2433;
    --color-border: #21262D;
    --color-border-emphasis: #30363D;
    --color-text: #E6EDF3;
    --color-heading: #F0F6FC;
    --color-muted: #8B949E;
    --color-link: #58A6FF;
    --color-link-hover: #79C0FF;
    --color-accent: #22C55E;
    --color-accent-hover: #4ADE80;
    --color-code-bg: #0D1117;
    --color-code-text: #E6EDF3;
    --color-inline-code-bg: rgba(110, 118, 129, 0.2);
    --color-inline-code-border: rgba(110, 118, 129, 0.3);
    --color-danger: #F85149;
    --color-warning: #D29922;
    --color-success: #3FB950;
    --color-info: #58A6FF;
    --color-scrollbar-thumb: var(--color-border);
    --color-scrollbar-track: transparent;
}

*, *::before, *::after { box-sizing: border-box; }

/* ── Scrollbars ── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
}
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: var(--color-scrollbar-track);
}
*::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-emphasis);
}

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    margin: 0;
    padding: 0;
    font-size: 1.0625rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-heading);
    line-height: 1.3;
    margin: 2rem 0 0.75rem;
    font-weight: 600;
}

h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.4rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.35rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.95rem; }

p { margin: 0 0 1rem; }

strong { font-weight: 600; color: var(--color-heading); }
em { font-style: italic; }

ul, ol {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
}
li { margin-bottom: 0.25rem; }
li > ul, li > ol { margin-top: 0.25rem; }

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

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

/* Lazy-loading placeholder shimmer (reserved width/height box) */
img[loading="lazy"] {
    background: linear-gradient(90deg,
        var(--color-surface) 25%,
        var(--color-surface-hover) 37%,
        var(--color-surface) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ── Inline elements ── */
code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--color-inline-code-bg);
    border: 1px solid var(--color-inline-code-border);
    border-radius: var(--radius-sm);
    padding: 0.15em 0.35em;
    color: var(--color-code-text);
    word-break: break-word;
}

kbd {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--color-surface);
    border: 1px solid var(--color-border-emphasis);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    padding: 0.1em 0.4em;
    color: var(--color-text);
}

mark {
    background: rgba(180, 83, 9, 0.18);
    color: var(--color-heading);
    border-radius: 2px;
    padding: 0.05em 0.15em;
}
html.dark mark {
    background: rgba(210, 153, 34, 0.3);
    color: var(--color-heading);
}

abbr[title] {
    text-decoration: underline dotted var(--color-muted);
    cursor: help;
}

sup, sub { font-size: 0.75em; }

progress {
    accent-color: var(--color-accent);
    width: 100%;
    height: 0.5rem;
}

/* ── Layout ── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

/* ── Navbar ── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.navbar-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.navbar .brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity var(--transition);
}
.navbar .brand:hover {
    opacity: 0.85;
    text-decoration: none;
}

.brand-logo {
    height: 2rem;
    width: auto;
    display: block;
    border-radius: var(--radius-sm);
}

.nav-menu {
    display: flex;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
    align-items: center;
    flex: 1;
}

.navbar a {
    color: var(--color-muted);
    transition: color var(--transition);
}
.navbar a:hover {
    color: var(--color-heading);
    text-decoration: none;
}

/* ── Nav icons ── */
.nav-icons {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin-left: auto;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition), background var(--transition);
}
.nav-icon:hover {
    color: var(--color-heading);
    background: var(--color-surface-hover);
}

.nav-icons .icon-light { display: none; }
.nav-icons .icon-dark { display: block; }
html.dark .nav-icons .icon-light { display: block; }
html.dark .nav-icons .icon-dark { display: none; }

/* ── TOC drawer toggle (mobile only) ── */
.toc-toggle {
    display: none;
}

/* ── Hamburger ── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.hamburger-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-muted);
    border-radius: 1px;
    transition: transform var(--transition), opacity var(--transition);
}

.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) {
    opacity: 0;
}
.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ── Cards ── */
.post-list, .note-list {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin-top: 2rem;
}

.post-card, .note-card {
    padding: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}
.post-card:hover, .note-card:hover {
    border-color: var(--color-border-emphasis);
    background: var(--color-surface-hover);
}

.post-card .card-body, .note-card .card-body {
    padding: 1.25rem;
}

.post-card .featured-image, .note-card .featured-image {
    display: block;
    width: 100%;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
    background: var(--color-surface-hover);
}

.post-card h2, .note-card h2 {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
    border: none;
    padding: 0;
}
.post-card h2 a, .note-card h2 a {
    color: var(--color-heading);
}
.post-card h2 a:hover, .note-card h2 a:hover {
    color: var(--color-link);
    text-decoration: none;
}

.post-card time, .note-card time {
    display: inline;
    color: var(--color-muted);
    font-size: 0.85rem;
    margin: 0;
}

.post-card p {
    margin-top: 0.5rem;
    margin-bottom: 0;
    color: var(--color-muted);
}

.post-card .card-excerpt {
    margin-top: 0.5rem;
    color: var(--color-muted);
    font-size: 0.95rem;
}
.post-card .card-excerpt p {
    margin: 0 0 0.5rem;
}
.post-card .card-excerpt p:last-child {
    margin-bottom: 0;
}
.post-card .card-read-more {
    margin: 0.75rem 0 0;
}

.post-card .read-more {
    color: var(--color-link);
    font-size: 0.85rem;
    white-space: nowrap;
}
.post-card .read-more:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/* Whole-card clickable: the title link's ::after stretches over the card */
.post-card h2 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* Every other link in the card (tags, read-more, excerpt links) stays
   clickable above the stretched link. */
.post-card a:not(h2 a) {
    position: relative;
    z-index: 1;
}

.note-card {
    cursor: default;
}
.note-card:hover {
    border-color: var(--color-border);
    background: var(--color-surface);
}
.note-card .note-body {
    margin-top: 0.75rem;
}

/* Permalink copy icon on note-card titles */
.note-card h2 .permalink-link {
    margin-left: 0.35rem;
    color: var(--color-muted);
    text-decoration: none;
    vertical-align: baseline;
    transition: color var(--transition);
}
.note-card h2 .permalink-link:hover {
    color: var(--color-link);
}
.note-card h2 .permalink-link.copied {
    color: var(--color-success);
}

.hashtag {
    color: var(--color-link);
    font-size: 0.85rem;
    transition: color var(--transition);
}
.hashtag:hover {
    color: var(--color-link-hover);
    text-decoration: none;
}

/* ── Tag pills (sidebar, cloud page) ── */
.tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0.25rem 0;
}

.tag {
    background: var(--color-inline-code-bg);
    border: 1px solid var(--color-inline-code-border);
    color: var(--color-muted);
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}
@media (hover: hover) {
    .tag:hover {
        border-color: var(--color-link);
        color: var(--color-link);
        background: rgba(26, 86, 219, 0.08);
        text-decoration: none;
    }
    html.dark .tag:hover {
        background: rgba(88, 166, 255, 0.1);
    }
}

.tag.active {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(21, 128, 61, 0.08);
}
html.dark .tag.active {
    background: rgba(34, 197, 94, 0.1);
}

/* ── Meta row: date + hashtags inline ── */
.card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--color-muted);
    font-size: 0.85rem;
    margin: 0.15rem 0 0.35rem;
}

.card-meta .hashtag {
    font-size: 0.85rem;
}

/* ── Tag cloud page ── */
.tag-cloud {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-cloud-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.tag-count {
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* ── Detail sidebar ── */
.detail-main {
    min-width: 0;
}

.with-sidebar {
    display: grid;
    grid-template-columns: 700px 200px;
    gap: 2rem;
}

.detail-sidebar {
    position: sticky;
    top: 4.5rem;
    align-self: start;
    max-height: calc(100vh - 4.5rem);
    overflow-y: auto;
    padding-top: 0.5rem;
}

.detail-sidebar h3 {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-top: 0;
    margin-bottom: 0.5rem;
    border: none;
}

/* TOC + tags stack vertically; the TOC scrolls internally when tall and
   the tags stay pinned at the bottom of the visible sidebar/drawer. */
.detail-sidebar.sidebar-toc {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-sidebar.sidebar-toc .toc {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.detail-sidebar.sidebar-toc h3,
.detail-sidebar.sidebar-toc .tags {
    flex: 0 0 auto;
}

.detail-sidebar.sidebar-toc h3 {
    margin-top: 1rem;
}

/* ── Sidebar TOC (Quarto <nav id="TOC">) ── */
.toc {
    font-size: 0.9rem;
}

.toc h2 {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin: 0 0 0.5rem;
    border: none;
}

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

.toc ul ul {
    display: none;
}

.toc li {
    margin: 0.25rem 0;
    line-height: 1.35;
}

.toc li.active > ul {
    display: block;
    padding-left: 1rem;
}

.toc a {
    color: var(--color-muted);
    text-decoration: none;
}

.toc a:hover,
.toc li.active > a {
    color: var(--color-link);
}

/* ── Load more (infinite scroll) ── */
.load-more {
    display: block;
    text-align: center;
    padding: 1.5rem 0;
    color: var(--color-muted);
    font-size: 0.95rem;
    cursor: pointer;
}
.load-more.retry {
    color: var(--color-link);
    text-decoration: underline;
}
.load-more-fallback {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.95rem;
}

/* ── Footer ── */
.footer {
    max-width: var(--max-width);
    margin: 3rem auto 1.5rem;
    padding: 2rem 1.25rem 1.25rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.88rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.footer-col h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    margin: 0 0 0.75rem;
    border: none;
}

.footer-brand {
    display: inline-block;
    transition: opacity var(--transition);
}
.footer-brand:hover {
    opacity: 0.85;
    text-decoration: none;
}

.footer-logo {
    height: 2rem;
    width: auto;
    display: block;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-heading);
    margin: 0 0 0.15rem;
}

.footer-tagline {
    margin: 0 0 0.75rem;
}

.footer-contact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.footer-email {
    display: inline-flex;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.footer-links a,
.footer-social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-muted);
    transition: color var(--transition);
}
.footer-links a:hover,
.footer-social-link:hover {
    color: var(--color-link);
    text-decoration: underline;
}

.social-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

.social-follow {
    margin-top: 1.5rem;
    padding: 0.65rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.social-follow-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-accent);
    opacity: 0.7;
}

.social-follow-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.social-follow-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-muted);
    transition: color var(--transition);
}
.social-follow-link:hover {
    color: var(--color-link);
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.82rem;
}

.footer-bottom-links {
    display: flex;
    gap: 1rem;
}

.footer-bottom-links a {
    color: var(--color-muted);
    transition: color var(--transition);
}
.footer-bottom-links a:hover {
    color: var(--color-link);
    text-decoration: underline;
}

/* ── Detail article ── */
.post-detail header, .note-detail header, .page-detail header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
}

.post-detail h1, .note-detail h1, .page-detail h1 {
    margin-bottom: 0.35rem;
    border: none;
    padding: 0;
}

.post-detail time, .note-detail time {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.post-detail .featured-image, .note-detail .featured-image,
.page-detail .featured-image {
    display: block;
    width: 100%;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    background: var(--color-surface-hover);
}

/* ── Content body ── */
.post-body, .note-body, .page-body {
    font-size: 1.0625rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-body img, .note-body img, .page-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* ── Quarto section levels ── */
.level2 { margin-bottom: 2rem; }
.level3 { margin-bottom: 1.5rem; }
.level4 { margin-bottom: 1.25rem; }

/* ── Figures ── */
.quarto-figure, .quarto-float {
    margin: 1.5rem 0;
}

.figure, .quarto-float-fig { margin: 0; }

.figure-img, .img-fluid {
    max-width: 100%;
    height: auto;
    display: block;
}

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

figcaption, .quarto-float-caption, .quarto-float-caption-bottom, .quarto-uncaptioned {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

img.left {
    float: left;
    margin: 0.25rem 1rem 0.75rem 0;
    max-width: 50%;
}

img.right {
    float: right;
    margin: 0.25rem 0 0.75rem 1rem;
    max-width: 50%;
}

/* Float figures: when quarto floats the image (class .left/.right on the
   <img> inside a <figure>), float the whole figure so the figcaption stays
   under the image instead of sitting in normal flow at the top of the
   full-width figure. */
figure:has(img.left) {
    float: left;
    max-width: 50%;
    margin: 0.25rem 1rem 0.75rem 0;
}

figure:has(img.right) {
    float: right;
    max-width: 50%;
    margin: 0.25rem 0 0.75rem 1rem;
}

figure:has(img.left) img, figure:has(img.right) img {
    float: none;
    max-width: 100%;
    margin: 0;
}

figure:has(img.left) p, figure:has(img.right) p {
    margin-bottom: 0;
}

/* ── Image zoom (lightbox) ── */
.image-zoom-target {
    cursor: zoom-in;
}

.image-zoom-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.72);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: image-zoom-fade-in 0.15s ease;
}

.image-zoom-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    animation: image-zoom-scale-in 0.2s ease;
}

.image-zoom-frame img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
    cursor: zoom-out;
}

.image-zoom-caption {
    margin-top: 0.75rem;
    color: #e5e5e5;
    font-size: 0.95rem;
    text-align: center;
}

@keyframes image-zoom-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes image-zoom-scale-in {
    from { transform: scale(0.96); }
    to { transform: scale(1); }
}

/* ── Blockquote ── */
blockquote, .blockquote {
    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--color-muted);
}

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

blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-style: normal;
    font-size: 0.88rem;
    color: var(--color-muted);
}

/* ── Tables ── */
.table-scroll {
    overflow-x: auto;
}

.post-body table, .note-body table, .page-body table,
.table {
    border-collapse: collapse;
    width: max-content;
    min-width: 500px;
    max-width: 100%;
    margin: 1rem 0;
    font-size: 0.92rem;
}

.post-body th, .note-body th, .page-body th,
.table th {
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border-emphasis);
    border-bottom: 2px solid var(--color-border-emphasis);
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 700;
    color: var(--color-heading);
    letter-spacing: 0.02em;
}

.post-body td, .note-body td, .page-body td,
.table td {
    border: 1px solid var(--color-border);
    padding: 0.45rem 0.75rem;
}

.table .odd { background: rgba(107, 97, 96, 0.04); }
.table .even { background: transparent; }
html.dark .table .odd { background: rgba(110, 118, 129, 0.04); }

/* ── Code blocks ── */
.post-body pre, .note-body pre, .page-body pre,
pre {
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.55;
    margin: 1rem 0;
    color: var(--color-code-text);
}

.post-body pre code, .note-body pre code, .page-body pre code,
pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.sourceCode { position: relative; }
.code-with-copy { padding-right: 3rem; }

.code-copy-outer-scaffold {
    position: relative;
    margin: 1rem 0;
}

.code-copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
    z-index: 1;
}
.code-copy-button:hover {
    border-color: var(--color-border-emphasis);
    color: var(--color-heading);
    background: var(--color-surface-hover);
}

.code-copy-button.copied {
    color: var(--color-success);
}

/* ── Syntax highlighting: light ── */
.sourceCode .kw { color: #D73A49; }
.sourceCode .st { color: #0A3069; }
.sourceCode .co { color: #6A737D; font-style: italic; }
.sourceCode .bu { color: #0550AE; }
.sourceCode .op { color: #CF222E; }
.sourceCode .fu { color: #8250DF; }
.sourceCode .dv { color: #0550AE; }
.sourceCode .dt { color: #953800; }
.sourceCode .im { color: #CF222E; }
.sourceCode .cf { color: #CF222E; font-weight: bold; }
.sourceCode .ch { color: #0550AE; }
.sourceCode .ss { color: #0A3069; }
.sourceCode .sc { color: #0A3069; }
.sourceCode .va { color: #953800; }
.sourceCode .cn { color: #0550AE; }
.sourceCode .at { color: #953800; }
.sourceCode .fl { color: #0550AE; }
.sourceCode .ot { color: #CF222E; }
.sourceCode .ex { color: #D73A49; }

/* ── Syntax highlighting: dark ── */
html.dark .sourceCode .kw { color: #FF7B72; }
html.dark .sourceCode .st { color: #A5D6FF; }
html.dark .sourceCode .co { color: #8B949E; font-style: italic; }
html.dark .sourceCode .bu { color: #79C0FF; }
html.dark .sourceCode .op { color: #FF7B72; }
html.dark .sourceCode .fu { color: #D2A8FF; }
html.dark .sourceCode .dv { color: #79C0FF; }
html.dark .sourceCode .dt { color: #FFA657; }
html.dark .sourceCode .im { color: #FF7B72; }
html.dark .sourceCode .cf { color: #FF7B72; font-weight: bold; }
html.dark .sourceCode .ch { color: #545D68; }
html.dark .sourceCode .ss { color: #A5D6FF; }
html.dark .sourceCode .sc { color: #A5D6FF; }
html.dark .sourceCode .va { color: #FFA657; }
html.dark .sourceCode .cn { color: #79C0FF; }
html.dark .sourceCode .at { color: #FFA657; }
html.dark .sourceCode .fl { color: #79C0FF; }
html.dark .sourceCode .ot { color: #FF7B72; }
html.dark .sourceCode .ex { color: #FF7B72; }

/* ── Cell output (Jupyter) ── */
.cell { margin: 1.25rem 0; }

.cell-output { margin-top: 0.5rem; }

.cell-output pre {
    background: var(--color-surface);
    border-color: var(--color-border-emphasis);
    border-left: 3px solid var(--color-accent);
    color: var(--color-muted);
    margin-top: 0;
}

.cell-output-stdout pre { border-left-color: var(--color-muted); }

.cell-output-display { margin-top: 0.75rem; }

/* ── Callouts ── */
.callout, .callout-style-default, .callout-titled {
    margin: 1.25rem 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.callout-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.callout-icon-container {
    display: flex;
    align-items: center;
}

.callout-body, .callout-body-container {
    padding: 0.75rem 1rem 1rem;
}

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

/* Callout: Note */
.callout-note {
    border-left: 4px solid var(--color-info);
    background: rgba(26, 86, 219, 0.06);
}
.callout-note .callout-header { color: var(--color-info); background: rgba(26, 86, 219, 0.1); }
html.dark .callout-note { background: rgba(88, 166, 255, 0.06); }
html.dark .callout-note .callout-header { background: rgba(88, 166, 255, 0.14); }

/* Callout: Warning */
.callout-warning {
    border-left: 4px solid var(--color-warning);
    background: rgba(180, 83, 9, 0.06);
}
.callout-warning .callout-header { color: var(--color-warning); background: rgba(180, 83, 9, 0.1); }
html.dark .callout-warning { background: rgba(210, 153, 34, 0.06); }
html.dark .callout-warning .callout-header { background: rgba(210, 153, 34, 0.14); }

/* Callout: Tip */
.callout-tip {
    border-left: 4px solid var(--color-success);
    background: rgba(21, 128, 61, 0.06);
}
.callout-tip .callout-header { color: var(--color-success); background: rgba(21, 128, 61, 0.1); }
html.dark .callout-tip { background: rgba(63, 185, 80, 0.06); }
html.dark .callout-tip .callout-header { background: rgba(63, 185, 80, 0.14); }

/* Callout: Important */
.callout-important {
    border-left: 4px solid var(--color-danger);
    background: rgba(220, 38, 38, 0.06);
}
.callout-important .callout-header { color: var(--color-danger); background: rgba(220, 38, 38, 0.1); }
html.dark .callout-important { background: rgba(248, 81, 73, 0.06); }
html.dark .callout-important .callout-header { background: rgba(248, 81, 73, 0.14); }

/* Callout: Caution */
.callout-caution {
    border-left: 4px solid var(--color-warning);
    background: rgba(180, 83, 9, 0.06);
}
.callout-caution .callout-header { color: var(--color-warning); background: rgba(180, 83, 9, 0.1); }
html.dark .callout-caution { background: rgba(210, 153, 34, 0.06); }
html.dark .callout-caution .callout-header { background: rgba(210, 153, 34, 0.14); }

/* Callout icons (Bootstrap-style glyphs via inline SVG mask) */
.callout-icon {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: var(--callout-icon) no-repeat center / contain;
    mask: var(--callout-icon) no-repeat center / contain;
}
.callout-note .callout-icon {
    --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='black'%3E%3Cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z'/%3E%3C/svg%3E");
}
.callout-tip .callout-icon {
    --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='black'%3E%3Cpath d='M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13a.5.5 0 0 1 0 1 .5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1 0-1 .5.5 0 0 1 0-1 .5.5 0 0 1-.46-.302l-.761-1.77a1.964 1.964 0 0 0-.453-.618A5.984 5.984 0 0 1 2 6m6-5a5 5 0 0 0-3.479 8.592c.263.254.514.564.676.941L5.83 12h4.342l.632-1.467c.162-.377.413-.687.676-.941A5 5 0 0 0 8 1z'/%3E%3C/svg%3E");
}
.callout-important .callout-icon {
    --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='black'%3E%3Cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16'/%3E%3Cpath d='M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z'/%3E%3C/svg%3E");
}
.callout-warning .callout-icon {
    --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='black'%3E%3Cpath d='M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z'/%3E%3Cpath d='M8 4.477c-.443 0-.81.367-.81.817 0 .003 0 .005.001.008l.575 5.202c.006.054.05.096.104.096.055 0 .098-.042.104-.096l.575-5.202a.81.81 0 0 0 .001-.008c0-.45-.367-.817-.81-.817zM8 11.2a1.2 1.2 0 1 0 0 2.4 1.2 1.2 0 0 0 0-2.4z'/%3E%3C/svg%3E");
}
.callout-caution .callout-icon {
    --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='black'%3E%3Cpath d='M9.97 4.88l.953 3.811C10.158 8.878 9.14 9 8 9c-1.14 0-2.159-.122-2.923-.309L6.03 4.88C6.635 4.957 7.3 5 8 5s1.365-.043 1.97-.12zm-.245-.978L8.97.88C8.718-.13 7.282-.13 7.03.88L6.274 3.9C6.8 3.965 7.382 4 8 4c.618 0 1.2-.036 1.725-.098zm4.396 8.613a.5.5 0 0 1 .037.96l-6 2a.5.5 0 0 1-.316 0l-6-2a.5.5 0 0 1 .037-.96l2.391-.598.565-2.257c.862.212 1.964.339 3.165.339s2.303-.127 3.165-.339l.565 2.257 2.391.598z'/%3E%3C/svg%3E");
}

/* ── Tabs ── */
.panel-tabset { margin: 1.25rem 0; }

.nav-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--color-border);
    gap: 0;
}

.nav-tabs .nav-item { margin: 0; }

.nav-tabs .nav-link {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-muted);
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition), border-color var(--transition);
    background: none;
    text-decoration: none;
}
.nav-tabs .nav-link:hover {
    color: var(--color-heading);
    border-bottom-color: var(--color-border-emphasis);
    text-decoration: none;
}
.nav-tabs .nav-link.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    font-weight: 500;
}

.tab-content { padding: 0.75rem 0; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Task lists ── */
.task-list {
    list-style: none;
    padding-left: 0;
}

.task-list li { margin-bottom: 0.2rem; }

.task-list label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}

.task-list input[type="checkbox"] {
    margin-top: 0.3rem;
    accent-color: var(--color-accent);
    width: 0.95rem;
    height: 0.95rem;
    flex-shrink: 0;
}

/* ── Definition lists ── */
dl { margin: 1rem 0; }

dt {
    font-weight: 600;
    color: var(--color-heading);
    margin-top: 0.75rem;
}
dt:first-child { margin-top: 0; }

dd {
    margin: 0.25rem 0 0.5rem 1rem;
    color: var(--color-muted);
}

/* ── Footnotes ── */
.footnotes, .footnotes-end-of-document {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.88rem;
    color: var(--color-muted);
}

.footnotes h2, .quarto-appendix-heading {
    font-size: 1rem;
    border-bottom: none;
}

.footnotes ol { padding-left: 1.25rem; }
.footnotes li { margin-bottom: 0.3rem; }
.footnotes p { margin: 0; display: inline; }

.footnote-ref {
    font-size: 0.82em;
    vertical-align: super;
    line-height: 0;
}

.footnote-back {
    font-size: 0.85em;
    color: var(--color-muted);
    margin-left: 0.15rem;
}

/* ── Details / Summary ── */
details {
    margin: 0.75rem 0;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

details[open] { padding-bottom: 0.75rem; }

summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--color-heading);
    padding: 0.25rem 0;
    outline: none;
}
summary:hover { color: var(--color-link); }

details p { margin: 0.5rem 0 0; }

/* ── Code annotations ── */
.code-annotation-anchor {
    float: right;
    margin-left: 1rem;
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 0.85em;
    text-decoration: none;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}
.code-annotation-anchor::before { content: "<"; }
.code-annotation-anchor::after { content: ">"; }

.code-annotation-target { display: inline; }

.cell-annotation { margin-top: 0.75rem; }

.code-annotation-container-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.75rem;
    row-gap: 0.25rem;
    align-items: baseline;
    margin: 0;
    padding: 0;
    font-size: 0.88rem;
    color: var(--color-muted);
}

.code-annotation-container-grid dt {
    color: var(--color-accent);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.85em;
    margin-top: 0;
    user-select: none;
    -webkit-user-select: none;
}
.code-annotation-container-grid dt::before { content: "<"; }
.code-annotation-container-grid dt::after { content: ">"; }

.code-annotation-container-grid dd {
    margin: 0;
    color: var(--color-muted);
}

.code-annotation-gutter-bg, .code-annotation-gutter { display: none; }

/* ── Quarto structural compatibility ── */
.nav {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}

.d-flex { display: flex; }
.flex-fill { flex: 1 1 auto; }
.align-content-center { align-content: center; }

/* Fragment navigation lands below the sticky navbar for any target */
:target { scroll-margin-top: 4.5rem; }
.anchored { scroll-margin-top: 4.5rem; }

/* Header hash links (JS-injected, revealed on hover/click) */
.header-anchor {
    opacity: 0;
    margin-left: 0.4rem;
    color: var(--color-muted);
    text-decoration: none;
    vertical-align: baseline;
    transition: opacity 0.15s ease;
}

.header-anchor:hover {
    color: var(--color-link);
}

.post-body h2:hover .header-anchor,
.post-body h3:hover .header-anchor,
.note-body h2:hover .header-anchor,
.note-body h3:hover .header-anchor,
.page-body h2:hover .header-anchor,
.page-body h3:hover .header-anchor,
.header-anchor.pinned {
    opacity: 1;
}

.callout-title-container {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    align-self: stretch;
    line-height: 1.2;
}

.screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
}

tr.header { background: var(--color-surface); }

.caption-top { caption-side: top; }

.quarto-figure-center { text-align: center; }

.quarto-xref { color: var(--color-link); }

.cell-code { margin: 0; }

pre.sourceCode.code-annotation-code { padding-right: 3rem; }
.code-annotated { margin-bottom: 0; }

.citation { color: var(--color-muted); }

.bi { font-style: normal; }

.default { margin: 0; }
.tabset-margin-container { margin: 0; }

/* Quarto code language markers (metadata classes, no visual styling) */
.sourceCode.bash, .sourceCode.css, .sourceCode.html, .sourceCode.javascript,
.sourceCode.js, .sourceCode.json, .sourceCode.python,
.sourceCode.yaml { }

/* ── Graphviz diagrams ── */
.graph svg { max-width: 100%; height: auto; }

.graph .node text {
    fill: var(--color-text);
    font-family: var(--font-sans);
}
html.dark .graph .node path,
html.dark .graph .edge path { stroke: var(--color-text); }
html.dark .graph .edge polygon { fill: var(--color-text); stroke: var(--color-text); }
html.dark .graph polygon[fill="white"] { fill: var(--color-surface); }

/* ── Horizontal overflow protection ── */
.post-body, .note-body, .page-body {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ── Search page ── */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem;
}
.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition);
}
.search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--color-accent);
}
.search-form button {
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.search-form button:hover { background: var(--color-accent-hover); }
.search-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.search-empty {
    color: var(--color-muted);
    padding: 1rem 0;
}

.search-active-tags {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity var(--transition);
}
.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
    opacity: 1;
}
.search-loading {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
}

.search-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}

.search-result {
    padding: 1rem 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), background var(--transition);
}
.search-result:hover {
    border-color: var(--color-border-emphasis);
    background: var(--color-surface-hover);
}

.search-type {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--color-muted);
    background: var(--color-inline-code-bg);
    border: 1px solid var(--color-inline-code-border);
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.4rem;
}

.search-title {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    border: none;
    padding: 0;
}
.search-title a { color: var(--color-heading); }
.search-title a:hover { color: var(--color-link); text-decoration: none; }

.search-snippet {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.92rem;
    overflow-wrap: break-word;
}

mark.search-hit {
    background: rgba(212, 167, 44, 0.35);
    color: inherit;
    padding: 0 0.12em;
    border-radius: 2px;
}

/* ── Focus styles ── */
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Selection ── */
::selection {
    background: rgba(107, 97, 96, 0.2);
    color: var(--color-heading);
}
html.dark ::selection {
    background: rgba(88, 166, 255, 0.3);
}

/* ── 404 / 500 pages ── */
.page-error {
    text-align: center;
    padding: 4rem 1rem;
}
.page-error h1 { font-size: 3rem; margin-bottom: 0.5rem; border: none; }
.page-error p { color: var(--color-muted); font-size: 1.1rem; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    body { font-size: 1rem; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }

    .navbar-inner {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .hamburger { display: flex; }
    .nav-menu {
        display: none;
        flex-direction: column;
        flex: none;
        width: 100%;
        gap: 0.5rem;
        padding: 0.75rem 0 0;
        border-top: 1px solid var(--color-border);
        margin-top: 0.5rem;
        font-size: 0.9rem;
    }
    .nav-menu.open {
        display: flex;
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
    }
    .nav-icons { margin-left: 0; align-self: flex-end; }

    .post-card, .note-card {
        padding: 1rem;
    }
    .post-card h2, .note-card h2 {
        font-size: 1.1rem;
    }

    .code-copy-outer-scaffold pre {
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    .nav-tabs { flex-wrap: wrap; }
    .nav-tabs .nav-link { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

    img.left, img.right {
        float: none;
        display: block;
        margin: 0.5rem 0;
        max-width: 100%;
    }

    .table-scroll table {
        width: 100%;
        min-width: max-content;
        max-width: none;
    }

    .with-sidebar {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .detail-sidebar {
        position: static;
        align-self: auto;
        max-height: none;
        overflow: visible;
        padding-top: 1rem;
        border-top: 1px solid var(--color-border);
    }

    .toc-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        height: auto;
        padding: 0.35rem 0.85rem;
        margin-left: 0;
        font-size: 0.9rem;
        line-height: 1;
        white-space: nowrap;
        color: var(--color-muted);
        background: none;
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        cursor: pointer;
        transition: color var(--transition), border-color var(--transition);
    }
    @media (hover: hover) {
        .toc-toggle:hover {
            color: var(--color-heading);
            border-color: var(--color-border-emphasis);
        }
    }
    .toc-toggle[aria-expanded="true"] {
        color: var(--color-link);
        border-color: var(--color-link);
    }

    .detail-sidebar.sidebar-toc {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(85vw, 320px);
        padding: 4.5rem 1.25rem 1.25rem;
        background: var(--color-bg);
        border: none;
        border-left: 1px solid var(--color-border);
        box-shadow: none;
        visibility: hidden;
        transform: translateX(100%);
        transition: transform var(--transition), visibility 0s linear var(--transition);
        overflow: hidden;
        z-index: 90;
    }
    .detail-sidebar.sidebar-toc.open {
        visibility: visible;
        transform: translateX(0);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
        transition: transform var(--transition);
    }
    html.drawer-open {
        overflow: hidden;
    }
    html, body {
        overflow-x: clip;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    .footer-col:first-child { grid-column: 1; grid-row: 1; }
    .footer-col:nth-child(2) { grid-column: 1; grid-row: 2; }
    .footer-col:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    body { font-size: 0.95rem; }
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.15rem; }

    .container { padding: 0.75rem; }
    .navbar-inner { padding: 0.6rem 0.75rem; }
}

