/* Reset and base styles */
* {
    box-sizing: border-box;
}

html {
    font-size: 18px;   /* or whatever you want 1rem to mean */
    color-scheme: light dark;
    scrollbar-gutter: stable;
}

/* CSS Custom Properties for theming */
:root {
    /* Fonts - see docs/README.md "Changing the font" for how to swap these */
    --font-body: 'Computer Modern Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier Prime', 'Courier New', monospace;

    /* Light theme colors (inspired by astro-theme-cactus) */
    --color-global-bg: oklch(98.48% 0 0);
    --color-global-text: oklch(26.99% 0.0096 235.05);
    --color-accent: #af67ff;
    --color-accent-2: oklch(18.15% 0 0);
    --color-quote: #af67ff;
    --color-border: #e5e7eb;
    --color-card-bg: rgba(255, 255, 255, 0.8);
    --color-shadow: rgba(0, 0, 0, 0.1);

    /* Fixed accent for the scrollbar, nav links, and markdown links; same value in light and dark */
    --color-accent-red: #FF4D00;
    --color-link: var(--color-accent-red);
}

/* Dark theme colors */
[data-theme="dark"] {
    --color-global-bg: oklch(23.64% 0.0045 248);
    --color-global-text: oklch(83.54% 0 264);
    --color-accent: #5ff26b;
    --color-accent-2: oklch(94.66% 0 0);
    --color-quote: oklch(94.8% 0.106 136.49);
    --color-border: #374151;
    --color-card-bg: rgba(31, 41, 55, 0.8);
    --color-shadow: rgba(0, 0, 0, 0.3);
}

/* Base typography */
body {
    font-family: var(--font-body);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--color-global-bg);
    color: var(--color-global-text);
    padding-top: 8rem; /* Increased to account for fixed header */
}

/* Responsive body padding */
@media (max-width: 640px) {
    body {
        padding-top: 5rem; /* Reduced padding on mobile */
    }
}

/* Utility classes matching astro-theme-cactus */
.bg-global-bg { background-color: var(--color-global-bg); }
.text-global-text { color: var(--color-global-text); }
.text-accent { color: var(--color-accent); }
.text-accent-2 { color: var(--color-accent-2); }

