/* Vista Legales. Sustituir los fondos al recibir los originales de diseño. */
.legales-page {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: #fff;
    background: #ba001b;
}

.legales-page *,
.legales-page *::before,
.legales-page *::after {
    box-sizing: border-box;
}

.legales-section {
    position: relative;
    isolation: isolate;
    min-height: 1040px;
    padding: 155px 11.7% 80px 5.5%;
    margin-top: 55px;
    background: linear-gradient(90deg, #0007, #000e), url('../images/esg/descanso-truck.png') 30% center / cover no-repeat;
    overflow: hidden;
}

.legales-section::after {
    content: '';
    position: absolute;
    z-index: -1;
    width: 160%;
    height: 700px;
    left: 22%;
    top: 70%;
    border-radius: 50% 0 0 0;
    transform: rotate(-19deg);
    background: #b00023aa;
    pointer-events: none;
}

.legales-layout {
    display: grid;
    grid-template-columns: 28% minmax(0, 1fr);
    gap: 4%;
    max-width: 1800px;
    margin: auto;
}

.legales-layout h1 {
    font-size: clamp(2.8rem, 3.7vw, 4.8rem);
    font-weight: 400;
    line-height: 1.12;
    margin: 0;
    padding: 22px 0 0 30px;
    align-self: start;
    border-left: 7px solid #ff354e;
}

.legales-list {
    display: grid;
}

.legales-list-page {
    grid-area: 1 / 1;
    display: grid;
    align-content: start;
    gap: 24px;
}

.legales-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 214px;
    border-radius: 24px;
    overflow: hidden;
    background: #eef1f3 url('../images/legales/privacidad.svg') center / cover no-repeat;
    color: #080808;
}

.legales-card h2,
.legales-card p {
    max-width: 57%;
    overflow-wrap: break-word;
}

.legales-card h2 {
    color: #e60020;
    font-size: clamp(1.2rem, 1.35vw, 1.7rem);
    line-height: 1.2;
    margin: 0;
    padding: 26px 36px 0;
}

.legales-card p {
    font-size: .95rem;
    line-height: 1.45;
    margin: 0;
    padding: 6px 36px 20px;
    color: #454d54;
}

.legales-actions {
    margin-top: auto;
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.legales-action {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border: 0;
    border-radius: 30px;
    background: #ed001d;
    color: #fff;
    padding: 10px 17px;
    font: inherit;
    font-size: .875rem;
    text-decoration: none;
    cursor: pointer;
}

.legales-action:hover {
    background: #b50019;
}

.legales-page :focus-visible {
    outline: 3px solid #369ade;
    outline-offset: 5px;
}

.legales-pagination {
    margin-top: 22px;
}

.legales-arrows {
    display: flex;
    gap: 18px;
}

.legales-arrows button {
    border: 0;
    background: none;
    padding: 5px 0;
    cursor: pointer;
    min-width: 46px;
    min-height: 44px;
}

.legales-arrows img {
    display: block;
    width: 46px;
    height: auto;
}

.legales-arrows button:disabled {
    opacity: .4;
    cursor: default;
}

.legales-status {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 22px;
}

#legales-count {
    font-size: 2rem;
    font-weight: 700;
    white-space: nowrap;
}

.legales-progress {
    flex: 1;
    height: 3px;
    background: #ffffff55;
}

.legales-progress span {
    display: block;
    height: 100%;
    background: #fff;
}

.legales-footer {
    min-height: 530px;
    padding: 170px 24px 120px;
    text-align: center;
    background: linear-gradient(#c90022dd, #c3001ddd), url('../images/esg/esg-caravana-bg.png') center / cover;
}

.legales-footer img {
    width: min(370px, 65vw);
    height: auto;
}

.legales-footer p {
    margin: 50px 0 0;
    font-size: 1.75rem;
}

#legales-dialog {
    max-width: min(480px, calc(100% - 40px));
    border: 0;
    border-radius: 20px;
    padding: 32px;
    color: #171717;
}

#legales-dialog::backdrop {
    background: #000a;
}

#legales-dialog h2 {
    color: #e60020;
    margin-top: 0;
}

#legales-dialog p {
    line-height: 1.5;
}

@media (max-width: 1400px) {
    .legales-section {
        padding: 100px 6% 70px;
        min-height: 950px;
    }

    .legales-layout {
        grid-template-columns: 29% minmax(0, 1fr);
        gap: 4%;
    }

    .legales-layout h1 {
        padding-left: 20px;
    }
}

