/* =========================================================================
   HEADER GLOBAL DEL SITIO (.pgh)
   Reemplaza al header de Astra + Elementor Pro en todo educapharos.com.
   Basado en el header de las landings de servicios (.phh), adaptado al menú
   oficial: Catálogo SaaS, Másteres, Blog, Casos de Éxito, Conócenos + switches
   de idioma de TranslatePress.

   Layout escritorio (grid de 3 columnas):
   [logo] |      [menú + botones centrados]      | [switcher]
   ========================================================================= */

.pgh {
    --pgh-yellow: #ffd200;
    --pgh-ink: #171717;
    position: sticky;
    top: 0;
    z-index: 500;
    width: 100%;
    height: 112px;
    background: #fff;
    border-bottom: 1px solid #eee;
    font-family: 'Montserrat', sans-serif;
}

.pgh * {
    box-sizing: border-box;
}

.pgh__inner {
    max-width: 1750px;
    height: 100%;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 32px;
}

/* ============ LOGO ============ */
.pgh__logo {
    display: flex;
    align-items: center;
    justify-self: start;
}

.pgh__logo img {
    display: block;
    height: 44px;
    width: auto;
}

.pgh__logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--pgh-ink);
    letter-spacing: -0.01em;
}

.pgh__logo-text strong {
    font-weight: 800;
}

/* ============ MENÚ + BOTONES CENTRADOS ============ */
.pgh__panel {
    grid-column: 2;
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 28px;
    height: 100%;
}

.pgh__nav {
    flex: none;
    height: 100%;
}

.pgh__menu {
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 28px;
}

.pgh__link,
.pgh__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--pgh-ink);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.pgh__link:hover,
.pgh__trigger:hover,
.pgh__link.is-current {
    color: #000;
}

.pgh__link.is-current {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.pgh__chevron {
    flex: none;
    transition: transform 0.2s ease;
}

.pgh__item--dropdown.is-open .pgh__chevron {
    transform: rotate(180deg);
}

/* ============ DESPLEGABLES ============ */
.pgh__item {
    position: relative;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.pgh__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: #fff;
    border-top: 3px solid var(--pgh-yellow);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.pgh__item--dropdown.is-open .pgh__dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Escritorio: además de con clic (JS, is-open), se abre al pasar el ratón. */
@media (min-width: 1025px) {
    .pgh__item--dropdown:hover .pgh__dropdown {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .pgh__item--dropdown:hover .pgh__chevron {
        transform: rotate(180deg);
    }
}

.pgh__dropdown li {
    border-bottom: 1px solid #eee;
}

.pgh__dropdown li:last-child {
    border-bottom: 0;
}

.pgh__dropdown a {
    display: block;
    padding: 13px 20px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--pgh-ink);
    text-decoration: none;
}

.pgh__dropdown a:hover,
.pgh__dropdown a.is-current {
    background: #f6f6f6;
}

/* ============ BOTONES ============ */
.pgh__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
}

.pgh__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.pgh__btn:hover {
    opacity: 0.88;
}

.pgh__btn--dark {
    background: var(--pgh-ink);
    color: #fff !important;
}

.pgh__btn--dark:hover {
    color: #fff !important;
}

.pgh__btn--yellow {
    background: var(--pgh-yellow);
    color: #111 !important;
}

/* ============ SWITCHES DE IDIOMA ============
   Clases .ls-es / .ls-en requeridas por los estilos que ya existen para el
   header oficial. El contenedor .pgh__langs asegura que ambos items estén
   pegados, de modo que el ::before de .ls-es cubra exactamente la caja gris
   compartida.
   ========================================================================= */
.pgh__langs-wrap {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
}

.pgh__langs {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ls-es,
.ls-en {
    position: relative;
    display: flex !important;
    align-items: center;
    background: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 5px 3px !important;
    flex: 1 1 50%;
}

.ls-es { padding-left: 5px !important; }
.ls-en { padding-right: 5px !important; }

/* ---- La caja gris: una sola pieza continua ---- */
.ls-es::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: calc(200% + 0px);
    height: 100%;
    background: #f0f0f0;
    border-radius: 4px;
    box-shadow:
        inset 0 3px 5px -1px rgba(0, 0, 0, .18),
        inset 0 -2px 4px -2px rgba(0, 0, 0, .10),
        inset 3px 0 5px -3px rgba(0, 0, 0, .14),
        inset -3px 0 5px -3px rgba(0, 0, 0, .14);
    z-index: 0;
    pointer-events: none;
}

/* ---- Cada bandera ---- */
.ls-item > a {
    position: relative;
    z-index: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 38px !important;
    height: 30px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 7px;
    font-size: 0 !important;
    line-height: 0 !important;
    transition: background .3s cubic-bezier(.4, 0, .2, 1), box-shadow .3s ease;
}

.ls-item img {
    width: 24px !important;
    height: auto !important;
    max-width: none !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25) !important;
    opacity: .5;
    transition: opacity .3s ease, transform .3s ease;
}