.mx-auto { margin-left: auto; margin-right: auto; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.min-h-screen { min-height: 100vh; }
.max-w-3xl { max-width: 57.6rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.pt-16 { padding-top: 4rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-16 { margin-bottom: 4rem; }
.mb-28 { margin-bottom: 7rem; }
.me-3 { margin-inline-end: 0.75rem; }
.me-4 { margin-inline-end: 1rem; }
.ms-auto { margin-inline-start: auto; }
.mt-auto { margin-top: auto; }
.h-4 { height: 1rem; }
.w-4 { width: 1rem; }
.h-7 { height: 1.75rem; }
.w-7 { width: 1.75rem; }
.h-10 { height: 2.5rem; }
.w-6 { width: 1.5rem; }
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-normal { font-weight: 400; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.relative { position: relative; }
.absolute { position: absolute; }
.hidden { display: none; }
.rounded-md { border-radius: 0.375rem; }
.shadow { box-shadow: 0 1px 3px 0 var(--color-shadow), 0 1px 2px -1px var(--color-shadow); }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.underline { text-decoration: underline; }
.underline-offset-2 { text-underline-offset: 2px; }
.grayscale { filter: grayscale(100%); }
.opacity-75 { opacity: 0.75; }
.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; }

/* Responsive utilities */
@media (min-width: 640px) {
    .sm\:px-8 { padding-left: 2rem; padding-right: 2rem; }
    .sm\:flex { display: flex; }
    .sm\:flex-row { flex-direction: row; }
    .sm\:flex-col { flex-direction: column; }
    .sm\:items-center { align-items: center; }
    .sm\:invisible { visibility: hidden; }
    .sm\:hidden { display: none; }
    .sm\:static { position: static; }
    .sm\:relative { position: relative; }
    .sm\:absolute { position: absolute; }
    .sm\:z-auto { z-index: auto; }
    .sm\:mt-1 { margin-top: 0.25rem; }
    .sm\:me-0 { margin-inline-end: 0; }
    .sm\:py-0 { padding-top: 0; padding-bottom: 0; }
    .sm\:h-20 { height: 5rem; }
    .sm\:w-12 { width: 3rem; }
    .sm\:text-2xl { font-size: 1.5rem; }
    .sm\:ps-18 { padding-inline-start: 4.5rem; }
    .sm\:-ms-4 { margin-inline-start: -1rem; }
    .sm\:divide-accent > :not([hidden]) ~ :not([hidden]) {
        border-inline-start-width: 1px;
        border-color: var(--color-accent);
    }
    .sm\:rounded-none { border-radius: 0; }
    .sm\:bg-transparent { background-color: transparent; }
    .sm\:shadow-none { box-shadow: none; }
    .sm\:backdrop-blur-none { backdrop-filter: none; }
}

/* Screen reader only */
.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;
}

.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Custom component styles */
.title {
    color: var(--color-accent-2);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.cactus-link {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cactus-link:hover {
    text-decoration-thickness: 2px;
}

/* Header styles */
#main-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 57.6rem; /* Same as max-w-3xl */
    width: 100%;
    background-color: color-mix(in srgb, var(--color-global-bg) 95%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
    z-index: 100;
    padding: 1rem 1rem 0.5rem 1rem; /* Match main content px-4 */
}


/* Header grid layout */
.header-grid {
    display: grid;
    grid-template-columns: 1fr minmax(0, auto);
    grid-template-rows: auto auto;
    grid-template-areas:
        "title controls"
        "nav controls";
    align-items: center;
    column-gap: 1rem;
}

.header-title { grid-area: title; align-self: center; }
.header-nav { grid-area: nav; align-self: center; }
.header-controls {
    grid-area: controls;
    justify-self: end;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Nav links now centered with title - no additional margin needed */

@media (min-width: 640px) {
    #main-header {
        padding: 1rem 2rem 0.5rem 2rem; /* Match main content sm:px-8 */
    }
}

/* Navigation styles - Desktop */
.mobile-nav-menu {
    /* Desktop styles */
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    position: static;
    background: transparent;
    margin-top: 0.25rem;
    margin-left: -1rem;
}

.mobile-nav-menu > a {
    padding: 0 1rem;
    border-left: 1px solid var(--color-accent-red);
    color: var(--color-accent-red);
    text-decoration: none;
}

.mobile-nav-menu > a:first-child {
    border-left: none;
}

.mobile-nav-menu > a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Mobile navigation - completely override everything */
@media (max-width: 640px) {
    .mobile-nav-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background-color: color-mix(in srgb, var(--color-global-bg) 98%, transparent) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        z-index: 150 !important;
        display: none !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2rem !important;
        padding: 2rem !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
        transform: none !important;
        inset: 0 !important;
    }

    .mobile-nav-menu > a {
        font-size: 1.5rem !important;
        padding: 1rem 2rem !important;
        border-radius: 0.5rem !important;
        text-align: center !important;
        min-width: 200px !important;
        background-color: color-mix(in srgb, var(--color-accent-red) 10%, transparent) !important;
        border: 1px solid var(--color-accent-red) !important;
        color: var(--color-accent-red) !important;
        text-decoration: none !important;
        display: block !important;
        margin: 0 !important;
    }

    .mobile-nav-menu > a:hover {
        background-color: var(--color-accent-red) !important;
        color: var(--color-global-bg) !important;
        box-shadow: 0 4px 12px color-mix(in srgb, var(--color-accent-red) 30%, transparent) !important;
        text-decoration: none !important;
    }
}

/* Show mobile menu when menu-open class is present */
.group.menu-open .mobile-nav-menu {
    display: flex !important;
    z-index: 150 !important;
}

/* Mobile menu button improvements */
#toggle-navigation-menu {
    z-index: 200; /* Highest z-index to stay above menu */
    position: relative;
    background-color: color-mix(in srgb, var(--color-accent-2) 10%, transparent);
    border-radius: 0.375rem;
    border: 1px solid color-mix(in srgb, var(--color-accent-2) 20%, transparent);
}

#toggle-navigation-menu:hover {
    background-color: color-mix(in srgb, var(--color-accent-2) 20%, transparent);
}

/* Hamburger icon sizing and toggling */
#toggle-navigation-menu svg {
    width: 24px;
    height: 24px;
}

#toggle-navigation-menu[aria-expanded="false"] svg:first-of-type { display: block; opacity: 1; }
#toggle-navigation-menu[aria-expanded="false"] svg:last-of-type  { display: none;  opacity: 0; }

