/* Capa final de la portada para tablets. Opera aplica zoom al viewport CSS:
   una vista visible de 938px se calcula como 1172px, por ello este límite
   cubre tablet vertical y horizontal sin perder la composición. */
@media (min-width: 769px) and (max-width: 1280px) {
    body.principal-page .reu-site-header {
        overflow: visible;
    }

    body.principal-page .reu-site-header .header-container,
    body.principal-page.principal-search-docked .reu-site-header .header-container {
        display: grid !important;
        grid-template-columns: max-content minmax(0, 1fr) max-content !important;
        grid-template-areas: "brand search menu";
        align-items: center;
        width: 100%;
        min-height: 92px;
        height: auto;
        gap: clamp(18px, 3vw, 30px);
        padding: 16px clamp(28px, 4.7vw, 48px);
        box-sizing: border-box;
    }

    body.principal-page .reu-site-header .header-left {
        display: flex;
        grid-area: brand;
    }

    body.principal-page .reu-site-header .brand-logo-img,
    body.principal-page.principal-search-docked .reu-site-header .brand-logo-img {
        height: 42px;
    }

    body.principal-page .reu-site-header .header-search-dock {
        display: none !important;
        grid-area: search;
        width: 100%;
        min-width: 0;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock {
        display: flex !important;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock,
    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-wrapper,
    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-bar {
        width: 100% !important;
        min-width: 0;
        max-width: none;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-bar {
        min-height: 58px;
        height: 58px;
        padding: 5px 7px;
        border-radius: 16px;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-field {
        min-height: 46px;
        height: 46px;
        padding: 6px 7px 6px 30px;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-field::before {
        left: 9px;
        font-size: .9rem;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-field small {
        font-size: .64rem;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-field input {
        font-size: .72rem;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-btn-active {
        min-width: 48px;
        height: 46px;
        padding: 0 12px;
    }

    body.principal-page.principal-search-docked .reu-site-header .header-search-dock .search-btn-active span {
        display: none;
    }

    body.principal-page .reu-site-header .mobile-menu-toggle {
        display: inline-flex !important;
        grid-area: menu;
        grid-column: auto;
        justify-self: end;
        align-items: center;
        justify-content: center;
        color: #1d1a24;
        font-size: 1.1rem;
    }

    body.principal-page .reu-site-header .header-right,
    body.principal-page.principal-search-docked .reu-site-header .header-right {
        position: absolute;
        top: calc(100% + 10px);
        right: clamp(28px, 4.7vw, 48px);
        left: auto;
        display: none !important;
        width: min(320px, calc(100vw - 56px));
        margin: 0;
        padding: 16px;
        border: 1px solid #e6dff0;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 18px 45px rgba(40, 20, 72, .16);
        transform: none;
        z-index: 3400;
    }

    body.principal-page .reu-site-header #siteMobileMenu {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none;
    }

    body.principal-page .reu-site-header .header-right.mobile-open,
    body.principal-page.principal-search-docked .reu-site-header .header-right.mobile-open {
        display: none !important;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    body.principal-page .reu-site-header .mobile-menu-toggle[aria-expanded="true"] + .header-right,
    body.principal-page.principal-search-docked .reu-site-header .mobile-menu-toggle[aria-expanded="true"] + .header-right {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    body.principal-page .reu-site-header .mobile-menu-toggle[aria-expanded="true"] + #siteMobileMenu {
        visibility: visible !important;
        pointer-events: auto;
    }

    body.principal-page .reu-site-header .header-right .publish-link {
        width: 100% !important;
        min-height: 46px;
        padding: 10px 12px;
        border-radius: 12px;
    }

    body.principal-page .reu-site-header .header-right .publish-link span {
        position: static !important;
        display: inline !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        clip: auto !important;
        clip-path: none !important;
        white-space: normal !important;
    }

    body.principal-page .reu-site-header .header-right .user-menu-container,
    body.principal-page .reu-site-header .header-right .user-menu-btn {
        width: 100%;
    }

    body.principal-page .reu-site-header .header-right .user-menu-btn {
        min-width: 0;
        height: 48px;
        padding: 7px 14px;
        justify-content: space-between;
        border-radius: 12px;
    }

    body.principal-page .reu-site-header .header-right .user-menu-name {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        color: #332348;
        font-size: .92rem;
        font-weight: 800;
        text-align: left;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.principal-page .reu-site-header .header-right .user-menu-container::after {
        display: none;
    }

    body.principal-page .reu-site-header .header-right .user-dropdown {
        position: static;
        width: 100%;
        margin-top: 8px;
    }

    /* Buscador del hero: conserva la información completa en una sola fila. */
    body.principal-page .home-hero-search-card {
        width: min(860px, calc(100% - 64px));
        margin: 0 auto -58px;
    }

    body.principal-page .home-hero-search-card .search-bar {
        min-height: 78px;
        padding: 8px 10px;
        gap: 0;
        border: 1px solid #e6dff0;
        border-radius: 22px;
        box-shadow: 0 12px 28px rgba(40, 20, 72, .12);
    }

    body.principal-page .home-hero-search-card .search-field {
        flex: 1 1 0;
        min-width: 0;
        min-height: 58px;
        padding: 10px 16px;
        border-radius: 999px;
    }

    body.principal-page .home-hero-search-card .search-field::before {
        display: none;
    }

    body.principal-page .home-hero-search-card .search-field small,
    body.principal-page .home-hero-search-card .search-field input {
        overflow: visible;
        font-size: .84rem;
        text-overflow: clip;
        white-space: nowrap;
    }

    body.principal-page .home-hero-search-card .search-field small {
        margin-bottom: 5px;
        color: #332348;
        font-weight: 800;
        text-align: center;
    }

    body.principal-page .home-hero-search-card .search-field input {
        color: #978da7;
        text-align: center;
    }

    body.principal-page .home-hero-search-card #fieldLocation {
        background: transparent;
    }

    body.principal-page .home-hero-search-card #fieldLocation small,
    body.principal-page .home-hero-search-card #fieldLocation input {
        text-align: left;
    }

    body.principal-page .home-hero-search-card .search-field.divider {
        display: block;
        flex: 0 0 1px;
        width: 1px;
        min-height: 26px;
        height: 26px;
        margin: 0 8px;
        padding: 0;
        overflow: hidden;
        color: transparent;
        background: #e6dff0;
    }

    body.principal-page .home-hero-search-card .search-btn-active {
        min-width: 136px;
        height: 56px;
        padding: 0 20px;
        border-radius: 14px;
        font-size: .95rem;
    }

    body.principal-page .home-hero-search-card .search-btn-active span {
        display: inline;
    }
}

/* El modo tablet se activa desde la página para cubrir navegadores cuyo zoom
   altera el ancho que reciben las media queries. */
body.principal-page.principal-tablet-layout .reu-site-header {
    overflow: visible;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-container,
body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-container {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) max-content !important;
    grid-template-areas: "brand search menu";
    align-items: center;
    width: 100%;
    min-height: 92px;
    height: auto;
    gap: clamp(18px, 3vw, 30px);
    padding: 16px clamp(28px, 4.7vw, 48px);
    box-sizing: border-box;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-left {
    display: flex;
    grid-area: brand;
}

body.principal-page.principal-tablet-layout .reu-site-header .brand-logo-img {
    height: 42px;
}

body.principal-page.principal-tablet-layout .reu-site-header .mobile-menu-toggle {
    display: inline-flex !important;
    grid-area: menu;
    grid-column: auto;
    justify-self: end;
    align-items: center;
    justify-content: center;
    color: #1d1a24;
    font-size: 1.1rem;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-search-dock {
    display: none !important;
    grid-area: search;
    width: 100%;
    min-width: 0;
}

body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-search-dock {
    display: flex !important;
}

body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-search-dock,
body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-search-dock .search-wrapper,
body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-search-dock .search-bar {
    width: 100% !important;
    min-width: 0;
    max-width: none;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right,
body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-right,
body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu {
    position: absolute;
    top: calc(100% + 10px);
    right: clamp(28px, 4.7vw, 48px);
    left: auto;
    display: none !important;
    visibility: hidden !important;
    width: min(320px, calc(100vw - 56px));
    margin: 0;
    padding: 16px;
    border: 1px solid #e6dff0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(40, 20, 72, .16);
    transform: none;
    pointer-events: none;
    z-index: 3400;
}

body.principal-page.principal-tablet-layout .reu-site-header .mobile-menu-toggle[aria-expanded="true"] + #siteMobileMenu {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
    visibility: visible !important;
    pointer-events: auto;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right .publish-link {
    width: 100% !important;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 12px;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right .publish-link span {
    position: static !important;
    display: inline !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right .user-menu-container,
body.principal-page.principal-tablet-layout .reu-site-header .header-right .user-menu-btn {
    width: 100%;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right .user-menu-btn {
    min-width: 0;
    height: 48px;
    padding: 7px 14px;
    justify-content: space-between;
    border-radius: 12px;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right .user-menu-name {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: #332348;
    font-size: .92rem;
    font-weight: 800;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right .user-menu-container::after {
    display: none;
}

body.principal-page.principal-tablet-layout .reu-site-header .header-right .user-dropdown {
    position: static;
    width: 100%;
    margin-top: 8px;
}

body.principal-page.principal-tablet-layout .home-hero-search-card {
    width: min(860px, calc(100% - 64px));
    margin: 0 auto -58px;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-bar {
    min-height: 78px;
    padding: 8px 10px;
    gap: 0;
    border: 1px solid #e6dff0;
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(40, 20, 72, .12);
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-field {
    flex: 1 1 0;
    min-width: 0;
    min-height: 58px;
    padding: 10px 16px;
    border-radius: 999px;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-field::before {
    display: none;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-field small,
body.principal-page.principal-tablet-layout .home-hero-search-card .search-field input {
    overflow: visible;
    font-size: .84rem;
    text-overflow: clip;
    white-space: nowrap;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-field small {
    margin-bottom: 5px;
    color: #332348;
    font-weight: 800;
    text-align: center;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-field input {
    color: #978da7;
    text-align: center;
}

body.principal-page.principal-tablet-layout .home-hero-search-card #fieldLocation {
    background: transparent;
}

body.principal-page.principal-tablet-layout .home-hero-search-card #fieldLocation small,
body.principal-page.principal-tablet-layout .home-hero-search-card #fieldLocation input {
    text-align: left;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-field.divider {
    display: block;
    flex: 0 0 1px;
    width: 1px;
    min-height: 26px;
    height: 26px;
    margin: 0 8px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    background: #e6dff0;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-btn-active {
    min-width: 136px;
    height: 56px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: .95rem;
}

body.principal-page.principal-tablet-layout .home-hero-search-card .search-btn-active span {
    display: inline;
}

/* Cabecera de tablet: los accesos caben como iconos y el perfil permanece
   como el único control de usuario visible. */
body.principal-page.principal-tablet-layout .reu-site-header .header-container,
body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-container {
    grid-template-columns: max-content minmax(0, 1fr) max-content !important;
    grid-template-areas: "brand . actions";
    min-height: 88px;
    padding: 14px clamp(28px, 4vw, 42px);
}

body.principal-page.principal-tablet-layout .reu-site-header .mobile-menu-toggle,
body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header .header-search-dock {
    display: none !important;
}

body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu,
body.principal-page.principal-tablet-layout.principal-search-docked .reu-site-header #siteMobileMenu {
    position: static;
    display: inline-flex !important;
    grid-area: actions;
    visibility: visible !important;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: auto !important;
    transform: none;
    gap: 14px;
}

body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu > .publish-link {
    display: inline-flex !important;
    width: 40px !important;
    min-width: 40px;
    min-height: 40px;
    height: 40px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu > .publish-link > span {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu .user-menu-container {
    width: auto;
}

body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu .user-menu-btn {
    width: 50px;
    min-width: 50px;
    height: 50px;
    padding: 4px;
    border-radius: 50%;
}

body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu .user-menu-name {
    display: none;
}

body.principal-page.principal-tablet-layout .reu-site-header #siteMobileMenu .user-dropdown {
    position: absolute;
    width: min(320px, calc(100vw - 56px));
    margin-top: 8px;
}
