html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
}

* {
    box-sizing: border-box;
}

:root {
    --offimedicas-blue: #1A4687;
}

/* ============================
   BASE / DESKTOP
   ============================ */
:root {
    --offimedicas-blue: #1A4687;
}

.offimedicas-header {
    position: relative;
    width: 100%;
    max-width: 100vw;
    height: 100px;
    background-color: rgba(255, 255, 255, 0.8); 
    background-size: cover;
    background-position: center;
    margin-bottom: -50px;
    z-index: 10;
    box-sizing: border-box;
    border-bottom-right-radius: 35px;
}

.offimedicas-banner {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
}

.offimedicas-curve {
    position: absolute;
    left: 0;

    top: -1px; 
    height: calc(100% + 2px); 
    
    width: 100%;
    z-index: 1;
    pointer-events: none;
    display: block;
}

.offimedicas-curve path {
    fill: var(--offimedicas-blue);
}

/* Logo — este clamp() se usa en TODOS los breakpoints, sin overrides */
.offimedicas-logo {
    position: absolute;
    left: clamp(16px, 10vw, 155px);
    top: 20px;
    z-index: 3;
}
.offimedicas-logo img {
    width: clamp(90px, 14vw, 170px);
    max-width: 100%;
    height: auto;
    display: block;
}

.offimedicas-nav {
    position: absolute;
    top: clamp(46px, 6vw, 62px);
    left: 20%;
    right: 4%;

    z-index: 3;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: clamp(28px, 2.75vw, 50px);
}

.offimedicas-nav a {
    color: #92BC3E;
    text-decoration: none;
    font-size: clamp(13px, 1.4vw, 17px);
    font-weight: 600;
    white-space: nowrap;

    transition: color 0.2s ease, background-color 0.3s ease;
}

.offimedicas-nav span {
    font-size: 11px;
}

/* Mantener el color azul al hacer hover en el enlace, 
   al tener el ratón sobre su submenú (escritorio), 
   o al estar desplegado (móvil mediante JS) */
.offimedicas-nav > .offimedicas-menu-item > a:hover,
.offimedicas-menu-item:hover > a,
.offimedicas-menu-item.is-open > a {
    color: var(--offimedicas-blue); 
}

.offimedicas-menu-item > a span {
  display: inline-block;
  /* Mantén el tamaño base del vector */
  width: 9px;
  height: 7px;
  margin-left: 7px;
  vertical-align: middle;
  background-color: currentColor;
  clip-path: path('M 0 1 Q 0 0 1 0 L 8 0 Q 9 0 9 1 L 5.3 6.2 Q 4.5 7.2 3.7 6.2 Z');

  transform: scale(1.25);

  position: relative;
  top: 1px; 
}



