/*
 * Fundación Despierta – Parche Breadcrumbs Responsive
 * Alcance deliberadamente limitado a .fdbp-shell y a los elementos
 * .fdam-breadcrumbs / .fdam-return-button que el JS mueve dentro de ella.
 */


/* Fuente autogenerada: se oculta antes de que JS la convierta en la barra responsive. */
.fdbp-generated-source {
    display: none !important;
}

.fdbp-shell,
.fdbp-shell * {
    box-sizing: border-box;
}

.fdbp-shell {
    --fdbp-petroleo: var(--fd-primary, #0D5963);
    --fdbp-turquesa: var(--fd-turq, #45B5B7);
    --fdbp-turquesa-fuerte: #149AA2;
    --fdbp-celeste: #CDEBEC;
    --fdbp-crema: var(--fd-bg, #FBF8F2);
    --fdbp-dorado: #F4B23D;
    --fdbp-texto: #0B5660;
    --fdbp-alto: 80px;
    --fdbp-punta: 34px;

    position: relative;
    z-index: 8;
    display: flex;
    align-items: stretch;
    width: 100vw;
    max-width: 100vw;
    min-height: var(--fdbp-alto);
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-bottom: 42px;
    background: var(--fdbp-crema);
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
}

/* Neutraliza únicamente reglas heredadas del widget original. */
.fdbp-shell .fdam-breadcrumbs,
.fdbp-shell .fdam-return-button {
    max-width: none !important;
    margin: 0 !important;
}

.fdbp-shell .fdam-breadcrumbs {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    min-width: 0;
    width: auto;
    height: var(--fdbp-alto);
    padding: 0 !important;
    font-size: 17px;
    line-height: 1.15;
    color: var(--fdbp-texto);
    overflow: visible;
}

.fdbp-shell .fdbp-crumb {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 220px;
    min-width: 140px;
    height: 100%;
    margin: 0 0 0 calc(var(--fdbp-punta) * -0.72);
    padding: 10px calc(var(--fdbp-punta) + 22px) 10px calc(var(--fdbp-punta) + 28px);
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--fdbp-celeste);
    color: var(--fdbp-texto) !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    font-size: inherit;
    font-weight: 700;
    transition: filter .18s ease, transform .18s ease;
    clip-path: polygon(
        0 0,
        calc(100% - var(--fdbp-punta)) 0,
        100% 50%,
        calc(100% - var(--fdbp-punta)) 100%,
        0 100%,
        var(--fdbp-punta) 50%
    );
}

.fdbp-shell .fdbp-crumb:first-child {
    z-index: 5;
    flex: 0 0 150px;
    min-width: 150px;
    margin-left: 0;
    padding-left: 18px;
    padding-right: calc(var(--fdbp-punta) + 18px);
    clip-path: polygon(
        0 0,
        calc(100% - var(--fdbp-punta)) 0,
        100% 50%,
        calc(100% - var(--fdbp-punta)) 100%,
        0 100%
    );
    background: var(--fdbp-petroleo);
    color: #fff !important;
}

.fdbp-shell .fdbp-crumb:nth-child(2) {
    z-index: 4;
    background: var(--fdbp-turquesa-fuerte);
    color: #fff !important;
}

.fdbp-shell .fdbp-crumb:nth-child(3) {
    z-index: 3;
    background: var(--fdbp-celeste);
    color: var(--fdbp-texto) !important;
}

.fdbp-shell .fdbp-crumb:nth-child(4) {
    z-index: 2;
    background: #BFE5E5;
    color: var(--fdbp-texto) !important;
}

.fdbp-shell .fdbp-crumb:nth-child(n+5) {
    z-index: 1;
    background: #D7EFEF;
    color: var(--fdbp-texto) !important;
}

.fdbp-shell .fdbp-crumb.fdbp-crumb--current {
    z-index: 6;
    background: var(--fdbp-dorado);
    color: #fff !important;
    font-weight: 800;
    cursor: default;
}

.fdbp-shell a.fdbp-crumb:hover,
.fdbp-shell a.fdbp-crumb:focus-visible {
    filter: brightness(.97) saturate(1.04);
    outline: none;
}

.fdbp-shell a.fdbp-crumb:focus-visible::after {
    content: "";
    position: absolute;
    inset: 6px 34px 6px 34px;
    border: 2px solid currentColor;
    border-radius: 5px;
    opacity: .8;
    pointer-events: none;
}

.fdbp-shell .fdbp-label {
    display: block;
    width: 100%;
    text-align: center;
    overflow-wrap: anywhere;
}

.fdbp-shell .fdbp-home-icon {
    width: 36px;
    height: 36px;
    display: block;
    color: currentColor;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .08));
}

