body.dark-theme {
    --bg-secondary: #2c2c2c;
    --text-muted: #aaa;
    --border-muted: #555;
    --bg-hover: #444;
    --text-primary: #eee;
    --accent: #002657;
    --bg-active: #555;

    --bg-body: #121212;
    --text-body: #e0e0e0;
    --bg-pre: #1e1e1e;
    --border-pre: #333;
    --border-pre-left: #5c6574;
    --text-code: #c5c8c6;
    --bg-table: #1e1e1e;
    --bg-th: #2c2c2c;
    --text-th: #a8d1ff;
    --bg-tr-alt: #1a1a1a;

    --search-bg: #292323;
    --search-text: #e0e0e0;
    --search-border: #444;
    --search-placeholder: #888;

    --sidebar-bg: #2c2c2c;
    --sidebar-hover: #333;
    --sidebar-active: #4a90e2;
    --sidebar-text: #fff;

    --hamburgerMenu-bg: #292323;
    --hamburgerMenu-color: #fff;
}

body.light-theme {
    --bg-secondary: #f0f0f0;
    --text-muted: #444;
    --border-muted: #ccc;
    --bg-hover: #e0e0e0;
    --text-primary: #222;
    --accent: #0077cc;
    --bg-active: #ddd;

    --bg-body: #ffffff;
    --text-body: #222222;
    --bg-pre: #f4f4f4;
    --border-pre: #ccc;
    --border-pre-left: #bbb;
    --text-code: #222;
    --bg-table: #f9f9f9;
    --bg-th: #e0e0e0;
    --text-th: #005fcc;
    --bg-tr-alt: #f0f0f0;

    --search-bg: #ece8e8;
    --search-text: #222;
    --search-border: #c3d0e0;
    --search-placeholder: #666;

    --sidebar-bg: #f9f9f9;
    --sidebar-hover: #ddd;
    --sidebar-active: #4a90e2;
    --sidebar-text: #222;

    --hamburgerMenu-bg: #ece8e8;
    --hamburgerMenu-color: #222;
}

body {
    font-family: "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 70px 2rem 2rem;
    background: var(--bg-body);
    color: var(--text-body);
    transition: background 0.3s ease, color 0.3s ease;
}

body.no-scroll {
    overflow: hidden;
}

#scrollProgress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0;
    background: linear-gradient(90deg, #2196f3, #4dabf7, #1e88e5);
    background-size: 200% 100%;
    border-radius: 0 2px 2px 0;
    z-index: 2000;
    transition: width 0.15s linear;
    
    /* subtle outer glow */
    box-shadow:
            0 0 6px rgba(33,150,243,.6),
            0 0 12px rgba(77,171,247,.45),
            0 0 18px rgba(30,136,229,.35);
}

/* bloom/halo without affecting layout */
#scrollProgress::after {
    content: "";
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    filter: blur(8px);
    opacity: .55;
    pointer-events: none;
}

/* Slightly stronger glow in dark theme, softer in light */
body.dark-theme #scrollProgress::after { opacity: .65; }
body.light-theme #scrollProgress::after { opacity: .45; }

@keyframes pulseGradient {
    0%   { background-position: 0 50%; opacity: 0.6; }
    50%  { background-position: 100% 50%; opacity: 1; }
    100% { background-position: 0 50%; opacity: 0.6; }
}

/* Remove default scrollbar */
html {
    overflow: scroll;
    overflow-x: hidden;
}
::-webkit-scrollbar {
    width: 0;  /* Remove scrollbar space */
    background: transparent;  /* Optional: just make scrollbar invisible */
}


/* HEADER / NAVBAR */
#appHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1200;
}

/* Center title absolutely, independent of left/right width */
#siteLogo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 70px;
}

/* Right-side group */
#headerRight {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* Section badge styling */
#sectionBadge {
    margin-right: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 4px 12px;
    border-radius: 14px;
    white-space: nowrap;
    user-select: none;
    transition: background 0.3s ease;
}

