/* Navigation commune Bonsai Finder + Phylo */
.site-brand {
    color: #333;
    margin-bottom: 4px;
    font-size: 1.75em;
    line-height: 1.2;
}

.site-brand a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.site-brand a:hover {
    opacity: 0.85;
}

.site-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    flex-shrink: 0;
}

.site-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
    text-align: center;
}

.subtitle {
    color: #666;
    font-size: 0.92em;
}

.site-nav {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    background: #eef0ff;
    color: #4a5568;
    text-decoration: none;
    font-weight: 600;
    border: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.nav-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.site-nav a:hover {
    background: #e2e6ff;
}

.site-nav a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.finder-link {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
}

.finder-link:hover {
    opacity: 0.92;
}

/* Barre latérale (paysage) / colonne unique (portrait) */
:root {
    --sidebar-w: 232px;
}

body.has-site-shell {
    overflow-x: hidden;
}

.site-sidebar,
button.nav-toggle,
body.has-site-shell .site-main {
    box-sizing: border-box;
}

.site-sidebar {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px 16px;
    margin: 0 auto 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    max-width: 100%;
}

.site-sidebar .site-brand {
    font-size: 1.2em;
    margin: 0 0 12px;
}

.site-sidebar .site-nav {
    margin-top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.site-sidebar .site-nav a {
    width: 100%;
    justify-content: flex-start;
}

button.nav-toggle {
    display: none;
    position: fixed;
    z-index: 40;
    top: 12px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d8dcf0;
    border-radius: 10px;
    background: #fff;
    color: #4a5568;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

button.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: #445;
}

button.nav-toggle:hover {
    background: #f4f6ff;
}

button.nav-toggle:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

@media (orientation: portrait) {
    body.has-site-shell .site-main {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        min-width: 0;
    }
}

@media (orientation: landscape) {
    body.has-site-shell {
        padding-left: 0;
    }

    .site-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--sidebar-w);
        margin: 0;
        border-radius: 0;
        border-right: 1px solid #e6e8f2;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
        padding: 58px 14px 20px;
        padding-left: max(14px, env(safe-area-inset-left));
        overflow-y: auto;
        z-index: 30;
        transform: translateX(0);
        transition: transform 0.22s ease;
    }

    body.site-nav-collapsed .site-sidebar {
        transform: translateX(-105%);
    }

    button.nav-toggle {
        display: flex;
        flex-direction: column;
        left: max(12px, env(safe-area-inset-left));
    }

    body.has-site-shell .site-main {
        margin-left: calc(var(--sidebar-w) + 12px);
        margin-right: 12px;
        max-width: min(1400px, calc(100vw - var(--sidebar-w) - 24px));
        width: auto;
        min-width: 0;
        transition: margin-left 0.22s ease;
    }

    body.has-site-shell.site-nav-collapsed .site-main {
        margin-left: 12px;
        padding-left: 44px;
        max-width: min(1400px, calc(100vw - 68px));
    }
}

@media (orientation: landscape) and (prefers-reduced-motion: reduce) {
    .site-sidebar,
    button.nav-toggle,
    body.has-site-shell .site-main {
        transition: none;
    }
}

.lang-switch {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0 0 14px;
}

.lang-switch button.lang-btn {
    flex: 0 0 auto;
    min-width: 30px;
    margin: 0;
    padding: 4px 3px;
    border: 1px solid #d8dcf0;
    border-radius: 6px;
    background: #f4f6ff;
    color: #3d4663;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: none;
}

.lang-switch button.lang-btn:hover {
    background: #e6eaff;
    color: #243;
}

.lang-switch button.lang-btn[aria-pressed="true"] {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}
