/* X Codec Pack - site-wide styles (header, nav, footer basics, themes).
   Moved out of header.php on 2026-10-24. Linked with ?v=<mtime>, so the
   1-year browser cache never serves a stale copy. */

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

:root {
    --bg-dark: #0a0a0b;
    --bg-card: #111113;
    --bg-elevated: #18181b;
    --border: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-primary: #34d399;
    --accent-secondary: #22d3ee;
    --accent-tertiary: #38bdf8;
    --success: #34d399;
    --gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-tertiary) 100%);
    --accent-hover: #4ade80;
    --nav-bg: rgba(10, 10, 11, 0.85);
    --nav-bg-solid: rgba(10, 10, 11, 0.97);
    --menu-bg: rgba(17, 17, 19, 0.98);
    --panel-soft: rgba(17, 17, 19, 0.5);
    --orb-opacity: 0.12;
    color-scheme: dark;
}

/* ===== Light theme ===== */
:root[data-theme="light"] {
    --bg-dark: #f2f6f9;          /* Ocean (2026-10-25), was #f6f8f7 */
    --bg-card: #ffffff;
    --bg-elevated: #eaf0ed;
    --border: #d9e1dd;
    --text-primary: #0e1412;
    --text-secondary: #3d4844;
    --text-muted: #5b6762;
    --accent-primary: #047857;
    --accent-secondary: #0e7490;
    --accent-tertiary: #0369a1;
    --success: #047857;
    --accent-hover: #065f46;
    --nav-bg: rgba(228, 241, 247, 0.94);      /* Ocean header */
    --nav-bg-solid: rgba(228, 241, 247, 0.99);
    --menu-bg: rgba(255, 255, 255, 0.99);
    --panel-soft: rgba(14, 20, 18, 0.03);
    --orb-opacity: 0.07;
    /* fallbacks some tool pages read (codec-inspector GUID lookup etc.) */
    --bg-panel: #ffffff;
    --bg-primary: #f2f6f9;
    color-scheme: light;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Skip to main content - Accessibility */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--accent-primary);
    color: var(--bg-dark);
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 8px;
    z-index: 10000;
    font-weight: 600;
}

.skip-link:focus {
    position: fixed;
    top: 10px;
    left: 10px;
    width: auto;
    height: auto;
    overflow: visible;
}

/* Animated background grid */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(52, 211, 153, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(52, 211, 153, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Glow orbs - painted with a radial gradient (cheap) instead of filter: blur() (expensive on mobile GPUs) */
.glow-orb {
    position: fixed;
    width: 900px;
    height: 900px;
    border-radius: 50%;
    opacity: var(--orb-opacity);
    pointer-events: none;
    z-index: 0;
    contain: strict;
}

.glow-orb-1 {
    top: -350px;
    right: -250px;
    background: radial-gradient(circle at center, var(--accent-primary) 0%, transparent 60%);
}

.glow-orb-2 {
    bottom: -350px;
    left: -250px;
    background: radial-gradient(circle at center, var(--accent-secondary) 0%, transparent 60%);
}

/* Version badge (next to logo) */
.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 99px;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.25);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 14px;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.version-badge:hover,
.version-badge:focus-visible {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.5);
    transform: translateY(-1px);
}

/* Shimmer sweep across badge */
.version-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.18), transparent);
    transform: translateX(-200%);
    animation: badgeShimmer 3.5s ease-in-out 3;
    pointer-events: none;
    will-change: transform;
}

@keyframes badgeShimmer {
    0% { transform: translateX(-200%); }
    60%, 100% { transform: translateX(400%); }
}

.version-num {
    display: inline-flex;
    align-items: baseline;
    position: relative;
    z-index: 1;
}

/* Slot-roll number reel - rolls through versions and settles on the current release */
.version-roll {
    display: inline-block;
    height: 14px;
    line-height: 14px;
    overflow: hidden;
    vertical-align: bottom;
    position: relative;
    z-index: 1;
}

