/* Header:MobileIcons (CrossFitF2): up to 900px the header is one row - logo, the menu as icons,
   WhatsApp + language on the right. Once the page scrolls (.is-scrolled, set by the layout) the
   bar gets slimmer. Wider screens keep the text menu; the icons are hidden there. */

.header-icons .nav-icon { display: none; }
.header-icons .logo-mobile { display: none; }

@media (max-width: 900px) {
    .site-header.header-icons {
        padding: .45rem 0;
        transition: padding .25s ease;
    }
    .header-icons > .container { gap: .6rem; }
    .header-icons > .container > div:first-child {
        flex: 1;
        min-width: 0;
        gap: .6rem !important;
    }

    /* Logo: picture only, the long site title would wrap over four lines */
    .header-icons .logo { flex: none; }
    .header-icons .logo span { display: none; }
    .header-icons .logo img { height: 38px; transition: height .25s ease; }
    /* Header:MobileLogoUrl: a compact mark replaces the wide wordmark */
    .header-icons .logo img.has-mobile-logo { display: none; }
    .header-icons .logo img.logo-mobile { display: block; width: auto; border-radius: 0; object-fit: contain; }

    /* Menu: equal icon slots across the remaining width */
    .header-icons nav {
        flex: 1;
        min-width: 0;
        display: flex;
        justify-content: space-between;
        gap: .15rem;
    }
    .header-icons nav a {
        margin: 0;
        flex: 1 1 0;
        min-width: 0;
        max-width: 3rem;
        height: 2.4rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        color: var(--text-color, #fff);
        opacity: .85;
        transition: background-color .2s ease, color .2s ease, height .25s ease;
    }
    .header-icons nav a:hover { opacity: 1; background: rgba(255, 255, 255, .08); text-decoration: none; }
    .header-icons nav a.active {
        opacity: 1;
        background: var(--header-active-bg, var(--accent-color));
        color: var(--header-active-fg, #111);
    }
    .header-icons .nav-icon { display: block; font-size: 1.1rem; }

    /* Labels stay for screen readers (and as the link's title tooltip) */
    .header-icons .nav-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* Right: WhatsApp, under it only the flag of the other language */
    .header-icons .top-right { flex: none; gap: .3rem; align-items: center; }
    .header-icons .lang-switch-header { max-width: none; }
    .header-icons .lang-switch-header a.active { display: none; }
    .header-icons .lang-switch-header img { height: 14px; }

    /* Light/dark switch: one icon for the theme it switches to, no slider */
    .header-icons .theme-toggle { padding: .3rem; gap: 0; font-size: 1.05rem; }
    .header-icons .theme-toggle .theme-toggle-track { display: none; }
    html[data-theme="dark"] .header-icons .theme-toggle .fa-moon,
    html:not([data-theme="dark"]) .header-icons .theme-toggle .fa-sun { display: none; }

    /* WhatsApp + theme switch: WhatsApp on the left, flag above the theme icon on the right */
    .header-icons .top-right:has(.top-social-mobile a):has(.theme-toggle) {
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: auto auto;
        column-gap: .45rem;
        row-gap: .15rem;
        align-items: center;
        justify-items: center;
    }
    .header-icons .top-right:has(.top-social-mobile a):has(.theme-toggle) .top-social-mobile { grid-row: 1 / 3; grid-column: 1; }
    .header-icons .top-right:has(.top-social-mobile a):has(.theme-toggle) .lang-switch-header { grid-row: 1; grid-column: 2; }
    .header-icons .top-right:has(.top-social-mobile a):has(.theme-toggle) .theme-toggle { grid-row: 2; grid-column: 2; padding: 0; font-size: .95rem; }
    .header-icons.is-scrolled .top-right .theme-toggle { grid-row: 1 / 3; }

    /* Scrolled: slimmer bar, smaller logo, no flag */
    .site-header.header-icons.is-scrolled { padding: .25rem 0; }
    .header-icons.is-scrolled .logo img { height: 30px; }
    .header-icons.is-scrolled nav a { height: 2.1rem; }
    .header-icons.is-scrolled .lang-switch-header { display: none; }
}

@media (max-width: 360px) {
    .header-icons .nav-icon { font-size: 1rem; }
    .header-icons > .container { gap: .4rem; }
}

@media (prefers-reduced-motion: reduce) {
    .site-header.header-icons, .header-icons .logo img, .header-icons nav a { transition: none; }
}
