/* Layout - Sidebar + Content */
:root {
    /* Color scheme aliases: older UI colours referenced vars no color scheme defines
       (--accent-color, --bg-primary, --text-primary, …), so they fell back to
       hardcoded Nord values and clashed with every other color scheme — e.g. the
       near-unreadable light-purple citations. Map them onto the real color scheme vars
       so all colour flows through the active color scheme (only these orphans; vars
       like --bg-secondary are already color-scheme-defined). */
    --accent-color: var(--link-color, var(--blue));
    --accent-color-bright: var(--link-color, var(--blue));
    --bg-primary: var(--bg-color);
    --text-primary: var(--text-color);
    --text-secondary: var(--text-dim);
    --hover-bg: var(--bg-highlight);

    /* Widget base */
    --widget-bg: var(--bg-secondary);
    --widget-radius: 6px;

    /* Task states */
    --task-open: #3b82f6;
    /* blue */
    --task-done: #22c55e;
    /* green */
    --task-blocked: #ef4444;
    /* red */
    --task-waiting: #f59e0b;
    /* amber */
    --task-progress: #8b5cf6;
    /* purple */
    --task-cancelled: #6b7280;
    /* gray */
}

/* Base widget styles */
.glint-widget {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    border-radius: var(--widget-radius);
    border-left: 3px solid #ccc;
    /* Fallback for missing accent */
    background: var(--widget-bg);
    position: relative;
}

/* Remove override on glint-task since styles moved to header */

/* Tasks */
/* Tasks */
/* Tasks */
.glint-task {
    list-style-type: var(--list-bullet, disc);
    margin: 0.2rem 0 !important;
    padding-left: 0 !important;
    /* No extra padding - align with normal bullets */
    position: relative;
    display: list-item;
}

/* Match nesting bullets */
ul ul .glint-task {
    --list-bullet: circle;
}

ul ul ul .glint-task {
    --list-bullet: square;
}

/* The styled "Box" is now strictly the header */
.glint-task-header {
    display: inline-flex;
    align-items: center;
    /* Center emoji with text */
    gap: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-left: 3px solid var(--task-open);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    margin: 0;
    line-height: 1.4;
    /* Match standard paragraph line-height */
}

/* Remove absolute bullet since we switched back to display: list-item */
.glint-task::before {
    display: none;
}

.theme-light .glint-task-header {
    background: rgba(0, 0, 0, 0.02);
}

/* Interactive task checkbox + state picker (SPA) */
.glint-task-check {
    cursor: pointer;
    user-select: none;
}

.glint-task-picker {
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    min-width: 10rem;
    padding: 0.25rem;
    border: 1px solid var(--border-color, rgba(128, 128, 128, 0.35));
    border-radius: 6px;
    background: var(--bg-elev, #1f2430);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    font-size: 0.9rem;
}

.theme-light .glint-task-picker {
    background: var(--bg-elev, #fff);
}

.glint-task-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.glint-task-picker-item:hover {
    background: rgba(128, 128, 128, 0.18);
}

.glint-task-picker-item.is-current {
    font-weight: 600;
}

/* Spacing fixes for task lists */
ul.contains-task-list,
ul:has(> .glint-task) {
    margin-bottom: 0.2rem !important;
    margin-top: 0.2rem !important;
}

/* When a task list follows a non-task list, pull it up to eliminate the gap */
ul:not(:has(> .glint-task))+ul:has(> .glint-task) {
    margin-top: -1rem !important;
}

/* Strip margins from anything inside a task to maintain uniform line spacing */
.glint-task-header,
.glint-task ul,
.glint-task ol,
.glint-task p {
    margin: 0 !important;
}

/* Force standard marker back for glint-task if GFM disabled it */
ul.contains-task-list .glint-task {
    display: list-item !important;
    list-style-type: var(--list-bullet, disc) !important;
}

.glint-task.picker-open {
    z-index: 1000;
}

/* Task States applied to Header */
.glint-task[data-state="done"]>.glint-task-header {
    border-left-color: var(--task-done);
    opacity: 0.7;
}

.glint-task[data-state="done"] .glint-task-content {
    text-decoration: line-through;
    color: var(--text-dim);
}

.glint-task[data-state="progress"]>.glint-task-header {
    border-left-color: var(--task-progress);
}

.glint-task[data-state="waiting"]>.glint-task-header {
    border-left-color: var(--task-waiting);
}

.glint-task[data-state="blocked"]>.glint-task-header {
    border-left-color: var(--task-blocked);
}

.glint-task[data-state="cancelled"]>.glint-task-header {
    border-left-color: var(--task-cancelled);
    opacity: 0.6;
}

.glint-task[data-state="cancelled"] .glint-task-content {
    text-decoration: line-through;
    color: var(--text-dim);
}

.glint-task-check {
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(1px);
    /* Micro-offset for visual centering */
    transition: transform 0.1s ease;
    position: relative;
    width: 1.2rem;
    height: 1.2rem;
}

.glint-task-check:hover {
    transform: scale(1.2);
}

.glint-task-right {
    flex: 1;
}

.glint-task-content-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    /* Center text with badges */
    gap: 0.5rem;
}

.glint-task-content {
    font-weight: 500;
}

.glint-task-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.glint-task-meta span {
    display: inline-block;
    background: var(--bg-highlight);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.glint-task-meta .meta-priority {
    font-weight: 600;
    color: var(--orange);
}

.glint-task-meta .meta-priority[data-priority="urgent"],
.glint-task-meta .meta-priority[data-priority="critical"] {
    background: var(--red);
    color: white;
    border-color: var(--red);
    font-weight: 700;
}

.glint-task-meta .meta-priority[data-priority="high"] {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
}

.glint-task-meta .meta-priority[data-priority="important"],
.glint-task-meta .meta-priority[data-priority="medium"] {
    background: rgba(245, 158, 11, 0.15);
    color: var(--orange);
    border-color: rgba(245, 158, 11, 0.3);
}

.glint-task-meta .meta-priority[data-priority="low"] {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.3);
}

/* SPA task-state dropdown (#69). Positioned with fixed viewport coords set inline
   from getBoundingClientRect; without position:fixed it fell into body flow at the
   bottom of the page and ignored the color scheme. */
.glint-task-picker {
    position: fixed;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    min-width: 9rem;
    padding: 0.3rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    font-family: 'Inter', sans-serif;
    animation: popIn 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.glint-task-picker-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.6rem;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.glint-task-picker-item:hover {
    background: var(--bg-color);
}
.glint-task-picker-item.is-current {
    color: var(--theme-accent, var(--link-color));
    font-weight: 600;
}

/* State Picker Popover */
.glint-state-picker {
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem;
    display: flex;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 1100;
    animation: popIn 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    backdrop-filter: blur(12px);
}

@media (max-width: 768px) {
    .glint-state-picker {
        position: fixed;
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: auto;
        max-width: 90vw;
        flex-wrap: wrap;
        justify-content: center;
        z-index: 3000;
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    }
}

/* Code Blocks (Collapsible & Copyable) */
.code-block-wrapper {
    position: relative;
    margin: 1.5rem 0;
    transition: all 0.3s ease;
}

.code-block-wrapper.collapsible.collapsed pre {
    max-height: 200px;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.code-copy-button,
.code-collapse-toggle {
    position: absolute;
    bottom: 0.5rem;
    right: 1.5rem;
    background: var(--bg-secondary);
    color: var(--text-dim);
    border: 1px solid var(--border-color);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s, transform 0.1s, color 0.1s;
    user-select: none;
    font-family: 'Inter', sans-serif;
}

.code-copy-button {
    top: 0.5rem;
    bottom: auto;
}

.code-block-wrapper:hover .code-copy-button,
.code-block-wrapper:hover .code-collapse-toggle {
    opacity: 0.8;
}

.code-copy-button:hover,
.code-collapse-toggle:hover {
    opacity: 1 !important;
    transform: translateY(-1px);
    background: var(--bg-highlight);
    color: var(--green);
}

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

.code-block-wrapper.collapsible:not(.collapsed) .code-collapse-toggle {
    bottom: auto;
    top: 0.5rem;
    right: 5rem;
    /* Offset from copy button */
}

/* CSS-driven label so it stays correct whether the block is open or collapsed. */
.code-collapse-toggle::after { content: 'Collapse'; }
.code-block-wrapper.collapsed .code-collapse-toggle::after { content: 'Expand'; }

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.8) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }
}

