/**
 * Print Stylesheet — Theme Template Chrome, Page Setup & Data Tables
 *
 * Enqueued with media="print" (see functions.php) so these rules only apply
 * during print/print-preview. It loads after style.css, so equal-specificity
 * rules here win; !important is only used to beat inline/Vuetify styles.
 *
 * Covers the theme's PHP templates:
 *   header.php / footer.php, page.php, market-report.php (+ other app templates)
 *
 * Does NOT cover the Vue apps themselves — those are handled inside the apps:
 *   - Vuetify print rules ......... src/vue/themes/base.css (@media print block)
 *   - Per-component print layout .. d-print-none / d-print-* classes in the .vue files
 *
 * Already handled elsewhere (don't duplicate unless consolidating):
 *   - Light-mode colour variables for print ... inc/customizer.php (@media print on :root)
 *   - Logo swap (light/dark -> print logo) .... style.css (@media print block)
 *   - .main-navigation / .mkt-location-nav / .site-footer hidden ... style.css (@media print block)
 *
 * Sections:
 *   1. Page setup
 *   2. Base / colours
 *   3. Global print toggles
 *   4. Header (header.php)
 *   5. Content area (page.php, market-report.php, template-parts/vue-apps/*)
 *   6. Footer (footer.php)
 *   7. Page breaks & typography
 *   8. Data tables
 */

/* ========================================
   1. Page Setup
   ======================================== */

/* Portrait is the supported orientation. The Vue chart image is rendered at
   720px (7.5in) wide and scales to fit the content width, so margins close to
   0.5in give it 1:1 sizing; the 1.5cm margin scales it by ~2%. */
@page {
  size: portrait;
  margin: .5in;
}

/* ========================================
   2. Base / Colours
   ======================================== */

html {
  font-size: 11pt;
  line-height: 1.35;
}

body {
  /* Print uses the screen font tokens (set on :root by the Vue theme); the fallback
     is the same system stack style.css uses for body on non-app pages. */
  font-family: var(--mkt-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif);
  font-size: 12pt;
  line-height: 1.35;
  color: #000;
  background: #fff !important; /* paper is always white, even if dark mode is active */
}

/* Monospace content follows the screen mono token */
pre,
code,
kbd,
.mkt-mono {
  font-family: var(--mkt-font-mono, monospace);
}

/* Keep coloured backgrounds/swatches when printing (browsers drop them by default).
   Scoped to the apps so ordinary page content still saves ink. */
.mkt {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ========================================
   3. Global Print Toggles
   ======================================== */

/* Hide sections marked with .no-print (toggleable via usePrintSection() composable) */
.no-print {
  display: none !important;
}

/* Never print admin/assistive chrome */
#wpadminbar,
.skip-link,
.menu-toggle {
  display: none !important;
}

/* ========================================
   4. Header (header.php)
   ======================================== */

/* Keep branding (the print logo is swapped in by style.css); drop navigation */
.main-navigation {
  display: none !important;
}

.site-header {
  position: static;
  background: #fff;
}

.site-header-content {
  /*max-width: none;
  padding: 0 0 0.4cm;
  border-bottom: 1px solid #999;
  margin-bottom: 12pt;*/
  padding: 0;
  margin: 0;
  margin-bottom: 12pt;
  display: inline-block;
}

.site-logo img.site-logo-print {
  max-width: 160pt;
  max-height: 20pt;
}
/* ========================================
   5. Content Area
   ======================================== */

/* style.css sets a viewport-based min-height, which can force a blank extra page */
.site-content {
  min-height: 0;
}

.site-content-core {
  padding: 0;
  max-width: none;
}

/* Market report / app templates: the location + market menu is navigation only */
.mkt-location-nav {
  display: none !important;
}

.mkt-report-main,
.mkt-report-content,
.vue-app-container {
  display: block;       /* collapse any screen-only grid/flex sidebar layout */
  width: 100%;
  max-width: none;
  overflow: visible;    /* nothing to scroll on paper */
}

/* Placeholder shown while the Vue app mounts */
.app-loading {
  display: none !important;
}

/* Static pages (page.php): simplify the title treatment */
.entry-header {
  max-width: none;
  margin: 0 0 0.5cm;
  padding: 0;
}

.entry-title,
.entry-title span {
  /*border-bottom-width: 1px;*/
  border-bottom: none;
}

/* Optional: print link targets in page content (uncomment if wanted)
.entry-content a[href^="http"]::after {
  content: " (" attr(href) ")";
  font-size: 0.85em;
}
*/

/* ========================================
   6. Footer (footer.php)
   ======================================== */

/* Keep the copyright line; drop footer navigation and widgets */
.footer-navigation,
.footer-widgets,
.theme-toggle {
  display: none !important;
}

.site-footer {
  margin: 12pt 0 0;
  background: #fff;
}

.site-footer-content {
  max-width: none;
  padding: 0;
  border-top: 1pt solid #999;
  font-size: 9pt;
}

/* ========================================
   7. Page Breaks & Typography
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  break-after: avoid;
}

p {
  orphans: 3;
  widows: 3;
}

img,
figure,
pre,
blockquote {
  break-inside: avoid;
  max-width: 100%;
}

/* ========================================
   8. Data Tables
   ======================================== */

/* Fix horizontal scroll + sticky header columns for print */
.mkt-data_table,
.mkt-data-table {
  overflow-x: visible !important;
}

.mkt-data_table th.row-header,
.mkt-data-table th.row-header {
  position: static !important;
}