.fdbp-shell .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Botón contextual: mismo lenguaje visual que HOME, conservando el href original. */
.fdbp-shell .fdbp-return {
    position: relative;
    flex: 0 0 310px;
    width: 310px;
    min-width: 310px;
    display: flex !important;
    align-items: stretch;
    justify-content: stretch;
    padding: 0 !important;
    background: var(--fdbp-petroleo);
    clip-path: polygon(
        var(--fdbp-punta) 0,
        100% 0,
        100% 100%,
        var(--fdbp-punta) 100%,
        0 50%
    );
}

.fdbp-shell .fdbp-return .fdam-button {
    width: 100% !important;
    min-height: var(--fdbp-alto) !important;
    margin: 0 !important;
    padding: 10px 24px 10px calc(var(--fdbp-punta) + 18px) !important;
    gap: 14px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #fff !important;
    box-shadow: none !important;
    text-transform: none !important;
    text-decoration: none !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    transform: none !important;
}

.fdbp-shell .fdbp-return .fdam-button:hover,
.fdbp-shell .fdbp-return .fdam-button:focus-visible {
    background: rgba(255,255,255,.06) !important;
    color: #fff !important;
    transform: none !important;
    box-shadow: none !important;
}

.fdbp-shell .fdbp-return .fdam-button:focus-visible {
    outline: 3px solid rgba(255,255,255,.75);
    outline-offset: -6px;
}

.fdbp-shell .fdbp-back-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
}

/* Tablet: compacta sin cambiar el contenido ni los enlaces. */
@media (max-width: 1180px) {
    .fdbp-shell {
        --fdbp-alto: 74px;
        --fdbp-punta: 28px;
        margin-bottom: 34px;
    }

    .fdbp-shell .fdam-breadcrumbs {
        font-size: 15px;
    }

    .fdbp-shell .fdbp-crumb {
        min-width: 116px;
        padding-left: calc(var(--fdbp-punta) + 20px);
        padding-right: calc(var(--fdbp-punta) + 15px);
    }

    .fdbp-shell .fdbp-crumb:first-child {
        flex-basis: 110px;
        min-width: 110px;
    }

    .fdbp-shell .fdbp-home-icon {
        width: 31px;
        height: 31px;
    }

    .fdbp-shell .fdbp-return {
        flex-basis: 255px;
        width: 255px;
        min-width: 255px;
        padding: 0 !important;
    }

    .fdbp-shell .fdbp-return .fdam-button {
        font-size: 15px !important;
        padding: 10px 17px 10px calc(var(--fdbp-punta) + 14px) !important;
    }
}