#sectionBadge.unity   { background: #4caf50; } /* green */
#sectionBadge.csharp  { background: #2196f3; } /* blue */
#sectionBadge.sites   { background: #9c27b0; } /* purple */
#sectionBadge.other   { background: #757575; } /* gray */

/* Group hamburger + search */
#headerLeft {
    display: flex;
    align-items: center;
    gap: 1rem; /* space between menu and search */
}

/* SEARCH FIELD */
#searchInput {
    width: 100px;
    min-width: 100px;
    max-width: 250px;
    height: 44px;
    padding: 0 2.5rem 0 1rem;
    font-size: 1rem;
    border-radius: 4px;
    border: none;
    outline: none;
    background: var(--search-bg);
    color: var(--search-text);
    box-sizing: content-box;
    transition: width 0.25s cubic-bezier(0.08, 0, 0.2, 1),
    background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#searchInput::placeholder {
    color: var(--search-placeholder);
}

/* Glow on focus */
#searchInput:focus {
    box-shadow: 0 0 0 3px var(--accent), 0 0 10px var(--accent);
}

#searchInputWrapper {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    position: relative;
    width: auto;
    min-width: 0;
}

#searchAllToggle {
    appearance: none;
    -webkit-appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--search-border);
    border-radius: 6px;
    background: var(--search-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    vertical-align: middle;
    position: relative;
    flex-shrink: 0;
}

/* Checkmark animation */
#searchAllToggle:checked::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 0px;
    width: 6px;
    height: 11px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(45deg);
}

/* Hover + focus feedback */
#searchAllToggle:hover {
    border-color: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}
#searchAllToggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Label text next to it */
.search-toggle span {
    color: var(--search-text);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.3s ease;
}

.search-toggle:hover span {
    color: var(--accent);
}

/* "Clear" button inside search field */
#clearSearch {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}

#themeToggle {
    margin-right: 4rem;
    position: fixed;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-theme #themeToggle:hover svg {
    transform: rotate(-15deg);
}

#themeIcon {
    transition: transform 0.4s ease;
}

#themePath {
    transition: d 0.4s ease, fill 0.3s ease, filter 0.4s ease;
}

#themeIcon {
    overflow: visible;
}

/* Subtle moon glow in dark mode */
body.dark-theme #themePath {
    filter: drop-shadow(0 0 4px #bbb);
}

body.light-theme #themePath {
    filter: none;
}

/* HAMBURGER BUTTON */
#sidebarToggle {
    position: relative;
    background: var(--hamburgerMenu-bg);
    color: var(--hamburgerMenu-color);
    border: none;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    z-index: 2000;
}

#sidebarToggle:hover {
    opacity: 0.8;
}

/* Sidebar drawer */
#sidebar {
    position: fixed;
    top: 0;
    left: -240px; /* hidden off-screen */
    height: 100%;
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: left 0.3s ease;
    z-index: 1500;
    padding-top: 0;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

/* Sidebar visible */
#sidebar.open {
    left: 0;
}

#sidebarClose {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--hamburgerMenu-color);
    cursor: pointer;
    z-index: 2001;
}

#sidebarTop {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--hamburgerMenu-bg);
    z-index: 5;
}

#sidebarLinks {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0;
}

.unity-logo {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.microsoft-logo {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Sidebar items */
#sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#sidebar li {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    transition: background 0.2s ease;
}

#sidebar li.has-search-hit {
    position: relative;
}

#sidebar li.has-search-hit::after {
    content: attr(data-hit-count);
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.25rem 0.45rem;
    border-radius: 999px;
    min-width: 1.5rem;
    text-align: center;
}

#sidebar li:hover {
    background: var(--sidebar-hover);
}

#sidebar li.active {
    background: var(--sidebar-active);
}

