/* Creator Systems — print stylesheet. Loaded with media="print" so it only applies
   when printing (or Print-to-PDF). Reformats the live page for paper: strips chrome,
   shows the print-only cover header/footer, and applies per-template-type layout.
   Template type is carried on <body class="cw-print-<glossary|detail|list|generic>">. */

@page {
    margin: 16mm 14mm;
}

/* --- Base: paper colors and readable type --- */
html, body {
    background: #fff !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11pt;
    line-height: 1.42;
    font-family: Georgia, "Times New Roman", Cambria, serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* --- Uniform high-contrast text for paper ---
   On-screen themes (especially dark themes) set muted/themed text colors via
   CSS variables (--cw-muted, --cw-text, --cw-creator-*). Those resolve to LIGHT
   values that print faint and hard to read on white paper. The body-level
   color:#000 above does not reach them: inherited color never overrides a
   child's own explicit color, and theme-scoped selectors out-specify `body`.
   Force every content element to solid black so light and dark areas print
   uniformly. Field labels/meta stay a readable dark gray (higher-specificity
   single-class rules below keep the print header/footer grays intact). */
body, body * {
    color: #000 !important;
    opacity: 1 !important;
    text-shadow: none !important;
    -webkit-text-fill-color: #000 !important;   /* wins over gradient/clip text */
}
/* Field labels & small-caps section headers print solid black too — they
   already read as labels via uppercase + bold + letter-spacing, so they don't
   need a gray tint that would just print faint. */
.cw-portal-label,
.cw-card-label,
.cw-stat-label,
.cw-field-label,
.cw-detail-label {
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
}

/* --- Ink-saving: no dark fills on paper ---
   Dark-background boxes (pills, badges, accent panels, callouts, dark cards)
   print as heavy ink and, with the black text forced above, would be black-on-
   dark = unreadable. Strip every background to white and drop shadows/gradients
   so the whole page prints as black on white. Boxed elements below get a thin
   outline so they still read as distinct chips/panels. Table headers get their
   light gray back via a higher-specificity rule further down. */
body * {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    filter: none !important;
}
/* Keep boxed elements (pills, badges, cards, panels) visible as outlines. */
.cw-portal-pill,
.cw-badge,
.cw-bound-badge,
.cw-badge-first-hand,
.cw-badge-reporting,
.cw-origin-pill,
.cw-origin-badge,
.cw-card,
.cw-portal-card,
.cw-heaven-card,
.cw-panel {
    border: 1px solid #666 !important;
    background: #fff !important;
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
}
.cw-portal-pill,
.cw-badge,
.cw-bound-badge,
.cw-badge-first-hand,
.cw-badge-reporting,
.cw-origin-pill,
.cw-origin-badge {
    padding: 0 3pt !important;
    border-radius: 3pt !important;
    font-size: 8.5pt !important;
}
/* Callout / help / info panels (e.g. heavens-portal "What are tiers…" box) and
   the home record-count chart: white with a thin outline, never a dark fill. */
.cw-user-view-help,
.cw-home-record-chart,
.cw-callout,
.cw-info-box,
.cw-note {
    background: #fff !important;
    border: 1px solid #666 !important;
    padding: 6pt 8pt !important;
}
/* Home record chart: drop the dark bar graphics for print — the numeric value
   prints next to every label, so the bars are redundant ink. */
.cw-home-chart-bar-wrap {
    display: none !important;
}
.cw-home-chart-value {
    margin-left: 8pt !important;
    font-weight: bold !important;
}

/* --- Hide all on-screen chrome, controls, ads, and interactive bits --- */
.cw-nav,
.cw-header-below-nav,
.cw-breadcrumb-row,
.cw-breadcrumb,
.cw-heavens-realms-nav,
.cw-main-aside,
.cw-page-sidebar,
.cw-data-overview-panel,
#cw-page-stats-slot,
.cw-footer,
.cw-hit-counter,
.cw-nav-ad-slot,
.cw-ad,
.adsbygoogle,
ins.adsbygoogle,
.cw-reactions,
.cw-share-buttons,
.cw-panel-share-buttons,
.cw-admin-edit-pencil,
.cw-sponsor-popup-overlay,
.cw-popup-overlay,
.cw-search,
.cw-page-links,
.cw-btn,
.cw-print-btn,
.cw-no-print,
[class*="cw-tts"],
button,
script,
noscript,
iframe,
.leaflet-container,
#cw-uap-map, #cw-claimants-map, #cw-uap-globe {
    display: none !important;
}