.glint-state-option {
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.glint-state-option:hover {
    background: var(--bg-highlight);
}





/* Base Resets & Typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100vh;
    /* Force viewport height */
    overflow: hidden;
    /* Prevent window scroll */
}

body {
    display: flex;
    max-width: none;
    padding: 0;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    /* Reduced from 1.7 to avoid subpixel rendering issues */
    background-color: var(--bg-color);
    color: var(--text-color);
    /* Font rendering fixes */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease-out;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.lightbox-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-caption {
    color: white;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    opacity: 0.9;
}

.image-figure img {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.image-figure img:hover {
    transform: scale(1.01);
}

/* Managed image that failed to resolve (#70): dim it, keep alt text, offer a retry. */
img.glint-image-broken {
    outline: 1px dashed var(--border-color, rgba(128, 128, 128, 0.5));
    opacity: 0.5;
    min-width: 2rem;
    min-height: 2rem;
}
.glint-image-error {
    display: inline-block;
    margin: 0.25rem 0;
    font-size: 0.85em;
    color: var(--muted, #a33);
}
.glint-image-error button {
    margin-left: 0.4rem;
    font: inherit;
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--accent-color);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* Sidebar */
.sidebar {
    width: 250px;
    min-width: 250px;
    height: 100%;
    background-color: var(--bg-dim);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 0;
    font-family: 'Inter', sans-serif;
    z-index: 2000;
    position: relative;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}

.sidebar-collapse-toggle {
    position: absolute;
    top: 12px;
    right: -14px;
    width: 14px;
    height: 28px;
    background: var(--bg-dim);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: var(--text-dim);
    font-size: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
    padding: 0;
    transition: color 0.15s ease;
}

.sidebar-collapse-toggle:hover {
    color: var(--text-color);
}

.sidebar-collapse-toggle::after {
    content: '◀';
    font-size: 0.5rem;
}

.sidebar.collapsed .sidebar-collapse-toggle {
    right: -14px;
}

.sidebar.collapsed .sidebar-collapse-toggle::after {
    content: '▶';
}

.sidebar.collapsed .sidebar-scrollable,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-branding {
    display: none;
}

.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-color: var(--bg-dim);
}

.color-scheme-select {
    width: 100%;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.vim-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.vim-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

/* Sidebar Branding */
.sidebar-branding {
    padding: 0.5rem 0.5rem 1.5rem 0.5rem;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.sidebar-logo:hover {
    transform: scale(1.05);
}

.sidebar-section {
    margin-bottom: 1rem;
}

.sidebar-header {
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    list-style: none;
    /* Remove default summary marker */
    font-weight: 700;
}

.sidebar-header::-webkit-details-marker {
    display: none;
}

.sidebar-header::after {
    content: '▾';
    float: right;
    transition: transform 0.2s;
}

details:not([open]) .sidebar-header::after {
    transform: rotate(-90deg);
}

/* Indent Guides */
.file-tree ul,
.outline-tree ul {
    border-left: 1px solid var(--border-color);
    margin-left: 0.75rem;
    padding-left: 0.75rem;
}

/* Remove border for top-level */
.file-tree>ul,
.outline-tree>ul {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
}

.content {
    flex: 1;
    height: 100%;
    /* Fill flex container */
    overflow-y: auto;
    /* Independent scroll */
    padding: 0;
    scroll-behavior: smooth;
}

/* Container for text to keep max-width but allow full background */
.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    padding-bottom: 4rem;
    min-height: calc(100vh - 4rem);
    /* Ensure last section can scroll to top */
}

/* SPA shell */
.spa-sidebar-controls,
.spa-page-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}

.spa-sidebar-controls {
    border-bottom: 1px solid var(--border-color);
}

.spa-sidebar-controls input {
    width: 100%;
    padding: 0.55rem 0.65rem;
    color: var(--text-color);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.spa-sidebar-controls button {
    padding: 0.45rem 0.65rem;
    color: var(--text-color);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    text-align: left;
}

.spa-sidebar-controls button:hover,
.spa-sidebar-controls button:focus-visible {
    background: var(--bg-highlight);
    outline: none;
}

.spa-sidebar-controls [data-search-results] {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.spa-page-list {
    overflow-y: auto;
}

.spa-page-list a,
.spa-sidebar-controls [data-search-results] a {
    overflow-wrap: anywhere;
}

.spa-page-list ul {
    margin: 0;
    padding-left: 1rem;
    list-style: none;
}

.spa-page-list > ul {
    padding-left: 0;
}

.spa-page-list li {
    margin: 0.15rem 0;
}

.spa-page-list summary {
    cursor: pointer;
    overflow-wrap: anywhere;
}

.spa-page-list a[aria-current="page"] {
    font-weight: 700;
}

.glint-landing .sidebar,
.glint-landing .mobile-toggle,
.glint-landing .mobile-overlay {
    display: none !important;
}

.glint-landing .content-wrapper {
    max-width: 64rem;
    min-height: 100%;
    display: grid;
    align-items: center;
}

.glint-landing-shell {
    max-width: 56rem;
    padding: 2rem 0;
}

.glint-eyebrow {
    margin-bottom: 0.5rem;
    color: var(--aqua);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.glint-landing-shell h1 {
    max-width: 12ch;
    margin: 0;
    font-size: clamp(3rem, 10vw, 6.5rem);
    letter-spacing: -0.06em;
    line-height: 0.85;
}

.glint-intro {
    max-width: 35rem;
    margin: 1.75rem 0 2.5rem;
    color: var(--text-dim);
    font-size: clamp(1.05rem, 2.5vw, 1.35rem);
}

.glint-source-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.glint-source-card {
    display: flex;
    min-height: 13rem;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.1rem;
    color: var(--text-color);
    background: var(--bg-dim);
    border: 1px solid var(--border-color);
    border-radius: 0.35rem;
    text-decoration: none;
}

.glint-source-card:not(.disabled):hover,
.glint-source-card:not(.disabled):focus-within {
    border-color: var(--aqua);
    background: var(--bg-highlight);
}

.glint-source-card strong {
    color: var(--aqua);
    font-size: 1.05rem;
}

.glint-source-card span,
.glint-source-card label {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.glint-source-card label {
    margin-top: auto;
}

.glint-source-card input,
.glint-source-card button {
    width: 100%;
    padding: 0.45rem 0.55rem;
    color: var(--text-color);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.2rem;
    font: inherit;
}

.glint-source-card button {
    border-color: var(--aqua);
    color: var(--aqua);
    cursor: pointer;
}

.glint-source-card button:hover,
.glint-source-card button:focus-visible {
    color: var(--bg-color);
    background: var(--aqua);
    outline: none;
}

.glint-source-card.disabled {
    opacity: 0.55;
}

.glint-route-help {
    margin-top: 1.25rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .content { padding: 0; }

    .content-wrapper {
        min-height: 100%;
        padding: 4.5rem 1.25rem 3rem;
    }

    .mobile-toggle {
        background: var(--bg-dim);
        color: var(--text-color);
    }

    .glint-landing .content-wrapper {
        padding-top: 2rem;
    }

    .glint-source-grid {
        grid-template-columns: 1fr;
    }

    .glint-source-card {
        min-height: auto;
    }
}

/* Scroll offset for anchor links to account for sticky headers */
.content-wrapper .glint-section h2[id],
.content-wrapper .glint-section h3[id],
.content-wrapper .glint-section h4[id],
.content-wrapper .glint-section h5[id],
.content-wrapper .glint-section h6[id] {
    scroll-margin-top: 5rem;
    position: sticky;
    top: -1px;
    z-index: 100;
    background-color: var(--bg-color, #ffffff);
    padding: 0.5rem 0;
    margin-top: 0;
    border-top: 1px solid var(--bg-color, #ffffff);
    /* Seal the gap */
    box-shadow: 0 -1px 0 var(--bg-color, #ffffff);
    /* Extra seal */
}

.glint-section {
    position: relative;
    margin-bottom: 2rem;
}

/* Typography Elements */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--green);
    margin-top: 2em;
    margin-bottom: 0.75em;
    line-height: 1.2;
    font-weight: 700;
    position: relative;
    /* For marginal edit icons and anchors */
}

.heading-anchor {
    position: absolute;
    left: -18px;
    opacity: 0;
    color: var(--text-dim);
    transition: all 0.2s ease;
    text-decoration: none !important;
    font-weight: normal;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    padding-right: 0.5rem;
    z-index: 110;
}

h1:hover .heading-anchor,
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
h5:hover .heading-anchor,
h6:hover .heading-anchor {
    opacity: 0.6;
}

.heading-anchor:hover {
    opacity: 1 !important;
    color: var(--green);
}

.heading-anchor.copied::after {
    content: 'Copied!';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--green);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    animation: fadeUpOut 1s forwards;
}

#shortcuts-help-overlay .command-item:hover {
    background: transparent;
    cursor: default;
}

#shortcuts-help-overlay .command-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-color);
}

@keyframes fadeUpOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(0);
    }

    20% {
        opacity: 1;
        transform: translateX(-50%) translateY(-5px);
    }

    80% {
        opacity: 1;
        transform: translateX(-50%) translateY(-5px);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(135deg, var(--green) 0%, var(--aqua) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-accent {
    width: 60px;
    height: 4px;
    margin: 1.5rem auto;
    background: linear-gradient(90deg, var(--green), var(--aqua));
    border-radius: 2px;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.4rem;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
    color: var(--aqua);
}

/* Wiki Links */
a.internal-link {
    text-decoration-color: var(--green);
    /* Subtle indicator */
    text-decoration-thickness: 2px;
}

a.internal-link.broken-link {
    text-decoration-color: var(--red);
    text-decoration-style: dashed;
    color: var(--red);
}

p {
    margin-bottom: 1.2rem;
}

/* Code & Pre */
code {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.85em;
}

pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

pre code {
    background: none !important;
    padding: 0;
    font-family: inherit;
}

/* Blockquotes, Lists, Tables */
blockquote {
    border-left: 4px solid var(--green);
    margin-left: 0;
    padding-left: 1rem;
    color: var(--text-dim);
    font-style: italic;
    margin-bottom: 1.5rem;
}

ul,
ol {
    padding-left: 1.5rem;
    margin-bottom: 1.2rem;
}

li {
    margin: 0.2rem 0;
}

/* Nested lists shouldn't add extra bottom margin */
li>ul,
li>ol {
    margin-bottom: 0;
}

/* Task Lists */
ul.contains-task-list {
    margin-bottom: 0.5rem;
}

.task-list-item {
    display: flex;
    align-items: baseline;
}

.task-list-item input[type="checkbox"] {
    margin-right: 0.5em;
    transform: translateY(1px);
}

/* In-Progress Checkbox [/] */
input[data-state="in-progress"] {
    appearance: none;
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border: 1px solid var(--text-dim);
    border-radius: 3px;
    position: relative;
    cursor: not-allowed;
    background: var(--code-bg);
}

input[data-state="in-progress"]::after {
    content: "/";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: var(--green);
    font-weight: 700;
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
}

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

img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.image-figure {
    margin: 2rem auto;
    max-width: fit-content;
}

.image-figure img {
    margin-bottom: 0.5rem;
}

.image-caption {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

th {
    background-color: var(--bg-dim);
    /* --text-color, not --green: the accent isn't contrast-checked against --bg-dim and
       failed WCAG AA on light color schemes (#79). Matches the heading color. */
    color: var(--text-color);
}

tr:nth-child(even) {
    background-color: var(--bg-dim);
}

/* KaTeX Layout Overrides */
.katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 1.5rem 0;
    /* Remove overflow from container so number stays fixed */
    position: relative;
    display: block;
    text-align: center;
    padding-left: 2rem;
    padding-right: 2rem;
}

.katex-display>.katex {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
    vertical-align: middle;
    padding-bottom: 4px;
    /* Space for subtle scrollbar */

    /* Standard Cross-Browser Scrollbar Support (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom scrollbar for equations */
.katex-display>.katex::-webkit-scrollbar {
    height: 4px;
}

.katex-display>.katex::-webkit-scrollbar-track {
    background: transparent;
}

.katex-display>.katex::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.katex-display>.katex::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Mermaid Diagrams */
.mermaid {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    background-color: var(--code-bg);
    /* Subtle box background */
    padding: 1rem;
    border-radius: 8px;
}

/* File Tree */
.file-tree ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.file-tree ul ul {
    padding-left: 1rem;
}

.file-tree li {
    margin: 0.25rem 0;
}

.file-tree a {
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.file-tree a:hover {
    background-color: var(--bg-highlight);
    text-decoration: none;
}

.file-tree li.active a {
    background-color: var(--green);
    color: var(--bg-color);
}

.file-tree details summary {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-dim);
    list-style: none;
}

.file-tree details summary::-webkit-details-marker {
    display: none;
}

.file-tree details summary::before {
    content: '▸ ';
    color: var(--text-dim);
}

.file-tree details[open] summary::before {
    content: '▾ ';
}

.file-tree details summary:hover {
    background-color: var(--bg-highlight);
}

/* Views List */
.views-list ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.views-list li {
    margin: 0.25rem 0;
}

.views-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.15s ease;
}

.views-list a:hover {
    background-color: var(--bg-highlight);
    text-decoration: none;
}

.views-list li.active a {
    background-color: var(--green);
    color: var(--bg-primary);
}

.views-list .view-icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

/* Outline Tree */
.outline-tree ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.outline-tree li {
    margin: 0.25rem 0;
}

.outline-tree a {
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    /* Truncate long lines */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.outline-tree a:hover {
    color: var(--text-color);
    background-color: var(--bg-highlight);
}

/* Indentation based on depth */
.outline-tree .depth-1 {
    padding-left: 0;
}

.outline-tree .depth-2 {
    padding-left: 0.75rem;
}

.outline-tree .depth-3 {
    padding-left: 1.5rem;
}

.outline-tree .depth-4,
.outline-tree .depth-5,
.outline-tree .depth-6 {
    padding-left: 2.25rem;
}


/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .content {
        padding: 1rem;
    }
}

/* Empty State */
.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50vh;
    color: var(--text-dim);
    font-style: italic;
    font-size: 1.1rem;
    text-align: center;
}

/* Article Header & Metadata */
/* "Open on GitHub" affordance at the top of a rendered page (#69). */
.glint-source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    float: right;
    margin: 0 0 0.5rem 1rem;
    padding: 0.25rem 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color, transparent);
}
.glint-source-link:hover {
    color: var(--text-color);
    border-color: var(--text-dim);
}
.glint-source-link svg {
    width: 1em;
    height: 1em;
}

.article-header {
    margin-bottom: 2rem;
    text-align: center;
}

.article-meta {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-dim);
    font-family: 'Inter', sans-serif;
}

.meta-date {
    font-weight: 500;
}

.meta-author {
    font-style: italic;
}

/* Tags */
.article-tags {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
}

/* Description/Summary */
.article-description {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Featured Image */
.featured-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Draft Badge */
.draft-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--orange);
    color: var(--bg-color);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Meta Category */
.meta-category {
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.05em;
    color: var(--purple);
}

/* Meta Updated */
.meta-updated {
    font-style: italic;
}

/* Arbitrary frontmatter fields (#67): a labelled key/value grid. */
.article-fields {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: left;
}
.article-fields .meta-field { display: contents; }
.article-fields dt { font-weight: 600; color: var(--text-dim); }
.article-fields dd { margin: 0; color: var(--text-color); }

/* Editor Widget Styles */
.glint-editor-wrapper {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
}

.glint-editor-content {
    flex: 1;
    min-height: 200px;
}

.glint-editor-toolbar {
    padding: 0.75rem 1rem;
    background: var(--bg-highlight);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.glint-btn {
    padding: 0.3rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.glint-btn-save {
    background: var(--aqua);
    color: var(--bg-color);
}

.glint-btn-save:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.glint-btn-cancel {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-color);
}

.glint-btn-cancel:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Context Expansion Buttons */
.glint-editor-expand-btn {
    padding: 0.4rem 0.75rem;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    width: 100%;
}

.glint-editor-expand-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-color);
    border-color: var(--aqua);
}

