/* ==========================================================================
   Términos y Condiciones — /terminos/ (.trm-*)
   Fondo, migas y botones salen de pag-* (paginas.css); aquí el índice, el
   texto de cada versión, la lista de versiones y la hoja de impresión.
   El texto es un archivo fijo sin clases: se estila por sus etiquetas, dentro
   de .trm-doc. Sin box-shadow, sin contornos de caja, sin degradado en texto;
   las líneas de 1px a baja opacidad solo separan.
   ========================================================================== */

/* Cabecera: versión y acciones ------------------------------------------- */

.trm-cabecera {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    max-width: 1120px;
    margin: 0 auto 1.75rem;
}

.trm-version {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .55rem;
    margin: 0;
    color: rgba(232, 236, 247, .78);
    font-size: .95rem;
    font-weight: 500;
    line-height: 1.45;
}

.trm-version > span:first-child {
    color: #fff;
    font-weight: 600;
}

.trm-version-sep {
    color: rgba(232, 236, 247, .4);
}

.trm-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}

.trm-imprimir {
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

.trm-imprimir[hidden] {
    display: none;
}

.trm-aviso {
    flex: 1 1 100%;
    order: 3;
    margin: 0;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .06);
    color: rgba(232, 236, 247, .8);
    font-size: .9rem;
    line-height: 1.6;
    text-wrap: pretty;
}

.trm-aviso strong {
    color: #fff;
    font-weight: 600;
}

.trm-aviso a,
.trm-fin a {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: rgba(232, 236, 247, .35);
    text-underline-offset: 3px;
}

.trm-aviso a:hover,
.trm-aviso a:focus,
.trm-fin a:hover,
.trm-fin a:focus {
    color: #fff;
    text-decoration-color: currentColor;
}

.trm-nota {
    flex: 1 1 100%;
    order: 4;
    margin: 0;
    color: rgba(232, 236, 247, .6);
    font-size: .82rem;
}

/* Solo en papel: versión, fecha y dirección estable al inicio. */
.trm-impreso {
    display: none;
}

/* Índice y texto --------------------------------------------------------- */

.trm-layout {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
    max-width: 1120px;
    margin: 0 auto;
}

.trm-lateral {
    position: sticky;
    top: calc(var(--site-header-h, 7.5rem) + 1.25rem);
    max-height: calc(100vh - var(--site-header-h, 7.5rem) - 2.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
}

.trm-indice > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 .6rem;
    border-radius: 10px;
    color: rgba(232, 236, 247, .6);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .1em;
    line-height: 1;
    text-transform: uppercase;
    list-style: none;
    cursor: pointer;
}

.trm-indice > summary::-webkit-details-marker {
    display: none;
}

.trm-indice > summary::after {
    content: "\f078";
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-size: .7rem;
    font-weight: 900;
    color: #8EB4D4;
    transition: transform .2s ease;
}

.trm-indice[open] > summary::after {
    transform: rotate(180deg);
}

.trm-indice > summary:hover {
    color: #fff;
}

