/*
 * Pop Emergency — print / "Save as PDF" layout for the policy and info pages.
 * Loaded with media="print" on those pages only. Built for A4 and US Letter.
 * Everything except the document is removed; the document is re-set as a clean,
 * branded, paginated report (header, numbered sections, footer with page numbers).
 */

/* Page size, margins and the running footer with page numbers.
   (Chrome: these apply when the print dialog's "Margins" is set to "Default".) */
@page {
    size: A4;
    margin: 18mm 17mm 20mm 17mm;
    @bottom-left {
        content: "Pop Emergency!  \00B7  popemergency.com";
        font-family: "DM Sans", Arial, sans-serif; font-size: 7.5pt; font-weight: 600;
        color: #a1a1aa;
        vertical-align: middle;
    }
    @bottom-right {
        content: "Page " counter(page) " of " counter(pages);
        font-family: "DM Sans", Arial, sans-serif; font-size: 7.5pt; font-weight: 600;
        color: #a1a1aa;
        vertical-align: middle;
    }
}
@page :first { margin-top: 14mm; }

/* ---------- 1. Strip the website away ---------- */
html, body {
    background: #fff !important;
    height: auto !important; min-height: 0 !important; max-height: none !important;
    overflow: visible !important;
    margin: 0 !important; padding: 0 !important;
    position: static !important;
}
html body * { animation: none !important; transition: none !important; }
/* Everything outside the main content: header, menus, toolbars, chat, banners, buttons, footer. */
html:has(.pe-legal) body > *:not(#site-content) { display: none !important; }
/* Inside the main content, only the document itself. */
html body #site-content { display: block !important; padding: 0 !important; margin: 0 !important; position: static !important; transform: none !important; filter: none !important; }
html:has(.pe-legal) body #site-content > *:not(.pe-legal) { display: none !important; }
html body .pe-legal-aside,
html body .pe-legal-more,
html body .pe-legal-print,
html body .pe-legal-meta,
html body .pe-legal-cookie-btn,
html body .pe-legal-help,
html body .pe-ad, html body .adsbygoogle, html body iframe,
html body .pe-legal-hero { display: none !important; }

/* ---------- 2. Reset the page shell ---------- */
html body .pe-legal,
html body .pe-legal-layout,
html body .pe-legal-card,
html body .pe-legal-doc {
    display: block !important;
    width: auto !important; max-width: none !important;
    margin: 0 !important; padding: 0 !important;
    position: static !important;
    background: none !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    transform: none !important; filter: none !important; opacity: 1 !important;
    overflow: visible !important; contain: none !important; content-visibility: visible !important;
}
html body .pe-legal::before, html body .pe-legal::after,
html body .pe-legal-card::before, html body .pe-legal-card::after { display: none !important; }

html body .pe-legal, html body .pe-legal * {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    text-shadow: none !important;
    -webkit-text-fill-color: currentColor !important;
}
html body .pe-legal {
    color: #27272a !important;
    font: 400 10pt/1.55 "DM Sans", -apple-system, "Segoe UI", Arial, sans-serif !important;
    orphans: 3; widows: 3;
}

/* ---------- 3. Print header and footer ---------- */
html body .pe-print-only { display: block !important; }
.pe-print-head { margin: 0 0 9mm !important; padding: 0 0 5mm !important; border-bottom: 1px solid #e4e4e7; break-after: avoid; }
.pe-print-head-top { display: flex !important; align-items: center; justify-content: space-between; gap: 6mm; margin-bottom: 7mm; }
.pe-print-logo { height: 6.5mm; width: auto; display: block; }
.pe-print-url { font: 700 7.5pt/1.2 "DM Sans", Arial, sans-serif; color: #71717a !important; letter-spacing: .04em; text-align: right; }
.pe-print-bar { height: 1.6mm; border-radius: 1mm; margin: 0 0 6mm; background: linear-gradient(90deg, #ef4444, #ec4899 45%, #8b5cf6) !important; }
.pe-print-kicker { display: block; font: 900 7.5pt/1 "DM Sans", Arial, sans-serif; letter-spacing: .16em; text-transform: uppercase; color: #ef4444 !important; margin: 0 0 3mm; }
.pe-print-title { margin: 0 0 3.5mm !important; padding: 0 !important; font: 400 25pt/1.05 "Archivo Black", "Arial Black", sans-serif !important; letter-spacing: -.02em; color: #111114 !important; }
.pe-print-meta { display: flex !important; flex-wrap: wrap; gap: 2mm 6mm; font: 700 8pt/1.3 "DM Sans", Arial, sans-serif; color: #71717a !important; text-transform: uppercase; letter-spacing: .06em; }
.pe-print-meta b { color: #27272a !important; font-weight: 800; }

.pe-print-foot { margin: 10mm 0 0 !important; padding: 4mm 0 0 !important; border-top: 1px solid #e4e4e7; font: 400 8pt/1.5 "DM Sans", Arial, sans-serif; color: #71717a !important; break-inside: avoid; }
.pe-print-foot strong { color: #27272a !important; }

/* ---------- 4. The document ---------- */
.pe-legal-doc p { margin: 0 0 2.6mm !important; }
.pe-legal-doc a { color: #111114 !important; text-decoration: underline !important; text-decoration-color: #ef4444 !important; text-underline-offset: 1.5px; font-weight: 600; background: none !important; border: 0 !important; }
.pe-legal-doc strong, .pe-legal-doc b { color: #111114 !important; font-weight: 800; }
.pe-legal-doc em { font-style: italic; }

/* Section headings: numbered, never left alone at the bottom of a page */
.pe-legal-doc { counter-reset: pe-print-h2 !important; }
.pe-legal-doc h2 {
    counter-increment: pe-print-h2;
    display: flex !important; align-items: baseline; gap: 3mm;
    margin: 8mm 0 3mm !important; padding: 0 0 2mm !important;
    border: 0 !important; border-bottom: 1px solid #f1f1f4 !important;
    background: none !important;
    font: 400 13.5pt/1.2 "Archivo Black", "Arial Black", sans-serif !important;
    letter-spacing: -.01em !important;
    color: #111114 !important;
    break-after: avoid; page-break-after: avoid; break-inside: avoid;
}
.pe-legal-doc h2::before {
    content: counter(pe-print-h2, decimal-leading-zero) !important;
    display: inline !important; width: auto !important; height: auto !important;
    border: 0 !important; border-radius: 0 !important; background: none !important;
    font: 900 10pt/1 "DM Sans", Arial, sans-serif !important;
    color: #ef4444 !important; letter-spacing: .04em;
}
.pe-legal-doc h3 { margin: 0 0 1.5mm !important; font: 800 10.5pt/1.3 "DM Sans", Arial, sans-serif !important; color: #111114 !important; break-after: avoid; text-transform: none !important; }

/* Lead paragraph */
.pe-legal-lead { margin: 0 0 5mm !important; padding: 0 0 0 4mm !important; border: 0 !important; border-left: 1.2mm solid #ef4444 !important; border-radius: 0 !important; background: none !important; font-size: 10.5pt !important; line-height: 1.6 !important; }
.pe-legal-lead p:last-child { margin-bottom: 0 !important; }

/* Boxes: summary, callouts, closing, legal notice */
.pe-legal-summary, .pe-legal-callout, .pe-legal-closing {
    margin: 4mm 0 5mm !important; padding: 4mm 5mm !important;
    border-radius: 3mm !important; border: 1px solid #e4e4e7 !important;
    background: #fafafa !important;
    break-inside: avoid; page-break-inside: avoid;
}
.pe-legal-summary { background: #fdf2f2 !important; border-color: #fbd5d5 !important; }
.pe-legal-callout.is-warn { background: #fef2f2 !important; border-color: #fecaca !important; }
.pe-legal-callout.is-ok, .pe-legal-closing { background: #f0fdf7 !important; border-color: #c6f0dd !important; }
.pe-legal-callout.is-info { background: #f3f4ff !important; border-color: #dcdffd !important; }
.pe-legal-summary-title, .pe-legal-callout-title, .pe-legal-closing-title {
    display: block !important; margin: 0 0 2mm !important;
    font: 900 7.5pt/1.2 "DM Sans", Arial, sans-serif !important;
    letter-spacing: .14em !important; text-transform: uppercase !important;
    color: #ef4444 !important;
}
.pe-legal-callout-title::before { display: none !important; }
.pe-legal-callout.is-ok .pe-legal-callout-title, .pe-legal-closing .pe-legal-closing-title { color: #059669 !important; }
.pe-legal-callout p:last-child, .pe-legal-closing p:last-child { margin-bottom: 0 !important; }

/* Lists: small, crisp markers instead of the screen bubbles */
.pe-legal-list { display: block !important; margin: 0 0 3.5mm !important; padding: 0 !important; list-style: none !important; }
.pe-legal-list li { position: relative !important; margin: 0 0 1.8mm !important; padding: 0 0 0 5.5mm !important; break-inside: avoid; }
.pe-legal-list li::before {
    content: "" !important; position: absolute !important; left: 0 !important; top: 2.15mm !important;
    width: 2mm !important; height: 2mm !important; border-radius: 50% !important;
    border: 0 !important; background: #ef4444 !important; background-image: none !important;
    -webkit-mask: none !important; mask: none !important;
}
.pe-legal-list.is-check li::before { background: #10b981 !important; }
.pe-legal-list.is-cross li::before { background: none !important; border: 1.5px solid #ef4444 !important; width: 1.6mm !important; height: 1.6mm !important; }
.pe-legal-list.is-arrow li::before { border-radius: 0 !important; width: 0 !important; height: 0 !important; top: 1.6mm !important; background: none !important; border-top: 1.2mm solid transparent !important; border-bottom: 1.2mm solid transparent !important; border-left: 1.8mm solid #8b5cf6 !important; }
ol.pe-legal-list { counter-reset: pe-print-ol; }
ol.pe-legal-list[class] li { counter-increment: pe-print-ol; padding-left: 7mm !important; }
ol.pe-legal-list[class] li::before { content: counter(pe-print-ol) "." !important; top: 0 !important; width: auto !important; height: auto !important; border: 0 !important; border-radius: 0 !important; background: none !important; font-family: "DM Sans", Arial, sans-serif !important; font-weight: 900 !important; font-size: 10pt !important; line-height: 1.55 !important; color: #ef4444 !important; }
.pe-legal-summary .pe-legal-list { margin: 0 !important; }
.pe-legal-summary .pe-legal-list li:last-child { margin-bottom: 0 !important; }

/* Rule cards and tiles: two neat columns */
.pe-legal-rules, .pe-legal-tiles { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 3mm !important; margin: 3mm 0 5mm !important; }
.pe-legal-rule, .pe-legal-tile {
    display: block !important;
    margin: 0 !important; padding: 3mm 4mm !important;
    border: 1px solid #e4e4e7 !important; border-top: 0.8mm solid #ef4444 !important;
    border-radius: 2.5mm !important; background: #fff !important; box-shadow: none !important;
    break-inside: avoid; page-break-inside: avoid;
}
.pe-legal-tile.is-amber, .pe-legal-tile.is-orange { border-top-color: #f59e0b !important; }
.pe-legal-tile.is-blue { border-top-color: #6366f1 !important; }
.pe-legal-rule p { margin: 0 !important; font-size: 9pt !important; line-height: 1.5 !important; }
.pe-legal-tile strong { display: block; margin: 0 0 1mm; font: 800 10pt/1.3 "DM Sans", Arial, sans-serif !important; color: #111114 !important; }
.pe-legal-tile span { display: block; font-size: 9pt !important; line-height: 1.5 !important; color: #3f3f46 !important; }

/* Tables (cookie list) */
.pe-legal-table-wrap { overflow: visible !important; margin: 0 0 4mm !important; border: 0 !important; box-shadow: none !important; background: none !important; }
.pe-legal-doc table { width: 100% !important; border-collapse: collapse !important; font-size: 8.5pt !important; line-height: 1.4 !important; background: none !important; }
.pe-legal-doc thead { display: table-header-group; }
.pe-legal-doc tr { break-inside: avoid; page-break-inside: avoid; }
.pe-legal-doc th, .pe-legal-doc td { padding: 1.8mm 2.2mm !important; border: 1px solid #e4e4e7 !important; text-align: left !important; vertical-align: top !important; background: #fff !important; color: #27272a !important; }
.pe-legal-doc th { background: #f4f4f5 !important; font-weight: 800 !important; color: #111114 !important; font-size: 7.5pt !important; letter-spacing: .06em; text-transform: uppercase; }
.pe-legal-doc code { font: 600 8pt/1.3 ui-monospace, Menlo, Consolas, monospace; background: none !important; color: #111114 !important; padding: 0 !important; }

/* Legal notice (who runs the site) */
.pe-legal-notice { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 0 !important; margin: 3mm 0 5mm !important; border: 1px solid #e4e4e7; border-radius: 2.5mm; overflow: hidden; break-inside: avoid; }
.pe-legal-notice > div { padding: 2.4mm 3.5mm !important; border: 0 !important; border-bottom: 1px solid #f1f1f4 !important; border-radius: 0 !important; background: #fff !important; }
.pe-legal-notice dt { margin: 0 0 .8mm !important; font: 900 6.8pt/1.2 "DM Sans", Arial, sans-serif !important; letter-spacing: .12em; text-transform: uppercase; color: #a1a1aa !important; }
.pe-legal-notice dd { margin: 0 !important; font-size: 9pt !important; font-weight: 600 !important; color: #111114 !important; }

/* Images or embeds that sneak into a policy */
.pe-legal-doc img { max-width: 100% !important; height: auto !important; break-inside: avoid; }
.pe-legal-doc hr { border: 0 !important; border-top: 1px solid #e4e4e7 !important; margin: 5mm 0 !important; background: none !important; height: 0 !important; }
