/*
 * Eulogikon design tokens — the single palette contract for every bundle.
 * Prepended structurally by stylesheet_registry.py (bundle_content).
 * Role-based names only: one signifier, one referent.
 *
 * Theme resolution (auto + manual toggle):
 *   1. Base `:root`          — light values (default).
 *   2. `@media dark` block   — dark values when the OS prefers dark and the
 *                              user has not forced light.
 *   3. `[data-theme="light"]`— light values re-asserted to defeat the media
 *                              query when the user forces light.
 *   4. `[data-theme="dark"]` — dark values when the user forces dark.
 *
 * By construction the light block appears exactly twice and the dark block
 * exactly twice. When editing either palette, update BOTH of its blocks.
 *
 * Fixed chrome (not mode-dependent, stays literal in site_chrome.css): the
 * navbar and footer slate gradient, the wordmark emboss shadows, rgba-black
 * card shadows, white-on-red PDF badge ink.
 */
:root {
    color-scheme: light;

    /* Surfaces */
    --surface-page: #F7F7F5;
    --surface-card: #FFFFFF;
    --surface-hover: #F0F0EC;
    --surface-recessed: #FAFAF8;
    --surface-code: #2D3748;
    --surface-chip: #F7F7F5;

    /* Text (slate ramp) */
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --text-faint: #A0AEC0;

    /* Borders */
    --border-default: #E2E8F0;
    --border-strong: #CBD5E0;
    --border-hairline: #EDF2F7;

    /* Accent — silver (replaces the retired bronze accent family) */
    --accent: #A0AEC0;
    --accent-strong: #718096;
    --accent-ink: #4A5568;
    --rim: rgba(226, 232, 240, 0.55);

    /* Chrome */
    --chrome-ink: #E2E8F0;
    --wordmark: #F0F4F8;
    --bar-bg: #4A5568;
    --bar-ink: #E2E8F0;

    /* Status */
    --status-danger-ink: #C53030;
    --status-danger-bg: #FFF5F5;
    --status-danger-border: #FED7D7;
    --status-success-ink: #276749;
    --status-success-bg: #F0FFF4;
    --status-success-border: #C6F6D5;
    --pdf-badge: #E31C23;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        /* Surfaces — true black, border-separated */
        --surface-page: #000000;
        --surface-card: #000000;
        --surface-hover: #14161A;
        --surface-recessed: #0B0C0E;
        --surface-code: #0D0F12;
        --surface-chip: #17191E;

        /* Text — inverted ramp */
        --text-primary: #E8EAED;
        --text-secondary: #B7BDC6;
        --text-muted: #8B93A1;
        --text-faint: #6E7681;

        /* Borders */
        --border-default: #262B33;
        --border-strong: #3D4552;
        --border-hairline: #171A1F;

        /* Accent — silver brightened for black */
        --accent: #C3CCD8;
        --accent-strong: #9AA5B4;
        --accent-ink: #C6CFDB;
        --rim: rgba(226, 232, 240, 0.55);

        /* Chrome */
        --chrome-ink: #E2E8F0;
        --wordmark: #F0F4F8;
        --bar-bg: #1A1E24;
        --bar-ink: #E2E8F0;

        /* Status */
        --status-danger-ink: #FCA5A5;
        --status-danger-bg: rgba(197, 48, 48, 0.16);
        --status-danger-border: rgba(197, 48, 48, 0.45);
        --status-success-ink: #9AE6B4;
        --status-success-bg: rgba(39, 103, 73, 0.16);
        --status-success-border: rgba(72, 187, 120, 0.45);
        --pdf-badge: #E31C23;
    }
}

:root[data-theme="light"] {
    color-scheme: light;

    /* Surfaces */
    --surface-page: #F7F7F5;
    --surface-card: #FFFFFF;
    --surface-hover: #F0F0EC;
    --surface-recessed: #FAFAF8;
    --surface-code: #2D3748;
    --surface-chip: #F7F7F5;

    /* Text (slate ramp) */
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --text-faint: #A0AEC0;

    /* Borders */
    --border-default: #E2E8F0;
    --border-strong: #CBD5E0;
    --border-hairline: #EDF2F7;

    /* Accent — silver (replaces the retired bronze accent family) */
    --accent: #A0AEC0;
    --accent-strong: #718096;
    --accent-ink: #4A5568;
    --rim: rgba(226, 232, 240, 0.55);

    /* Chrome */
    --chrome-ink: #E2E8F0;
    --wordmark: #F0F4F8;
    --bar-bg: #4A5568;
    --bar-ink: #E2E8F0;

    /* Status */
    --status-danger-ink: #C53030;
    --status-danger-bg: #FFF5F5;
    --status-danger-border: #FED7D7;
    --status-success-ink: #276749;
    --status-success-bg: #F0FFF4;
    --status-success-border: #C6F6D5;
    --pdf-badge: #E31C23;
}