/* BACK TO TOP BUTTON */
#backToTop {
    position: fixed;
    bottom: 40px;
    right: 30px;
    background-color: #333;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

#backToTop.show {
    opacity: 1;
    pointer-events: auto;
}

#backToTop:hover {
    opacity: 1;
    background-color: #555;
}

/* Footer */
footer {
    display: block;
    text-align: center;
    margin-top: 3rem;
    font-size: 0.9rem;
    color: #888;
}

/* Headings */
h1, h2, h3 {
    color: var(--text-primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background: var(--bg-table);
    border-radius: 4px;
    overflow: hidden;
    transition: background 0.3s ease;
}

th {
    background: var(--bg-th);
    color: var(--text-th);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-muted);
    vertical-align: top;
    text-align: left;
}

tr:nth-child(even) td {
    background: var(--bg-tr-alt);
}

tr:last-child td {
    border-bottom: none;
}

/* Code Blocks */
pre {
    background: var(--bg-pre);
    border: 1px solid var(--border-pre);
    border-left: 4px solid var(--border-pre-left);
    padding: 1rem;
    margin: 1.5rem 0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre;
    overflow-x: auto;
    border-radius: 2px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Inline code */
code {
    background: transparent;
    padding: 0;
    color: var(--text-code);
    font-size: 0.9em;
    transition: color 0.3s ease;
}

td code {
    display: inline;
    white-space: normal;
}

/* Links */
a {
    color: #58a6ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* Keep Attribute column left aligned */
table tbody tr td:first-child {
    text-align: left;
}

/* Center Description and Requirements columns */
th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #333;
    vertical-align: top;
    text-align: left;
}

.copy-attr {
    background: none;
    color: var(--text-primary, #eee);
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    font-family: inherit;
    position: relative;
}

.copy-attr[data-type="field"] {
    color: #7cbbe6;
}

/* Blue */
.copy-attr[data-type="class"] {
    color: #4caf50;
}

/* Green */
.copy-attr[data-type="method"] {
    color: #ff9800;
}

/* Orange */
.copy-attr[data-type="dots"] {
    color: #e91e63;
}

/* Pink */
.copy-attr[data-type="interop"] {
    color: #9c27b0;
}

/* Purple */
.copy-attr[data-type="editor"] {
    color: #f9a825;
}

.copy-attr:hover {
    text-decoration: none;
    color: var(--accent, #4a90e2);
}

.copy-attr:active {
    color: var(--accent, #4a90e2);
}

.copy-attr::after {
    content: none !important;
}

.attr-tooltip {
    position: absolute;
    bottom: 100%;          /* sit above the attribute */
    left: 50%;             /* centered on the attribute */
    transform: translateX(-50%);
    padding: 2px 6px;
    font-size: 0.75em;
    color: #ccc;
    background: #222;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    margin-bottom: 4px;    /* spacing above */
    z-index: 1500;
}

.section-header {
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
}

.section-header .section-title,
.section-header .toggle-icon {
    cursor: pointer;
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 1.5rem;
    user-select: none;
    position: relative;
    bottom: 3px;
}

/* Smooth slide animation */
.section-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0;
}

/* Expanded state */
.section-content.expanded {
    max-height: 1200px;
}

.collapsible-section {
    margin: 14px 0;
    border-radius: 14px;
    background: color-mix(in oklab, var(--bg-secondary) 92%, black 8%);
    border: 1px solid color-mix(in oklab, var(--border-muted) 80%, white 20%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.light-theme .collapsible-section {
    background: color-mix(in oklab, var(--bg-secondary) 92%, white 8%);
    border-color: color-mix(in oklab, var(--border-muted) 70%, white 30%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.collapsible-section:hover,
.collapsible-section:focus-within {
    border-color: color-mix(in oklab, var(--border-muted) 60%, var(--accent) 40%);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.light-theme .collapsible-section:hover,
.light-theme .collapsible-section:focus-within {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.collapsible-section .section-header {
    padding: 12px 14px;
    background: transparent;
    font-weight: 600;
    letter-spacing: 0;
    border-bottom: 1px solid color-mix(in oklab, var(--border-muted) 70%, transparent 30%);
}

.collapsible-section .section-header:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.collapsible-section .toggle-icon {
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 8px;
    opacity: 0.85;
}

.collapsible-section .section-content {
    padding: 0 14px;
    background: color-mix(in oklab, var(--bg-secondary) 95%, black 5%);
}

.light-theme .collapsible-section .section-content {
    background: color-mix(in oklab, var(--bg-secondary) 96%, white 4%);
}

.collapsible-section .section-content.expanded {
    padding: 10px 14px 14px;
    border-top: 1px solid color-mix(in oklab, var(--border-muted) 65%, transparent 35%);
}

.collapsible-section .section-header .doc-icon-link,
.collapsible-section .section-header .doc-link {
    margin-left: auto;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(0);
}

.collapsible-section .section-header .doc-icon-link:hover,
.collapsible-section .section-header .doc-link:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* Standalone Useful Sites section */
.sites-section {
    margin: 14px 0;
    padding: 22px 24px 28px;
    border-radius: 16px;
    background: color-mix(in oklab, var(--bg-secondary) 92%, black 8%);
    border: 1px solid color-mix(in oklab, var(--border-muted) 80%, white 20%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.light-theme .sites-section {
    background: color-mix(in oklab, var(--bg-secondary) 92%, white 8%);
    border-color: color-mix(in oklab, var(--border-muted) 70%, white 30%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.sites-section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.sites-section-title {
    margin: 0;
    font-weight: 650;
    font-size: clamp(1.35rem, 1vw + 1.15rem, 1.65rem);
    letter-spacing: -0.01em;
}

.sites-section-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sites-section-body > .section-sites-desc {
    margin: 0 0 16px;
}

.sites-section-body > .section-sites-intro {
    margin-top: 0;
}

/* The question mark icon link (separate) */
.doc-icon-link {
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.3rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #1a3d7c;
    text-decoration: none;
    pointer-events: none;
}

/* Style the svg inside the link */
.doc-icon-link svg {
    width: 20px;
    height: 20px;
    fill: #4a80d8;
    display: block;
}

.doc-icon-link:hover svg {
    fill: #234aba;
}


/* Hover effect */
.doc-links a:hover img {
    transform: scale(1.05);
    opacity: 0.85;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* dim effect */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 1200; /* just under the sidebar */
}

#overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Useful Sites cards */
.site-grid .site-link,
.site-grid .site-link:hover,
.site-grid .site-link:focus,
.site-grid .site-link:active {
    text-decoration: none;
}

.site-grid {
    list-style: none;
    padding: 0;
    margin: 20px auto;
    max-width: 1200px;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.section-sites {
    margin-top: 24px;
}

.section-sites-title {
    margin: 0;
    font-size: clamp(1.05rem, 1.2vw + 1rem, 1.25rem);
    font-weight: 600;
}


.section-sites-desc {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: clamp(.95rem, 1vw + .85rem, 1.05rem);
}

.section-sites-intro {
    margin-top: 12px;
}


.section-sites .site-grid {
    margin: 16px 0 0;
}

.site-card {
    background: color-mix(in oklab, var(--bg-secondary) 92%, black 8%);
    border: 1px solid color-mix(in oklab, var(--border-muted) 80%, white 20%);
    border-radius: 14px;
    overflow: hidden;
    transition: transform .12s ease, box-shadow .12s ease, border-color .2s ease;
    box-shadow:
            0 1px 2px rgba(0,0,0,.25),
            0 12px 24px -16px rgba(0,0,0,.45);
}

.site-card:hover,
.site-card:focus-within {
    transform: translateY(-3px);
    box-shadow:
            0 4px 8px rgba(0,0,0,.25),
            0 24px 40px -20px rgba(0,0,0,.6);
    border-color: color-mix(in oklab, var(--border-muted) 60%, var(--accent) 40%);
}

.site-link {
    display: block;
    color: inherit;
}

.thumb {
    position: relative;
    background: #0c0e13;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity .35s ease, transform .35s ease;
}

.thumb-img.loaded {
    opacity: 1;
    transform: scale(1);
}

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
            180deg,
            rgba(0,0,0,0) 0%,
            rgba(0,0,0,.15) 60%,
            rgba(0,0,0,.25) 100%
    );
    pointer-events: none;
}

.thumb[data-letter]::after {
    content: attr(data-letter);
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 56px;
    font-weight: 800;
    letter-spacing: .02em;
    color: rgba(255,255,255,.10);
}

.thumb-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(40px, 18%, 72px);
    height: clamp(40px, 18%, 72px);
    transform: translate(-50%, -50%);
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08) inset;
    image-rendering: auto;
    opacity: 0;
    transition: opacity .2s ease, transform .15s ease;
}
.thumb-icon.loaded { opacity: 1; }
.site-card:hover .thumb-icon { transform: translate(-50%, -50%) scale(1.06); }

/* favicon badge */
.fav-badge {
    position: absolute;
    left: 12px;
    bottom: 12px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.12);
}

.fav-badge img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    image-rendering: auto;
}

.info {
    padding: 12px;
}

.title {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
    line-height: 1.2;
}

.desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}
    
    /* Code block aesthetics */
    #otherSection pre {
        margin: 10px 0 0;
        padding: 12px 14px;
        background: rgba(0,0,0,0.4);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 12px;
        overflow: auto;
    }
    #otherSection pre code {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
        font-size: 0.92rem;
        line-height: 1.4;
        white-space: pre;
    }

    /* Hide the native disclosure marker across engines */
    summary::-webkit-details-marker { display: none; }
    summary::marker { display: none; }

    /* Container */
    details.example {
        margin-top: .5rem;
        border: 1px solid var(--border-muted);
        border-radius: 10px;
        background: color-mix(in oklab, var(--bg-secondary) 90%, black 10%);
    }

    details.example img {
        display: block;
        max-width: 340px;
        width: 100%;
        height: auto;
        border-radius: 6px;
        box-shadow: 0 2px 10px rgba(0,0,0,.25);
        cursor: zoom-in;
    }

    /* Compact, icon-like summary (matches your ? icon vibe) */
    .example-summary {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 6px;
        margin: 6px 6px 0;
        border-radius: 8px;
        cursor: pointer;
        color: var(--text-muted);
        transition: color .2s ease, background .2s ease;
    }
    .example-summary:hover {
        color: var(--accent);
        background: color-mix(in oklab, var(--bg-secondary) 82%, white 18%);
    }
    .example-summary:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    /* Triangle arrow built with borders */
    .ex-arrow {
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-left: 8px solid currentColor;
        opacity: .9;
        transition: transform .18s ease;
        transform-origin: 25% 50%;
    }

    /* Rotate arrow when open (points down) */
    details.example[open] .ex-arrow {
        transform: rotate(90deg);
    }

    /* Plus to minus when open */
    .ex-plusminus::before {
        content: "+";
        display: inline-block;
        font-weight: 700;
        font-size: 12px;
        line-height: 1;
        transform: translateY(-.5px);
        transition: transform .18s ease, opacity .18s ease;
        opacity: .9;
    }
    details.example[open] .ex-plusminus::before {
        content: "−"; /* U+2212 */
    }

    /* Body area */
    details.example figure {
        max-width: 360px;
        margin: 0 auto;
        padding: .6rem 1.2rem .8rem;
    }

/* Make sure captions don’t stick to the image edges */
details.example figcaption {
    margin-top: 0.6rem;
    text-align: center;
    padding: 0 0.4rem;
}

    /* Respect reduced motion */
    @media (prefers-reduced-motion: reduce) {
        .ex-arrow,
        .ex-plusminus::before { transition: none; }
    }

    summary::-webkit-details-marker { display: none; }

    summary::marker { display: none; }

/* Lock page when lightbox is open */
html.no-scroll,
body.no-scroll {
    overflow: hidden !important;
    height: 100%;
}

html.no-scroll {
    position: fixed;
    width: 100%;
}
    
/* Lightbox overlay */
#lightbox {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 3000;
    opacity: 0;
    transition: opacity .18s ease;
    pointer-events: none;
}
#lightbox.show {
    opacity: 1;
    pointer-events: auto;
}

#lightbox .lb-wrap {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 12px;
    overflow: auto;
    box-shadow: 0 12px 48px rgba(0,0,0,.6);
    transform: scale(.98);
    transition: transform .18s ease;
    position: relative;
    margin: auto;
}

/* Show caption when lightbox is revealed */
#lightbox.reveal #lb-cap {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Use more of the screen when showing multiple images */
#lightbox.gallery .lb-wrap {
    width: min(98vw, 1400px);
    padding-inline: clamp(8px, 1.5vw, 16px); /* slimmer side padding */
}

/* Let the gallery span the full wrap width */
#lightbox.gallery .lb-gallery {
    display: flex;
    gap: clamp(8px, 1.2vw, 16px);
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    width: 100%;           /* fill the wrap */
    max-width: none;       /* remove the old 92vw cap */
    margin: 0 auto 12px;
}

