/* ── Print: a clean one-page calculation receipt ─────────────────────────────
   Loaded from BaseLayout with media="print", so it is never render-blocking
   and never inflates the inlined critical CSS. The @media wrapper is kept as
   well as the media attribute so the file is still correct on its own.
   ------------------------------------------------------------------------- */
@media print {
  @page { margin: 15mm; }

  /* Force a light, ink-cheap rendering whichever theme is active on screen. */
  :root, [data-theme="dark"], [data-theme="light"] {
    --c-bg: #fff; --c-surface: #fff; --c-surface-2: #fff;
    --c-text: #000; --c-text-2: #333; --c-text-3: #555;
    --c-border: #bbb; --c-border-strong: #888;
    --c-result-bg: #fff; --c-result-text: #000; --c-result-border: #888;
    --c-primary: #000; --c-primary-soft: #f2f2f2;
  }
  html, body { background: #fff !important; color: #000 !important; }
  /* Nothing should be mid-animation on paper — and it makes the rendering
     deterministic rather than dependent on when the print snapshot is taken. */
  *, *::before, *::after { transition: none !important; animation: none !important; }

  /* Site furniture, navigation, monetisation and everything interactive. */
  .site-header, .site-footer, .breadcrumbs, .sidebar, .ad-slot, .adsbygoogle,
  .btn-row, .result-actions, .share-bar, .share-hint, .cite-box, .embed-box,
  .calc-article, .related-grid, .section-head, .faq-list, .references,
  .author-box, .use-case, .mode-tabs, .nav-toggle, .skip-link,
  #calc-search, #search-results, .mg-bar-key,
  [data-mgpanel="bulk"] .field, [data-mgpanel="bulk"] .mg-intro,
  .calc-main > .section {
    display: none !important;
  }

  /* Layout: single column, no shadows, no rounded cards eating margin. */
  .container { max-width: none; padding: 0; }
  .calc-page-grid { display: block; padding: 0; }
  .calc-main { display: block; }
  .calc-tool, .result-panel, .mgb-table-wrap {
    box-shadow: none !important; border-radius: 0;
    border: 1px solid #bbb; break-inside: avoid;
  }
  .calc-tool-head { background: #fff !important; color: #000 !important; border-bottom: 1px solid #bbb; }
  .page-title-wrap { margin: 0 0 6px; }
  .page-title-wrap h1 { font-size: 20pt; margin: 0; }
  .page-title-wrap .subtitle { display: none; }
  .fade-up { animation: none !important; opacity: 1 !important; transform: none !important; }

  /* Inputs print as values, not as empty form controls. */
  input, select, textarea {
    border: 0 !important; border-bottom: 1px solid #999 !important;
    border-radius: 0 !important; padding: 2px 0 !important;
    background: #fff !important; color: #000 !important;
    box-shadow: none !important; -webkit-appearance: none; appearance: none;
    font-weight: 600 !important;
  }
  input::placeholder, textarea::placeholder { color: transparent !important; }
  /* Chrome draws number spinners regardless of `appearance: none`. */
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; display: none; }
  input[type="number"] { -moz-appearance: textfield; }
  /* Browsers do not print backgrounds by default, so the cost/profit split
     needs an ink outline to stay readable on paper. */
  .mg-bar { border: 1px solid #999 !important; }
  .mg-seg { color: #000 !important; }
  .mg-seg-cost { border-right: 1px solid #999; }
  select { padding-right: 0 !important; }
  details { display: block; }
  details > summary { display: none; }        /* print the contents, not the toggle */

  /* The result is the point of the page. */
  .result-panel { display: block !important; opacity: 1 !important; page-break-inside: avoid; }
  .result-value { font-size: 18pt; }
  .result-steps { margin: 6px 0 0; }

  /* Bulk mode: keep the table, drop the paste box and the scroll container. */
  /* !important because the component's scoped styles carry an attribute
     selector and would otherwise out-specify these overrides. */
  .mgb-table-wrap { max-height: none !important; overflow: visible !important; border: 0 !important; }
  .mgb-table thead th { position: static; background: #eee !important; }
  .mgb-table tfoot td { position: static; background: #eee !important; }
  .mgb-table tr { break-inside: avoid; }

  /* The byline is the provenance line on a printed record — keep it. */
  .byline { border-top: 0; padding-top: 0; font-size: 9pt; color: #333 !important; }
  .byline .verified { border: 0; background: none !important; padding: 0; }

  /* Server-rendered, hidden on screen; the date is stamped in by CalcLayout. */
  .print-only { display: block !important; }
  .print-source {
    margin-top: 14px; padding-top: 8px; border-top: 1px solid #bbb;
    font-size: 9pt; color: #333;
  }
}
