* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

/* Category color system - works with light/dark modes */
:root {
    --playable-primary: #F5B02A;
    --playable-text-light: #F5B02A;
    --playable-text-dark: #FFCA6B;
    --playable-bg-light: #FDF8EA;
    --playable-border-light: #F2E7C9;
    --playable-bg-dark: #4A3117;
    --playable-border-dark: #A37B17;
    
    --research-primary: #C04849;
    --research-text-light: #C04849;
    --research-text-dark: #E07677;
    --research-bg-light: #FDF4F4;
    --research-border-light: #F2D6D6;
    --research-bg-dark: #3A1A1A;
    --research-border-dark: #843233;
    
    --design-primary: #0647A1;
    --design-text-light: #4077CE;
    --design-text-dark: #4A7BC8;
    --design-bg-light: #F0F4FB;
    --design-border-light: #C7D8F0;
    --design-bg-dark: #0A1A33;
    --design-border-dark: #1E3A6B;
    
    /* Muted variants for filter tags */
    --playable-muted-light: #FEFDF9;
    --playable-muted-border-light: #F9F2E2;
    --playable-muted-dark: #241C13;
    --playable-muted-border-dark: #57451E;
    
    --research-muted-light: #FEFBFB;
    --research-muted-border-light: #F9F1F1;
    --research-muted-dark: #201010;
    --research-muted-border-dark: #572525;
    
    --design-muted-light: #FAFCFE;
    --design-muted-border-light: #EBF2F9;
    --design-muted-dark: #08111A;
    --design-muted-border-dark: #162033;
    
    /* Current color variables */
    --playable-text: var(--playable-text-light);
    --playable-bg: var(--playable-bg-light);
    --playable-border: var(--playable-border-light);
    --research-text: var(--research-text-light);
    --research-bg: var(--research-bg-light);
    --research-border: var(--research-border-light);
    --design-text: var(--design-text-light);
    --design-bg: var(--design-bg-light);
    --design-border: var(--design-border-light);
    
    --playable-muted: var(--playable-muted-light);
    --playable-muted-border: var(--playable-muted-border-light);
    --research-muted: var(--research-muted-light);
    --research-muted-border: var(--research-muted-border-light);
    --design-muted: var(--design-muted-light);
    --design-muted-border: var(--design-muted-border-light);
}

/* Dark mode color adjustments */
@media (prefers-color-scheme: dark) {
    :root {
        --playable-text: var(--playable-text-dark);
        --playable-bg: var(--playable-bg-dark);
        --playable-border: var(--playable-border-dark);
        --research-text: var(--research-text-dark);
        --research-bg: var(--research-bg-dark);
        --research-border: var(--research-border-dark);
        --design-text: var(--design-text-dark);
        --design-bg: var(--design-bg-dark);
        --design-border: var(--design-border-dark);
        
        --playable-muted: var(--playable-muted-dark);
        --playable-muted-border: var(--playable-muted-border-dark);
        --research-muted: var(--research-muted-dark);
        --research-muted-border: var(--research-muted-border-dark);
        --design-muted: var(--design-muted-dark);
        --design-muted-border: var(--design-muted-border-dark);
    }
}
/* General link styling - black in light mode, white in dark mode */
a {
    color: #333;
    text-decoration: underline;
}

a:hover {
    opacity: 0.8;
}

/* Exception: item cards should not have opacity change on hover */
a.item-card:hover {
    opacity: 1;
}

/* Section-specific link colors */
.section-playable a {
    color: var(--playable-text);
}

.section-research a {
    color: var(--research-text);
}

.section-design a {
    color: var(--design-text);
}

/* Exception: item-title links should remain neutral regardless of section */
/* .item-title a {
    color: #333 !important;
} */

/* Special link styles for specific contexts */
a.detail-title-link, .bio-table a{
    font-weight: 500;
    color: #333; /* Black in light mode */
}