.glint-editor-expand-top {
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.glint-editor-expand-bottom {
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* Section Editing UI */
.heading-container {
    position: relative;
    display: flex;
    align-items: center;
}

.heading-edit-icon {
    opacity: 0;
    cursor: pointer;
    position: absolute;
    left: -64px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    user-select: none;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    z-index: 110;
}

.heading-edit-icon:hover {
    transform: translateY(-50%) scale(1.1);
    background: var(--bg-dim);
    border-color: var(--green);
}

h1:hover .heading-edit-icon,
h2:hover .heading-edit-icon,
h3:hover .heading-edit-icon,
h4:hover .heading-edit-icon,
h5:hover .heading-edit-icon,
h6:hover .heading-edit-icon,
.code-block-wrapper:hover .code-edit-icon {
    opacity: 1;
}

.code-block-wrapper {
    position: relative;
    /* For marginal edit icon */
}

.code-edit-icon {
    opacity: 0;
    cursor: pointer;
    position: absolute;
    left: -64px;
    top: 20px;
    /* Fixed offset from top of code block */
    font-size: 0.9rem;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    user-select: none;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    z-index: 110;
}

.code-edit-icon:hover {
    transform: scale(1.1);
    background: var(--bg-dim);
    border-color: var(--green);
}

/* Edit Mode Overlay */
.edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

/* Editor Overlay and Section Editing */
/* Inline Editor */
.glint-inline-editor-container {
    margin: 1.5rem 0;
    padding: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.glint-inline-editor-container .glint-editor-wrapper {
    margin: 0;
    border: none;
    border-radius: 0;
}

.glint-inline-editor-container .cm-editor {
    min-height: 200px;
    max-height: 60vh;
}

/* Modal styles (Legacy - kept for potential full-page edit later) */
.glint-editor-overlay {
    display: none;
    /* Hidden by default now */
}

/* Comments */
:root {
    --comment-accent: #f59e0b;
    /* Amber for active discussions */
    --comment-resolved: #22c55e;
    /* Green for resolved */
    --comment-important: #ef4444;
    /* Red for emphasis */
}

.glint-comment {
    border-left-color: var(--comment-accent);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.glint-comment[data-resolved="true"] {
    border-left-color: var(--comment-resolved);
    opacity: 0.75;
}

.glint-comment[data-important="true"] {
    border-left-color: var(--comment-important);
    background: rgba(239, 68, 68, 0.05);
    /* Slight red tint */
}

.glint-comment-header {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.glint-comment-header.important {
    color: var(--comment-important);
}

.glint-comment-thread {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.glint-comment-item {
    font-size: 0.95rem;
    line-height: 1.5;
}

.comment-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.comment-author {
    color: var(--text-main);
    font-weight: 600;
}

.comment-body-wrapper {
    border-left: 2px solid var(--border);
    padding-left: 0.75rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.comment-content {
    color: var(--text-main);
}

.comment-content p {
    margin: 0.25rem 0;
}

.comment-content p:first-child {
    margin-top: 0;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.comment-content blockquote {
    border-left: 2px solid var(--border);
    margin: 0.5rem 0;
    padding-left: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
}

.comment-content code {
    background: rgba(127, 127, 127, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
    font-family: var(--font-mono);
}

.comment-content pre {
    background: rgba(127, 127, 127, 0.05);
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.comment-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
}


.glint-comment-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
    opacity: 0;
    transition: opacity 0.2s;
}

.glint-comment:hover .glint-comment-actions {
    opacity: 1;
}

.glint-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-dim);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: inherit;
    transition: background 0.1s, color 0.1s;
}

.glint-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.theme-dark .glint-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-reply:hover {
    color: var(--task-open);
    /* Blue */
}

.btn-resolve:hover {
    color: var(--comment-resolved);
    /* Green */
}

/* Collapsing */
.glint-comment-header {
    cursor: pointer;
    user-select: none;
}

.comment-collapse-toggle {
    display: inline-block;
    width: 1.2em;
    text-align: center;
    transition: transform 0.2s;
    font-size: 0.8em;
}

.glint-comment[data-collapsed="true"] .comment-collapse-toggle {
    transform: rotate(-90deg);
}

.glint-comment[data-collapsed="true"] .glint-comment-thread,
.glint-comment[data-collapsed="true"] .glint-comment-actions {
    display: none;
}

.glint-comment[data-collapsed="true"] {
    padding-bottom: 0.5rem;
    gap: 0;
}

.glint-comment[data-collapsed="true"] .glint-comment-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.comment-status-icon {
    font-weight: bold;
    margin-right: -0.2rem;
}

.comment-header-snippet {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: calc(100% - 4rem);
    vertical-align: middle;
    font-style: italic;
    color: var(--text-main);
    opacity: 0.8;
}

.glint-comment[data-collapsed="true"] .comment-header-snippet {
    opacity: 1;
    font-weight: 500;
}

/* Line Tracker */
.glint-line-tracker {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.15s, top 0.08s ease-out;
}

.glint-line-visual {
    position: absolute;
    height: 2px;
    background: rgba(127, 127, 127, 0.3);
}

.glint-line-tracker.visible {
    opacity: 1;
}

.line-tracker-hint {
    position: absolute;
    /* Left is calculated via JS */
    top: 50%;
    transform: translateY(-50%);
    padding: 0.25rem 0;
    font-size: 0.7rem;
    color: var(--text-dim);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-mono);
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: left 0.1s ease-out;
}

/* Toast Notifications */
.glint-loading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
    padding: 3rem 0;
    color: var(--text-dim, #6a737d);
}

.glint-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--green, #22863a);
    border-radius: 50%;
    animation: glint-spin 0.7s linear infinite;
}

.glint-editor-saving {
    color: var(--text-dim, #6a737d);
    font-size: 0.9rem;
    margin: 0.4rem 0 0;
}

@keyframes glint-spin {
    to { transform: rotate(360deg); }
}

.glint-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10000;
    pointer-events: none;
}

.glint-toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: auto;
    animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 300px;
}

.glint-toast.success {
    border-left: 3px solid var(--green);
}

.glint-toast.error {
    border-left: 3px solid var(--red);
}

.glint-toast.info {
    border-left: 3px solid var(--blue);
}

.glint-toast.out {
    animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(5px);
    }
}

/* Print Styles */
@media print {

    /* Hide non-printable elements */
    .sidebar,
    .right-outline,
    .glint-line-tracker,
    .glint-toast-container,
    .section-edit-btn,
    .code-edit-btn,
    .copy-btn,
    .color-scheme-select,
    .vim-toggle,
    .share-sidebar-button,
    .modal-overlay {
        display: none !important;
    }

    /* Reset Body/Layout */
    body {
        height: auto !important;
        overflow: visible !important;
        background: white !important;
        color: black !important;
    }

    /* Content Width & Margins */
    .content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
    }

    .content-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Typography Tweaks */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        color: black !important;
        page-break-after: avoid;
    }

    p,
    li,
    blockquote {
        color: black !important;
    }

    /* Code Blocks */
    pre,
    code {
        background: #f5f5f5 !important;
        color: black !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    /* Ensure images fit */
    img,
    video,
    svg {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Tasks */
    .glint-task-check {
        border: 1px solid #000 !important;
        color: #000 !important;
    }
}

/* Mobile Responsive */
.mobile-toggle,
.mobile-overlay {
    display: none;
}

@media (max-width: 768px) {

    /* Mobile Toggle Button */
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 1rem;
        left: 1rem;
        width: 40px;
        height: 40px;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        font-size: 1.5rem;
        cursor: pointer;
        z-index: 2000;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        color: var(--text-primary);
    }

    /* Sidebar as Overlay */
    .sidebar {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 2001;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Overlay Backdrop */
    .mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
    }

    body.sidebar-open .mobile-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* Content adjustments */
    .content {
        margin-left: 0;
        /* Override the 300px desktop margin */
        padding-top: 4rem;
        /* Space for hamburger */
    }

    /* Hide right outline on mobile */
    .right-outline {
        display: none;
    }

    /* Adjust tools for mobile */
    .glint-line-tracker {
        display: none;
        /* Too cramped */
    }
}

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.breadcrumbs ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumbs a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--text-tertiary);
    font-size: 0.8em;
}