/* Botón hamburguesa */
.offimedicas-toggle {
    display: none;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 4;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.offimedicas-toggle span {
    position: absolute;
    left: 50%;
    width: 26px;
    height: 3px;
    background-color: #F1F1F1;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: transform .25s ease, opacity .25s ease;
}
.offimedicas-toggle span:nth-child(1) { top: 8px; }
.offimedicas-toggle span:nth-child(2) { top: 16px; }
.offimedicas-toggle span:nth-child(3) { top: 24px; }

.offimedicas-toggle.is-open span:nth-child(1) {
    top: 16px;
    transform: translateX(-50%) rotate(45deg);
}
.offimedicas-toggle.is-open span:nth-child(2) {
    opacity: 0;
}
.offimedicas-toggle.is-open span:nth-child(3) {
    top: 16px;
    transform: translateX(-50%) rotate(-45deg);
}

/* ============================
   SUBMENÚS
   ============================ */

.offimedicas-menu-item {
    position: relative;
}


/* Menú secundario */

.offimedicas-submenu {
    /* Mantenemos tu configuración anterior... */
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    transform: translateY(8px);
    min-width: 230px;
    background-color: #ffffff;
    padding: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    z-index: 20;

    /* REEMPLAZA EL 25% POR PIXELES FIJOS */
    border-radius: 10px;
    border-bottom-right-radius: 24px; 
}

/* Agrega esto para redondear la esquina del último item y que no se salga */
.offimedicas-submenu > a:last-child,
.offimedicas-submenu-item:last-child > a {
    border-bottom-right-radius: 16px;
}

.offimedicas-menu-item::after {
    content: "";

    position: absolute;

    top: 100%;
    left: -10px;

    width: calc(100% + 20px);
    height: 20px;

    background: transparent;

    z-index: 19;
}


/* Enlaces de los submenús */
.offimedicas-submenu > a,
.offimedicas-submenu-item > a {
    display: flex;

    width: 100%;

    padding: 10px 14px;

    color: #92BC3E;

    font-size: 14px;

    font-weight: 600;

    text-decoration: none;

    white-space: nowrap;

    align-items: center;
    justify-content: space-between;

    border-radius: 6px;
}


/* Hover de los submenús y mantener resaltado el ítem 
   cuando su sub-submenú está abierto */
.offimedicas-submenu > a:hover,
.offimedicas-submenu.nested a:hover,
.offimedicas-submenu-item:hover > a,
.offimedicas-submenu-item.is-open > a {
    background-color: #f1f1f1;
    color: var(--offimedicas-blue);
}


/* ============================
   SUB-SUBMENÚ
   ============================ */

.offimedicas-submenu-item {
    position: relative;
}

.offimedicas-submenu-item::after {
    content: "";

    position: absolute;

    top: 0;
    left: 100%;

    width: 15px;
    height: 100%;

    background: transparent;

    z-index: 19;
}

.offimedicas-submenu.nested {
    top: -8px;
    left: calc(100% + 16px); 
    transform: none;
    min-width: 240px;
}

/* ============================
   MOSTRAR MENÚS (SOLO DESKTOP)
   ============================ */
@media (min-width: 1001px) {
    /* Mostrar menú secundario al pasar el mouse */
    .offimedicas-menu-item:hover > .offimedicas-submenu {
        display: block;
    }

    /* Mostrar tercer nivel al pasar el mouse */
    .offimedicas-submenu-item:hover > .offimedicas-submenu.nested {
        display: block;
    }
}
/* ============================
   MÓVIL
   ============================ */
@media (max-width: 1000px) {

    .offimedicas-header {
        background-color: #ffffff;
        border-bottom-right-radius: 35px;
    }

    .offimedicas-banner {
        background-color: var(--offimedicas-blue);
        border-bottom-right-radius: 25px;
        z-index: 2;

        transform: translateZ(0);
    }

    .offimedicas-curve {
        display: none;
    }


    /* ============================
       LOGO
       ============================ */

    .offimedicas-logo {
        left: 16px;
        top: 20px;
    }

    .offimedicas-logo img {

        width: clamp(120px, 32vw, 160px);
    }


    /* ============================
       BOTÓN HAMBURGUESA
       ============================ */

    .offimedicas-toggle {
        display: flex;
        top: 50%;
        right: 20px;
        transform: translateY(-50%);
    }


    /* ============================
       MENÚ DESPLEGABLE
       ============================ */

    .offimedicas-nav {
        
        display: none;

        position: absolute;
        top: 75px;

        left: 0;
        right: 0;

        z-index: 1;

        flex-direction: column;
        align-items: center;
        justify-content: flex-start;

        gap: 0;

        background-color: #f1f1f1;

        padding: 30px 24px 20px;

        border-bottom-right-radius: 40px;

        box-shadow: 0 8px 16px rgba(0, 0, 0, .15);

        box-sizing: border-box;
    }

    .offimedicas-nav.is-open {
        display: flex;
    }

    .offimedicas-nav a {
        display: block;

        width: 100%;
        max-width: 320px;

        padding: 12px 0;

        font-size: 15px;

        color: #92BC3E;
        text-decoration: none;
        text-align: center;

        border-bottom: 1px solid #cfcfcf;
    }

    /* ============================
       ELEMENTOS PRINCIPALES
       ============================ */

    .offimedicas-menu-item {
        width: 100%;
        max-width: 320px;
    }


    .offimedicas-menu-item > a {
        display: flex;

        width: 100%;

        align-items: center;
        justify-content: center;

        position: relative;
    }

    .offimedicas-menu-item > a span {
        margin-left: 7px;
        font-size: 9px;
    }


    /* ============================
       SUBMENÚ
       ============================ */

    .offimedicas-menu-item > .offimedicas-submenu {

        position: static;

        display: none;

        transform: none;

        width: 100%;
        min-width: 0;

        margin: 5px 0 8px;

        padding: 6px;

        background-color: #ffffff;

        border-radius: 10px;
        border-bottom-right-radius: 25%;

        box-shadow: 0 3px 10px rgba(0, 0, 0, .10);

        box-sizing: border-box;

    }


    /*
     * Cuando JS añade is-open,
     * mostramos el submenú.
     */
    .offimedicas-menu-item.is-open > .offimedicas-submenu {
        display: block;
    }


    /* ============================
       ENLACES DEL SUBMENÚ
       ============================ */

    .offimedicas-submenu > a,
    .offimedicas-submenu-item > a {

        display: flex;

        width: 100%;

        align-items: center;
        justify-content: center;

        padding: 10px 8px;

        color: #92BC3E;

        font-size: 14px;

        font-weight: 600;

        text-align: center;

        white-space: normal;

        text-decoration: none;

        border-bottom: 1px solid #dddddd;

    }


    /*
     * Quitamos la línea del último elemento.
     */
    .offimedicas-submenu > a:last-child,
    .offimedicas-submenu-item:last-child > a {
        border-bottom: none;
    }


    /* ============================
       ELEMENTOS QUE TIENEN
       UN TERCER NIVEL
       ============================ */

    .offimedicas-submenu-item {
        position: relative;

        width: 100%;
    }


    /*
     * Flecha del segundo nivel.
     */
    .offimedicas-submenu-item > a span {
        margin-left: 8px;
        font-size: 14px;
    }


    /* ============================
       TERCER NIVEL
       ============================ */

    .offimedicas-submenu-item > .offimedicas-submenu.nested {

        position: static;

        display: none;

        transform: none;

        width: 100%;
        min-width: 0;

        margin: 4px 0 6px;

        padding: 5px;

        background-color: #f8f8f8;

        border-radius: 10px;
        border-bottom-right-radius: 25%;

        box-shadow: none;

    }


    /*
     * JS abre el tercer nivel.
     */
    .offimedicas-submenu-item.is-open > .offimedicas-submenu.nested {
        display: block;
    }


    /* ============================
       ENLACES DEL TERCER NIVEL
       ============================ */

    .offimedicas-submenu.nested a {

        display: block;

        width: 100%;

        padding: 9px 6px;

        color: #92BC3E;

        font-size: 13px;

        text-align: center;

        text-decoration: none;

        border-bottom: 1px solid #e3e3e3;

    }


    .offimedicas-submenu.nested a:last-child {
        border-bottom: none;
    }

}