#toggle-navigation-menu[aria-expanded="true"]  svg:first-of-type { display: none;  opacity: 0; }
#toggle-navigation-menu[aria-expanded="true"]  svg:last-of-type  { display: block; opacity: 1; }

/* Theme toggle styles */
#theme-toggle {
    background-color: color-mix(in srgb, var(--color-accent-2) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-accent-2) 30%, transparent);
    z-index: 50;
    position: relative;
}

#theme-toggle:hover {
    background-color: color-mix(in srgb, var(--color-accent-2) 30%, transparent);
}

/* Theme icon visibility */
[data-theme="dark"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

[data-theme="light"] .sun-icon {
    display: none;
}

[data-theme="light"] .moon-icon {
    display: block;
}

:root .sun-icon {
    display: none;
}

:root .moon-icon {
    display: block;
}

/* Prose styles (typography) */
.prose {
    color: var(--color-global-text);
    max-width: none; /* Allow prose to use full container width */
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: var(--color-accent-2);
    font-weight: 600;
    line-height: 1.25;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.prose h1 { font-size: 2.25rem; }
.prose h2 { font-size: 1.875rem; }
.prose h3 { font-size: 1.5rem; }
.prose h4 { font-size: 1.25rem; }

.prose p {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

.prose ul, .prose ol {
    margin-bottom: 1.1rem;
    padding-left: 1.625rem;
}

.prose li {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.prose a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    text-decoration-thickness: 2px;
}

/* Responsive media inside markdown-rendered content (about/publications/blog) */
.prose img,
.prose video {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0.5rem;
    margin: 1.5rem auto;
}

/* Wrap an <iframe> (e.g. a YouTube embed) in <div class="embed-16x9"> to keep
   it responsive - see docs/blog/posts/welcome-to-the-blog.md for an example. */
.embed-16x9 {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: var(--color-border);
}

.embed-16x9 iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Code blocks (fenced ``` code in markdown) */
.prose pre {
    background-color: color-mix(in srgb, var(--color-accent-2) 8%, transparent);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.prose pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    font-family: var(--font-mono);
}

/* KaTeX math: keep long display equations scrollable instead of overflowing
   the page on narrow viewports. */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25rem 0;
}

/* About section layout */
.about-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: nowrap;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

.about-avatar {
    width: 200px;
    height: 200px;
    border-radius: 9999px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--color-shadow) 50%, transparent);
    background-color: var(--color-border);
}

.about-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Reduce default heading top margin inside about header to better center with avatar */
.about-header .title {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
    .about-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .about-avatar {
        width: 140px;
        height: 140px;
        margin-top: 1.5rem; /* Add padding above the avatar on mobile */
    }
    .about-header-content {
        align-items: center;
    }
}

.prose strong {
    color: var(--color-accent-2);
    font-weight: 600;
}

.prose code {
    background-color: color-mix(in srgb, var(--color-accent-2) 10%, transparent);
    border: 1px dotted #666;
    border-radius: 2px;
    padding: 0.125rem 0.25rem;
    font-size: 0.875rem;
    font-family: var(--font-mono);
}

.prose blockquote {
    border-left: 4px solid var(--color-accent);
    padding-left: 1rem;
    margin-left: 0;
    font-style: italic;
    color: var(--color-quote);
}

/* Let Music's photos continue behind the navigation. */
.music-page #main-header {
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 0;
}

/* Music photos fill four fixed viewport quarters with proportional cropping. */
.music-page .music-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    opacity: 0.32;
    pointer-events: none;
    container-type: size;
}

[data-theme="dark"] .music-page .music-background {
    opacity: 0.22;
}

.music-page .music-background img {
    /* Enabled responsive sources select and preload images, but never paint. */
    display: none;
}

.music-page .music-photo {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    /* The optional full layer stays empty while high-resolution loading is disabled. */
    background-image: var(--music-full, none), var(--music-preview);
    background-size: max(50cqw, calc(50cqh * var(--music-ratio))) max(50cqh, calc(50cqw / var(--music-ratio)));
    background-position: center;
    background-repeat: no-repeat;
}

.music-page .music-background .music-photo-bottom {
    background-position: center bottom;
}

.music-page main {
    position: relative;
    z-index: 1;
}

/* Subtle stroke weight for legibility over the Music photos. */
.music-page #music-content {
    -webkit-text-stroke: 0.12px currentColor;
}

/* Project index: each preview opens its own project page. */
.project-index {
    border-top: 1px solid var(--color-border);
}

.prose .project-entry {
    position: relative;
    display: block;
    padding: 1.5rem 2rem 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-global-text);
    text-decoration: none;
}

.project-entry h5 {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.4;
}

.project-entry p {
    margin: 0.625rem 0 0;
    font-size: 1rem;
    opacity: 0.85;
}

.project-entry:hover h5,
.project-entry:focus-visible h5 {
    color: var(--color-link);
}

.project-entry-arrow {
    position: absolute;
    top: 1.5rem;
    right: 0;
    color: var(--color-link);
}

.project-detail .prose > h1:first-child {
    margin-top: 0;
}

/* Project grid */
.project-grid {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
}

@media (min-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

.project-card {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
}

.project-card:hover {
    box-shadow: 0 4px 12px var(--color-shadow);
}

.project-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--color-accent-2);
}

.project-card p {
    margin-bottom: 1.5rem;
    color: var(--color-global-text);
}

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

.project-links a {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-accent);
    border-radius: 0.25rem;
    text-decoration: none;
}

.project-links a:hover {
    background-color: var(--color-accent);
    color: var(--color-global-bg);
}

/* Contact links */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

.contact-links a {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    text-decoration: none;
}

.contact-links a:hover {
    background-color: var(--color-accent);
    color: var(--color-global-bg);
}


/* Focus styles for accessibility: only show on keyboard navigation */
a:focus,
button:focus {
    outline: none;
}
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Scroll margin for anchor links */
:target {
    scroll-margin-top: 8rem; /* Increased to account for fixed header */
}

@media (max-width: 640px) {
    :target {
        scroll-margin-top: 5rem; /* Reduced for mobile */
    }
}

/* Responsive typography */
@media (max-width: 640px) {
    .title {
        font-size: 1.25rem;
    }

    .prose h1 { font-size: 1.875rem; }
    .prose h2 { font-size: 1.5rem; }
    .prose h3 { font-size: 1.25rem; }

    .contact-links {
        flex-direction: column;
    }

    .project-links {
        flex-direction: column;
    }

    /* Mobile header adjustments */
    #main-header {
        /* Keep fixed position on mobile - removed position: relative override */
        z-index: 100; /* Ensure proper z-index on mobile */
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
        height: 100vh;
    }

    /* Logo and title spacing on mobile */
    #main-header .text-xl {
        font-size: 1.125rem;
    }

}

/* Touch-friendly improvements */
@media (max-width: 640px) {
    /* Collapse grid to a simple row on mobile; keep existing overlay menu */
    .header-grid {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        flex-wrap: nowrap;
    }

    .header-title { display: flex; align-items: center; flex: 1; min-width: 0; }
    .header-nav { display: none; }

    /* Adjust controls spacing on mobile */
    .header-controls {
        gap: 0.5rem;
        white-space: nowrap;
    }

    /* Enlarge hamburger icon visuals on mobile */
    #toggle-navigation-menu svg {
        width: 24px;
        height: 24px;
    }

    /* Larger touch targets */
    #theme-toggle,
    #toggle-navigation-menu {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }

    /* Improved header spacing on mobile */
    #main-header {
        /* Keep fixed positioning - only adjust padding */
        padding-bottom: 1rem;
        /* Remove margin-bottom since fixed headers don't need margin */
    }

    /* Reduce first section top padding to avoid excessive gap under fixed header */
    #about {
        padding-top: 1rem !important;
    }

}

/* Prevent text selection on interactive elements */
#toggle-navigation-menu,
#theme-toggle {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}


/* Active navigation link styling */
@media (max-width: 640px) {
    .mobile-nav-menu a.active {
        background-color: var(--color-accent-red) !important;
        color: var(--color-global-bg) !important;
        border-color: var(--color-accent-red) !important;
        box-shadow: 0 4px 12px color-mix(in srgb, var(--color-accent-red) 30%, transparent) !important;
    }
}

@media (min-width: 640px) {
    .mobile-nav-menu a.active {
        background-color: transparent !important;
        color: var(--color-accent-red) !important;
        text-decoration: underline !important;
        text-underline-offset: 4px !important;
        /* Keep vertical dividers visible even when active */
        border-left: 1px solid var(--color-accent-red) !important;
    }
    .mobile-nav-menu a.active:first-child {
        border-left: none !important;
    }
}


/* Loading spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--color-link);
    font-style: italic;
}

.loading-spinner::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid var(--color-link);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error message styling */
.error-message {
    padding: 1rem;
    background-color: color-mix(in srgb, #ef4444 10%, transparent);
    border: 1px solid #ef4444;
    border-radius: 0.5rem;
    color: #ef4444;
    text-align: center;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

.katex-display::-webkit-scrollbar,
.report-inline-math::-webkit-scrollbar,
.report math[display="block"]::-webkit-scrollbar,
.report table.equation::-webkit-scrollbar,
.report table.equation-star::-webkit-scrollbar {
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-global-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-accent-red);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-2);
}

/* Publication card styles */
.publication-card {
    display: flex;
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(8px);
    gap: 1.5rem;
}

.publication-card:hover {
    box-shadow: 0 8px 25px var(--color-shadow);
}

.publication-image {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: var(--color-border);
}

.publication-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.publication-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.publication-title {
    margin: 0 !important;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Override prose heading margins for publication titles */
.prose .publication-title {
    margin-top: 0 !important;
    margin-bottom: 0.5rem;
}

.publication-link {
    color: var(--color-accent-2);
    text-decoration: none;
}

.publication-link:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.publication-venue {
    font-size: 0.875rem;
    color: var(--color-accent);
    font-weight: 500;
    background-color: color-mix(in srgb, var(--color-accent) 10%, transparent);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
    width: fit-content;
}

.publication-authors {
    font-size: 0.875rem;
    color: var(--color-global-text);
    opacity: 0.8;
}

.publication-year {
    font-size: 0.875rem;
    color: var(--color-global-text);
    opacity: 0.6;
    font-style: italic;
}

.publication-description {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-global-text);
    opacity: 0.9;
}

.publication-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid;
}

.tag-safety {
    background-color: color-mix(in srgb, #ef4444 15%, transparent);
    border-color: #ef4444;
    color: #ef4444;
}

.tag-interpretability {
    background-color: color-mix(in srgb, #af67ff 15%, transparent);
    border-color: #af67ff;
    color: #af67ff;
}

.tag-arxiv {
    background-color: color-mix(in srgb, #10b981 15%, transparent);
    border-color: #10b981;
    color: #10b981;
}

.tag-workshop {
    background-color: color-mix(in srgb, #f59e0b 15%, transparent);
    border-color: #f59e0b;
    color: #f59e0b;
}

.tag-conference {
    background-color: color-mix(in srgb, #3b82f6 15%, transparent);
    border-color: #3b82f6;
    color: #3b82f6;
}

.tag-bibtex {
    background-color: color-mix(in srgb, #6b7280 15%, transparent);
    border-color: #6b7280;
    color: #6b7280;
}

.tag-default {
    background-color: color-mix(in srgb, var(--color-accent) 15%, transparent);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.tag:hover {
    box-shadow: 0 2px 4px var(--color-shadow);
}

.publication-citations {
    font-size: 0.75rem;
    color: var(--color-global-text);
    opacity: 0.6;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Responsive publication cards */
@media (max-width: 768px) {
    .publication-card {
        flex-direction: column;
        gap: 1rem;
    }

    .publication-image {
        width: 100%;
        height: 120px;
    }

    .publication-tags {
        justify-content: center;
    }
}

/* ============================= */
/* Blog components                */
/* ============================= */
.blog-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (min-width: 640px) {
    .blog-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

.blog-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    backdrop-filter: blur(8px);
}

.blog-card:hover {
    box-shadow: 0 8px 25px var(--color-shadow);
}

.blog-card-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-accent-2);
}

.blog-card-date {
    font-size: 0.8125rem;
    color: var(--color-accent);
    opacity: 0.9;
}

.blog-card-excerpt {
    font-size: 0.875rem;
    line-height: 1.5;
    opacity: 0.85;
    margin: 0;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.blog-post-header {
    margin-bottom: 2rem;
}

.blog-post-date {
    font-size: 0.875rem;
    color: var(--color-accent);
    opacity: 0.9;
}

.blog-back-link,
.project-back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    .blog-grid {
        gap: 1rem;
    }
}
