/* ===== The Daily Mine — Print Stylesheet =====
 * Clean, readable output for paper. Hides UI chrome,
 * forces light colors, and shows link URLs inline.
 */

@media print {

  /* ---------- Page setup ---------- */
  @page {
    size: letter;
    margin: 0.75in 0.6in;
    @top-center {
      content: "thedailymine.co";
      font-size: 8pt;
      color: #999;
      font-family: 'IBM Plex Mono', monospace;
    }
    @bottom-center {
      content: "Page " counter(page);
      font-size: 8pt;
      color: #999;
    }
  }

  /* ---------- Force light theme ---------- */
  :root,
  [data-theme="dark"],
  [data-theme="light"] {
    --bg-primary: #fff !important;
    --bg-secondary: #f8f8f8 !important;
    --bg-tertiary: #f0f0f0 !important;
    --text-primary: #111 !important;
    --text-secondary: #444 !important;
    --text-muted: #666 !important;
    --accent: #b45309 !important;
    --accent-hover: #92400e !important;
    --border: #ccc !important;
    --border-light: #ddd !important;
  }

  html, body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt;
    line-height: 1.45;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ---------- Hide UI chrome ---------- */
  /* Navigation */
  .category-nav,
  nav,
  .nav-dropdown,
  .dropdown-menu,

  /* Footer */
  footer,

  /* Ticker / live data */
  .breaking-ticker,
  #ticker,

  /* Subscribe banners & forms */
  .subscribe-banner,
  .subscribe-section,
  .subscribe-form,

  /* Share & social */
  .share-btn,
  .share-btn-small,
  .story-share,

  /* Reading list buttons (injected by JS) */
  .save-btn,
  .rl-toast,

  /* Theme toggle & header controls */
  .theme-toggle,
  .header-controls,

  /* Back to top */
  #backToTop,

  /* Command palette (injected by JS) */
  .cmd-overlay,
  .cmd-palette,

  /* Skip nav */
  .skip-nav,

  /* Support callouts */
  .support-callout,
  .support-link,

  /* PWA install banner */
  #pwa-banner,

  /* Keyboard shortcuts hint */
  .kbd-hint,

  /* Tip box / donation */
  .tip-box,
  .tip-link,

  /* Print-specific hide class (add to anything) */
  .no-print {
    display: none !important;
  }

  /* ---------- Layout ---------- */
  .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Header: keep logo and title, simplify */
  header {
    border-bottom: 2px solid #333 !important;
    padding: 10px 0 8px !important;
    margin-bottom: 15px !important;
    text-align: center;
  }

  .logo {
    font-size: 1.8rem !important;
    color: #111 !important;
  }

  .tagline {
    font-size: 0.8rem !important;
    color: #666 !important;
  }

  /* Main content */
  main, #main-content, .main {
    padding: 0 !important;
    margin: 0 !important;
  }

  /* ---------- Typography ---------- */
  h1 {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem !important;
    color: #111 !important;
  }

  h2 {
    font-size: 1.2rem !important;
    margin: 1rem 0 0.4rem !important;
    color: #111 !important;
  }

  h3 {
    font-size: 1.05rem !important;
    margin: 0.8rem 0 0.3rem !important;
    color: #222 !important;
  }

  p, li, td, th {
    font-size: 10pt !important;
    color: #111 !important;
  }

  /* ---------- Links: show URLs ---------- */
  a {
    color: #111 !important;
    text-decoration: underline !important;
  }

  /* Show URL after external links */
  a[href^="http"]:after,
  a[href^="//"]:after {
    content: " (" attr(href) ")" !important;
    font-size: 8pt;
    color: #666;
    font-family: 'IBM Plex Mono', monospace;
    word-break: break-all;
  }

  /* Don't show URL for internal nav links (already hidden) or anchors */
  a[href^="#"]:after,
  a[href^="javascript"]:after,
  .logo a:after,
  header a:after {
    content: "" !important;
  }

  /* ---------- Story cards ---------- */
  .story, .archive-item {
    border: 1px solid #ddd !important;
    background: #fff !important;
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .story.featured {
    border-left: 3px solid #b45309 !important;
  }

  .story-link {
    color: #111 !important;
    font-weight: 600 !important;
  }

  .story-source, .source-info, .source-name {
    color: #555 !important;
    font-size: 9pt !important;
  }

  .tier1-indicator {
    color: #b45309 !important;
  }

  .date, .read-time, .freshness, .edition-meta {
    color: #666 !important;
    font-size: 9pt !important;
  }

  /* ---------- Three-column layout → single column ---------- */
  .three-col {
    display: block !important;
  }

  .three-col .column {
    width: 100% !important;
    float: none !important;
    margin-bottom: 12px !important;
  }

  .column-header {
    border-bottom: 1px solid #999 !important;
    margin-bottom: 6px !important;
  }

  /* ---------- State profile: EIA data grid ---------- */
  .eia-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .eia-stat {
    border: 1px solid #ddd !important;
    background: #fafafa !important;
    padding: 6px 10px !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .eia-value {
    color: #111 !important;
    font-weight: 700 !important;
  }

  .eia-label, .eia-rank, .eia-source {
    color: #555 !important;
    font-size: 9pt !important;
  }

  /* Tabs: show all panels in print */
  .energy-tabs input[type="radio"] {
    display: none !important;
  }

  .tab-bar {
    display: none !important;
  }

  .tab-panel {
    display: block !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
    margin-bottom: 15px !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ---------- Tables ---------- */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  th, td {
    border: 1px solid #ccc !important;
    padding: 4px 8px !important;
    background: #fff !important;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: 600 !important;
  }

  /* ---------- Section dividers ---------- */
  .section-divider {
    border-color: #999 !important;
    margin: 12px 0 !important;
  }

  /* ---------- Page breaks ---------- */
  h1, h2, h3 {
    page-break-after: avoid;
    break-after: avoid;
  }

  .story, .archive-item, .eia-stat, table, figure, img {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Section breaks between major areas */
  .archive-section {
    page-break-before: auto;
  }

  /* ---------- Images ---------- */
  img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* ---------- Misc cleanup ---------- */
  /* Remove animations / transitions */
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }

  /* Remove shadows & rounded corners for cleaner print */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Ensure visible overflow */
  body, main, .container {
    overflow: visible !important;
  }
}