.version-roll-inner {
    display: flex;
    flex-direction: column;
    animation: versionRoll 1.7s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

.version-roll-inner span {
    display: block;
    height: 14px;
    line-height: 14px;
}

@keyframes versionRoll {
    /* 7 items * 14px each = 98px total. The final item is SITE_VERSION and sits at offset -84px. */
    0%   { transform: translateY(0); }
    100% { transform: translateY(-84px); }
}

/* Honor reduced-motion preference: skip the roll, show final value */
@media (prefers-reduced-motion: reduce) {
    .version-roll-inner {
        animation: none;
        transform: translateY(-84px);
    }
    .version-badge::before {
        animation: none;
        display: none;
    }
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 14px 32px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    width: 165px;
    height: 110px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    margin-left: 48px;
    align-items: center;
}

.nav-links > li {
    position: relative;
}

.nav-links a,
.nav-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.nav-links > li > a:hover,
.nav-links > li > a:focus-visible,
.nav-links > li > a.active,
.nav-dropdown-btn:hover,
.nav-dropdown-btn:focus-visible,
.nav-links > li:hover .nav-dropdown-btn,
.nav-links > li:focus-within .nav-dropdown-btn {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-links > li > a.active,
.nav-dropdown-btn.active {
    color: var(--accent-primary);
}

.nav-dropdown-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-links > li:hover .nav-dropdown-chevron,
.nav-links > li:focus-within .nav-dropdown-chevron {
    transform: rotate(180deg);
}

/* Dropdown menu */
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 280px;
    background: var(--menu-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    list-style: none;
    margin: 0;
    z-index: 1001;
}

.nav-links > li:hover .nav-dropdown-menu,
.nav-links > li:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: block;
    padding: 9px 14px;
    font-size: 14px;
    border-radius: 7px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.nav-dropdown-menu a.active {
    color: var(--accent-primary);
}

.nav-dropdown-menu a .menu-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

/* "View all tools" link at the bottom of the Tools dropdown */
.nav-dropdown-all {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}
.nav-dropdown-all a {
    font-weight: 600;
    color: var(--accent-primary) !important;
}
.nav-dropdown-all a:hover,
.nav-dropdown-all a:focus-visible {
    background: rgba(52, 211, 153, 0.1) !important;
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-primary);
    color: var(--bg-dark);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-cta:hover,
.nav-cta:focus {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(52, 211, 153, 0.25);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent-primary);
    color: var(--bg-dark);
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 20px 60px rgba(52, 211, 153, 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: var(--bg-card);
    border-color: var(--accent-primary);
}

/* Gradient text */
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Section styles */
.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(36px, 4vw, 56px);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.section-description {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 48px;
}

/* AdSense Container */
.ad-container {
    position: relative;
    z-index: 1;
    padding: 24px 32px;
    text-align: center;
}

.ad-container-inner {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.ad-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

/* Page Header */
.page-header {
    position: relative;
    z-index: 1;
    padding: 190px 32px 80px;
    text-align: center;
}

.page-header h1 {
    font-size: clamp(40px, 5vw, 64px);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
}

.page-header p {
    font-size: 20px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Content sections */
.content-section {
    position: relative;
    z-index: 1;
    padding: 80px 32px;
}

.content-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        padding: 12px 20px 0;
        top: 0;
        background: var(--nav-bg-solid);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .logo-icon {
        width: 60px;
        height: 34px;
    }

    .logo {
        font-size: 18px;
        gap: 10px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-dark);
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 0 0 16px 16px;
        margin: 0 16px;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links > li {
        width: 100%;
    }

    .nav-links > li > a,
    .nav-dropdown-btn {
        width: 100%;
        padding: 14px 16px;
        justify-content: space-between;
    }

    /* Mobile: dropdowns become accordions - open only when .is-open is set */
    .nav-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: 4px 0 4px 12px;
        margin-top: 2px;
        display: none;
        min-width: 0;
    }

    .nav-links > li.is-open .nav-dropdown-menu {
        display: block;
    }

    .nav-links > li.is-open .nav-dropdown-chevron {
        transform: rotate(180deg);
    }

    /* Disable desktop hover-open on mobile (touch devices re-open on tap-away) */
    .nav-links > li:hover .nav-dropdown-menu,
    .nav-links > li:focus-within .nav-dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .nav-links > li:not(.is-open):hover .nav-dropdown-menu,
    .nav-links > li:not(.is-open):focus-within .nav-dropdown-menu {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        order: 3;
        margin-left: 6px;
    }

    /* Compact header row: logo | theme + download icon | menu */
    .nav-container { gap: 8px; }
    .logo-group { gap: 8px; min-width: 0; }
    .logo span { white-space: nowrap; }
    .nav-actions { order: 2; margin-left: auto; }
    .theme-toggle { margin-right: 6px; }
    .nav-cta { padding: 10px 12px; }
    .nav-cta-label { display: none; }

    .page-header {
        padding: 150px 20px 60px;
    }

    .content-section {
        padding: 60px 20px;
    }
}

/* AdSense Auto ads guard - Google injects .google-auto-placed wrappers anywhere,
   including inside 2-column grids, where an 860px ad overflows a 300px column
   and covers text. Force them onto their own full-width row. */
.google-auto-placed {
    grid-column: 1 / -1 !important;
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    clear: both;
    margin: 24px 0 !important;
}
/* Hide ad units Google could not fill (documented AdSense pattern) - no empty white boxes */
ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}

/* Theme toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 10px;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.nav-actions {
    display: flex;
    align-items: center;
}

/* Light theme - fixes for colours hard-coded in individual pages */
:root[data-theme="light"] .info-section-alt { background: rgba(14, 20, 18, 0.03); }
:root[data-theme="light"] .components,
:root[data-theme="light"] .mirrors,
:root[data-theme="light"] .comparison { background: linear-gradient(180deg, transparent 0%, rgba(14, 20, 18, 0.04) 100%); }
:root[data-theme="light"] .btn-primary:hover,
:root[data-theme="light"] .nav-cta:hover,
:root[data-theme="light"] .download-btn:hover,
:root[data-theme="light"] .download-btn-large:hover,
:root[data-theme="light"] .hero-dl-btn:hover,
:root[data-theme="light"] .encode-btn:hover:not(:disabled),
:root[data-theme="light"] .result-dl:hover,
:root[data-theme="light"] .aside-dl-btn:hover,
:root[data-theme="light"] .compare-dl:hover,
:root[data-theme="light"] .dl-sidebar-btn:hover,
:root[data-theme="light"] .hevc-cta-btn:hover,
:root[data-theme="light"] .encoder-cta-btn:hover,
:root[data-theme="light"] .btn-small:hover,
:root[data-theme="light"] .vvc-download-btn:hover { background: var(--accent-hover); }
:root[data-theme="light"] .xaac-component-link:focus { color: var(--accent-hover); }
:root[data-theme="light"] .xdh-btn-primary,
:root[data-theme="light"] .xdw-btn-primary { color: #ffffff; }
:root[data-theme="light"] .ae-badge { background: rgba(255, 255, 255, 0.85); }
/* VVC encoder page uses fixed dark panels */
:root[data-theme="light"] .vvc-explainer,
:root[data-theme="light"] .vvc-howitworks,
:root[data-theme="light"] .vvc-specs,
:root[data-theme="light"] .vvc-faq { background: #eef2f0; }
:root[data-theme="light"] .vvc-codec-table,
:root[data-theme="light"] .vvc-feature-card,
:root[data-theme="light"] .vvc-step,
:root[data-theme="light"] .vvc-usecase,
:root[data-theme="light"] .vvc-specs-table,
:root[data-theme="light"] .vvc-faq-item,
:root[data-theme="light"] .vvc-download-card { background: #ffffff; }
/* Light screenshots get a soft frame so they don't melt into the page */
:root[data-theme="light"] .hero-image-container,
:root[data-theme="light"] .formats-visual img { box-shadow: 0 20px 50px rgba(14, 20, 18, 0.12); }
:root[data-theme="light"] .glow-orb { display: none; }

/* Touch devices: no hover lift / big shadows on tap. A tap fires :hover, and repainting
   60px box-shadows right before navigation was adding paint time to every tap (INP). */
@media (hover: none) {
    a:hover, a:focus, button:hover, button:focus,
    [class*="card"]:hover, [class*="btn"]:hover, [class*="tag"]:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}

@media (max-width: 400px) {
    .version-badge { display: none; }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* ===== Mega menu (2026-10-24) =====
   Codecs and Tools open one wide panel under the whole nav bar; Guides
   (no featured card, two columns) opens a compact panel under its button.
   Markup comes from data/nav.php xcpRenderMega(). On phones every panel
   falls back to the accordion rules above (.nav-dropdown-menu). */
.nav-container { position: relative; }

@media (min-width: 769px) {
    .nav-links > li.has-mega { position: static; }
    .nav-links > li.has-mega.mega-compact { position: relative; }

    .mega-menu {
        left: 0;
        right: 0;
        top: calc(100% + 10px);
        min-width: 0;
        padding: 22px;
        border-radius: 16px;
    }
    .mega-compact .mega-menu {
        left: auto;
        right: 0;
        width: 560px;
        top: calc(100% + 6px);
    }
    /* invisible bridge so the pointer can travel from the button to the panel */
    .mega-menu::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -18px;
        height: 18px;
    }

    .mega-cols {
        display: grid;
        grid-template-columns: repeat(var(--mega-cols, 3), minmax(0, 1fr)) 250px;
        gap: 18px;
    }
    .mega-compact .mega-cols {
        grid-template-columns: repeat(var(--mega-cols, 2), minmax(0, 1fr));
    }
}

/* A dismissed panel (Esc) stays shut while the pointer is still over it */
.nav-links > li.is-dismissed .nav-dropdown-menu {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* nav links are nowrap/inline-flex by default - panel links wrap and align left */
.mega-menu a {
    white-space: normal;
    text-align: left;
}
.mega-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.mega-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 14px 8px;
}
.mega-menu .mega-col a {
    font-weight: 600;
    color: var(--text-primary);
    padding: 9px 14px;
}
.mega-menu .mega-col a .menu-sub {
    font-size: 12px;
    margin-top: 3px;
    line-height: 1.4;
    color: var(--text-secondary);
    font-weight: 400;
}
.mega-menu .mega-col a.active { color: var(--accent-primary); }
.mega-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 2px;
    color: var(--accent-primary);
    background: rgba(52, 211, 153, 0.12);
}
.mega-menu .mega-more a {
    font-size: 13px;
    color: var(--accent-primary);
}

.mega-menu a.mega-feature {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 20px;
    border-radius: 14px;
    border: 1px solid rgba(52, 211, 153, 0.28);
    background: linear-gradient(160deg, rgba(52, 211, 153, 0.14), rgba(34, 211, 238, 0.08));
    color: var(--text-primary);
}
.mega-menu a.mega-feature:hover,
.mega-menu a.mega-feature:focus-visible {
    border-color: var(--accent-primary);
    background: linear-gradient(160deg, rgba(52, 211, 153, 0.2), rgba(34, 211, 238, 0.12));
}
.mega-kicker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-primary);
}
.mega-feature strong {
    font-size: 18px;
    line-height: 1.25;
}
.mega-feature-text {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}
.mega-cta {
    margin-top: auto;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}

.mega-foot {
    margin-top: 14px;
    padding: 12px 14px 0;
    border-top: 1px solid var(--border);
}
.mega-menu .mega-foot a {
    display: inline-block;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}
.mega-menu .mega-foot a:hover { background: none; text-decoration: underline; }

@media (max-width: 768px) {
    .mega-cols { display: block; }
    .mega-col + .mega-col,
    .mega-menu a.mega-feature { margin-top: 10px; }
    .mega-title { padding: 6px 14px 4px; }
    .mega-menu a.mega-feature { padding: 14px; }
    .mega-feature-text { display: none; }
    .mega-foot { margin-top: 8px; padding-top: 10px; }
}

/* Narrow desktops: the featured card drops below the columns */
@media (min-width: 769px) and (max-width: 1100px) {
    .mega-cols { grid-template-columns: repeat(var(--mega-cols, 3), minmax(0, 1fr)); }
    .mega-menu a.mega-feature {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 14px 18px;
    }
    .mega-cta { margin-top: 0; margin-left: auto; }
}

/* ===== Site search (2026-10-25) - button in the nav, dialog from assets/js/search.js ===== */
.nav-search {
    height: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    margin-right: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-search:hover,
.nav-search:focus-visible {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}
.nav-search-label,
.nav-search-kbd { display: none; }
.nav-search-kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
}
@media (min-width: 1200px) {
    .nav-search { padding: 0 10px 0 12px; min-width: 150px; justify-content: flex-start; }
    .nav-search-label { display: inline; }
    .nav-search-kbd { display: inline; margin-left: auto; }
}
@media (max-width: 768px) {
    .nav-search { margin-right: 6px; }
}

html.xs-open { overflow: hidden; }
.xs-dialog {
    width: min(680px, calc(100vw - 32px));
    max-height: min(640px, calc(100vh - 96px));
    margin: 72px auto auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
}
.xs-dialog::backdrop {
    background: rgba(5, 5, 6, 0.6);
    backdrop-filter: blur(3px);
}
:root[data-theme="light"] .xs-dialog::backdrop { background: rgba(14, 20, 18, 0.35); }
.xs-box {
    display: flex;
    flex-direction: column;
    max-height: inherit;
}
.xs-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--accent-primary);
}
.xs-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 19px;
}
.xs-input::-webkit-search-cancel-button { display: none; }
.xs-close {
    flex: none;
    min-height: 32px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
}
.xs-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}
.xs-group {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}
.xs-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
}
.xs-item[aria-selected="true"] {
    background: var(--bg-elevated);
    box-shadow: inset 0 0 0 1px var(--border);
}
.xs-title { font-size: 15px; font-weight: 600; }
.xs-title mark {
    background: none;
    color: var(--accent-primary);
}
.xs-sub {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.xs-none {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px 14px;
    font-size: 14px;
    color: var(--text-secondary);
}
.xs-none strong { color: var(--text-primary); font-size: 15px; }
.xs-none a { color: var(--accent-primary); }
.xs-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.xs-foot {
    display: flex;
    gap: 18px;
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}
.xs-foot kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 1px 5px;
    margin-right: 4px;
    border: 1px solid var(--border);
    border-radius: 5px;
}
@media (max-width: 768px) {
    .xs-dialog { margin-top: 16px; max-height: calc(100vh - 32px); }
    .xs-foot { display: none; }
}