.breadcrumb-home {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-raw {
    margin-left: auto;
}

.breadcrumb-raw a {
    font-size: 0.8em;
    color: var(--text-tertiary);
    text-decoration: none;
    border: 1px solid var(--border-color);
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.breadcrumb-raw a:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    text-decoration: none;
}

/* Recent Files Sidebar */
.recent-files {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.recent-files .sidebar-section-title {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    font-weight: 600;
}

.recent-files .sidebar-item {
    font-size: 0.9rem;
}

/* Command Palette */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.command-palette-modal {
    width: 100%;
    max-width: 600px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.command-palette-search {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.command-palette-search .search-icon {
    margin-right: 0.75rem;
    opacity: 0.5;
    font-size: 1.2rem;
}

.command-palette-search input {
    flex: 1;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-primary);
    outline: none;
}

.command-palette-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.command-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
}

.command-item.selected,
.command-item:hover {
    background: var(--bg-hover);
}

.command-content {
    flex: 1;
}

.command-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.1rem;
}

.command-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.command-palette-footer {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.command-palette-footer kbd {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.line-tracker-hint .hint-item {
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.line-tracker-hint .hint-item:last-child {
    border-bottom: none;
}

.line-tracker-hint .hint-key {
    color: var(--aqua);
    font-weight: 600;
}

/* Share Sidebar Button */
.share-sidebar-button {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    border-radius: 4px;
    background-color: var(--blue);
    color: white;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.share-sidebar-button:hover {
    background-color: var(--aqua);
}

/* Share Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.share-modal {
    background: var(--bg-secondary);
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-overlay.open .share-modal {
    transform: translateY(0);
}

.share-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.share-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color) !important;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.share-modal-content {
    padding: 1.5rem;
}

.share-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group-share {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group-share label {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 500;
}

.form-group-share select,
.form-group-share input {
    padding: 0.5rem;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: inherit;
}

.create-share-btn {
    padding: 0.6rem;
    background: var(--green);
    color: var(--bg-color);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: opacity 0.2s;
}

.create-share-btn:hover {
    opacity: 0.9;
}

.existing-shares {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.existing-shares h3 {
    font-size: 1rem;
    margin: 0 0 1rem 0;
    color: var(--text-dim) !important;
}

.share-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
}

.share-item {
    background: var(--bg-primary);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.share-label-text {
    font-weight: 600;
    font-size: 0.9rem;
}

.share-access-badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: var(--bg-highlight);
    text-transform: uppercase;
    color: var(--text-muted);
}

.share-url-container {
    display: flex;
    gap: 0.5rem;
}

.share-url-input {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg-dim);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-dim);
    font-family: monospace;
}

.copy-btn,
.revoke-btn {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.revoke-btn {
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.revoke-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

/* ============================================
   RIGHT MARGIN OUTLINE
   ============================================ */

.right-outline {
    position: fixed;
    right: 2rem;
    top: 6rem;
    width: 240px;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-dim);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    z-index: 150;
}

.right-outline-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.right-outline-item {
    margin: 0.1rem 0;
}

.right-outline-link {
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 2px solid transparent;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.right-outline-link:hover {
    color: var(--text-color);
    background: var(--bg-highlight);
    border-left-color: var(--aqua);
    transform: translateX(2px);
}

.right-outline-link.active {
    color: var(--green);
    background: linear-gradient(90deg, rgba(167, 192, 128, 0.1) 0%, transparent 100%);
    border-left-color: var(--green);
    font-weight: 600;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(167, 192, 128, 0.15);
}

/* Depth-based styles - Font sizes only */
.right-outline-item[data-depth="1"] .right-outline-link {
    font-size: 0.9rem;
    font-weight: 600;
}

.right-outline-item[data-depth="2"] .right-outline-link {
    font-size: 0.85rem;
}

.right-outline-item[data-depth="3"] .right-outline-link {
    font-size: 0.8rem;
    opacity: 0.9;
}

.right-outline-item[data-depth="4"] .right-outline-link,
.right-outline-item[data-depth="5"] .right-outline-link,
.right-outline-item[data-depth="6"] .right-outline-link {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Outline section collapse toggle */
.right-outline-section-header {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.right-outline-section-header .right-outline-link {
    flex: 1;
    min-width: 0;
}

.outline-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.6rem;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.outline-toggle::before {
    content: '▼';
    display: block;
    transition: transform 0.2s ease;
}

.outline-toggle:hover {
    color: var(--text-color);
    background: var(--bg-highlight);
}

.right-outline-section.collapsed .outline-toggle::before {
    transform: rotate(-90deg);
}

/* Indent Guides (replacing manual padding) */
.right-outline-section-children {
    margin-left: 0.75rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 1;
}

.right-outline-section.collapsed .right-outline-section-children {
    max-height: 0;
    opacity: 0;
}

/* Scrollbar styling */
.right-outline::-webkit-scrollbar {
    width: 6px;
}

.right-outline::-webkit-scrollbar-track {
    background: transparent;
}

.right-outline::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.right-outline::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Outline visibility toggle button */
.outline-visibility-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.outline-visibility-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-color);
    border-color: var(--aqua);
    transform: scale(1.1);
}

/* Hidden state */
.right-outline.outline-hidden {
    transform: translateX(calc(100% + 2rem));
    opacity: 0;
    pointer-events: none;
}

/* Reopen button (shown when outline is hidden) */
.outline-reopen-toggle {
    position: fixed;
    right: 1rem;
    top: 6rem;
    width: 28px;
    height: 28px;
    background: var(--bg-dim);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 150;
    padding: 0;
    transition: color 0.15s ease;
}

.outline-reopen-toggle:hover {
    color: var(--text-color);
    border-color: var(--aqua);
}

/* Smooth transition for hide/show */
.right-outline.outline-transitioning {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hide on narrow viewports */
@media (max-width: 1400px) {
    .right-outline {
        display: none;
    }
}

/* Responsive adjustments for medium screens */
@media (max-width: 1600px) {
    .right-outline {
        right: 1rem;
        width: 200px;
    }
}

/* ============================================
   SHARED VIEW STYLES
   ============================================ */

/* Hide sidebar on shared pages. [data-theme] prefix to outspecify `[data-theme] .sidebar`. */
.sidebar.shared-view,
[data-theme] .sidebar.shared-view {
    display: none;
}

/* Adjust content width when sidebar is hidden */
body.shared-view .content,
[data-theme] body.shared-view .content {
    margin-left: 0;
    max-width: 100%;
}

body.shared-view .content-wrapper {
    max-width: 900px;
    padding: 0 2rem;
}

/* ============================================
   DRAG-TO-REORDER STYLES
   ============================================ */

.drag-handle {
    display: none;
    position: absolute;
    left: -36px;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
    color: var(--text-dim);
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    user-select: none;
    padding: 0.25rem;
    line-height: 1;
    z-index: 110;
}

.draggable-section:hover .drag-handle {
    display: inline-block;
    opacity: 0.6;
}

.drag-handle:hover {
    opacity: 1 !important;
    color: var(--green);
}

.drag-handle:active {
    cursor: grabbing;
}

.draggable-section {
    position: relative;
    transition: opacity 0.2s ease;
}

.draggable-section.is-dragging {
    opacity: 0.3;
}

.drop-zone {
    height: 4px;
    margin: 1rem 0;
    position: relative;
    transition: all 0.2s ease;
    border-radius: 2px;
    background: transparent;
}

.drop-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    opacity: 0.3;
    transition: all 0.2s ease;
}

.drop-zone-active {
    height: 8px;
    margin: 1.5rem 0;
}

.drop-zone-active::before {
    height: 4px;
    background: var(--green);
    opacity: 1;
    box-shadow: 0 0 8px var(--green);
}

.drop-zone-active::after {
    content: '\25BC';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--green);
    font-size: 0.75rem;
    animation: dropPulse 1s ease-in-out infinite;
}

@keyframes dropPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.7;
    }
}

body:has(.glint-inline-editor-container) .drag-handle {
    display: none !important;
}


/* ===========================
   CITATIONS & BIBLIOGRAPHY
   =========================== */

/* Inline citation */
.glint-cite {
    color: var(--accent-color, #81a1c1);
    cursor: pointer;
    font-size: 0.85em;
    vertical-align: super;
    text-decoration: none;
    font-style: normal;
    transition: color 0.2s, background 0.2s;
    padding: 0 0.15em;
    border-radius: 3px;
}

.glint-cite:hover {
    background: var(--hover-bg, rgba(129, 161, 193, 0.15));
    color: var(--accent-color-bright, #a3c4dc);
}

/* Hover card container */
.glint-cite-cards {
    position: fixed;
    bottom: 0;
    right: 0;
    pointer-events: none;
    z-index: 1100;
}


/* Individual hover card */
.glint-cite-card {
    position: absolute;
    bottom: 0;
    right: 0;
    max-width: 320px;
    background: var(--bg-primary, #2e3440);
    border: 1px solid var(--border-color, #3b4252);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    line-height: 1.4;
    display: none;
    pointer-events: auto;
}

.glint-cite-card.visible {
    display: block;
}

.glint-cite-card .cite-title {
    display: block;
    color: var(--text-primary, #eceff4);
    margin-bottom: 0.25rem;
}

.glint-cite-card .cite-meta {
    color: var(--text-secondary, #9da9a0);
    font-size: 0.85em;
    margin-bottom: 0.25rem;
}

.glint-cite-card .cite-url {
    display: block;
    color: var(--accent-color, #81a1c1);
    font-size: 0.8em;
    word-break: break-all;
    text-decoration: none;
}

.glint-cite-card .cite-url:hover {
    text-decoration: underline;
}

/* Bibliography section */
.glint-bibliography {
    list-style-type: decimal;
    padding-left: 2rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color, #3b4252);
    padding-top: 1rem;
}

.glint-bib-entry {
    margin-bottom: 0.75rem;
    line-height: 1.5;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.glint-bib-entry:target,
.glint-bib-entry:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.05));
}

.glint-bib-entry .bib-title {
    font-weight: 500;
    color: var(--text-primary, #eceff4);
}

.glint-bib-entry .bib-author {
    color: var(--text-secondary, #9da9a0);
}

.glint-bib-entry .bib-year {
    color: var(--text-muted, #6b7280);
}

.glint-bib-entry .bib-url {
    display: block;
    color: var(--accent-color, #81a1c1);
    font-size: 0.85em;
    text-decoration: none;
    margin-top: 0.25rem;
}

.glint-bib-entry .bib-url:hover {
    text-decoration: underline;
}

@keyframes highlight-line-fade {
    0% {
        background: rgba(167, 192, 128, 0.2);
        box-shadow: 0 0 10px rgba(167, 192, 128, 0.2);
    }

    100% {
        background: transparent;
        box-shadow: none;
    }
}

.highlight-line {
    animation: highlight-line-fade 2s ease-out;
    border-radius: 4px;
}

/* Print Stylesheet */
@media print {

    /* Hide non-printable elements */
    .sidebar,
    .right-outline,
    .glint-line-tracker,
    .glint-toast-container,
    .section-edit-btn,
    .code-edit-btn,
    .copy-btn,
    .color-scheme-select,
    .vim-toggle,
    .share-sidebar-button,
    .modal-overlay,
    .glint-cite-cards,
    .heading-edit-icon,
    .code-edit-icon,
    .preamble-edit-icon,
    .glint-comment-actions,
    .btn-reply,
    .btn-resolve {
        display: none !important;
    }

    /* Reset Body/Layout */
    body {
        height: auto !important;
        overflow: visible !important;
        background: white !important;
        color: black !important;
    }

    /* Content Width & Margins */
    .content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
    }

    .content-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    /* Typography Tweaks */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        color: black !important;
        page-break-after: avoid;
    }

    p,
    li,
    blockquote {
        color: black !important;
    }

    /* Code Blocks */
    pre,
    code {
        background: #f5f5f5 !important;
        color: black !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
        white-space: pre-wrap !important;
    }

    /* Ensure images fit */
    img,
    video,
    svg {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Tasks */
    .glint-task-check {
        border: 1px solid #000 !important;
        color: #000 !important;
    }
}

/* Permission-based Visibility Enforcement */
body:not([data-access="edit"]) .heading-edit-icon,
body:not([data-access="edit"]) .code-edit-icon,
body:not([data-access="edit"]) .preamble-edit-icon {
    display: none !important;
}

body:not([data-access="comment"]):not([data-access="edit"]) .glint-comment-actions,
body:not([data-access="comment"]):not([data-access="edit"]) .btn-reply,
body:not([data-access="comment"]):not([data-access="edit"]) .btn-resolve {
    display: none !important;
}