/* IMPRESIÓN — Marca Privada
   ============================================================================
   Se carga la última (head.php) para ganar a las reglas de pantalla y al bloque
   de modo oscuro de variables.css a igualdad de especificidad.

   Tres problemas que resuelve:
   · La barra de cookies NO se oculta al aceptarla: la librería solo la desplaza
     (.ccb--hidden = translateY(100%), display:block) y es position:fixed, así que
     el navegador la repetía en todas las páginas del PDF.
   · Con el sistema en oscuro, el navegador imprime con los tokens oscuros pero
     sin fondos (opción por defecto): texto claro sobre papel blanco. Aquí se
     redeclaran los tokens en claro, y los módulos "tinta" pasan a papel.
   · Cabecera sticky, publicidad, menús y botones no tienen sentido en papel.
   ========================================================================= */

@media print {

    @page {
        margin: 16mm 15mm 18mm;
    }

    /* --- Tokens en claro, también si el sistema está en modo oscuro --- */
    :root {
        color-scheme: light;

        --surface-page: #FFFFFF;
        --surface-card: #FFFFFF;
        --surface-raised: #FFFFFF;
        --surface-offset: #FFFFFF;
        --surface-accent: #FFFFFF;
        /* Sin fondos impresos, un módulo oscuro es papel: su texto pasa a tinta */
        --surface-ink: #FFFFFF;

        --text-strong: var(--warm-950);
        --text-body: var(--warm-900);
        --text-body-soft: var(--warm-800);
        --text-dim: var(--warm-700);
        --text-faint: var(--warm-600);
        --text-on-ink: var(--warm-950);
        --text-dim-on-ink: var(--warm-700);
        --accent-on-ink: var(--gold-800);

        --link: var(--warm-950);
        --link-hover: var(--warm-950);
        --link-underline: var(--warm-400);

        --border-hair-soft: var(--warm-200);
        --border-hair: var(--warm-300);
        --border-strong: var(--warm-400);
        --border-accent: var(--gold-700);
        --border-accent-soft: var(--gold-300);
        --accent-soft: var(--gold-500);

        --action: var(--warm-950);
        --action-strong: var(--warm-950);
        --danger: var(--red-700);

        --shadow-sm: none;
        --shadow-md: none;
        --shadow-lg: none;
    }

    /* Los filtros del modo oscuro (logo invertido, fotos atenuadas) fuera.
       Las del detalle se atenúan en pages/detalle.css. */
    .logo-alimarket,
    .mp-report__media img,
    .card__image img,
    .mp-issue__cover img,
    .article-hero img,
    .article-figure img,
    .informe-hero__image img,
    .abody figure img,
    .rel__media img,
    .child__media img {
        filter: none !important;
    }

    /* --- Lo que no se imprime --- */
    #cconsent-bar,
    #cconsent-modal,
    .process.notification,
    .skip-link,
    .mp-ad-top,
    .ad-container,
    .ad-slot,
    .ad-label,
    .header__actions,
    .header__menu-toggle,
    .header__nav-container,
    .article-actions,
    .share-dropdown,
    .related-block,
    .toc,
    .gatecard__actions,
    .dlbox,
    .sumario-nav,
    .sumario-sidebar .btn,
    .year-paginator,
    .edition-card .card__meta,
    .footer__links,
    .mp-subscribe-promo,
    .mp-advertisers,
    .jvm-tooltip,
    .jvm-zoom-btn,
    iframe,
    video {
        display: none !important;
    }

    /* --- Página --- */
    html,
    body {
        background: #FFFFFF !important;
    }

    body {
        font-size: 10.5pt;
        line-height: 1.45;
        color: var(--text-body);
    }

    /* Nada fijo ni pegajoso: se repetiría o taparía texto en cada hoja */
    .header,
    .header__mancheta,
    .sumario-sidebar {
        position: static !important;
    }

    .header {
        border-bottom: 0.5pt solid var(--border-hair);
        box-shadow: none;
    }

    .container,
    .noticia-col,
    .abody,
    .article-locked,
    p {
        max-width: none !important;
    }

    .container {
        padding-left: 0;
        padding-right: 0;
    }

    .footer {
        margin-top: 12mm;
        padding: 4mm 0 0;
        border-top: 0.5pt solid var(--border-hair);
    }

    /* --- Tipografía --- */
    h1,
    .arttitle {
        font-size: 22pt !important;
        line-height: 1.1 !important;
    }

    h2 {
        font-size: 16pt;
    }

    h3,
    .abody h3 {
        font-size: 13pt;
    }

    .abody {
        font-size: 10.5pt;
        line-height: 1.55;
    }

    .article-lead,
    .informe-hero__subtitle {
        font-size: 12pt;
    }

    .abody blockquote {
        font-size: 13pt;
    }

    .abody table th,
    .abody table td {
        font-size: 9pt;
    }

    /* Los gráficos del cuerpo (Alimarket Viz, Datawrapper) son iframes y no se imprimen:
       sin aviso quedaba un hueco mudo entre párrafos. :lang(en) toma el lang del <html>. */
    .abody .iframe_table_wrapper:has(iframe)::after {
        content: "[Gráfico interactivo: consúltalo en la versión web de este artículo]";
        display: block;
        margin: 2mm 0 4mm;
        font-size: 9pt;
        font-style: italic;
        color: var(--text-dim);
    }

    .abody .iframe_table_wrapper:has(iframe):lang(en)::after {
        content: "[Interactive chart: see the web version of this article]";
    }

    /* Lo que entra con animación al hacer scroll parte de opacity:0 y el observador no
       llega a dispararse al imprimir: sin esto, en papel salían huecos en blanco. El
       !important es legítimo aquí: tiene que ganar a la clase .is-visible y a cualquier
       estado intermedio de la animación, sea cual sea su especificidad. */
    .anim-reveal-up,
    .anim-fade-in {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }

    /* En papel un enlace no se puede pulsar: se imprime su destino externo */
    .abody a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: var(--text-dim);
        word-break: break-all;
    }

    /* --- Cortes de página --- */
    h1,
    h2,
    h3,
    h4 {
        break-after: avoid;
        page-break-after: avoid;
    }

    figure,
    table,
    blockquote,
    img,
    picture {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    p,
    li {
        orphans: 3;
        widows: 3;
    }

    img {
        max-height: 120mm;
        object-fit: contain;
    }

    /* --- Detalle: hero del Informe ---
       En pantalla es un bloque tinta con colores fijos claros; sin fondo
       impreso esos textos desaparecerían. Una columna, tinta sobre papel. */
    .informe-hero__inner {
        display: block;
        background: none !important;
        color: var(--text-body);
    }

    .informe-hero__text {
        padding: 0 0 4mm;
    }

    .informe-hero .arttitle,
    .informe-hero__subtitle,
    .informe-hero__h2desc,
    .crumbs--on-dark,
    .crumbs--on-dark a,
    .crumbs--on-dark .sep,
    .crumbs--on-dark .current,
    .mp-privel__title,
    .mp-privel__subnav-title {
        color: var(--text-strong) !important;
    }

    .informe-hero .crumbs {
        margin-bottom: 4mm;
    }

    .informe-hero__image {
        min-height: 0;
    }

    .informe-hero__image img {
        height: auto;
        max-height: 90mm;
    }

    /* Índice fuera: el cuerpo ocupa todo el ancho */
    .toc-layout {
        display: block;
    }

    .article-hero img,
    .article-figure img {
        border-radius: 0;
    }
}
