/*
 * Datasheet print layout for the product detail page (Show.html).
 *
 * The datasheet IS the product page, printed: no separate markup, so every
 * language GTranslate serves (/de/, /pl/, eilersen.dk) prints translated.
 * Loaded on the product detail page only (f:asset.css in Show.html).
 *
 * The sitepackage's theme SCSS still has an older @media print block with
 * !important rules; the selectors here are prefixed with `html body` so they
 * win regardless of load order.
 */

/* Print-only elements stay hidden on screen. */
.ds-print-only {
    display: none;
}

@media print {
    @page {
        size: A4;
        margin: 16mm 16mm 18mm 16mm;

        @bottom-left {
            content: "www.eilersen.com";
            font-size: 8pt;
            color: #555;
            border-top: 0.6mm solid #E76E00;
            padding-top: 1.5mm;
            vertical-align: top;
        }
        @bottom-right {
            content: counter(page) " / " counter(pages);
            font-size: 8pt;
            color: #555;
            border-top: 0.6mm solid #E76E00;
            padding-top: 1.5mm;
            vertical-align: top;
        }
    }

    html,
    html body {
        background: #fff !important;
        color: #1a1a1a;
        font-size: 9.5pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ---- Hide everything that is not the product ---------------------- */
    html body > :not(.body-bg),
    html body .body-bg > :not(#page-content),
    html body #page-content > :not(:has(.singleproduct-container)),
    html body .backicon,
    html body .product-singleview-actions,
    html body .product-thumbnails,
    html body .single-product-tabpanel > nav,
    html body #nav-3dviewer,
    html body .related,
    html body #product_qoute,
    html body .gtranslate_wrapper,
    html body .typo3-adminPanel-bar,
    html body .onlyprint {
        display: none !important;
    }

    /* Cookiebot styles its banner with #id + !important, which beats the
       generic rule above; without this a visitor who has not answered the
       banner gets it printed on every page. */
    html body div#CybotCookiebotDialog,
    html body div#CybotCookiebotDialogBodyUnderlay,
    html body div#CookiebotWidget {
        display: none !important;
    }

    html body .ds-print-only {
        display: block !important;
    }

    html body #page-content {
        padding: 0 !important;
        margin: 0 !important;
        position: relative;
    }

    html body .frame,
    html body .frame-container,
    html body .frame-container-default,
    html body .frame-inner,
    html body .frame-group-container,
    html body .frame-group-inner {
        max-width: none !important;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ---- Page 1: header row, title, image, description, key data ------------
       .single-product-left is flattened (display: contents), so its children
       and .single-product-right are all items of one grid:
       row 1 = brand (left) + category (right), then one full-width item each. */
    html body .singleproduct-container {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        gap: 0 !important;
        break-after: auto !important;
    }
    html body .singleproduct-container > .single-product-left {
        display: contents !important;
    }
    html body .singleproduct-container > *,
    html body .singleproduct-container > .single-product-left > * {
        grid-column: 1 / -1;
    }

    html body .singleproduct-container .ds-brand {
        grid-column: 1;
        grid-row: 1;
        font-weight: 700;
        font-size: 16pt;
        line-height: 1;
        margin: 0 0 8mm 0;
    }

    /* Product category (R01) = the breadcrumb's active item. The site's JS
       moves the breadcrumb <ol> into .single-product-left. */
    html body .singleproduct-container ol.breadcrumb-eiler {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        display: block !important;
        padding: 0 !important;
        margin: 1mm 0 0 0 !important;
        background: none !important;
        list-style: none;
    }
    html body ol.breadcrumb-eiler li:not(.active) {
        display: none !important;
    }
    html body ol.breadcrumb-eiler li.active,
    html body ol.breadcrumb-eiler li.active a,
    html body ol.breadcrumb-eiler li.active span {
        display: inline !important;
        padding: 0 !important;
        color: #555 !important;
        font-size: 9pt !important;
        font-weight: 400 !important;
        text-decoration: none !important;
        background: none !important;
    }
    html body ol.breadcrumb-eiler li.active::before,
    html body ol.breadcrumb-eiler li.active::after {
        content: none !important;
    }

    html body .single-product-left h1 {
        order: 1;
        font-size: 24pt !important;
        font-weight: 700 !important;
        line-height: 1.15 !important;
        margin: 0 0 6mm 0 !important;
    }
    html body .singleproduct-container > .single-product-right {
        order: 2;
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 0 6mm 0 !important;
        padding: 0 !important;
        text-align: center;
    }
    /* On screen the image box is a 4:3 flex box; at print width that is
       ~25 cm tall. */
    html body .single-view-large-image {
        display: block !important;
        aspect-ratio: auto !important;
        height: auto !important;
        min-height: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        background: none !important;
    }
    html body .single-view-large-image img {
        max-width: 120mm !important;
        max-height: 72mm !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain;
    }
    html body .single-product-left .product-description {
        order: 3;
        display: block;
        margin: 0 0 6mm 0;
    }
    html body .single-product-left .product-description p {
        font-size: 10.5pt !important;
        line-height: 1.45 !important;
        margin: 0 !important;
    }

    /* Key data (R05): spans alternate label/value; each pair becomes a card,
       two cards per row. grid-auto-flow: dense puts each pair's label back
       into the first free row of its column. */
    html body .single-product-left .product-specs {
        order: 4;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        grid-auto-flow: dense;
        column-gap: 4mm;
        row-gap: 0;
        margin: 0 !important;
        break-inside: avoid;
    }
    html body .product-specs > span {
        display: block !important;
        background: #fff3e6;
        border-left: 1mm solid #E76E00;
        padding: 0 3.5mm;
        margin: 0;
    }
    html body .product-specs > span:nth-child(4n+1),
    html body .product-specs > span:nth-child(4n+2) {
        grid-column: 1;
    }
    html body .product-specs > span:nth-child(4n+3),
    html body .product-specs > span:nth-child(4n+4) {
        grid-column: 2;
    }
    /* label */
    html body .product-specs > span:nth-child(odd) {
        font-size: 8pt !important;
        color: #666;
        padding-top: 2.5mm;
        margin-top: 3mm;
    }
    /* value */
    html body .product-specs > span:nth-child(even) {
        font-size: 10.5pt !important;
        font-weight: 600;
        padding-bottom: 2.5mm;
    }

    /* ---- Sections ----------------------------------------------------------- */
    html body .single-product-tabpanel {
        margin: 0 !important;
        padding: 0 !important;
    }
    html body .single-product-tabpanel .tab-content {
        display: block !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    html body .single-product-tabpanel .tab-content > .tab-pane {
        display: block !important;
        opacity: 1 !important;
        background: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 0 8mm 0 !important;
        break-after: auto !important;
    }
    html body .single-product-tabpanel .tab-content > #nav-3dviewer {
        display: none !important;
    }

    /* Page breaks as in the customer's layout: features/applications/options,
       then specifications, then dimensions/documentation. */
    html body #nav-specialfeatures,
    html body #nav-specifications,
    html body #nav-dimensions {
        break-before: page;
    }

    html body .ds-section-title {
        display: block !important;
        font-size: 17pt;
        font-weight: 700;
        line-height: 1.2;
        margin: 0 0 4mm 0;
        break-after: avoid;
    }

    html body .tab-pane ul {
        margin: 0 !important;
        padding-left: 5mm !important;
    }
    html body .tab-pane li {
        font-size: 9.5pt !important;
        line-height: 1.4 !important;
        padding: 0 0 1mm 0 !important;
        margin: 0 !important;
        break-inside: avoid;
    }
    html body .tab-pane p {
        font-size: 9.5pt !important;
    }

    /* Special features (R07/R08): editors use a 2-column table of lists. */
    html body #nav-specialfeatures figure.table,
    html body #nav-specialfeatures .table-responsive {
        margin: 0 !important;
        overflow: visible !important;
    }
    html body #nav-specialfeatures table {
        width: 100% !important;
        border: none !important;
        border-collapse: collapse;
    }
    html body #nav-specialfeatures td {
        width: 50%;
        vertical-align: top;
        border: none !important;
        padding: 0 4mm 0 0 !important;
        background: none !important;
        height: auto !important;
    }

    /* Applications (R10): one list, set in two columns. */
    html body #nav-applications ul {
        columns: 2;
        column-gap: 8mm;
    }

    /* ---- Specifications table (R14) ------------------------------------------
       Rendered exactly as entered: 2, 3 or 5 columns, colspans kept. The
       script marks empty rows (.ds-empty-row) and the first row with content
       (.ds-head-row), since editors use <td> for the header too. */
    html body #nav-specifications figure.table,
    html body #nav-specifications .table-responsive {
        margin: 0 !important;
        overflow: visible !important;
    }
    html body #nav-specifications table {
        width: 100% !important;
        border-collapse: collapse !important;
        border: none !important;
        table-layout: auto !important;
    }
    html body #nav-specifications tr {
        break-inside: avoid;
    }
    html body #nav-specifications tr.ds-empty-row {
        display: none !important;
    }
    html body #nav-specifications td,
    html body #nav-specifications th {
        font-size: 9pt !important;
        line-height: 1.3 !important;
        padding: 1.8mm 2.5mm !important;
        border: none !important;
        border-bottom: 0.2mm solid #ddd !important;
        vertical-align: middle !important;
        height: auto !important;
        background: none;
        color: #1a1a1a;
    }
    html body #nav-specifications td span,
    html body #nav-specifications th span {
        font-size: inherit !important;
    }
    html body #nav-specifications tr:nth-child(even) > td {
        background: #f5f5f5;
    }
    html body #nav-specifications tr > td:first-child {
        font-weight: 600;
    }
    html body #nav-specifications tr.ds-head-row > td,
    html body #nav-specifications tr.ds-head-row > th,
    html body #nav-specifications thead th {
        background: #1a1a1a !important;
        color: #fff !important;
        font-weight: 600;
        border-bottom: none !important;
    }
    html body #nav-specifications p {
        font-size: 8.5pt !important;
        color: #444;
        margin: 2mm 0 0 0 !important;
    }

    /* ---- Dimensions (R17) ----------------------------------------------------- */
    html body #nav-dimensions img,
    html body #nav-dimensions video {
        display: block;
        float: none !important;
        width: auto !important;
        max-width: 100% !important;
        max-height: 80mm !important;
        height: auto !important;
        margin: 0 auto 4mm auto;
    }

    /* ---- Documentation (R19): type label + title, one row per file ------------ */
    html body #nav-documentation {
        display: block !important;
    }
    html body #nav-documentation .filelink-list {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }
    html body #nav-documentation .filelink-item {
        display: grid !important;
        grid-template-columns: 16mm 1fr;
        align-items: baseline;
        border-bottom: 0.2mm solid #ddd;
        padding: 1mm 0 !important;
        margin: 0 !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        min-height: 0 !important;
        background: none !important;
        border-radius: 0 !important;
        flex: none !important;
        break-inside: avoid;
    }
    /* The site's own type badge (absolute ::after) is replaced by ::before. */
    html body #nav-documentation .filelink-item::after {
        content: none !important;
        display: none !important;
    }
    /* Replaces the site's 11px orange bullet (list-normal li::before). */
    html body #nav-documentation .filelink-item::before {
        display: block !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        background: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        line-height: 1.3 !important;
        content: "FILE";
        grid-column: 1;
        font-size: 7.5pt !important;
        font-weight: 600;
        color: #E76E00 !important;
        text-transform: uppercase;
    }
    html body #nav-documentation .filelink-item.pdf::before { content: "PDF"; }
    html body #nav-documentation .filelink-item.jpg::before,
    html body #nav-documentation .filelink-item.jpeg::before { content: "JPG"; }
    html body #nav-documentation .filelink-item.png::before { content: "PNG"; }
    html body #nav-documentation .filelink-item.step::before,
    html body #nav-documentation .filelink-item.stp::before { content: "STEP"; }
    html body #nav-documentation .filelink-item.dwg::before { content: "DWG"; }
    html body #nav-documentation .filelink-item.dxf::before { content: "DXF"; }
    html body #nav-documentation .filelink-item.zip::before { content: "ZIP"; }
    html body #nav-documentation .filelink-item.youtube::before,
    html body #nav-documentation .filelink-item.vimeo::before,
    html body #nav-documentation .filelink-item.mp4::before { content: "VIDEO"; }

    html body #nav-documentation .file-wrapperlink,
    html body #nav-documentation .filelink-media,
    html body #nav-documentation .filelink-filesize,
    html body #nav-documentation hr,
    html body #nav-documentation br {
        display: none !important;
    }
    html body #nav-documentation .filelink-body {
        grid-column: 2;
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
    }
    html body #nav-documentation .filelink-heading,
    html body #nav-documentation .filelink-filename,
    html body #nav-documentation .filelink-filename a {
        display: inline !important;
        font-size: 9pt !important;
        font-weight: 400 !important;
        color: #1a1a1a !important;
        text-decoration: none !important;
    }
    /* Intro text above the list, if any. */
    html body #nav-documentation > p {
        font-size: 9pt !important;
        margin: 0 0 2mm 0 !important;
    }
}