/* Tablet en vertical: mantiene la ruta arriba y baja el botón para ganar ancho útil. */
@media (max-width: 900px) {
    .fdbp-shell {
        display: block;
        overflow: visible;
    }

    .fdbp-shell .fdam-breadcrumbs {
        width: 100%;
    }

    .fdbp-shell .fdbp-return {
        width: 100%;
        min-width: 0;
        display: flex !important;
        min-height: 64px;
        padding: 0 !important;
        background: var(--fdbp-petroleo);
        clip-path: none;
    }

    .fdbp-shell .fdbp-return .fdam-button {
        width: 100% !important;
        min-height: 64px !important;
        margin: 0 !important;
        padding: 12px 20px !important;
        justify-content: center;
    }

    .fdbp-shell--many .fdam-breadcrumbs {
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .fdbp-shell--many .fdam-breadcrumbs::-webkit-scrollbar {
        display: none;
    }

    .fdbp-shell--many .fdbp-crumb {
        flex: 0 0 168px;
        min-width: 168px;
    }
}

/* Móvil: barra de ruta arriba + botón Volver en una segunda fila. */
@media (max-width: 767px) {
    .fdbp-shell {
        --fdbp-alto: 94px;
        --fdbp-punta: 22px;
        display: block;
        min-height: 0;
        margin-bottom: 32px;
        overflow: visible;
        background: var(--fdbp-crema);
    }

    /* Compensa el padding móvil !important del widget original y ocupa todo el viewport. */
    .fdam-section > .fdbp-shell {
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(50% - 50vw) !important;
        margin-right: calc(50% - 50vw) !important;
    }

    .fdbp-shell .fdam-breadcrumbs {
        display: flex;
        width: 100%;
        height: var(--fdbp-alto);
        font-size: clamp(12px, 3.65vw, 16px);
        overflow: hidden;
        scrollbar-width: none;
    }

    .fdbp-shell .fdam-breadcrumbs::-webkit-scrollbar {
        display: none;
    }

    .fdbp-shell .fdbp-crumb {
        flex: 1 1 0;
        min-width: 0;
        margin-left: -16px;
        padding: 8px 20px 8px 32px;
        line-height: 1.08;
    }

    .fdbp-shell .fdbp-crumb:first-child {
        flex: 0 0 84px;
        min-width: 84px;
        padding: 8px 25px 8px 10px;
    }

    .fdbp-shell .fdbp-home-icon {
        width: 36px;
        height: 36px;
    }

    .fdbp-shell .fdbp-label {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        hyphens: auto;
    }

    /* Con 5 o más niveles, la ruta se desplaza dentro de su propia barra,
       evitando cualquier desbordamiento horizontal de la página. */
    .fdbp-shell--many .fdam-breadcrumbs {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
    }

    .fdbp-shell--many .fdbp-crumb {
        flex: 0 0 148px;
        min-width: 148px;
        scroll-snap-align: start;
    }

    .fdbp-shell--many .fdbp-crumb:first-child {
        flex-basis: 78px;
        min-width: 78px;
    }

    .fdbp-shell .fdbp-return {
        width: 100%;
        min-width: 0;
        display: flex !important;
        min-height: 64px;
        padding: 0 !important;
        background: var(--fdbp-petroleo);
        clip-path: none;
    }

    .fdbp-shell .fdbp-return .fdam-button {
        width: 100% !important;
        min-height: 64px !important;
        margin: 0 !important;
        padding: 12px 24px !important;
        justify-content: center;
        gap: 13px;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: #fff !important;
        font-size: clamp(17px, 5vw, 23px) !important;
    }

    .fdbp-shell .fdbp-back-icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }
    /* Título actual más grande en móviles, sin cambiar los niveles anteriores. */
    .fdbp-shell .fdbp-crumb--current .fdbp-label {
        font-size: clamp(18px, 5.2vw, 22px);
        font-weight: 800;
        line-height: 1.05;
    }

    /* En móvil, Volver atrás se muestra solo como icono, tipo botón HOME. */
    .fdbp-shell .fdbp-return {
        width: 112px;
        min-width: 112px;
        min-height: 64px;
        margin-left: auto !important;
        background: var(--fdbp-petroleo);
        clip-path: polygon(22px 0, 100% 0, 100% 100%, 22px 100%, 0 50%);
    }

    .fdbp-shell .fdbp-return .fdam-button {
        min-height: 64px !important;
        padding: 8px 12px 8px 24px !important;
        justify-content: center;
        gap: 0;
    }

    .fdbp-shell .fdbp-return .fdam-button > span {
        display: none !important;
    }

    .fdbp-shell .fdbp-back-icon {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
    }

}

/* Pantallas muy angostas: reduce solo tipografía/espaciado del breadcrumb. */
@media (max-width: 420px) {
    .fdbp-shell {
        --fdbp-alto: 86px;
        --fdbp-punta: 18px;
    }

    .fdbp-shell .fdam-breadcrumbs {
        font-size: 11.5px;
    }

    .fdbp-shell .fdbp-crumb {
        margin-left: -13px;
        padding-left: 26px;
        padding-right: 15px;
    }

    .fdbp-shell .fdbp-crumb:first-child {
        flex-basis: 70px;
        min-width: 70px;
        padding-left: 8px;
        padding-right: 20px;
    }

    .fdbp-shell .fdbp-home-icon {
        width: 31px;
        height: 31px;
    }

    .fdbp-shell .fdbp-crumb--current .fdbp-label {
        font-size: 18px;
    }

    .fdbp-shell .fdbp-return {
        width: 96px;
        min-width: 96px;
        min-height: 58px;
        padding: 0 !important;
    }

    .fdbp-shell .fdbp-return .fdam-button {
        width: 100% !important;
        min-height: 58px !important;
        padding: 6px 10px 6px 22px !important;
    }

    .fdbp-shell .fdbp-back-icon {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }
}

/* Respeta preferencias de accesibilidad. */
@media (prefers-reduced-motion: reduce) {
    .fdbp-shell .fdbp-crumb,
    .fdbp-shell .fdbp-return .fdam-button {
        transition: none !important;
    }
}