.trm-indice-grupo {
    margin: .9rem 0 .3rem;
    padding: 0 .6rem;
    color: rgba(232, 236, 247, .45);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.trm-indice-lista {
    margin: 0;
    padding: 0;
    list-style: none;
}

.trm-indice-lista a {
    display: block;
    padding: .38rem .6rem;
    border-radius: 8px;
    color: rgba(232, 236, 247, .7);
    font-size: .84rem;
    line-height: 1.35;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}

.trm-indice-lista a:hover,
.trm-indice-lista a:focus {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

.trm-indice-lista a[aria-current="true"] {
    background: rgba(50, 94, 132, .3);
    color: #fff;
}

.trm-doc {
    min-width: 0;
    padding: 40px 44px 32px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .035);
    color: rgba(232, 236, 247, .82);
    font-size: .95rem;
    line-height: 1.7;
}

.trm-doc [id] {
    scroll-margin-top: calc(var(--site-header-h, 7.5rem) + 1.25rem);
}

.trm-doc h1 {
    margin: 0 0 1rem;
    color: #fff;
    font-size: clamp(1.55rem, 2.6vw, 2.1rem);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -.02em;
}

.trm-doc h2 {
    margin: 2.6rem 0 1rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.trm-doc h3 {
    margin: 1.9rem 0 .75rem;
    color: #fff;
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.35;
}

/* main.css fija p a .9rem (y a .7rem en ≤768 px): el texto legal se lee
   parejo, al tamaño de .trm-doc. */
.trm-doc p {
    margin: 0 0 .9rem;
    font-size: inherit;
    line-height: inherit;
    text-wrap: pretty;
}

.trm-doc strong {
    color: #fff;
    font-weight: 600;
}

/* El CSS global apaga las viñetas: aquí vuelven, porque el texto las usa. */
.trm-doc ul,
.trm-doc ol {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
    list-style: disc;
}

.trm-doc ol {
    list-style: decimal;
}

.trm-doc li {
    margin: 0 0 .45rem;
    text-wrap: pretty;
}

.trm-doc li::marker {
    color: #8EB4D4;
}

/* El texto trae algunas listas envueltas en un ítem vacío ((a), (b)…): el
   ítem de afuera no lleva viñeta y la lista de adentro tampoco, porque cada
   punto ya trae su letra. */
.trm-doc li:has(> ul:only-child),
.trm-doc li:has(> ul:only-child) > ul {
    list-style: none;
}

.trm-doc li:has(> ul:only-child) > ul {
    margin: 0;
    padding-left: 0;
}

.trm-doc hr {
    height: 0;
    margin: 3rem 0 0;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.trm-doc hr + h2 {
    margin-top: 0;
}

.trm-doc a {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: rgba(232, 236, 247, .35);
    text-underline-offset: 3px;
}

/* Tablas: desplazables en teléfono, dentro de su contenedor. */
.trm-tabla {
    margin: .9rem 0 1.4rem;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
}

.trm-tabla.is-desliza::before {
    content: "Deslice la tabla para ver todas las columnas →";
    display: block;
    position: sticky;
    left: 0;
    margin: 0 0 .5rem;
    color: rgba(232, 236, 247, .55);
    font-size: .76rem;
}

.trm-doc table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
    line-height: 1.5;
}

.trm-doc th,
.trm-doc td {
    padding: .65rem .6rem;
    text-align: left;
    vertical-align: top;
}

.trm-doc th:first-child,
.trm-doc td:first-child {
    padding-left: 0;
}

.trm-doc th:last-child,
.trm-doc td:last-child {
    padding-right: 0;
}

.trm-doc thead th {
    padding-bottom: .55rem;
    color: rgba(232, 236, 247, .6);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.35;
    text-transform: uppercase;
}

.trm-doc tbody tr td {
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.trm-doc tbody td:first-child {
    color: #fff;
}

.trm-fin {
    display: none;
    margin: 2rem 0 0;
    font-size: .88rem;
}

/* Documento anterior: sus listas ya traen el número en el texto. ---------- */

.trm-doc--legado section + section {
    margin-top: .5rem;
}

.trm-doc--legado ul {
    padding-left: 0;
    list-style: none;
}

.trm-doc--legado h1 {
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.trm-doc--legado .twenty {
    margin-top: 1.5rem;
    padding-top: 0;
    border-top: 0;
}

.trm-doc--legado .terms-accent {
    color: #FFA41B;
}

.trm-doc--legado .terms-copy {
    color: rgba(232, 236, 247, .6);
    font-size: .85rem;
}

/* Versiones -------------------------------------------------------------- */

.trm-versiones {
    max-width: 820px;
    margin: 0 auto;
}

/* Las migas arrancan en la misma columna que el título de la lista. */
.trm-versiones .pag-migas {
    max-width: none;
}

.trm-titulo {
    margin: .5rem 0 1rem;
    color: #fff;
    font-size: clamp(1.7rem, 3.2vw, 2.4rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.trm-intro {
    max-width: 680px;
    margin: 0 0 2rem;
    color: rgba(232, 236, 247, .78);
    font-size: 1rem;
    line-height: 1.65;
    text-wrap: pretty;
}

.trm-lista {
    display: grid;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.trm-item {
    padding: 26px 28px 28px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .045);
}

.trm-item-cabecera {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem 1rem;
}

.trm-item-titulo {
    margin: 0;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.trm-item-estado {
    margin: 0;
    color: #FFC46B;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.trm-item-fecha {
    margin: .35rem 0 0;
    color: rgba(232, 236, 247, .6);
    font-size: .88rem;
}

.trm-item-vigencia {
    margin: .75rem 0 0;
    color: rgba(232, 236, 247, .8);
    font-size: .94rem;
    line-height: 1.6;
    text-wrap: pretty;
}

.trm-item-enlace {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    margin: 1.15rem 0 0;
}

.trm-item-url {
    color: rgba(232, 236, 247, .55);
    font-size: .82rem;
    overflow-wrap: anywhere;
}

.trm-resumen {
    margin-top: 1.6rem;
    padding-top: 1.35rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.trm-resumen-titulo {
    margin: 0 0 .8rem;
    color: rgba(232, 236, 247, .6);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .1em;
    line-height: 1;
    text-transform: uppercase;
}

.trm-resumen p,
.trm-resumen li {
    margin: 0 0 .8rem;
    color: rgba(232, 236, 247, .8);
    font-size: .92rem;
    line-height: 1.65;
    text-wrap: pretty;
}

.trm-resumen strong {
    color: #fff;
    font-weight: 600;
}

/* La lista de cambios llega numerada (<ol>); el CSS global le quita el número. */
.trm-resumen ol {
    margin: 0 0 1rem;
    padding-left: 1.4rem;
    list-style: decimal;
}

.trm-resumen li {
    margin-bottom: .6rem;
    padding-left: .2rem;
}

.trm-resumen li::marker {
    color: #8EB4D4;
    font-weight: 600;
}

/* Tablet y teléfono ------------------------------------------------------ */

@media (max-width: 991px) {
    .trm-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .trm-lateral {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .trm-indice {
        border-radius: 14px;
        background: rgba(255, 255, 255, .045);
    }

    .trm-indice > summary {
        min-height: 48px;
        padding: 0 1rem;
        color: #fff;
        font-size: .78rem;
    }

    .trm-indice nav {
        padding: 0 .4rem .8rem;
    }

    .trm-indice-grupo {
        margin-top: .4rem;
    }

    .trm-indice-lista a {
        padding: .55rem .6rem;
        font-size: .9rem;
    }

    .trm-doc {
        padding: 30px 28px 26px;
    }

    /* Sin el ancho del escritorio, las tablas anchas se deslizan en vez de
       apretar sus columnas. */
    .trm-doc th,
    .trm-doc td {
        min-width: 5.5rem;
    }

    .trm-fin {
        display: block;
    }
}

@media (max-width: 575px) {
    .trm-cabecera {
        gap: .9rem;
        margin-bottom: 1.25rem;
    }

    /* Versión y fecha en dos líneas, sin el punto colgando al final. */
    .trm-version {
        flex-direction: column;
    }

    .trm-version-sep {
        display: none;
    }

    .trm-acciones {
        flex: 1 1 100%;
    }

    .trm-acciones .pag-cta {
        flex: 1 1 auto;
    }

    .trm-doc {
        padding: 24px 18px 20px;
        border-radius: 16px;
        font-size: .92rem;
        line-height: 1.65;
    }

    .trm-doc h2 {
        margin-top: 2rem;
        padding-top: 1.5rem;
        font-size: 1.1rem;
    }

    .trm-doc ul,
    .trm-doc ol {
        padding-left: 1.1rem;
    }

    .trm-item {
        padding: 22px 20px 22px;
        border-radius: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .trm-indice > summary::after,
    .trm-indice-lista a {
        transition: none;
    }
}

html.fx-pausa .trm-indice > summary::after,
html.fx-pausa .trm-indice-lista a {
    transition: none;
}

/* Impresión y PDF (Reglamento 37899-MEIC, art. 190) ---------------------- */

@media print {
    @page {
        margin: 16mm 14mm;
    }

    html,
    body,
    body.version1,
    #app {
        background: #fff !important;
        color: #000 !important;
    }

    /* Bootstrap imprime con un mínimo de 992 px: el texto saldría encogido. */
    body,
    .container {
        min-width: 0 !important;
    }

    #header,
    .skip-link,
    .ftr-area,
    .cielo,
    .pag-migas,
    .trm-version,
    .trm-acciones,
    .trm-nota,
    .trm-lateral,
    .trm-fin,
    .trm-item-enlace .pag-cta {
        display: none !important;
    }

    .pag-main {
        padding: 0 !important;
        background: none !important;
        overflow: visible !important;
    }

    .pag-main > .container,
    .container {
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .trm-impreso {
        display: block;
        margin: 0 0 5mm;
        padding-bottom: 2mm;
        border-bottom: .5pt solid #999;
        color: #333;
        font-size: 8.5pt;
    }

    .trm-cabecera {
        display: block;
        margin: 0;
    }

    .trm-aviso {
        margin: 0 0 5mm;
        padding: 0;
        background: none;
        color: #000;
        font-size: 9.5pt;
    }

    .trm-aviso *,
    .trm-impreso {
        color: #000 !important;
    }

    .trm-aviso-enlace {
        display: none;
    }

    .trm-layout,
    .trm-versiones {
        display: block;
        max-width: none;
        margin: 0;
    }

    .trm-doc,
    .trm-item {
        padding: 0;
        border-radius: 0;
        background: none;
        color: #000;
        font-size: 10.5pt;
        line-height: 1.45;
    }

    .trm-doc *,
    .trm-versiones * {
        color: #000 !important;
    }

    .trm-doc h1 {
        font-size: 17pt;
    }

    .trm-doc h2 {
        margin-top: 7mm;
        padding-top: 0;
        border-top: 0;
        font-size: 12.5pt;
    }

    .trm-doc h3 {
        font-size: 11pt;
    }

    .trm-doc h1,
    .trm-doc h2,
    .trm-doc h3 {
        break-after: avoid;
        page-break-after: avoid;
    }

    .trm-doc p,
    .trm-doc li,
    .trm-doc tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .trm-doc li::marker,
    .trm-resumen li::marker {
        color: #000;
    }

    .trm-tabla {
        overflow: visible;
    }

    .trm-tabla.is-desliza::before {
        display: none;
    }

    .trm-doc table {
        font-size: 8.5pt;
    }

    .trm-doc th,
    .trm-doc td,
    .trm-doc th:first-child,
    .trm-doc td:first-child,
    .trm-doc th:last-child,
    .trm-doc td:last-child {
        min-width: 0;
        padding: 1.2mm 1.6mm;
        border: .5pt solid #999;
    }

    .trm-doc hr {
        border-top-color: #999;
    }

    .trm-item-url::before {
        content: "Dirección: ";
    }
}