@media (max-width: 900px) {
    .legales-section {
        padding: 60px 6%;
        min-height: auto;
    }

    .legales-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 36px;
    }

    .legales-layout h1 {
        font-size: 3rem;
        padding-top: 0;
    }

    .legales-card {
        min-height: 220px;
    }

    .legales-footer {
        min-height: 360px;
        padding: 100px 24px;
    }
}

@media (max-width: 540px) {
    .legales-card {
        border-radius: 20px;
        background-position: 42% center;
    }

    .legales-card h2,
    .legales-card p {
        max-width: 72%;
    }

    .legales-card h2 {
        padding: 22px 20px 0;
    }

    .legales-actions {
        padding: 14px 20px;
        justify-content: flex-start;
        gap: 10px;
    }

    .legales-card p {
        padding-inline: 20px;
    }

    .legales-action {
        min-height: 44px;
    }

    .legales-list-page {
        gap: 18px;
    }

    .legales-footer p {
        font-size: 1.3rem;
        margin-top: 34px;
    }
}

/* Interna de cada aviso; se abre con ?aviso=ID y conserva la página del listado. */
/* clip evita que los contenedores creen un scroll intermedio que bloquee sticky. */
.legales-page,
.legales-page .site-wrapper {
    overflow-x: clip;
}

.legales-page [hidden] {
    display: none !important;
}

.legales-detail {
    display: grid;
    grid-template-columns: 35% minmax(0, 1fr);
    margin-top: 55px;
    min-height: calc(100vh - 55px);
    background: #fff;
    color: #111;
}

.legales-detail-sidebar {
    background: #ed0016;
    color: #fff;
    position: sticky;
    top: 55px;
    align-self: start;
    height: calc(100dvh - 55px);
    overflow-y: auto;
    z-index: 2;
}

.legales-back {
    position: sticky;
    top: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin-left: 8%;
    padding: 5px 16px;
    background: #fff;
    color: #ed0016;
    border-radius: 0 0 10px 10px;
    text-decoration: none;
    font-size: 1rem;
}

.legales-detail-heading {
    padding: 120px 0 80px 23%;
}

.legales-detail-heading h1 {
    font-size: clamp(2rem, 3.1vw, 4.4rem);
    line-height: 1.15;
    text-transform: uppercase;
    margin: 0;
    padding: 0 9% 40px 0;
    border-bottom: 1px solid #fff;
    overflow-wrap: break-word;
}

.legales-detail-download {
    padding: 44px 20px 0 0;
}

.legales-detail-download .legales-action {
    background: #fff;
    color: #ed0016;
}

.legales-detail-download .legales-action:hover {
    background: #ffe3e7;
}

.legales-detail-content {
    position: relative;
    padding: 95px 10% 100px 13.5%;
    font-size: clamp(1.1rem, 1.4vw, 1.9rem);
    line-height: 1.2;
}

.legales-detail-rule {
    position: absolute;
    top: 0;
    left: 34%;
    width: 35%;
    height: 7px;
    background: #ed0016;
    border-radius: 0 0 9px 9px;
}

.legales-detail-content::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 55%;
    bottom: 0;
    width: 2px;
    background: #ed0016;
}

.legales-detail-content p {
    margin: 0 0 34px;
}

.legales-detail-content h2 {
    font: inherit;
    margin: 0 0 34px;
}

.legales-detail-content .legales-sample-label {
    font-size: .875rem;
    color: #666;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .legales-detail {
        grid-template-columns: minmax(0, 1fr);
    }

    .legales-detail-sidebar {
        height: auto;
        max-height: calc(50dvh - 55px);
    }

    .legales-detail-heading {
        position: static;
        padding: 45px 7%;
    }

    .legales-detail-heading h1 {
        font-size: clamp(2rem, 6vw, 3rem);
        padding: 0 0 25px;
    }

    .legales-detail-download {
        padding-top: 25px;
    }

    .legales-detail-content {
        padding: 55px 7%;
        font-size: 1.125rem;
        line-height: 1.5;
    }

    .legales-detail-content::before {
        display: none;
    }

    .legales-back {
        margin-left: 7%;
        min-height: 44px;
    }
}

/* El facsímil conserva la tipografía original y el texto superpuesto permite copiarlo. */
.legal-sheet {
    display: block;
    width: 100%;
    height: auto;
    background: white;
}

.legal-sheet+.legal-sheet {
    border-top: 1px solid #ddd;
}

.legal-sheet image {
    pointer-events: none;
}

.legal-sheet text {
    fill: transparent;
    white-space: pre;
    cursor: text;
}

.legal-sheet text::selection {
    background: #3487dc55;
}