/* Shared public header polish for Jacques AO pages. */
body > header {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border-bottom: 1px solid var(--line, var(--border-color, #e5e7eb)) !important;
    backdrop-filter: saturate(180%) blur(14px) !important;
    -webkit-backdrop-filter: saturate(180%) blur(14px) !important;
}

[data-theme="dark"] body > header {
    background: rgba(10, 14, 26, 0.92) !important;
}

body > header .header-wrapper,
body > header .header-content,
body > header .header-inner {
    width: 100% !important;
    max-width: 1180px !important;
    margin: 0 auto !important;
    padding: 1.05rem 2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1.25rem !important;
    flex-wrap: nowrap !important;
}

body > header .header-wrapper > .header-inner {
    max-width: none !important;
    padding: 0 !important;
}

body > header .logo {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.8rem !important;
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    color: var(--ink, var(--text-primary, #111827)) !important;
    text-decoration: none !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    background-clip: initial !important;
    white-space: nowrap !important;
}

body > header .logo:hover {
    color: var(--nebula, var(--accent-primary, #2563eb)) !important;
}

body > header .nav-container,
body > header .header-tools {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 1rem !important;
    flex-wrap: nowrap !important;
}

body > header nav {
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
}

body > header nav ul {
    display: flex !important;
    align-items: center !important;
    gap: 1.15rem !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-wrap: nowrap !important;
}

body > header nav a {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 2.25rem !important;
    margin-left: 0 !important;
    padding: 0.35rem 0.15rem !important;
    border: 0 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--ink-2, var(--text-secondary, #475569)) !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}

body > header nav a:hover {
    color: var(--nebula, var(--accent-primary, #2563eb)) !important;
    border-bottom-color: var(--nebula, var(--accent-primary, #2563eb)) !important;
}

body > header .theme-toggle {
    width: 2.35rem !important;
    min-width: 2.35rem !important;
    height: 2.35rem !important;
    border: 1px solid var(--line, var(--border-color, #e5e7eb)) !important;
    border-radius: 8px !important;
    background: var(--bg-card, var(--bg-primary, #ffffff)) !important;
    color: var(--ink-2, var(--text-secondary, #475569)) !important;
}

body > header .theme-toggle:hover {
    border-color: var(--nebula, var(--accent-primary, #2563eb)) !important;
    color: var(--nebula, var(--accent-primary, #2563eb)) !important;
}

body > header .lang-switch {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    margin-left: 0 !important;
    padding-left: 0.8rem !important;
    border-left: 1px solid var(--line, var(--border-color, #e5e7eb)) !important;
    flex-wrap: nowrap !important;
}

body > header .lang-btn {
    min-height: 2.25rem !important;
    padding: 0.34rem 0.68rem !important;
    border: 1px solid var(--line, var(--border-color, #e5e7eb)) !important;
    border-radius: 8px !important;
    background: var(--bg-card, var(--bg-primary, #ffffff)) !important;
    color: var(--ink-3, var(--text-secondary, #64748b)) !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
}

body > header .lang-btn.active,
body > header .lang-btn:hover {
    background: var(--nebula, var(--accent-primary, #2563eb)) !important;
    border-color: var(--nebula, var(--accent-primary, #2563eb)) !important;
    color: #ffffff !important;
}

/* Mobile-first polish shared by the public Jacques AO pages. */
@media (max-width: 820px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    header {
        padding: 0.8rem 0 !important;
    }

    .header-wrapper,
    .header-content,
    .header-inner {
        width: 100%;
        max-width: 100%;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .header-wrapper,
    .header-content {
        flex-direction: column;
    }

    .logo {
        font-size: 1.25rem !important;
        line-height: 1.2;
        max-width: 100%;
    }

    .nav-container,
    .header-tools,
    nav {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start !important;
        gap: 0.55rem !important;
    }

    nav {
        overflow-x: auto;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    nav ul {
        width: max-content;
        min-width: 100%;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 0.55rem !important;
        overflow-x: auto;
        padding-bottom: 0.2rem !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    nav ul::-webkit-scrollbar {
        display: none;
    }

    nav li {
        flex: 0 0 auto;
    }

    nav a {
        display: inline-flex;
        align-items: center;
        min-height: 2.25rem;
        margin-left: 0 !important;
        padding: 0.35rem 0.68rem;
        border: 1px solid var(--border-color);
        border-radius: 999px;
        background: var(--bg-card, var(--bg-primary));
        font-size: 0.88rem !important;
        line-height: 1.2;
        white-space: nowrap;
    }

    .lang-switch {
        border-left: 0 !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
        gap: 0.35rem !important;
        flex-wrap: nowrap;
    }

    .lang-btn {
        min-height: 2.2rem;
        padding: 0.35rem 0.58rem !important;
        border-radius: 999px !important;
    }

    .theme-toggle {
        width: 2.2rem !important;
        min-width: 2.2rem;
        height: 2.2rem !important;
    }

    .container,
    main,
    .section,
    .content-section,
    .hero,
    footer {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .container {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .hero {
        padding-top: 2.4rem !important;
        padding-bottom: 2rem !important;
    }

    h1,
    .hero h1 {
        font-size: clamp(1.8rem, 8vw, 2.35rem) !important;
        line-height: 1.15 !important;
        overflow-wrap: anywhere;
    }

    h2,
    .section-title {
        overflow-wrap: anywhere;
    }

    .section-title {
        font-size: 1.55rem !important;
        margin-bottom: 1.25rem !important;
    }

    .posts-grid,
    .posts-list,
    .book-grid,
    .topic-grid,
    .twin-grid,
    .stats-grid,
    .org-chart,
    .phase-goals,
    .asset-grid,
    .related-grid,
    .post-links,
    .note-layout,
    .resource-links,
    .architecture-diagram,
    .layer ul {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .post-card,
    .book-card,
    .topic-card,
    .twin-card,
    .company-card,
    .phase-card,
    .goal-item,
    .stat-card,
    .asset-card,
    .journal-entry,
    .layer,
    .resource-link,
    .related-card,
    .post-link-card,
    .progress-container,
    .roadmap-container,
    .book-note-content,
    article {
        padding: 1.1rem !important;
        border-radius: 16px !important;
    }

    .post-card-image-link {
        margin: -1.1rem -1.1rem 1rem !important;
    }

    .post-meta,
    .book-header,
    .phase-header,
    .progress-header,
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.55rem !important;
    }

    .category-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        padding-bottom: 0.35rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .category-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex: 0 0 auto;
    }

    .reading-actions,
    .hero .social-links {
        width: 100%;
        justify-content: flex-start !important;
        flex-wrap: wrap;
    }

    .social-link {
        width: auto;
        max-width: 100%;
    }

    .post-cover {
        margin-top: 1rem !important;
        border-radius: 16px !important;
    }

    .post-content,
    .book-note-content,
    .note-main,
    .note-sidebar {
        overflow-wrap: anywhere;
        word-break: normal;
    }

    .post-content pre,
    .book-note-content pre,
    .note-table {
        max-width: 100%;
        overflow-x: auto;
    }

    .note-table {
        display: block;
        white-space: nowrap;
    }

    footer {
        margin-top: 2rem !important;
    }
}

@media (max-width: 430px) {
    .header-wrapper,
    .header-content,
    .header-inner {
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
    }

    .lang-btn {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .post-card,
    .book-card,
    .topic-card,
    .twin-card,
    article {
        padding: 1rem !important;
    }

    .post-card-image-link {
        margin: -1rem -1rem 0.95rem !important;
    }

    .about-stats {
        grid-template-columns: 1fr !important;
    }
}