:root[data-theme="dark"] {
    color-scheme: dark;

    /* Surfaces — true black, border-separated */
    --surface-page: #000000;
    --surface-card: #000000;
    --surface-hover: #14161A;
    --surface-recessed: #0B0C0E;
    --surface-code: #0D0F12;
    --surface-chip: #17191E;

    /* Text — inverted ramp */
    --text-primary: #E8EAED;
    --text-secondary: #B7BDC6;
    --text-muted: #8B93A1;
    --text-faint: #6E7681;

    /* Borders */
    --border-default: #262B33;
    --border-strong: #3D4552;
    --border-hairline: #171A1F;

    /* Accent — silver brightened for black */
    --accent: #C3CCD8;
    --accent-strong: #9AA5B4;
    --accent-ink: #C6CFDB;
    --rim: rgba(226, 232, 240, 0.55);

    /* Chrome */
    --chrome-ink: #E2E8F0;
    --wordmark: #F0F4F8;
    --bar-bg: #1A1E24;
    --bar-ink: #E2E8F0;

    /* Status */
    --status-danger-ink: #FCA5A5;
    --status-danger-bg: rgba(197, 48, 48, 0.16);
    --status-danger-border: rgba(197, 48, 48, 0.45);
    --status-success-ink: #9AE6B4;
    --status-success-bg: rgba(39, 103, 73, 0.16);
    --status-success-border: rgba(72, 187, 120, 0.45);
    --pdf-badge: #E31C23;
}
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            /* Greek-optimized sans-serif stack */
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
            line-height: 1.6;
            background-color: var(--surface-page);
            color: var(--text-primary);
        }

        .navbar {
            position: relative;
        }

        .menu-download-buttons {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .menu-download-buttons .download-btn {
            width: 100%;
            justify-content: flex-start;
        }

        .downloads {
            position: absolute;
            /* Right of the theme-toggle corner: 20px toggle inset + 38px
               toggle + 8px gap, so the Download widget no longer sits
               under the theme-toggle (which owns the banner's right edge). */
            right: 66px;
            top: 20px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            align-items: flex-end;
            max-width: 500px;
        }

        .download-label {
            display: none;
        }

        .download-buttons {
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            gap: 8px;
            align-items: center;
            justify-content: center;
        }

        .download-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 10px 14px;
            background: #4A5568;
            color: #E2E8F0;
            text-decoration: none;
            border-radius: 6px;
            font-size: 0.85em;
            font-weight: 500;
            transition: all 0.3s;
            border: 1px solid rgba(255, 255, 255, 0.15);
            position: relative;
            text-align: center;
            flex-shrink: 0;
            box-sizing: border-box;
            white-space: nowrap;
            cursor: pointer;
            font-family: inherit;
        }

        .download-btn:visited {
            color: #E2E8F0;
        }

        .download-btn span:last-child {
            white-space: nowrap;
        }

        .download-btn:hover {
            background: #5A6A78;
            border-color: rgba(255, 255, 255, 0.4);
            transform: translateY(-1px);
        }

        .download-btn.coming-soon {
            cursor: not-allowed;
            opacity: 0.7;
        }

        .download-btn.coming-soon:hover::after {
            content: "Coming Soon";
            position: absolute;
            bottom: -25px;
            left: 50%;
            transform: translateX(-50%);
            background: #4A5568;
            color: #E2E8F0;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.75em;
            white-space: nowrap;
            border: 1px solid rgba(255, 255, 255, 0.15);
        }

        .download-icon {
            font-size: 1.1em;
        }

        .pdf-download-link {
            transition: border-bottom 0.2s ease, color 0.2s ease;
            border-bottom: 1px solid transparent;
        }

        .pdf-download-link:hover {
            color: var(--accent-ink) !important;
            border-bottom: 1px solid currentColor;
        }

        .mobile-download-toggle {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 10px 14px;
            background: #4A5568;
            color: #E2E8F0;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 6px;
            font-size: 0.85em;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            width: 100%;
            box-sizing: border-box;
        }

        .mobile-download-toggle:hover {
            background: #5A6A78;
            border-color: rgba(255, 255, 255, 0.4);
        }

        .mobile-download-toggle.active {
            background: #5A6A78;
        }

        .mobile-download-text {
            display: inline;
        }

        .desktop-download-toggle {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 10px 14px;
            background: #4A5568;
            color: #E2E8F0;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 6px;
            font-size: 0.85em;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            white-space: nowrap;
        }

        .desktop-download-toggle:hover {
            background: #5A6A78;
            border-color: rgba(255, 255, 255, 0.4);
            transform: translateY(-1px);
        }

        .desktop-download-toggle.active {
            background: #5A6A78;
        }

        .downloads-content {
            display: none;
            position: fixed;
            left: 50%;
            transform: translateX(-50%);
            width: 1200px;
            background: #3D4852;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 6px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            padding: 12px;
            z-index: 200;
            white-space: nowrap;
            box-sizing: border-box;
        }

        .downloads-content.show {
            display: block;
        }

        .breadcrumbs {
            max-width: 1200px;
            margin: 0 auto 8px auto;
            padding: 12px 20px 4px 20px;
            text-align: center;
            font-size: 0.9em;
            color: var(--text-primary);
        }

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

        .breadcrumbs a:hover {
            color: var(--accent-ink);
            opacity: 1;
            text-decoration: underline;
        }

        .breadcrumb-separator {
            margin: 0 8px;
            color: var(--text-muted);
            opacity: 0.7;
        }

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

        .container {
            max-width: 1200px;
            margin: 30px auto;
            padding: 0 20px;
            display: flex;
            justify-content: center;
        }

        .content-wrapper {
            background-color: var(--surface-card);
            padding: 40px;
            border-radius: 0;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            min-width: 800px;
        }

        .work-header {
            margin-bottom: 16px;
            margin-top: -15px;
            position: relative;
        }

        .eul-wid-top-left {
            position: absolute;
            top: 0;
            left: 0;
            font-size: 0.75em;
            color: var(--text-muted);
            font-family: 'Courier New', monospace;
            font-weight: 400;
        }

        .eul-wid-top-left .eul-wid-value {
            color: var(--text-secondary);
            font-weight: 400;
        }

        /* Zenodo concept-DOI badge — sits just below the eul_wid badge in the
           identity area. Restrained: small, top-left, clear of the centred
           title. The .work-header is position:relative so this anchors to it. */
        .doi-badge.doi-badge-identity {
            position: absolute;
            top: 18px;
            left: 0;
            line-height: 0;
        }

        .doi-badge.doi-badge-identity img {
            height: 20px;
            width: auto;
        }

        /* Site PDF — top-right of the work header, opposite the identity
           badges. Compact original 20px pill (DOI-badge height), not Adobe's
           trademarked PDF icon. Crawlable <a href> to the published PDF. */
        .pdf-badge {
            position: absolute;
            top: 0;
            right: 0;
            display: block;
            line-height: 0;
            text-decoration: none;
            z-index: 1;
        }

        .pdf-badge-icon {
            display: block;
            width: 36px;
            height: 20px;
        }

        .pdf-badge-band {
            fill: var(--pdf-badge);
        }

        .pdf-badge-text {
            fill: #FFFFFF;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.6px;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
                'Segoe UI', Arial, sans-serif;
        }

        .pdf-badge:hover .pdf-badge-band {
            fill: #C4181E;
        }

        .author-name {
            color: var(--text-muted);
            font-size: 1.1em;
            font-weight: 400;
            margin-bottom: 8px;
            letter-spacing: 0.5px;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }
        
        .author-name a {
            text-decoration: none;
            color: inherit;
            transition: opacity 0.2s;
        }
        
        .author-name a:hover {
            opacity: 0.7;
        }

        h1 {
            color: var(--text-primary);
            margin-top: 5px;
            margin-bottom: 10px;
            font-size: 2em;
            font-weight: 600;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }

        .work-metadata {
            text-align: center;
            margin-top: 16px;
            margin-bottom: 16px;
            font-size: 0.9em;
            color: var(--text-muted);
            line-height: 1.4;
        }

        .work-metadata .metadata-line {
            margin: 0;
        }

        .work-metadata .metadata-label {
            font-weight: 600;
            color: var(--text-secondary);
            margin-right: 4px;
        }

        .work-metadata .metadata-greek {
            font-weight: 400;
            color: var(--text-primary);
        }

        .work-metadata .metadata-english {
            color: var(--text-muted);
            font-style: italic;
        }

        .work-metadata .metadata-link {
            color: var(--accent-ink);
            text-decoration: underline;
            font-weight: 500;
        }

        .work-metadata .metadata-link:hover {
            color: var(--text-primary);
            text-decoration: underline;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        /* Remove table header ("Ref", "Text") entirely */
        thead {
            display: none !important;
        }

        th, td {
            border: none;
            padding: 3px 12px;
            text-align: left;
        }

        th {
            background-color: var(--bar-bg);
            color: var(--bar-ink);
            font-weight: 600;
            font-size: 0.95em;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }

        td:first-child {
            font-weight: 400;
            font-size: 0.85em;
            width: 60px;
            text-align: center;
            color: var(--text-primary);
            font-family: 'Courier New', monospace;
            vertical-align: top;
            opacity: 0;
            transition: opacity 0.2s ease-in-out;
        }

        /* Show ref on row hover (desktop) */
        tr:hover td:first-child {
            opacity: 1;
        }

        .speaker-label {
            font-weight: 600;
            color: var(--text-secondary);
            margin-right: 0.5em;
        }

        /* Print-edition page/line marginalia (e.g. "[15]"): a small, muted
           citation marker set after the passage text. */
        .marginalia {
            font-size: 0.7em;
            color: var(--text-faint);
            font-family: 'Courier New', monospace;
            vertical-align: super;
            margin-left: 0.4em;
            user-select: none;
        }

        td:last-child {
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
            font-size: 1.2em;
            line-height: 1.7;
            font-weight: 400;
        }

        /* Subtle separation between consecutive passages so distinct scholia /
           sub-entries do not run together as one wall of text. Body rows only —
           title and speaker rows belong to the text and stay borderless. */
        tbody tr td {
            border-bottom: 1px solid var(--border-hairline);
        }

        tbody tr.title-row td,
        tbody tr.testimonium-row td {
            border-bottom: none;
        }

        .title-row {
            background-color: transparent;
        }

        .title-row td:first-child {
            display: none;
        }

        .title-row td:last-child {
            text-align: center;
            font-weight: 600;
            font-style: italic;
            padding: 12px;
        }

        .also-published {
            margin-top: 0;
            margin-bottom: 24px;
            text-align: center;
            font-size: 0.85em;
            color: var(--text-faint);
            font-style: italic;
        }

        .also-published p {
            margin: 0 0 6px 0;
        }

        .also-published p:last-child {
            margin-bottom: 0;
        }

        .also-published a {
            color: var(--accent-ink);
            text-decoration: underline;
        }

        .also-published a:hover {
            color: var(--text-primary);
        }

        .footer {
            background:
                linear-gradient(180deg,
                    #556170 0%,
                    #3d4852 38%,
                    #2c343c 100%);
            border-top: 1px solid var(--rim);
            box-shadow:
                0 -8px 24px rgba(0, 0, 0, 0.28),
                inset 0 1px 0 rgba(255, 255, 255, 0.14),
                inset 0 -2px 0 rgba(0, 0, 0, 0.35);
            color: #E2E8F0;
            text-align: center;
            padding: 30px 20px;
            margin-top: 40px;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }

        .footer a {
            color: #E2E8F0;
            text-decoration: underline;
        }

        /* Tablet styles */
        @media (max-width: 1024px) {
            .content-wrapper {
                padding: 30px;
            }
        }

        /* Mobile styles */
        @media (max-width: 768px) {
            .menu-download-buttons {
                display: flex;
                flex-direction: column;
                gap: 10px;
            }

            .menu-download-buttons .download-btn {
                font-size: 0.85em;
                padding: 10px 12px;
                min-height: 44px;
                width: 100%;
                justify-content: flex-start;
            }

            .menu-download-buttons .download-btn span:last-child {
                white-space: nowrap;
            }

            .container {
                margin: 15px auto;
                padding: 0 10px;
            }

            .breadcrumbs {
                padding: 10px 15px;
                font-size: 0.85em;
            }

            .breadcrumb-separator {
                margin: 0 6px;
            }

            .content-wrapper {
                padding: 20px;
                border-radius: 0;
                min-width: 0;
            }

            .work-header {
                margin-bottom: 25px;
                margin-top: -15px;
                position: relative;
            }

            .eul-wid-top-left {
                position: static;
                font-size: 0.7em;
                margin-bottom: 6px;
            }

            .doi-badge.doi-badge-identity {
                position: static;
                display: block;
                margin-bottom: 10px;
                line-height: normal;
            }

            .pdf-badge {
                position: static;
                float: right;
                margin: 0 0 10px 10px;
            }

            .author-name {
                font-size: 1.15em;
                margin-bottom: 10px;
            }

            h1 {
                font-size: 1.75em;
                padding-bottom: 12px;
                line-height: 1.3;
            }

            .work-metadata {
                font-size: 0.9em;
                margin-top: 14px;
                margin-bottom: 14px;
            }

            table {
                font-size: 1em;
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                margin-top: 15px;
            }

            table thead,
            table tbody,
            table tr {
                display: table;
                width: 100%;
                table-layout: fixed;
            }

            /* Keep header hidden on mobile too (override display: table) */
            table thead {
                display: none !important;
            }

            th, td {
                padding: 6px 8px;
                word-wrap: break-word;
                overflow-wrap: break-word;
                hyphens: auto;
            }

            th {
                font-size: 1em;
                padding: 8px;
            }

            th:first-child {
                width: 45px;
                min-width: 45px;
            }

            td:first-child {
                width: 45px;
                min-width: 45px;
                font-size: 0.8em;
                padding: 6px 4px;
                opacity: 1 !important;
            }

            td:last-child {
                font-size: 1.3em;
                line-height: 1.8;
            }

            .title-row td:last-child {
                font-size: 1.4em;
                line-height: 1.6;
            }

            .footer {
                padding: 20px 15px;
                font-size: 0.85em;
            }

            .footer a {
                margin: 0;
            }
        }

        /* Small mobile styles */
        @media (max-width: 480px) {
            .menu-download-buttons .download-btn {
                font-size: 0.8em;
                padding: 10px 12px;
            }

            .container {
                margin: 10px auto;
                padding: 0 5px;
            }

            .content-wrapper {
                padding: 16px;
                min-width: 0;
            }

            .eul-wid-top-left {
                font-size: 0.65em;
            }

            .author-name {
                font-size: 1.1em;
            }

            h1 {
                font-size: 1.5em;
                line-height: 1.3;
            }

            .work-metadata {
                font-size: 0.85em;
                margin-top: 12px;
                margin-bottom: 12px;
            }

            table {
                font-size: 0.95em;
            }

            th:first-child {
                width: 40px;
                min-width: 40px;
            }

            td:first-child {
                width: 40px;
                min-width: 40px;
                font-size: 0.75em;
                padding: 5px 3px;
                opacity: 1 !important;
            }

            td:last-child {
                font-size: 1.25em;
                line-height: 1.8;
            }

            .title-row td:last-child {
                font-size: 1.35em;
                line-height: 1.6;
            }

            .footer {
                padding: 15px 10px;
                font-size: 0.8em;
            }
        }

        /* ==========================================
           PRINT STYLES (PDF export)
           ========================================== */
        @media print {
            /* Hide UI elements */
            .download-btn, .downloads, .download-buttons,
            .mobile-download-toggle, .desktop-download-toggle, .downloads-content,
            footer, .footer, .export-notice, .breadcrumbs,
            .also-published, .pdf-badge {
                display: none !important;
            }

            /* Reset body for PDF */
            body {
                max-width: 100%;
                margin: 0;
                padding: 0;
                font-size: 11pt;
                line-height: 1.6;
                color: #000;
                background: #fff;
            }

            /* Container adjustments */
            .container {
                max-width: 100%;
                margin: 0;
                padding: 0;
            }

            .content-wrapper {
                max-width: 100%;
                padding: 0.5in;
                box-shadow: none;
                border-radius: 0;
                background: #fff;
            }

            /* Work header styling for print */
            .work-header {
                margin-bottom: 0.3in;
                page-break-after: avoid;
            }

            .eul-wid-top-left {
                position: static;
                font-size: 9pt;
                color: #666;
                margin-bottom: 0.1in;
            }

            /* In print the eul_wid badge flows statically; the DOI badge
               follows it in normal flow rather than overlapping the title. */
            .doi-badge.doi-badge-identity {
                position: static;
                display: block;
                margin-bottom: 0.1in;
            }

            .author-name {
                font-size: 11pt;
                color: #333;
                margin-bottom: 0.1in;
            }

            h1 {
                font-size: 16pt;
                color: #000;
                border-bottom: 2px solid #000;
                padding-bottom: 0.1in;
                margin-top: 0;
                page-break-after: avoid;
            }

            .work-metadata {
                font-size: 9pt;
                color: #666;
                margin-top: 0.1in;
                margin-bottom: 0.2in;
                text-align: left;
            }

            /* Table styling for print */
            table {
                width: 100%;
                margin-top: 0.2in;
                font-size: 11pt;
            }

            thead {
                display: none !important;
            }

            tr {
                page-break-inside: avoid;
            }

            td:first-child {
                width: 0.5in;
                font-size: 9pt;
                opacity: 1 !important;
                color: #666;
                padding: 3px 8px;
            }

            td:last-child {
                font-size: 11pt;
                line-height: 1.6;
                padding: 3px 12px;
                color: #000;
            }

            .title-row td:last-child {
                font-weight: 600;
                font-style: italic;
                text-align: center;
                padding: 8px;
            }

            /* Page setup */
            @page {
                size: letter;
                margin: 0.75in 0.5in;
            }

            /* Prevent orphans and widows */
            p, td {
                orphans: 3;
                widows: 3;
            }

            h1, h2, h3, h4, h5, h6 {
                page-break-after: avoid;
            }
        }
/* Utility-page extras — site chrome look is concat-last site_chrome.css. */

/* Utility main column: undo work-page flex centre (single-column pages only). */
main > .container:not(:has(.content-wrapper)),
main > .utility-container-wide {
    display: block;
    min-width: 0;
}

main > .container:not(:has(.content-wrapper)) {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
}

main > .utility-container-wide,
main > .container.utility-container-wide {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 20px;
}


/* Contact + shared utility layout */
        .container {
            max-width: 700px;
            margin: 0 auto;
            padding: 40px 20px;
        }

        h1 {
            font-size: 1.8em;
            font-weight: 300;
            color: var(--text-primary);
            margin-bottom: 8px;
        }

        .page-intro {
            color: var(--text-muted);
            font-size: 1.05em;
            margin-bottom: 32px;
            line-height: 1.7;
        }

        .contact-form {
            background: var(--surface-card);
            border: 1px solid var(--border-default);
            border-radius: 0;
            padding: 32px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            font-weight: 600;
            font-size: 0.9em;
            color: var(--text-secondary);
            margin-bottom: 6px;
        }

        .form-group label .required {
            color: var(--status-danger-ink);
        }

        .form-group input,
        .form-group textarea {
            width: 100%;
            padding: 10px 14px;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
            font-size: 1em;
            border: 1px solid var(--border-strong);
            border-radius: 3px;
            background: var(--surface-recessed);
            color: var(--text-primary);
            transition: border-color 0.2s;
        }

        .form-group input:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--border-strong);
            background: var(--surface-card);
        }

        .form-group textarea {
            min-height: 160px;
            resize: vertical;
        }

        /* Honeypot - invisible to humans */
        .form-hp { position: absolute; left: -9999px; }

        .submit-btn {
            display: inline-block;
            background: var(--bar-bg);
            color: var(--bar-ink);
            border: none;
            padding: 12px 32px;
            font-family: 'Source Sans Pro', -apple-system, sans-serif;
            font-size: 1em;
            font-weight: 600;
            border-radius: 3px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .submit-btn:hover { background: var(--surface-code); }
        .submit-btn:disabled {
            background: var(--accent);
            cursor: not-allowed;
        }

        .form-status {
            margin-top: 16px;
            padding: 12px 16px;
            border-radius: 3px;
            display: none;
            font-size: 0.95em;
        }

        .form-status.success {
            display: block;
            background: var(--status-success-bg);
            border: 1px solid var(--status-success-border);
            color: var(--status-success-ink);
        }

        .form-status.error {
            display: block;
            background: var(--status-danger-bg);
            border: 1px solid var(--status-danger-border);
            color: var(--status-danger-ink);
        }

        .footer {
            background:
                linear-gradient(180deg,
                    #556170 0%,
                    #3d4852 38%,
                    #2c343c 100%);
            border-top: 1px solid var(--rim);
            box-shadow:
                0 -8px 24px rgba(0, 0, 0, 0.28),
                inset 0 1px 0 rgba(255, 255, 255, 0.14),
                inset 0 -2px 0 rgba(0, 0, 0, 0.35);
            color: var(--chrome-ink);
            text-align: center;
            padding: 30px 20px;
            margin-top: 60px;
            font-size: 0.9em;
        }
        .footer a { color: #E2E8F0; text-decoration: none; }
        .footer a:hover { text-decoration: underline; }

        @media (max-width: 768px) {
            .container { padding: 24px 16px; }
            .contact-form { padding: 20px; }
            h1 { font-size: 1.5em; }
        }

/* Sources page content */
        .container {
            max-width: 1200px;
            margin: 10px auto;
            padding: 0 20px;
        }
        
        .content-wrapper {
            padding: 20px 35px;
            position: relative;
        }
        
        h1 {
            color: var(--text-primary);
            margin-bottom: 15px;
            margin-top: 30px;
            font-size: 2em;
            font-weight: 600;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }
        
        .greek-title {
            font-size: 1.3rem;
            color: var(--text-muted);
            font-style: italic;
            margin-top: -10px;
            margin-bottom: 20px;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }
        
        h2 {
            color: var(--text-primary);
            margin-top: 2.5rem;
            margin-bottom: 1rem;
            font-size: 1.6em;
            font-weight: 600;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }
        
        p {
            margin-bottom: 1rem;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        }
        
        .section-intro {
            font-size: 1rem;
            color: var(--text-muted);
            margin-bottom: 1.5rem;
        }
        
        .source-entry {
            margin-bottom: 2rem;
            padding: 15px 20px;
            background: var(--surface-card);
            border-radius: 0;
            border: 1px solid var(--border-default);
            border-left: 4px solid var(--accent);
            transition: background-color 0.2s ease, border-color 0.2s ease;
        }

        .source-entry:hover {
            background: var(--surface-hover);
            border-color: var(--border-strong);
            border-left-color: var(--accent);
        }
        
        .source-name {
            font-weight: 700;
            font-size: 1.15rem;
            margin-bottom: 0.5rem;
            font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
            color: var(--text-primary);
        }
        
        .source-name a {
            color: var(--accent-ink);
            text-decoration: underline;
        }

        .source-name a:hover {
            color: var(--text-primary);
        }
        
        .source-institution {
            font-size: 0.95rem;
            color: var(--text-muted);
            margin-bottom: 0.5rem;
        }
        
        .source-description {
            font-size: 0.95rem;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
            line-height: 1.6;
        }
        
        .provenance-note {
            margin: 1.5rem 0 2rem 0;
            padding: 18px 22px;
            background: var(--surface-recessed);
            border: 1px solid var(--border-default);
            border-left: 4px solid var(--accent);
            border-radius: 0;
        }

        .provenance-note-heading {
            font-size: 0.8rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
            margin-bottom: 0.6rem;
        }

        .provenance-note p {
            font-size: 0.97rem;
            color: var(--text-secondary);
            margin-bottom: 0.6rem;
            line-height: 1.65;
        }

        .provenance-note p:last-child {
            margin-bottom: 0;
        }

        .source-license {
            font-size: 0.85rem;
            color: var(--text-muted);
            font-style: italic;
        }
        
        .license-badge {
            display: inline-block;
            background: var(--surface-chip);
            padding: 0.2rem 0.6rem;
            border-radius: 4px;
            font-size: 0.8rem;
            font-style: normal;
            color: var(--text-secondary);
            font-weight: 600;
            margin-right: 0.5rem;
            border: 1px solid var(--border-default);
        }

        .example-stage-title {
            font-size: 1rem;
            font-weight: 700;
            color: var(--text-primary);
            margin: 1.25rem 0 0.5rem 0;
        }

        .ocr-intermediate {
            font-size: 1.05rem;
            line-height: 1.55;
            color: var(--text-primary);
            background: var(--surface-card);
            border: 1px solid var(--border-default);
            border-left: 4px solid var(--accent);
            border-radius: 0;
            padding: 14px 16px;
        }

        .flow-frame {
            margin: 0.6rem 0 1.8rem 0;
            padding: 14px 14px 12px 14px;
            background: var(--surface-card);
            border: 1px solid var(--border-default);
            border-left: 4px solid var(--accent);
            border-radius: 0;
        }

        .flow-controls {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 12px;
            color: var(--text-secondary);
            font-size: 0.95rem;
        }

        .flow-controls input[type="range"] {
            width: 180px;
        }

        .flow-controls output {
            min-width: 44px;
            font-family: 'Courier New', monospace;
            font-size: 0.85rem;
            color: var(--text-primary);
        }

        .flow-viewport {
            width: 100%;
            max-width: 100%;
            min-width: 320px;
            resize: horizontal;
            overflow: auto;
            margin: 0 auto;
            padding: 8px 4px;
            border: 1px dashed var(--border-default);
            border-radius: 0;
            background: var(--surface-recessed);
        }

        .flow-row {
            display: grid;
            grid-template-columns: 72px 1fr;
            column-gap: 8px;
            margin-bottom: 10px;
        }

        .flow-row:last-child {
            margin-bottom: 0;
        }

        .flow-ref {
            text-align: center;
            color: var(--text-primary);
            font-size: 0.85rem;
            font-family: 'Courier New', monospace;
            opacity: 0.35;
            transition: opacity 0.2s ease-in-out;
        }

        .flow-row:hover .flow-ref {
            opacity: 1;
        }

        .flow-text {
            font-size: 1.2rem;
            line-height: 1.7;
            color: var(--text-primary);
        }

        .flow-hint {
            margin: 10px 0 0 0;
            font-size: 0.9rem;
            color: var(--text-muted);
        }

/* 404 — scoped (body.page-404) */
/* Source: public/404.html */
        body.page-404 {
            font-family: 'Gentium Plus', 'Source Sans Pro', Georgia, serif;
            max-width: 800px;
            margin: 100px auto;
            padding: 20px;
            text-align: center;
            color: var(--text-secondary);
        }

        h1 {
            font-size: 3em;
            color: var(--text-primary);
            margin-bottom: 0.5em;
        }
        p {
            font-size: 1.2em;
            line-height: 1.6;
            margin-bottom: 2em;
        }
        a {
            color: var(--accent-ink);
            text-decoration: none;
            font-weight: bold;
        }
        a:hover {
            text-decoration: underline;
        }
        .greek {
            font-size: 2em;
            color: var(--text-secondary);
            margin: 1em 0;
        }

/* For Agents */
        .container {
            max-width: 760px;
            margin: 0 auto;
            padding: 40px 20px;
        }

        h1 {
            font-size: 1.9em;
            font-weight: 300;
            color: var(--text-primary);
            margin-bottom: 8px;
        }

        .page-intro {
            color: var(--text-muted);
            font-size: 1.05em;
            margin-bottom: 24px;
            line-height: 1.7;
        }

        h2 {
            font-size: 1.25em;
            font-weight: 600;
            color: var(--text-primary);
            margin-top: 36px;
            margin-bottom: 12px;
        }

        h3 {
            font-size: 1em;
            font-weight: 600;
            color: var(--text-secondary);
            margin-top: 18px;
            margin-bottom: 6px;
        }

        p { margin-bottom: 12px; }

        ul {
            margin: 0 0 16px 24px;
        }
        ul li { margin-bottom: 6px; }

        a { color: var(--accent-ink); }
        a:hover { color: var(--text-secondary); }

        code {
            font-family: 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
            font-size: 0.92em;
            background: var(--surface-page);
            padding: 1px 6px;
            border-radius: 3px;
            color: var(--text-primary);
        }

        pre {
            background: var(--surface-code);
            color: var(--chrome-ink);
            font-family: 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
            font-size: 0.88em;
            line-height: 1.55;
            padding: 16px 20px;
            border-radius: 0;
            overflow-x: auto;
            margin: 0 0 18px 0;
        }
        pre code {
            background: transparent;
            padding: 0;
            color: inherit;
            font-size: inherit;
        }
        pre .comment { color: #A0AEC0; }
        pre .out { color: var(--accent); }

        .install-block {
            background: var(--surface-code);
            color: var(--chrome-ink);
            padding: 18px 20px;
            border-radius: 0;
            font-family: 'SF Mono', Menlo, Consolas, monospace;
            font-size: 1.05em;
            margin: 8px 0 20px 0;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .install-block::before {
            content: '$';
            color: var(--accent);
            user-select: none;
        }

        .notice {
            background: var(--surface-recessed);
            border: 1px solid var(--border-default);
            border-left: 4px solid var(--accent);
            padding: 16px 20px;
            border-radius: 0;
            margin: 0 0 32px 0;
            font-size: 0.97em;
            color: var(--text-secondary);
        }
        .notice strong {
            color: var(--text-primary);
        }

        .url-list {
            background: var(--surface-card);
            border: 1px solid var(--border-default);
            border-radius: 0;
            padding: 4px 0;
            margin-bottom: 20px;
        }
        .url-list-item {
            padding: 10px 18px;
            border-bottom: 1px solid var(--border-hairline);
        }
        .url-list-item:last-child { border-bottom: none; }
        .url-list-item code {
            font-size: 0.92em;
            background: transparent;
            padding: 0;
            color: var(--text-primary);
        }
        .url-list-item .desc {
            display: block;
            margin-top: 3px;
            color: var(--text-muted);
            font-size: 0.92em;
        }

        .footer {
            background:
                linear-gradient(180deg,
                    #556170 0%,
                    #3d4852 38%,
                    #2c343c 100%);
            border-top: 1px solid var(--rim);
            box-shadow:
                0 -8px 24px rgba(0, 0, 0, 0.28),
                inset 0 1px 0 rgba(255, 255, 255, 0.14),
                inset 0 -2px 0 rgba(0, 0, 0, 0.35);
            color: var(--chrome-ink);
            text-align: center;
            padding: 30px 20px;
            margin-top: 60px;
            font-size: 0.9em;
        }
        .footer a { color: #E2E8F0; text-decoration: none; }
        .footer a:hover { text-decoration: underline; }

        @media (max-width: 768px) {
            .container { padding: 24px 16px; }
            h1 { font-size: 1.55em; }
            pre { font-size: 0.82em; padding: 12px 14px; }
            .install-block { font-size: 0.95em; }
        }

/* Dataset */
        .container {
            max-width: 820px;
            margin: 0 auto;
            padding: 40px 20px;
        }

        h1 {
            font-size: 1.8em;
            font-weight: 300;
            color: var(--text-primary);
            margin-bottom: 8px;
        }

        h2 {
            font-size: 1.3em;
            font-weight: 600;
            color: var(--text-primary);
            margin: 36px 0 14px;
        }

        .page-intro {
            color: var(--text-muted);
            font-size: 1.05em;
            margin-bottom: 8px;
            line-height: 1.7;
        }

        .download-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 16px;
            margin-top: 8px;
        }
        .download-card {
            background: var(--surface-card);
            border: 1px solid var(--border-default);
            border-radius: 0;
            padding: 20px;
            display: flex;
            flex-direction: column;
        }
        .download-card h3 {
            font-size: 1.05em;
            font-weight: 600;
            margin-bottom: 6px;
        }
        .download-card p {
            color: var(--text-muted);
            font-size: 0.92em;
            margin-bottom: 16px;
            flex-grow: 1;
        }
        .btn {
            display: inline-block;
            background: var(--bar-bg);
            color: var(--bar-ink);
            text-decoration: none;
            padding: 9px 18px;
            font-size: 0.95em;
            font-weight: 600;
            border-radius: 3px;
            text-align: center;
            transition: background 0.2s;
        }
        .btn:hover { background: var(--surface-code); }

        .info-table {
            width: 100%;
            border-collapse: collapse;
            background: var(--surface-card);
            border: 1px solid var(--border-default);
            border-radius: 0;
            overflow: hidden;
        }
        .info-table th, .info-table td {
            text-align: left;
            padding: 10px 14px;
            border-bottom: 1px solid var(--border-hairline);
            font-size: 0.95em;
        }
        .info-table th { background: var(--surface-recessed); font-weight: 600; }
        .info-table tr:last-child td { border-bottom: none; }

        .citation-block {
            background: var(--surface-card);
            border: 1px solid var(--border-default);
            border-radius: 0;
            padding: 18px;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            font-size: 0.88em;
            white-space: pre-wrap;
            word-break: break-word;
            color: var(--text-primary);
        }

        .note {
            color: var(--text-muted);
            font-size: 0.95em;
            margin-top: 12px;
        }
        .note a { color: var(--accent-ink); }

/* llms.html — scoped (body.page-llms) */
/* Source: public/llms.html */
        body.page-llms {
            font-family: Georgia, 'Times New Roman', serif;
            max-width: 720px;
            margin: 3rem auto;
            padding: 0 1.5rem;
            color: var(--text-primary);
            line-height: 1.7;
        }
        h1 { font-size: 1.8rem; margin-bottom: 0.25rem; }
        blockquote {
            border-left: 3px solid var(--border-strong);
            margin: 1.2rem 0;
            padding: 0.5rem 1.2rem;
            color: var(--text-secondary);
            font-style: italic;
        }
        h2 { font-size: 1.2rem; margin-top: 2rem; }
        ul { padding-left: 1.5rem; }
        li { margin-bottom: 0.4rem; }
        code { font-family: monospace; background: var(--surface-chip); padding: 0.1em 0.3em; border-radius: 3px; }
        .meta { font-size: 0.9rem; color: var(--text-muted); margin-top: 3rem; border-top: 1px solid var(--border-default); padding-top: 1rem; }
        a { color: var(--accent-ink); }

/* Reference grammars shelf (/grammars) */
.grammar-shelf-card {
    border: 1px solid var(--border-default);
    border-radius: 0;
    padding: 22px 24px;
    margin: 18px 0;
    background: var(--surface-card);
}

.grammar-shelf-card-title {
    font-size: 1.4em;
    margin-bottom: 2px;
    color: var(--accent-ink);
}

.grammar-shelf-meta {
    color: var(--text-muted);
    margin-bottom: 10px;
}

.grammar-shelf-blurb {
    line-height: 1.55;
}

.grammar-shelf-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 6px;
    align-items: center;
    justify-content: center;
}

/* Equal footprint — house .download-btn colour/padding; width locked to the
   longest label so PDF / EPUB / Markdown read as one row of twins. */
.grammar-shelf-downloads .download-btn {
    min-width: 8rem;
    justify-content: center;
}
/* Catalog layout; palette and typography inherit the shared site tokens. */
.page-catalog main > .utility-container-wide { max-width: 1200px; width: 100%; padding: 48px 55px; }
.catalog-eyebrow { color: var(--text-muted); font-size: .75rem; letter-spacing: .17em; font-weight: 600; margin: 0 0 12px; }
.page-catalog h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 16px; }
.page-catalog .page-intro { margin-bottom: 30px; }
.catalog-toolbar { display: flex; align-items: end; gap: 20px; padding-bottom: 28px; border-bottom: 1px solid var(--border-strong); }
.catalog-search-wrap { flex: 1; max-width: 620px; }
.catalog-search-wrap label { display: block; margin-bottom: 8px; font-size: .9rem; font-weight: 600; }
#catalog-search { width: 100%; box-sizing: border-box; padding: 12px 14px; font: inherit; color: var(--text-primary); background: var(--surface-card); border: 1px solid var(--border-strong); border-radius: 3px; }
#catalog button { font: inherit; color: var(--text-primary); background: var(--surface-card); border: 1px solid var(--border-strong); padding: 11px 16px; border-radius: 3px; cursor: pointer; }
#catalog button:hover { background: var(--surface-hover); }
#catalog :focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.catalog-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 42px; padding-top: 26px; align-items: start; }
#catalog-facets fieldset { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
#catalog-facets legend, #catalog-facets summary { font-size: 1rem; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
#catalog-facets details { padding: 16px 0 0; border-top: 1px solid var(--border-default); margin-bottom: 12px; }
#catalog-facets summary { cursor: pointer; }
#catalog-facets label { display: flex; align-items: start; gap: 8px; padding: 6px 2px; cursor: pointer; font-size: .94rem; line-height: 1.4; }
#catalog-facets label:hover { background: var(--surface-hover); }
#catalog-facets input { margin: 4px 2px 0 0; flex: 0 0 auto; accent-color: var(--accent-ink); width: 15px; height: 15px; }
#catalog-facets [lang="grc"] { display: block; color: var(--text-muted); font-size: .84rem; }
.catalog-option-count { margin-left: auto; padding-left: 8px; color: var(--text-muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.catalog-help { font-size: .83rem; line-height: 1.6; color: var(--text-muted); margin: 20px 0; }
#catalog-count { margin: 0; padding: 0 0 16px; color: var(--text-secondary); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--border-default); }
#catalog-results { list-style: none; padding: 0; margin: 0 0 24px; }
#catalog-results > li { padding: 22px 0; border-bottom: 1px solid var(--border-default); }
#catalog-results .catalog-work-title { font-size: 1.2rem; font-weight: 500; margin: 0 0 6px; }
#catalog-results a { color: var(--text-primary); text-decoration: none; }
#catalog-results a:hover { text-decoration: underline; }
#catalog-results p { margin: 5px 0; line-height: 1.5; }
.catalog-work-author { color: var(--text-secondary); font-size: .95rem; }
.catalog-work-greek { display: block; margin-top: 6px; color: var(--text-muted); font-size: 1rem; }
.catalog-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.catalog-chip { background: var(--surface-chip); border: 1px solid var(--border-default); color: var(--text-secondary); padding: 3px 8px; font-size: .76rem; border-radius: 2px; }
.catalog-id { font-size: .75rem; color: var(--text-muted); }
#catalog-error { padding: 15px; background: var(--status-danger-bg); color: var(--status-danger-ink); border: 1px solid var(--status-danger-border); }
#catalog [hidden] { display: none !important; }
@media (max-width: 760px) {
    .page-catalog main > .utility-container-wide { padding: 30px 18px; }
    .catalog-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .catalog-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
    #catalog-reset { align-self: start; }
    #catalog-facets { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 20px; }
    #catalog-facets > details { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { #catalog * { scroll-behavior: auto; } }
/*
 * Site chrome look — navbar wash, drawer hamburger, theme-toggle, share cluster.
 * Appended last onto every bundle by stylesheet_registry.py (SITE_CHROME_FILE).
 * HTML/JS owner: src/core/site_chrome.py. Do not copy these selectors into
 * page sheets. Navbar position is a page particular (relative vs sticky).
 */

.navbar {
    background:
        linear-gradient(180deg,
            #556170 0%,
            #3d4852 38%,
            #2c343c 100%);
    color: #E2E8F0;
    padding: 20px 0;
    border-bottom: 1px solid var(--rim);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -2px 0 rgba(0, 0, 0, 0.35);
    z-index: 100;
}

.navbar,
.hamburger-menu-panel {
    font-weight: 400;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.home-link {
    color: var(--wordmark);
    text-decoration: none;
    font-weight: 300;
    font-size: 3.75em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    line-height: 1;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.28),
        0 -1px 0 rgba(0, 0, 0, 0.55),
        0 2px 2px rgba(0, 0, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.32);
}

.home-link:hover {
    color: #fff;
    text-decoration: none;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.32),
        0 -1px 0 rgba(0, 0, 0, 0.5),
        0 2px 3px rgba(0, 0, 0, 0.45),
        0 5px 10px rgba(0, 0, 0, 0.35);
}

.navbar-subtitle {
    color: #CBD5E0;
    font-size: 0.9em;
    margin-top: 0px;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.4;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.45);
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

.nav-tabs {
    display: flex;
    gap: 0;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}

.nav-tab {
    color: #CBD5E0;
    text-decoration: none;
    font-size: 1em;
    font-weight: 400;
    padding: 8px 18px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
        'Segoe UI', Arial, sans-serif;
}

.nav-tab:hover {
    color: white;
    border-bottom-color: var(--accent);
}

.hamburger-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 350;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background-color: #E2E8F0;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-menu-toggle:hover .hamburger-line {
    background-color: white;
}

.hamburger-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.hamburger-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 250;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hamburger-menu-overlay.visible {
    display: block;
    opacity: 1;
}

.hamburger-menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: #3D4852;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.hamburger-menu-panel.open {
    transform: translateX(0);
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section:last-child {
    margin-bottom: 0;
}

.menu-section-title {
    color: #E2E8F0;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-link {
    display: block;
    color: #E2E8F0;
    text-decoration: none;
    padding: 12px 0;
    font-size: 1em;
    transition: color 0.3s;
}

.menu-link:hover {
    color: white;
}

.theme-toggle {
    position: absolute;
    right: 20px;
    top: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    z-index: 120;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: #FFFFFF;
    border-color: var(--accent);
    outline: none;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

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

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Share cluster — the .theme-toggle recipe mirrored to the left corner.
 * Desktop-only (the drawer Share section covers mobile). HTML/JS owner:
 * src/core/site_chrome.py. */
.share-cluster {
    position: absolute;
    left: 20px;
    top: 14px;
    display: flex;
    gap: 6px;
    z-index: 120;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.share-btn:hover,
.share-btn:focus-visible {
    color: #FFFFFF;
    border-color: var(--accent);
    outline: none;
}

.share-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Brand fill glyphs sit one optical step smaller than the stroke glyphs. */
.share-btn .icon-fill {
    width: 18px;
    height: 18px;
}

.share-btn .icon-check {
    display: none;
}

.share-btn.copied .icon-link {
    display: none;
}

.share-btn.copied .icon-check {
    display: block;
}

/* Bluesky/Mastodon pop-out — the .downloads-content recipe anchored left. */
.share-popout {
    display: none;
    position: absolute;
    left: 20px;
    top: 58px;
    flex-direction: column;
    min-width: 160px;
    padding: 6px;
    background: #3D4852;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 130;
}

.share-popout.open {
    display: flex;
}

.share-popout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #E2E8F0;
    font-size: 0.95em;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.share-popout-link:hover,
.share-popout-link:focus-visible {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.share-popout-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Visually hidden copy-feedback live region. */
.share-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Drawer Share rows — .menu-link rhythm with a small icon. */
.menu-share-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 0;
    background: transparent;
    border: none;
    color: #E2E8F0;
    font-size: 1em;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: color 0.3s;
}

.menu-share-link:hover {
    color: white;
}

.menu-share-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

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

    .home-link {
        font-size: 3em;
        gap: 6px;
    }

    .share-cluster {
        left: 15px;
        gap: 4px;
    }
}

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

    .navbar-content {
        padding: 0 15px;
    }

    .hamburger-menu-toggle {
        display: flex;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block;
    }

    .nav-center {
        width: 100%;
    }

    .home-link {
        font-size: 2.5em;
        gap: 6px;
    }

    .navbar-subtitle {
        font-size: 0.8em;
        padding-left: 0;
    }

    /* The drawer Share section is the mobile share surface. */
    .share-cluster,
    .share-popout {
        display: none !important;
    }
}

@media (max-width: 600px) {
    .theme-toggle {
        right: 12px;
        top: 10px;
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 12px 0;
    }

    .navbar-content {
        padding: 0 10px;
    }

    .home-link {
        font-size: 2em;
        gap: 8px;
    }

    .navbar-subtitle {
        font-size: 0.75em;
        padding-left: 0;
    }

    .hamburger-menu-toggle {
        width: 40px;
        height: 40px;
        padding: 8px;
    }
}

@media print {
    nav,
    .navbar,
    .navbar-content,
    .hamburger-menu-toggle,
    .hamburger-menu-overlay,
    .hamburger-menu-panel,
    .nav-tabs,
    .theme-toggle,
    .share-cluster,
    .share-popout {
        display: none !important;
    }
}