/* Fallback si no hay bandera de TranslatePress disponible */
.ls-item > a span {
    position: relative;
    z-index: 1;
    font-size: 13px !important;
    font-weight: 700;
    color: var(--pgh-ink);
    line-height: 1 !important;
    opacity: .5;
}

html[lang^="es"] .ls-es img,
html[lang^="en"] .ls-en img,
html[lang^="es"] .ls-es > a span,
html[lang^="en"] .ls-en > a span {
    opacity: 1;
}

.ls-item > a:hover img,
.ls-item > a:hover span {
    opacity: .85;
}

/* ============ MENÚ MÓVIL ============ */
.pgh__burger {
    display: none;
    flex: none;
    width: 32px;
    height: 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
}

.pgh__burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--pgh-ink);
}

.pgh.is-menu-open .pgh__burger span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.pgh.is-menu-open .pgh__burger span:nth-child(2) {
    opacity: 0;
}

.pgh.is-menu-open .pgh__burger span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

@media (max-width: 1024px) {
    .pgh__inner {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 0 24px;
    }

    .pgh__logo {
        justify-self: auto;
    }

    .pgh__burger {
        display: flex;
    }

    .pgh__panel,
    .pgh__langs-wrap {
        display: none;
        width: 100%;
        order: 3;
    }

    .pgh.is-menu-open .pgh__panel,
    .pgh.is-menu-open .pgh__langs-wrap {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-top: 1px solid #eee;
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
    }

    .pgh.is-menu-open .pgh__panel {
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
    }

    .pgh.is-menu-open .pgh__langs-wrap {
        justify-content: center;
        padding: 16px 24px 24px;
        border-top: 1px solid #f0f0f0;
    }

    .pgh.is-menu-open .pgh__menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        height: auto;
    }

    .pgh.is-menu-open .pgh__actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 16px 24px 0;
        border-top: 1px solid #f0f0f0;
        margin-top: 8px;
    }

    .pgh__item {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    .pgh__link,
    .pgh__trigger {
        width: 100%;
        padding: 16px 24px;
        justify-content: space-between;
    }

    /* En móvil el desplegable no flota: empuja el resto del menú hacia abajo. */
    .pgh__dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        pointer-events: none;
        transform: none;
        border-top: 0;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        transition: max-height 0.2s ease, border-top-width 0.2s ease;
    }

    .pgh__item--dropdown.is-open .pgh__dropdown {
        border-top: 3px solid var(--pgh-yellow);
        pointer-events: auto;
        max-height: 600px;
        padding: 0 0 8px;
    }

    .pgh__dropdown a {
        padding: 12px 24px 12px 36px;
    }

    .pgh__btn {
        width: 100%;
    }

    .pgh__langs {
        padding: 0;
        justify-content: center;
    }
}