/* Small phones: logo, search, theme, download and menu must fit one row */
@media (max-width: 480px) {
    .logo-icon { width: 46px; height: 26px; }
    .logo { font-size: 15px; gap: 7px; }
    .nav-search,
    .theme-toggle { width: 38px; height: 38px; min-width: 38px; margin-right: 4px; padding: 0; }
    .nav-cta { padding: 9px 10px; }
    .mobile-menu-toggle { margin-left: 2px; }
}
@media (max-width: 400px) {
    .nav-container { gap: 4px; }
    .logo { font-size: 13px; gap: 5px; }
    .logo-icon { width: 40px; height: 24px; }
}


/* ===== Light theme "Ocean" (2026-10-25): light blue header, cool grey page,
   navy footer. Header and page colours are the variables above; the footer
   needs its own text colours because it turns dark. ===== */
:root[data-theme="light"] nav[aria-label="Main navigation"] {
    border-bottom-color: #c9e1ec;
}
:root[data-theme="light"] footer {
    background: #0f2a3d;
    border-top-color: #1d4560;
    color: rgba(255, 255, 255, 0.72);
}
:root[data-theme="light"] footer p,
:root[data-theme="light"] footer .footer-column a,
:root[data-theme="light"] footer .footer-legal a,
:root[data-theme="light"] footer .footer-copyright,
:root[data-theme="light"] footer .counter-label {
    color: rgba(255, 255, 255, 0.72);
}
:root[data-theme="light"] footer .footer-column a:hover,
:root[data-theme="light"] footer .footer-column a:focus-visible,
:root[data-theme="light"] footer .footer-legal a:hover,
:root[data-theme="light"] footer .footer-legal a:focus-visible {
    color: #ffffff;
}
:root[data-theme="light"] footer .footer-column h4,
:root[data-theme="light"] footer .footer-column h4 a {
    color: #93c5fd;
}
:root[data-theme="light"] footer .logo,
:root[data-theme="light"] footer .logo span {
    color: #ffffff;
}
:root[data-theme="light"] footer .footer-all-link,
:root[data-theme="light"] footer .counter-value {
    color: #6ee7b7 !important;
}
:root[data-theme="light"] footer .footer-support-link svg { color: #f9a8d4; }
:root[data-theme="light"] footer .download-counter,
:root[data-theme="light"] footer .footer-bottom {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
}
:root[data-theme="light"] footer a:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