/* Section-specific colors for special links */
.section-playable a.detail-title-link,
.section-playable .bio-table a {
    color: var(--playable-text);
}

.section-research a.detail-title-link,
.section-research .bio-table a {
    color: var(--research-text);
}

.section-design a.detail-title-link,
.section-design .bio-table a {
    color: var(--design-text);
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    color: #333; 
    line-height: 1.6; 
}
.centered{
    margin-left: auto;
    margin-right: auto;
}
.nav-header {
    background: white;
    padding: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

/* Only apply sticky behavior when JS is enabled */
.js-enabled .nav-header {
    position: sticky;
    top: 0;
    z-index: 100;
    will-change: transform; /* Optimize for animations */
}

.breadcrumb { 
    display: flex; 
    gap: 1rem; 
    align-items: center; 
    flex-wrap: wrap; 
}
.breadcrumb-item { 
    cursor: pointer; 
    padding: 0.5rem 1rem; 
    background: #f0f0f0; 
    border-radius: 20px; 
    text-decoration: none; 
    color: #333;
}
.breadcrumb-item:hover { 
    background: #333; 
    color: white; 
}
.breadcrumb-item.active { 
    background: #333; 
    color: white; 
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Category breadcrumb coloring */
.breadcrumb-item.category-playable.active {
    background: var(--playable-primary);
    border-color: var(--playable-primary);
    color: white !important;
}

.breadcrumb-item.category-research.active {
    background: var(--research-primary);
    border-color: var(--research-primary);
    color: white !important;
}

.breadcrumb-item.category-design.active {
    background: var(--design-primary);
    border-color: var(--design-primary);
    color: white !important;
}
.breadcrumb-separator { 
    color: #999; 
}
.tag-cloud { 
    margin-top: 1rem; 
    display: flex; 
    gap: 0.5rem; 
    flex-wrap: wrap; 
}
.tag { 
    padding: 0.25rem 0.75rem; 
    background: #e8e8e8; 
    border-radius: 8px; 
    font-size: 0.875rem; 
    cursor: pointer; 
    text-decoration: none; 
    color: #333;
    border-style: solid;
    border-width: thin;
    border-color: rgba(255, 255, 255, 0.18);
}
.tag:hover { 
    background: #666; 
    color: white; 
}

/* Category color coding for main navigation */
.tag.category-playable {
    border: 1px solid var(--playable-border);
    background: var(--playable-bg);
    color: var(--playable-text);
}

.tag.category-playable:hover {
    background: var(--playable-primary);
    color: white;
}

.tag.category-research {
    border: 1px solid var(--research-border);
    background: var(--research-bg);
    color: var(--research-text);
}

.tag.category-research:hover {
    background: var(--research-primary);
    color: white;
}

.tag.category-design {
    border: 1px solid var(--design-border);
    background: var(--design-bg);
    color: var(--design-text);
}

.tag.category-design:hover {
    background: var(--design-primary);
    color: white;
}

/* Subcategory coloring - inherit from parent categories */
.tag.category-games,
.tag.category-ar-spatial, 
.tag.category-tools {
    border: 1px solid var(--playable-border);
    background: var(--playable-bg);
    color: var(--playable-text);
}

.tag.category-games:hover,
.tag.category-ar-spatial:hover,
.tag.category-tools:hover {
    background: var(--playable-primary);
    color: white;
}

.tag.category-engagement,
.tag.category-publications,
.tag.category-presentations {
    border: 1px solid var(--research-border);
    background: var(--research-bg);
    color: var(--research-text);
}

.tag.category-engagement:hover,
.tag.category-publications:hover,
.tag.category-presentations:hover {
    background: var(--research-primary);
    color: white;
}

.tag.category-architecture,
.tag.category-exhibitions,
.tag.category-media,
.tag.category-objects {
    border: 1px solid var(--design-border);
    background: var(--design-bg);
    color: var(--design-text);
}

.tag.category-architecture:hover,
.tag.category-exhibitions:hover,
.tag.category-media:hover,
.tag.category-objects:hover {
    background: var(--design-primary);
    color: white;
}

/* Filter tags with subtle coloring */
.tag.filter-tag {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #6c757d;
}

.tag.filter-tag:hover {
    background: #e9ecef;
    color: #495057;
}

.tag.filter-tag.active {
    background: #495057;
    color: white;
    border-color: #495057;
}

/* Section-specific muted filter tag colors */
.tag.filter-tag.section-playable {
    background: var(--playable-muted);
    border-color: var(--playable-muted-border);
    color: var(--playable-text);
}

.tag.filter-tag.section-playable:hover {
    background: var(--playable-bg);
    border-color: var(--playable-border);
}

.tag.filter-tag.section-playable.active {
    background: var(--playable-primary);
    border-color: var(--playable-primary);
    color: white;
}

.tag.filter-tag.section-research {
    background: var(--research-muted);
    border-color: var(--research-muted-border);
    color: var(--research-text);
}

.tag.filter-tag.section-research:hover {
    background: var(--research-bg);
    border-color: var(--research-border);
}

.tag.filter-tag.section-research.active {
    background: var(--research-primary);
    border-color: var(--research-primary);
    color: white;
}

.tag.filter-tag.section-design {
    background: var(--design-muted);
    border-color: var(--design-muted-border);
    color: var(--design-text);
}

.tag.filter-tag.section-design:hover {
    background: var(--design-bg);
    border-color: var(--design-border);
}

.tag.filter-tag.section-design.active {
    background: var(--design-primary);
    border-color: var(--design-primary);
    color: white;
}
.grid-container { 
    padding: 2rem; 
    max-width: 1400px; 
    margin: 0 auto; 
}
.item-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 1.5rem; 
}
.item-card { 
    border-radius: 8px; 
    overflow: hidden; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    color: inherit; /* Prevent link from turning text blue */
    text-decoration: none; /* Remove link underline */
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.item-card:hover .item-title {
    text-decoration: underline;
}

/* --- Static media cell (reserves space even if media is missing) --- */
:root {
    --cell-max-h: 300px; /* global height cap for cells */
    --letterbox: #00000000;   /* side bars for tall media */
}

.item-thumbnail { 
    position: relative;
}

/* The wrapper itself reserves space:
   - its width comes from the grid column
   - its height is width / --ar, clamped by max-block-size
*/
.media-aspect-wrapper {
    inline-size: 100%;
    /* aspect-ratio must NOT depend on missing vars—set --ar inline on each wrapper */
    aspect-ratio: var(--ar);
    max-block-size: var(--cell-max-h);
    border-radius: 8px;
    overflow: hidden;
    background: var(--letterbox);
    position: relative;
}

/* Media inside wrapper:
   - top aligned, centered horizontally
   - width shrinks if hitting the height cap
   - no cropping (contain → letterboxing for tall)
*/
.media-aspect-wrapper > img,
.media-aspect-wrapper > picture,
.media-aspect-wrapper > video {
    display: block;
    inline-size: min(100%, calc(var(--cell-max-h) * var(--ar)));
    block-size: auto;
    max-block-size: var(--cell-max-h);
    margin-inline: auto;
    object-fit: contain;
    object-position: top center;
    border-radius: 8px;
    /* max-width: 100%;
    max-height: 100%; */
}
/* The <picture> is the sized box and holds the placeholder; its image fills it */
.media-aspect-wrapper > picture > img {
    display: block;
    inline-size: 100%;
    block-size: auto;
    max-block-size: var(--cell-max-h);
    object-fit: contain;
    object-position: top center;
    border-radius: 8px;
}

.media-aspect-wrapper > iframe {
    /* iframes need to fill their wrapper completely */
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    border-radius: 8px;
}

/* For iframes, the wrapper needs special handling */
.media-aspect-wrapper:has(iframe) {
    /* Still use aspect ratio, but ensure proper sizing */
    width: 100%;
    max-width: min(888px, calc(100vw - 4rem));
    height: 500px;
    aspect-ratio: var(--ar);
    margin-inline: auto;
}

/* Optional: skeleton so empties look intentional if assets 404 */
.media-aspect-wrapper::after {
    content: "";
    position: absolute; 
    inset: 0;
    background: linear-gradient(90deg, transparent, #ffffff10, transparent);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
/* Hide skeleton when any media src is present (no JS) */
.media-aspect-wrapper:has(img[src], video[src], iframe[src])::after { 
    display: none; 
}
@keyframes shimmer { 
    to { background-position: -200% 0; } 
}

/* Detail view media - different max height */
.detail-view .media-aspect-wrapper {
    --cell-max-h: 500px; /* Override for detail view */
}

.item-content { 
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
}
.item-title { 
    font-size: 1.25rem; 
    font-weight: 600; 
    margin-bottom: 0.5rem; 
}
.item-meta { 
    color: #666; 
    font-size: 0.875rem; 
    margin-bottom: 0.75rem; 
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: flex-start;
}
.year{
    border-width: thin;
	border-style: solid;
	justify-content: center;
    padding-left: 5px;
    padding-right: 6px;
}
.item-description {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #444;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item-tags { 
    display: flex; 
    gap: 0.25rem; 
    flex-wrap: wrap; 
    margin-top: auto; 
}
.item-tag { 
    font-size: 0.75rem; 
    padding: 0.125rem 0.5rem; 
    background: #f0f0f0; 
    border-radius: 8px; 
}
.bio { 
    text-align: center; 
    max-width: 700px; 
    margin: 2rem auto; 
}
.bio h1 { 
    font-size: 2rem; 
    font-weight: 600; 
    margin-bottom: 0.5rem; 
}
.bio p {
    font-size: 1.1rem;
    color: #555;
}
.bio-situation {
    font-size: 0.95rem;
    color: #777;
    margin-bottom: 1rem;
}

/* Responsive bio break - shows line break on wide screens, space on narrow */
.bio-break::before {
    content: "\A"; /* Line break */
    white-space: pre;
}

@media (max-width: 768px) {
    .bio-break::before {
        content: " "; /* Just a space on mobile */
        white-space: normal;
    }
}
p {
    max-width: 60ch;
    margin-bottom: 1.2em;
}

/* Justification only for paragraphs inside description divs */
.description p, .justified {
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphenate-limit-chars: 6 3 3;
}
.detail-view { 
    background: none; 
    border-radius: 8px; 
    margin-bottom: 2rem; 
    overflow: hidden;
}

/* Horizontal scroll with snap for multiple items */
.detail-media.multi {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 1rem 0;
    margin: 0 0; /* Extend to viewport edges */
    padding-left: 2rem;
    padding-right: 2rem;
}

.detail-media.multi .media-item {
    flex: 0 0 auto; /* Responsive width */
    align-content:center;
    scroll-snap-align: start;
    max-width: 100%;
}

/* Each box in the scroller is as wide as its media will be drawn (the scroller's width or the 500 px height cap
   times the aspect ratio, whichever is smaller), before anything loads. Without it, a box takes its width from its
   image, and a lazy image that hasn't loaded collapses the box to zero until it arrives. */
.detail-media.multi { container-type: inline-size; }
.detail-media.multi .media-aspect-wrapper:not(:has(iframe)) {
    inline-size: min(100cqi, calc(var(--cell-max-h) * var(--ar)));
}

/* Single item display */
.detail-media.single .media-item {
    max-width: min(100%, 1000px);
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Media item base styles */
.media-item {
    position: relative;
    border-radius: 8px;
}

/* Detail view adjustments for iframes */
.detail-view .media-aspect-wrapper:has(iframe) {
    max-height: 500px; /* Respect detail view height */
}

/* Remove special iframe handling - use same aspect ratio system */
/* .detail-view .media-aspect-wrapper:has(iframe) {
    height:auto;
    width: min(888px,calc(100vw - 6rem));
} */

/* Images fade in over their placeholder once loaded and decoded (REVEAL in tools/media.js adds .js and .in).
   Only opacity, on the compositor: no layout, no repaint. Without script they show as they arrive. */
.js picture > img { opacity: 0; transition: opacity .25s ease-out; }
.js picture > img.in { opacity: 1; }
/* Until an image arrives the browser draws its alt text over the placeholder (with or without script); hide
   it there (screen readers still read alt). Not once shown: REVEAL marks a failed image .in, so its alt shows. */
picture[style*="background"] > img:not(.in) { color: transparent; }

/* Smooth load animation */
.media-aspect-wrapper video,
.media-aspect-wrapper iframe {
    opacity: 1;
    transition: opacity .25s ease-out;
}

/* Initial render snapshot (Chromium 117+, Safari 17+, FF 128+) */
@starting-style {
  .media-aspect-wrapper video,
  .media-aspect-wrapper iframe { 
    opacity: 0; 
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .js picture > img,
  .media-aspect-wrapper img,
  .media-aspect-wrapper video,
  .media-aspect-wrapper iframe { 
    transition: none; 
  }
}

/* Scroll indicators */
.detail-media.multi {
    /* Subtle shadows to indicate scrollability */
    background: 
        linear-gradient(to right, white 0%, transparent 2rem) left center,
        linear-gradient(to left, white 0%, transparent 2rem) right center;
    background-size: 3rem 100%;
    background-repeat: no-repeat;
    background-attachment: local, local;
}

/* Hide scrollbar but keep functionality */
.detail-media.multi {
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #999 transparent;
}

.detail-media.multi::-webkit-scrollbar {
    height: 6px;
}

.detail-media.multi::-webkit-scrollbar-track {
    background: transparent;
}

.detail-media.multi::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 3px;
}

/* Media count indicator */
.media-indicator {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    
    
    /* Stronger snap on mobile */
    .detail-media.multi {
        scroll-snap-stop: always;
    }
}

.detail-content h1 { 
    font-size: 2.25rem; 
    font-weight: 600; 
    margin-bottom: 0.5rem; 
}
.detail-content .meta { 
    color: #666; 
    font-size: 1rem; 
    margin-bottom: 1.5rem; 
    display: flex;
    flex-direction: row;
}
.detail-content .description { 
    line-height: 1.7; 
}
.section-title { 
    font-size: 1.5rem; 
    font-weight: 500; 
    margin-bottom: 1rem; 
    border-top: 1px solid #e0e0e0; 
    padding-top: 2rem; 
}
.section-playable .item-title {
    color: #E8AD43;
}
.section-research .item-title {
    color: #C6595A;
}
.section-design .item-title {
    color: #58739d;
}
.detail-media .media-item { 
    margin-bottom: 1rem; 
}
.detail-media .media-placeholder { 
    padding: 2rem; 
    text-align: center; 
}
.detail-title-link { 
    color: inherit; 
}

.filter-separator {
    margin: 0 10px;
    color: #555;
    align-self: center;
}
.tag.filter-tag {
    background-color: #e0e4f8ff;
    border-color: #555;
}
.tag.filter-tag:hover {
    background-color: #667eea;
    color: #111;
}
.tag.filter-tag.active {
    background-color: #667eea;
    color: #fff;
    border-color: #667eea;
}
/* MODIFIED: Style for the filtered breadcrumb item */
.breadcrumb-item.filtered-crumb {
    background-color: #5a67d8; /* Darker purple */
    color: #fff;
}

/* --- Bio Section & Links Table --- */
.bio-table {
    width: 100%; /* Make it fill its container */
    max-width: 60ch; /* But not exceed 60ch */
    margin: 2rem auto;
    border-collapse: collapse;
}

.bio-table td {
    padding: 0.5rem 0rem;
}
.bio-details {
    max-width: 60ch;
    margin: 1rem auto;
    text-align: center;
}
.bio-details summary {
    cursor: pointer;
    color: #777;
    font-size: 0.9rem;
}
.bio-details p {
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

/* Section intro text for category pages */
.section-intro {
    grid-column: span 1;
    max-width: 60ch;
    padding: 1.25rem 1.25rem 1.25rem 1.25rem;
    border-left: 3px solid #ccc;
    align-self: start;
}
.section-intro-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    margin: 0 0 0.5rem;
}
.section-intro p {
    font-size: 0.925rem;
    color: #777;
    margin: 0 0 0.75rem;
    line-height: 1.8;
}
.section-intro p:last-child {
    margin-bottom: 0;
}
.section-intro strong {
    color: #333;
    font-weight: 600;
}

/* Color the border to match the section */
.section-playable .section-intro {
    border-left-color: var(--playable-primary);
}
.section-playable .section-intro strong {
    color: var(--playable-text);
}
.section-research .section-intro {
    border-left-color: var(--research-primary);
}
.section-research .section-intro strong {
    color: var(--research-text);
}
.section-design .section-intro {
    border-left-color: var(--design-primary);
}
.section-design .section-intro strong {
    color: var(--design-text);
}

/* Define view transitions */
@supports (view-transition-name: none) {
  /* Transition the entire page by default */
  ::view-transition-old(root) {
    animation: fade-out 0.3s ease-out;
  }
  
  ::view-transition-new(root) {
    animation: fade-in 0.3s ease-out;
  }
  
  /* Specific transitions for nav elements */
  .nav-header {
    view-transition-name: nav-header;
  }
  
  /* Keep breadcrumb stable during transition */
  .breadcrumb {
    view-transition-name: breadcrumb;
  }
  
  /* Animate tag cloud separately */
  .tag-cloud {
    view-transition-name: tag-cloud;
  }
  
  /* Smooth grid transitions */
  .item-grid {
    view-transition-name: content-grid;
  }
  
  /* Custom animations */
  @keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
  }
  
  @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  /* Slide effect for content */
  ::view-transition-old(content-grid) {
    animation: slide-out 0.3s ease-out;
  }
  
  ::view-transition-new(content-grid) {
    animation: slide-in 0.3s ease-out;
  }
  
  @keyframes slide-out {
    from { opacity: 1; }
    to {  opacity: 0; }
  }
  
  @keyframes slide-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .nav-header {
        background: #1a1a1a;
        border-bottom: 1px solid #404040;
    }
    
    .breadcrumb-item {
        background: #404040;
        color: #e0e0e0;
    }
    
    .breadcrumb-item:hover {
        background: #e0e0e0;
        color: #1a1a1a;
    }
    
    .breadcrumb-item.active {
        background: #e0e0e0;
        color: #1a1a1a;
    }
    
    .breadcrumb-item.filtered-crumb {
        background-color: #6366f1;
        color: #fff;
    }
    
    .breadcrumb-separator {
        color: #808080;
    }
    
    .tag {
        background: #404040;
        color: #e0e0e0;
    }
    
    .tag:hover {
        background: #e0e0e0;
        color: #1a1a1a;
    }
    
    .tag.filter-tag {
        background-color: #475569;
        color: #e0e0e0;
    }
    
    .tag.filter-tag:hover {
        background-color: #6366f1;
        color: #fff;
    }
    
    .tag.filter-tag.active {
        background-color: #6366f1;
        color: #fff;
        border-color: #6366f1;
    }
    
    .item-tag {
        background: #404040;
        color: #e0e0e0;
    }
    
    .item-meta {
        color: #b0b0b0;
    }
    
    .item-description {
        color: #d0d0d0;
    }
    
    .bio p {
        color: #c0c0c0;
    }
    .bio-situation {
        color: #999;
    }
    .bio-details summary {
        color: #999;
    }

    .section-intro {
        border-left-color: #555;
    }
    .section-intro-title {
        color: #666;
    }
    .section-intro p {
        color: #999;
    }
    .section-intro strong {
        color: #e0e0e0;
    }

    .detail-view {
        background: none;
    }
    
    .detail-content .meta {
        color: #b0b0b0;
    }
    
    .section-title {
        border-top: 1px solid #404040;
    }
    
    .filter-separator {
        color: #b0b0b0;
    }
    
    .media-indicator {
        color: #b0b0b0;
    }
    
    /* General links in dark mode */
    a {
        color: #e0e0e0;
    }
    
    /* Item-title links remain neutral in dark mode */
    /* .item-title {
        color: #e0e0e0 !important;
    } */
    
    a.detail-title-link, .bio-table a {
        color: #e0e0e0; /* White in dark mode */
    }
    
    a.detail-title-link:hover, .bio-table a:hover {
        color: #818cf8;
    }
    
    /* Dark mode scrollbar */
    .detail-media.multi {
        scrollbar-color: #666 transparent;
    }
    
    .detail-media.multi::-webkit-scrollbar-thumb {
        background: #666;
    }
    
    /* Dark mode scroll indicators */
    .detail-media.multi {
        background: 
            linear-gradient(to right, #2d2d2d 0%, transparent 2rem) left center,
            linear-gradient(to left, #2d2d2d 0%, transparent 2rem) right center;
        background-size: 3rem 100%;
        background-repeat: no-repeat;
        background-attachment: local, local;
    }
    
    /* Iframe background for dark mode */
    .media-aspect-wrapper > iframe {
        background: #2d2d2d;
    }
}

/* --- Mobile & Portrait Optimization --- */
@media (max-width: 768px) {
    /* Reduce header padding to save vertical space */
    .nav-header {
        padding: 1rem;
    }

    /* Half the side gutter (2rem): at 375 px the content column was 311 px wide, now 343. The header's 1rem
       above already matches; the detail scroller's padding scrolls under it, so it halves too. */
    .grid-container {
        padding-inline: 1rem;
    }
    .detail-media.multi {
        padding-inline: 1rem;
    }

    /* Tighten up the spacing for breadcrumbs and tags */
    .breadcrumb, .tag-cloud {
        gap: 0.5rem;
    }

    .tag-cloud {
        margin-top: 0.75rem; /* Adjust space between breadcrumbs and tags */
    }

    /* Make breadcrumb and tag buttons slightly smaller */
    .breadcrumb-item {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    /* Make grid items and fonts smaller */
    .item-grid {
        /* Allow cards to be a bit smaller on mobile */
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }

    .item-title {
        font-size: 1.1rem;
    }

    /* Adjust typography for detail pages */
    .detail-content h1 {
        font-size: 1.75rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .bio-table {
        font-size: 0.9rem;
    }
    
    .bio-table td {
        padding: 0.5rem 0rem;
    }
}
/* With a mouse or trackpad, a carousel scrollbar you can see and grab: 12 px (it was 6 px). Chrome 121+ ignores
   ::-webkit-scrollbar while scrollbar-width or scrollbar-color is set, and drew its own thin bar instead, so both
   go back to auto here (last in the file, after the dark-mode colour); the ::-webkit- rules above give the colours.
   Touch screens keep their overlay bar. */
@media (hover: hover) and (pointer: fine) {
    .detail-media.multi { scrollbar-width: auto; scrollbar-color: auto; }
    .detail-media.multi::-webkit-scrollbar { height: 12px; }
    .detail-media.multi::-webkit-scrollbar-thumb { border-radius: 6px; }
}