/* --- Reflow content to full page width --- */
.cw-main,
.cw-main-wrap,
.cw-main-content,
.cw-page-layout,
.cw-page-content,
main {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    grid-template-columns: none !important;
}

/* --- Print-only cover header --- */
.cw-print-header {
    border-bottom: 2px solid #000;
    padding-bottom: 8pt;
    margin-bottom: 14pt;
}
.cw-print-brand {
    font-size: 8.5pt;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #555;
}
.cw-print-title {
    font-size: 19pt;
    line-height: 1.15;
    margin: 3pt 0 7pt;
    color: #000 !important;
}
.cw-print-meta {
    font-size: 8.5pt;
    color: #333;
}
.cw-print-meta span {
    display: inline-block;
    margin-right: 14pt;
}
.cw-print-meta .cw-print-url {
    color: #555;
    word-break: break-all;
}

/* --- Print-only footer --- */
.cw-print-footer {
    border-top: 1px solid #999;
    margin-top: 16pt;
    padding-top: 6pt;
    font-size: 8pt;
    color: #444;
    display: flex;
    justify-content: space-between;
    gap: 10pt;
}
.cw-print-footer .cw-print-foot-url { word-break: break-all; }

/* --- Typography & flow --- */
h1, h2, h3, h4, h5 { color: #000 !important; page-break-after: avoid; }
.cw-main-content h1 { font-size: 16pt; margin: 0 0 6pt; }
h2 { font-size: 13.5pt; border-bottom: 1px solid #bbb; padding-bottom: 2pt; margin-top: 12pt; }
h3 { font-size: 11.5pt; margin-top: 9pt; }
p, li { orphans: 3; widows: 3; }
a { color: #000 !important; text-decoration: underline; }
img { max-width: 100% !important; height: auto !important; }
ul, ol { padding-left: 18pt; }

table { border-collapse: collapse; width: 100%; margin: 6pt 0; page-break-inside: auto; }
th, td { border: 1px solid #999; padding: 3pt 5pt; font-size: 9.5pt; text-align: left; vertical-align: top; }
th { background: #eee !important; }
tr, thead, tbody { page-break-inside: avoid; }

/* Avoid breaking cards/entries/rows across pages */
article,
.cw-portal-card,
.cw-heaven-card,
.cw-glossary-entry,
.cw-glossary-term,
.cw-stat-row,
.cw-card,
.cw-panel {
    page-break-inside: avoid;
    box-shadow: none !important;
}

/* ==== Per-template-type layouts ==== */

/* GLOSSARY / long-form reference: comfortable measure, term headings start clean */
.cw-print-glossary .cw-main-content { max-width: 100% !important; }
.cw-print-glossary h2 { page-break-before: auto; }
.cw-print-glossary .cw-glossary-entry,
.cw-print-glossary dt { font-weight: bold; margin-top: 8pt; }
.cw-print-glossary dd { margin: 0 0 6pt 0; }

/* DETAIL: single entity — larger title, fields laid out as a definition block */
.cw-print-detail .cw-print-title { font-size: 21pt; }
.cw-print-detail .cw-portal-grid,
.cw-print-detail .cw-detail-grid {
    display: block !important;
}
.cw-print-detail .cw-portal-field { margin-bottom: 5pt; page-break-inside: avoid; }

/* LIST / collections — compact cards, borders instead of shadows, 1 per row */
.cw-print-list .cw-portal-list,
.cw-print-list .cw-heavens-portal-list,
.cw-print-list .cw-card-grid {
    display: block !important;
    columns: auto !important;
}
.cw-print-list .cw-portal-card,
.cw-print-list .cw-heaven-card,
.cw-print-list .cw-card {
    padding: 6pt 8pt !important;
    margin: 0 0 6pt 0 !important;
}
/* Badge/pill outlines are normalized globally in the ink-saving block above. */

/* GENERIC — sensible defaults already applied above */
