/* ===================================================================
   Jyotiṣa — Yuga · PRINT STYLESHEET
   Linked with media="print", so every rule here applies only to the
   printed / "Save as PDF" output. Two layers:
     1. base print rules   — apply to any print (native Ctrl/Cmd-P too)
     2. body.printing*      — the designed full-reading book that the
                              "Print / Save PDF" button assembles
   Keep this file editable in isolation; it must not affect the screen.
   =================================================================== */

/* ---- 1. PALETTE: always print on warm paper with near-black ink,
        even when dark mode is active, so SVG var() fills resolve. ---- */
html.dark, html:not(.dark){
  --paper:#ece5d6; --paper-2:#e6dece; --paper-3:#ddd3bf;
  --ink:#1c1a16; --ink-2:#3a352c; --ink-soft:#6f685a;
  --red:#a8392b; --red-deep:#8c2c20;
  --rule:#b8ab8f; --rule-soft:#cabd9f;
  --benefic:#3f6b4a; --debil:#a8392b;
}
body, html.dark body, html.dark{ background:#fff; color:#000; }
*{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }

/* ---- page geometry + running heads/feet ---- */
@page{
  margin:16mm 14mm 16mm 14mm;
}
/* table-heavy folios print landscape so numbers stay legible (no 6px type) */
@page wide{ size:A4 landscape; margin:12mm; }

/* ---- hide all interactive chrome from any printout ---- */
.topband, nav.bar, .hero, .cast-grid, footer, .sechead .rt, .prefbar,
.export-btn, .natal-export, .bs-btn, .page-nav, .emblem-toggle,
.folio-jump-wrap, .nav-scrim, .chart-modal, #homeBg{ display:none !important; }
#results{ display:block !important; }
.sec{ padding-top:18px; }

/* ---- charts: one unified cap; scale to column, never overflow/split ---- */
.chartsvg{ width:100% !important; height:auto !important; max-width:330px;
  display:block; margin:0 auto; }
.chart-img{ width:auto !important; height:auto !important; max-width:330px !important;
  display:block !important; margin:10px auto !important;
  break-inside:avoid; page-break-inside:avoid; }
img, svg{ max-width:100% !important; }

/* keep a chart with its caption/table; keep headings with their body */
.natal-chart, .spec-chart, .transit-chart, .previewcard, .graha-card,
table, thead, tr, .synth-emph, figure{ break-inside:avoid; page-break-inside:avoid; }
h2, h3, h4{ break-after:avoid; page-break-after:avoid; }

/* ---- WIDE DATA TABLES: collapse min-widths so columns fit the page ---- */
.divscroll, .graha-wrap, .sarvato-wrap, .poruttam-table, .match-planet-table,
.gochara-table, .match-charts-grid{ overflow:visible !important; max-width:100% !important; }
table.graha, table.divtab, .match-planet-table table, .poruttam-table table{
  min-width:0 !important; width:100% !important; font-size:8.5px !important; table-layout:fixed; }
table.graha th, table.graha td, table.divtab th, table.divtab td,
.match-planet-table th, .match-planet-table td{ white-space:normal !important;
  overflow-wrap:anywhere; word-break:break-word; padding:3px 4px !important; }
.sarvato-grid{ min-width:0 !important; width:100% !important; font-size:7px !important; table-layout:fixed; }
.sarvato-grid td, .sarvato-grid th{ padding:1px !important; white-space:normal !important; }

/* nothing may exceed the printable width */
#results, .book-page, .print-folio, .sec{ max-width:100% !important; overflow:visible !important; }

/* ===================================================================
   2. THE DESIGNED FULL READING  (body.printing — Print button path)
   =================================================================== */
body.printing .topband, body.printing nav.bar, body.printing .hero,
body.printing .cast-grid, body.printing footer, body.printing .book-tabs,
body.printing .book-subtabs, body.printing .page-nav,
body.printing .book-spine .bs-right, body.printing .book-foot{ display:none !important; }
body.printing .book-page{ min-height:auto; overflow:visible; }

/* sub-tab + vertical-menu panes expand so nothing is hidden in print */
.printing .sb-tabwrap{ display:block; }
.printing .sb-vmenu{ display:none; }
.printing .sb-pane, .printing .match-pane{ display:block !important; margin-top:18px; }
.printing .hsub-pane{ display:block !important; }

/* ---- COVER FOLIO ---- */
.print-cover{ break-after:page; page-break-after:always; text-align:center;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  min-height:86vh; padding:0 8mm; }
.print-cover .pc-seal{ width:64px; height:64px; margin-bottom:26px; }
.print-cover .pc-kicker{ font-family:var(--mono); font-size:9.5px; letter-spacing:.3em;
  text-transform:uppercase; color:var(--ink-soft); margin-bottom:20px; }
.print-cover .pc-title{ font-family:var(--disp); font-size:46px; font-weight:600;
  letter-spacing:.01em; line-height:1; }
.print-cover .pc-title em{ font-style:italic; font-weight:500; color:var(--red-deep); }
.print-cover .pc-rule{ width:120px; height:1px; background:var(--rule); margin:24px 0 26px; }
.print-cover .pc-native{ font-family:var(--disp); font-size:30px; font-style:italic;
  color:var(--ink); margin-bottom:16px; }
.print-cover .pc-particulars{ font-family:var(--mono); font-size:11px; line-height:2;
  letter-spacing:.06em; color:var(--ink-2); }
.print-cover .pc-foot{ margin-top:42px; font-family:var(--body); font-style:italic;
  font-size:12px; color:var(--ink-soft); }

/* ---- CONTENTS PAGE ---- */
.print-contents{ break-after:page; page-break-after:always; padding-top:10mm; }
.print-contents h2{ font-family:var(--disp); font-size:30px; font-weight:600;
  border-bottom:1px solid var(--rule); padding-bottom:10px; margin:0 0 22px; }
.print-contents .pc-toc{ list-style:none; margin:0; padding:0; columns:2; column-gap:32px; }
.print-contents .pc-toc li{ display:flex; align-items:baseline; gap:12px;
  padding:7px 0; border-bottom:1px dotted var(--rule-soft); break-inside:avoid; }
.print-contents .toc-rn{ font-family:var(--mono); font-size:10px; letter-spacing:.16em;
  color:var(--red-deep); min-width:34px; }
.print-contents .toc-name{ font-family:var(--body); font-size:15px; color:var(--ink); }

/* ---- PER-FOLIO SECTION DIVIDER ---- */
body.printing .print-folio{ break-before:page; page-break-before:always;
  margin-bottom:24px; padding-bottom:18px; }
body.printing .print-folio:first-child{ break-before:auto; page-break-before:auto; }
body.printing .print-folio.landscape{ page:wide; }
body.printing .folio-head{ border-bottom:1px solid var(--rule); margin-bottom:22px;
  padding-bottom:14px; }
body.printing .folio-rn{ display:inline-block; font-family:var(--mono); font-size:10px;
  letter-spacing:.28em; text-transform:uppercase; color:var(--red-deep); margin-bottom:6px; }
body.printing .folio-title{ font-family:var(--disp); font-size:30px; font-weight:600;
  margin:0 0 6px; line-height:1.05; }
body.printing .folio-blurb{ font-family:var(--body); font-style:italic; font-size:14px;
  line-height:1.5; color:var(--ink-soft); margin:0; max-width:62ch; }

/* the per-folio judgment reads as a framed pull-quote in print */
body.printing .synth-emph{ border-left:3px solid var(--red); background:var(--paper-2);
  padding:12px 16px; margin:14px 0; break-inside:avoid; page-break-inside:avoid; }

body.printing .sc-shell{max-width:580px}


body.printing .natal-chart, body.printing .spec-chart, body.printing .transit-chart,
body.printing table, body.printing .graha-card, body.printing .previewcard{
  break-inside:avoid; page-break-inside:avoid; }
body.printing .chartsvg{ width:100% !important; height:auto !important; max-width:330px;
  display:block; margin:0 auto; }
body.printing .chart-img{ width:auto !important; height:auto !important; max-width:330px !important;
  display:block !important; margin:10px auto !important; break-inside:avoid; page-break-inside:avoid; }

/* ===================================================================
   MATCHING DETAILS — stack every compatibility pane
   =================================================================== */
body.printing-match #mcTabs, body.printing-match .sb-vmenu,
body.printing-match .book-foot,
body.printing-match .page-nav{ display:none !important; }
body.printing-match .book-page-wrap,
body.printing-match .sb-tabwrap, body.printing-match .sb-panebox{ display:block !important; }
body.printing-match .match-pane{ display:block !important; break-before:page;
  page-break-before:always; border-top:1px solid var(--rule); margin-top:16px; padding-top:14px; }
body.printing-match .match-pane:first-of-type{ break-before:auto; page-break-before:auto;
  border-top:none; margin-top:0; }
body.printing-match .match-pane, body.printing-match .match-charts-grid,
body.printing-match .match-chart-box, body.printing-match .dm-state,
body.printing-match .rel-rem-card, body.printing-match .synth-composite,
body.printing-match table{ break-inside:avoid; page-break-inside:avoid; }
body.printing-match .match-charts-grid{ display:grid !important; grid-template-columns:1fr 1fr; }
body.printing-match .pane-insight{ break-inside:avoid; }
body.printing-match .divscroll, body.printing-match .graha-wrap,
body.printing-match .poruttam-table, body.printing-match .match-planet-table,
body.printing-match .match-kuta-table{ overflow:visible !important; max-width:100% !important; }
body.printing-match table{ min-width:0 !important; width:100% !important;
  table-layout:fixed; font-size:7.5px !important; }
body.printing-match .match-planet-table table{ font-size:6px !important; }
body.printing-match th, body.printing-match td{ padding:2px 3px !important;
  white-space:normal !important; overflow-wrap:anywhere; word-break:break-word; }
body.printing-match .match-chart-svg img, body.printing-match .match-chart-svg svg{
  max-width:230px !important; width:100% !important; height:auto !important; margin:0 auto; display:block; }
body.printing-match img, body.printing-match svg{ max-width:100% !important; }
