/*
 * revcon-print.css
 * Print / PDF stylesheet for RevCon 2027 product detail pages.
 * Loaded via <link media="print"> — does not affect screen rendering.
 * Used by:
 *   1. Browser print-to-PDF (client-side fallback)
 *   2. Playwright generate-spec-pdfs.js (server-side at deploy time)
 *
 * Design: clean one-to-many page layout.
 * Cover: product ID, name, RC level, tagline, yield table.
 * Body: spec content sections, tables, chemical properties.
 * Footer: running footer with product ID, page number, disclaimer.
 */

/* ── Page setup ─────────────────────────────────────────────────────────── */
@page {
  size: letter portrait;
  margin: 0.75in 0.75in 0.9in 0.75in;
  @bottom-center {
    content: element(page-footer);
    font-size: 8pt;
  }
}

@page :first {
  margin-top: 0.5in;
}

/* ── Reset screen-only elements ─────────────────────────────────────────── */
@media print {

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Hide all nav / interactive / screen-only chrome */
  .topbar,
  .topbar-nav,
  .product-breadcrumb,
  .spec-sidebar,
  .btn-loi,
  .btn-download,
  .sidebar-cta-group,
  .sidebar-demand,
  footer,
  nav,
  .engineering-internal {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #1a202c !important;
    font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
    font-size: 9.5pt;
    line-height: 1.45;
    margin: 0;
  }

  /* ── Cover block ───────────────────────────────────────────────────────── */
  .product-hero {
    background: #1a202c !important;
    color: #fff !important;
    padding: 32pt 0 24pt !important;
    margin: 0 -0.75in;   /* bleed to page edge */
    padding-left: 0.75in !important;
    padding-right: 0.75in !important;
    page-break-after: avoid;
  }

  .product-hero .product-badges {
    margin-bottom: 8pt;
  }

  .rc-badge,
  .badge-cdr,
  .badge-new {
    display: inline-block;
    padding: 2pt 7pt;
    border-radius: 2pt;
    font-size: 7.5pt;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-right: 6pt;
  }

  .rc-badge {
    background: #C71585 !important;
    color: #fff !important;
  }

  .badge-cdr {
    background: #0c6e3d !important;
    color: #fff !important;
  }

  .badge-new {
    background: #d97706 !important;
    color: #fff !important;
  }

  .product-hero .product-name {
    font-family: 'Bricolage Grotesque', 'IBM Plex Sans', Arial, sans-serif;
    font-size: 22pt;
    font-weight: 700;
    line-height: 1.15;
    color: #fff !important;
    margin: 6pt 0 8pt;
  }

  .product-hero .product-tagline {
    font-size: 10pt;
    color: rgba(255,255,255,0.82) !important;
    max-width: 540pt;
    margin: 0 0 14pt;
    line-height: 1.5;
  }

  /* Product metadata row under tagline */
  .product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16pt;
    margin-top: 8pt;
    font-size: 8pt;
    color: rgba(255,255,255,0.7) !important;
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 10pt;
  }

  .meta-item {
    display: flex;
    flex-direction: column;
    gap: 2pt;
  }

  .meta-label {
    color: rgba(255,255,255,0.5) !important;
    font-size: 7pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .meta-value {
    color: #fff !important;
    font-size: 8.5pt;
  }

  .meta-value.mono {
    font-family: 'IBM Plex Mono', monospace;
  }

  /* ── Carbotura wordmark on cover ────────────────────────────────────────── */
  .print-cover-brand {
    display: flex !important;
    align-items: center;
    gap: 8pt;
    margin-bottom: 20pt;
  }

  /* Inject via JS in print mode — see generate-spec-pdfs.js */

  /* ── Yield table ─────────────────────────────────────────────────────────── */
  .yield-section {
    page-break-inside: avoid;
    margin: 20pt 0 16pt;
    background: #fff;
  }

  .yield-section .section-title {
    font-size: 9pt;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #718096 !important;
    margin: 0 0 12pt;
    border-bottom: 1.5pt solid #E5E5E0;
    padding-bottom: 4pt;
  }

  .yield-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8pt;
  }

  .yield-card {
    background: #FAFAF7 !important;
    border: 1pt solid #E5E5E0 !important;
    border-radius: 3pt;
    padding: 10pt 12pt;
    text-align: center;
  }

  .yield-card.yield-primary {
    border-color: #C71585 !important;
    background: #FCEEF5 !important;
  }

  .yield-config {
    font-size: 9pt;
    font-weight: 700;
    color: #1a202c !important;
    margin-bottom: 2pt;
  }

  .yield-sub {
    font-size: 7pt;
    color: #718096 !important;
    margin-bottom: 8pt;
    line-height: 1.3;
  }

  .yield-num {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 16pt;
    font-weight: 600;
    color: #C71585 !important;
    line-height: 1;
    margin-bottom: 2pt;
  }

  .yield-card.yield-primary .yield-num {
    font-size: 19pt;
  }

  .yield-unit, .yield-annual {
    font-size: 7.5pt;
    color: #718096 !important;
  }

  /* ── Spec body ──────────────────────────────────────────────────────────── */
  .spec-body {
    padding: 0;
  }

  .spec-inner {
    display: block !important;  /* override flex/grid layout */
  }

  .spec-content {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Sections */
  .spec-content h2 {
    font-family: 'IBM Plex Sans', Arial, sans-serif;
    font-size: 10pt;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #C71585 !important;
    margin: 20pt 0 6pt;
    padding-bottom: 3pt;
    border-bottom: 1pt solid #E5E5E0;
    page-break-after: avoid;
  }

  .spec-content h3 {
    font-size: 9.5pt;
    font-weight: 600;
    color: #1a202c !important;
    margin: 12pt 0 4pt;
    page-break-after: avoid;
  }

  .spec-content p {
    margin: 0 0 8pt;
    orphans: 3;
    widows: 3;
  }

  /* Tables */
  .spec-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
    margin: 8pt 0 14pt;
    page-break-inside: auto;
  }

  .spec-content th {
    background: #1a202c !important;
    color: #fff !important;
    font-weight: 600;
    font-size: 8pt;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 5pt 8pt;
  }

  .spec-content td {
    padding: 4pt 8pt;
    border-bottom: 0.5pt solid #E5E5E0;
    vertical-align: top;
    color: #1a202c !important;
  }

  .spec-content tr:nth-child(even) td {
    background: #FAFAF7 !important;
  }

  /* Lists */
  .spec-content ul, .spec-content ol {
    padding-left: 16pt;
    margin: 4pt 0 10pt;
  }

  .spec-content li {
    margin-bottom: 3pt;
    page-break-inside: avoid;
  }

  /* Strong */
  .spec-content strong {
    font-weight: 600;
    color: #1a202c !important;
  }

  /* Forward-looking statement */
  .spec-content em {
    color: #718096 !important;
    font-style: italic;
  }

  /* Price disclaimer */
  .price-disclaimer,
  .sidebar-disclaimer {
    display: none; /* sidebar hidden; disclaimer in footer */
  }

  /* ── Running page footer ─────────────────────────────────────────────────── */

  /* Print header on each page after first */
  @page :not(:first) {
    @top-left {
      content: "CARBOTURA RevCon 2027";
      font-size: 7pt;
      color: #718096;
      font-family: 'IBM Plex Sans', Arial, sans-serif;
      letter-spacing: 0.06em;
    }

    @top-right {
      content: attr(data-product-id);
      font-size: 7pt;
      color: #C71585;
      font-family: 'IBM Plex Mono', monospace;
    }

    @bottom-left {
      content: "Confidential — Indicative specifications. Not an offer to supply.";
      font-size: 6.5pt;
      color: #718096;
    }

    @bottom-right {
      content: counter(page) " / " counter(pages);
      font-size: 7pt;
      color: #718096;
      font-family: 'IBM Plex Mono', monospace;
    }
  }

  /* ── Page break controls ─────────────────────────────────────────────────── */
  .yield-section         { page-break-before: avoid; }
  .spec-content h2       { page-break-after: avoid; }
  .spec-content table    { page-break-inside: auto; }
  .spec-content tr       { page-break-inside: avoid; }

  /* ── Confidential watermark ──────────────────────────────────────────────── */
  body::after {
    content: "CARBOTURA CONFIDENTIAL";
    position: fixed;
    bottom: 0.4in;
    left: 50%;
    transform: translateX(-50%);
    font-size: 7pt;
    letter-spacing: 0.14em;
    color: #D4D4CE !important;
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
    pointer-events: none;
  }

} /* end @media print */