/* Two-up on wide screens, stack on narrow */
#lightbox.gallery .lb-gallery img {
    flex: 1 1 0;
    max-width: 48%;        /* two columns */
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    background: #111;
    box-shadow: 0 4px 18px rgba(0,0,0,.45);
}

@media (max-width: 960px) {
    #lightbox.gallery .lb-gallery img {
        max-width: 100%;     /* stack */
    }
}

/* Keep caption comfy but not wasteful */
#lightbox.gallery #lb-cap {
    padding: 0 clamp(8px, 1.5vw, 16px) !important;
    text-align: center;
}

#lightbox.gallery .lb-gallery img { width: 48%; height: auto; }

#lb-cap {
    display: block;
    position: static;
    margin-top: 12px; 
    margin-bottom: 12px;
    max-width: 92vw;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-body);
    text-align: center; 
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 1rem !important;
    opacity: 1 !important;
    transform: none !important;
}

#lb-cap .cap-alt {
    font-weight: 600;
    margin-bottom: 4px;
}

#lb-cap code {
    font-family: Consolas, ui-monospace, Menlo, monospace;
    background: var(--bg-pre);
    padding: 0 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

#lb-cap .cap-note {
    font-size: 0.9em;
    opacity: 0.85;
}

#lb-cap .cap-alt,
#lb-cap .cap-note {
    display: block;
    text-align: center;
}

/* The image */
#lb-img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    background: #111;
}

.lb-gallery {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    max-width: 92vw;
    max-height: 80vh;
    margin: 0 auto 12px;
}

.lb-gallery img {
    max-width: 45%;
    max-height: 80vh;
    border-radius: 8px;
    background: #111;
    box-shadow: 0 4px 18px rgba(0,0,0,.45);
    object-fit: contain;
}

#lb-cap { padding: 0 1rem !important; text-align: center; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    #lightbox, #lightbox .lb-wrap { transition: none; }
}

/* Floating magnifier */
#hoverMag {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-150%, -50%);
    width: 18px;
    height: 18px;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease, transform .12s ease;
    z-index: 2500;
}

#hoverMag svg {
    width: 18px; height: 18px; display: block;
}

#hoverMag.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-22px, -50%) scale(1);
}
#hoverMag:hover {
    color: var(--accent);
}