/* ======================================
   PRINT / EXPORT PDF — overrides
   Active when reveal is in print-pdf mode
   ====================================== */

@page {
    size: 1280pt 720pt;
    margin: 0;
}

@media print {
    html, body {
        background: #fff !important;
        width: 1280px !important;
        height: 720px !important;
    }

    /* Hide UI chrome */
    .topbar, .reveal .controls, .reveal .progress, .reveal .speaker-notes,
    .btn-download { display: none !important; }

    /* Force background colors to render in PDF */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .reveal .slides section {
        padding: 44px 56px !important;
        page-break-after: always;
        width: 1280px !important;
        height: 720px !important;
        box-sizing: border-box !important;
    }

    .slide-hero, .slide-samsung {
        background: var(--hero-gradient) !important;
        color: #fff !important;
    }
    .slide-hero { background: linear-gradient(135deg, #073E99 0%, #1428A0 50%, #1F4FCB 100%) !important; }
    .slide-samsung { background: linear-gradient(135deg, #1428A0 0%, #073E99 100%) !important; }
    .slide-soft { background: #F4F6FA !important; }
    .slide-white { background: #fff !important; }

    .card, .stat, .kpi, .endpoint, .dashboard-mock, .mock-browser, .kb-item {
        box-shadow: 0 2px 6px rgba(7,62,153,0.08) !important;
        break-inside: avoid;
    }
    .card:hover, .kb-item:hover, .mock-browser:hover { transform: none !important; }

    /* FORCE desktop layout — override responsive media queries on print */
    .stats { grid-template-columns: repeat(4, 1fr) !important; }
    .grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
    .grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
    .grid-4 { grid-template-columns: repeat(4, 1fr) !important; }
    .dashboard-mock { grid-template-columns: repeat(4, 1fr) !important; }
    .endpoint-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .split { grid-template-columns: 1.1fr 0.9fr !important; }
    .checklist { grid-template-columns: repeat(2, 1fr) !important; }
    .mock-layout { grid-template-columns: 150px 1fr !important; }
    .mock-sidebar { display: block !important; }
    .mock-widgets { grid-template-columns: repeat(4, 1fr) !important; }
    .mock-form-grid { grid-template-columns: 1fr 1fr !important; }
    .mock-warranty-card { grid-template-columns: repeat(4, 1fr) !important; }

    /* Hero phone visible in print */
    .hero-phone { display: block !important; }

    /* Hide labels that are mobile-only */
    .hero-content { max-width: 70% !important; }
}

/* When reveal injects body.print-pdf class */
.reveal.print-pdf .topbar,
.reveal.print-pdf .btn-download { display: none !important; }

/* ======================================
   SINGLE-SLIDE MODE — usato da /api/pdf.php
   per renderizzare ogni slide come PDF di 1 pagina

   Funziona via attribute data-slide-print sul <html>
   impostato dallo script inline in index.html PRIMA
   che chromium print-to-pdf scatti lo snapshot.
   ====================================== */

html[data-slide-print] .reveal .slides > section { display: none !important; }
html[data-slide-print="0"]  .reveal .slides > section:nth-of-type(1)  { display: block !important; }
html[data-slide-print="1"]  .reveal .slides > section:nth-of-type(2)  { display: block !important; }
html[data-slide-print="2"]  .reveal .slides > section:nth-of-type(3)  { display: block !important; }
html[data-slide-print="3"]  .reveal .slides > section:nth-of-type(4)  { display: block !important; }
html[data-slide-print="4"]  .reveal .slides > section:nth-of-type(5)  { display: block !important; }
html[data-slide-print="5"]  .reveal .slides > section:nth-of-type(6)  { display: block !important; }
html[data-slide-print="6"]  .reveal .slides > section:nth-of-type(7)  { display: block !important; }
html[data-slide-print="7"]  .reveal .slides > section:nth-of-type(8)  { display: block !important; }
html[data-slide-print="8"]  .reveal .slides > section:nth-of-type(9)  { display: block !important; }
html[data-slide-print="9"]  .reveal .slides > section:nth-of-type(10) { display: block !important; }
html[data-slide-print="10"] .reveal .slides > section:nth-of-type(11) { display: block !important; }
html[data-slide-print="11"] .reveal .slides > section:nth-of-type(12) { display: block !important; }
html[data-slide-print="12"] .reveal .slides > section:nth-of-type(13) { display: block !important; }
html[data-slide-print="13"] .reveal .slides > section:nth-of-type(14) { display: block !important; }
html[data-slide-print="14"] .reveal .slides > section:nth-of-type(15) { display: block !important; }
html[data-slide-print="15"] .reveal .slides > section:nth-of-type(16) { display: block !important; }
html[data-slide-print="16"] .reveal .slides > section:nth-of-type(17) { display: block !important; }
html[data-slide-print="17"] .reveal .slides > section:nth-of-type(18) { display: block !important; }
html[data-slide-print="18"] .reveal .slides > section:nth-of-type(19) { display: block !important; }
html[data-slide-print="19"] .reveal .slides > section:nth-of-type(20) { display: block !important; }



body.single-slide-mode {
    width: 1280px !important;
    height: 720px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
}

body.single-slide-mode .topbar,
body.single-slide-mode .reveal .controls,
body.single-slide-mode .reveal .progress,
body.single-slide-mode .reveal .slide-number,
body.single-slide-mode .reveal .pause-overlay,
body.single-slide-mode .reveal .speaker-notes { display: none !important; }

body.single-slide-mode .reveal {
    width: 1280px !important;
    height: 720px !important;
    position: static !important;
    overflow: visible !important;
}

body.single-slide-mode .reveal .slides {
    transform: none !important;
    width: 1280px !important;
    height: 720px !important;
    left: 0 !important;
    top: 0 !important;
    position: static !important;
    perspective: none !important;
    text-align: left;
    zoom: 1 !important;
}

body.single-slide-mode .reveal .slides > section {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 1280px !important;
    height: 720px !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block;
    box-sizing: border-box !important;
    padding: 44px 56px !important;
}

/* Forza layout desktop in single-slide-mode — disattiva tutte le media query mobile */
body.single-slide-mode .stats { grid-template-columns: repeat(4, 1fr) !important; gap: 16px !important; }
body.single-slide-mode .stat .num { font-size: 2.6em !important; }
body.single-slide-mode .grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
body.single-slide-mode .grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
body.single-slide-mode .grid-4 { grid-template-columns: repeat(4, 1fr) !important; }
body.single-slide-mode .dashboard-mock { grid-template-columns: repeat(4, 1fr) !important; }
body.single-slide-mode .endpoint-grid { grid-template-columns: repeat(3, 1fr) !important; }
body.single-slide-mode .split { grid-template-columns: 1.1fr 0.9fr !important; }
body.single-slide-mode .checklist { grid-template-columns: repeat(2, 1fr) !important; }
body.single-slide-mode .mock-layout { grid-template-columns: 150px 1fr !important; }
body.single-slide-mode .mock-sidebar { display: block !important; }
body.single-slide-mode .mock-widgets { grid-template-columns: repeat(4, 1fr) !important; }
body.single-slide-mode .mock-form-grid { grid-template-columns: 1fr 1fr !important; }
body.single-slide-mode .mock-warranty-card { grid-template-columns: repeat(4, 1fr) !important; }
body.single-slide-mode .hero-phone { display: block !important; }
body.single-slide-mode .hero-content { max-width: 70% !important; }
body.single-slide-mode .reveal { font-size: 22px !important; }
body.single-slide-mode .hero-title { font-size: 2.8em !important; }
body.single-slide-mode .section-title { font-size: 1.8em !important; }
body.single-slide-mode .reveal .slides section { padding: 44px 56px !important; }
body.single-slide-mode .topbar { display: none !important; }

/* Force background colors render */
body.single-slide-mode * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

body.single-slide-mode .slide-hero {
    background: linear-gradient(135deg, #073E99 0%, #1428A0 50%, #1F4FCB 100%) !important;
}
body.single-slide-mode .slide-samsung {
    background: linear-gradient(135deg, #1428A0 0%, #073E99 100%) !important;
}
body.single-slide-mode .slide-soft  { background: #F4F6FA !important; }
body.single-slide-mode .slide-white { background: #fff !important; }

/* Phone: rimuovi transform rotate che fa casino in PDF */
body.single-slide-mode .hero-phone {
    transform: none !important;
    right: 60px !important;
    bottom: 60px !important;
    width: 200px !important;
    height: 380px !important;
}

/* Logo Samsung in single-slide-mode: filter funziona meglio se forzato */
body.single-slide-mode .hero-logos img.sam,
body.single-slide-mode .hero-logos img[alt="Samsung"] {
    filter: brightness(0) invert(1) !important;
}

/* Slide section: lascia overflow visibile per content che eccede 720px,
   ma il body resta clipping container 1280x720 */
body.single-slide-mode .reveal .slides > section {
    overflow: visible !important;
}

/* Compatta padding sulle slide con mockup browser larghi */
body.single-slide-mode .reveal .slides > section .mock-browser {
    margin-top: 8px !important;
}

/* Riduci dim mockup in PDF per garantire fit */
body.single-slide-mode .mock-layout { min-height: 280px !important; }
body.single-slide-mode .mock-main { padding: 10px 14px !important; }
body.single-slide-mode .mock-h { margin-bottom: 6px !important; }
body.single-slide-mode .mock-widgets { margin-bottom: 6px !important; }
