/* AquaMania Catalog 2026 — Print stylesheet.
   Подключение: <link rel="stylesheet" href="assets/print.css" media="print">
   Цели:
   - A4 portrait по умолчанию (210×297 mm), landscape для матриц.
   - Скрыть интерактивный UI (nav, palette-bar, cart, lightbox, кнопки).
   - Открыть свернутые <details> (FAQ) и все pb-step-panel.
   - Корректная пагинация — page-break-before на chapter-openers, avoid внутри карточек/таблиц.
   - Header/footer через @page rules + URL aquamania.pro + номер страницы.
   - Печать-нейтральные цвета (тёмные блоки → светлые с рамкой). */

@page {
  size: A4 portrait;
  margin: 18mm 16mm 22mm;
}

/* Полностраничные обложки и landscape матрицы — отдельные правила */
@page :first {
  margin: 0;
}

/* === GLOBAL SETUP === */

@media print {

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

  html, body {
    background: white !important;
    color: #0A0A0A !important;
    font-size: 10pt;
    line-height: 1.45;
  }

  body {
    font-family: 'Source Serif Pro', Georgia, serif;
  }

  /* === HIDE INTERACTIVE UI === */

  .nav,
  .palette-bar,
  .cart-btn,
  .cart-drawer,
  .backdrop,
  .lightbox,
  #nav-mount,
  #palette-bar-mount,
  #cart-mount,
  #lightbox-mount,
  .pb-progress,
  .pb-actions,
  .pb-nav-row,
  .pb-anchor-preset .pb-load-preset,
  .pb-load-preset,
  .toc-card .toc-arrow,
  .audience-card .aud-cta,
  .spec-cta,
  .tender-btn,
  .aqua1-cta-btn,
  .calc-actions,
  .toolbar,
  .pdf-export-fab {
    display: none !important;
  }

  /* === OPEN COLLAPSED CONTENT === */

  details {
    display: block !important;
  }
  details > summary {
    display: block !important;
    pointer-events: none;
    background: #F4F4F4 !important;
    padding: 8px 12px !important;
    border-radius: 4px !important;
    margin-bottom: 8px;
    font-weight: 700;
  }
  details > summary span:last-child {
    display: none !important;
  }
  details > *:not(summary) {
    display: block !important;
  }

  /* Project Builder — показываем все 5 шагов + результат */
  .pb-step-panel {
    display: block !important;
    page-break-before: always;
    padding-top: 8mm;
  }
  .pb-step-panel:first-of-type {
    page-break-before: avoid;
  }

  /* === PAGE BREAKS — структура === */

  /* Каждая chapter-opener / .block начинается с новой страницы (но не первая) */
  section.block + section.block,
  section.aqua1-launch,
  .pb-shell .pb-step-panel {
    page-break-before: always;
  }

  /* Не разрывать внутри карточек и таблиц */
  .why-card,
  .toc-card,
  .case-card,
  .testimonial,
  .disc-detail,
  .mat-card,
  .audience-card,
  .spec-feature,
  .tender-zone,
  .tender-action,
  .aqua1-compare-col,
  .aqua1-kpis,
  .aqua1-repair-stats,
  .pb-disc-card,
  .pb-summary-card,
  .pb-anchor-cases,
  .stoplist,
  .maint-cell,
  .spare-cat,
  .coverage-col,
  .warranty-row,
  .tender-docs table tr,
  .matrix-table tr {
    page-break-inside: avoid;
  }

  /* === HERO — печатать как обложку === */

  .hero {
    min-height: auto !important;
    padding: 0 !important;
    page-break-after: always;
    background: #0A0A0A !important;
    color: white !important;
    page: cover-page;
  }
  .hero::before {
    opacity: 0.3 !important;
  }
  .hero-top-bar {
    position: relative !important;
    top: auto !important; left: auto !important; right: auto !important;
    padding: 12mm 16mm 0 !important;
  }
  .hero-content-single {
    padding: 0 16mm 16mm !important;
    page-break-inside: avoid;
  }
  .hero-title { font-size: 48pt !important; line-height: 1.0 !important; }
  .hero-subtitle { font-size: 12pt !important; max-width: none !important; }
  .hero-metrics-row { gap: 12mm !important; }
  .m-value { font-size: 22pt !important; }
  .m-label { font-size: 7pt !important; }

  /* Audience cards — компактнее */
  .hero-audience-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 4mm !important;
    margin-bottom: 16mm !important;
  }
  .audience-card {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    padding: 8mm !important;
  }
  .aud-name { font-size: 11pt !important; }
  .aud-desc { font-size: 8pt !important; }

  /* === BLOCK PADDING === */

  section.block {
    padding: 12mm 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }
  .block-head { margin-bottom: 8mm !important; max-width: none !important; }
  .block-head .label { margin-bottom: 4mm; }

  /* === TYPOGRAPHY === */

  h1, .h-display, .h-large {
    font-family: 'Source Serif Pro', Georgia, serif !important;
    font-weight: 400 !important;
    page-break-after: avoid;
  }
  h2, h3, h4, .h-medium, .h-small {
    page-break-after: avoid;
  }
  .h-display { font-size: 32pt !important; }
  .h-large { font-size: 22pt !important; }
  .h-medium { font-size: 16pt !important; }
  .h-small { font-size: 12pt !important; }

  p { orphans: 3; widows: 3; }

  /* === DARK BLOCKS → LIGHT (для economy of toner) === */

  .pb-summary-card,
  .tender-action,
  .aqua1-compare-col.old,
  .nav-cta {
    background: #F4F4F4 !important;
    color: #0A0A0A !important;
    border: 1px solid #CCCCCC !important;
  }
  .pb-summary-card *,
  .tender-action *,
  .aqua1-compare-col.old * {
    color: #0A0A0A !important;
  }
  .pb-summary-card h4,
  .tender-action .label {
    color: #555555 !important;
  }
  .pb-summary-card .pb-sum-value em {
    color: #4FA8C8 !important;
  }

  /* Cart-related dark elements — hide */
  .foot-bar { display: none !important; }

  /* === CATALOG-FOOTER (multi-page footer) === */

  .catalog-footer {
    background: #F4F4F4 !important;
    color: #0A0A0A !important;
    padding: 8mm 0 !important;
    margin-top: 8mm !important;
    page-break-before: always;
  }
  .catalog-footer * { color: #0A0A0A !important; }
  .footer-col a { color: #0A0A0A !important; }
  .footer-tagline { color: #0A0A0A !important; }
  .footer-heritage { color: #555 !important; }
  .footer-metric-row { border-top: 1px solid #CCC !important; }
  .footer-metric-row strong { color: #0A0A0A !important; }
  .footer-bottom { border-top: 1px solid #CCC !important; color: #555 !important; }

  /* === LINKS — показываем URL в скобках === */

  a[href^="http"]:not(.no-print-url)::after,
  a[href^="mailto:"]:not(.no-print-url)::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #888;
    font-weight: normal;
  }
  /* Internal links — без URL */
  a[href^="#"]::after,
  a[href$=".html"]:not([href^="http"])::after,
  a[href^="tel:"]::after {
    content: "";
  }

  /* === TABLES === */

  table {
    page-break-inside: auto;
  }
  thead {
    display: table-header-group;
  }
  tfoot {
    display: table-footer-group;
  }
  tr {
    page-break-inside: avoid;
  }
  th {
    background: #F4F4F4 !important;
    color: #0A0A0A !important;
  }

  /* === SVG sprites — ОСТАВИТЬ скрытыми (только symbol defs) === */
  svg[style*="display:none"] { display: none !important; }
  /* Видимые иконки — нормальный размер */
  .disc-icon svg, .pb-disc-icon svg, .aud-icon svg { width: 16pt !important; height: 16pt !important; }

  /* === IMAGES — fit и не разрывать === */

  img { max-width: 100% !important; height: auto !important; page-break-inside: avoid; }
  .aqua1-exploded img { max-height: 100mm !important; object-fit: contain; }
  .aqua1-hero-bg {
    background-position: center !important;
    background-size: cover !important;
    height: 80mm !important;
  }

  /* === GRIDS — упрощаем для печати === */

  .why-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4mm !important;
  }
  .toc-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4mm !important;
  }
  .cases-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4mm !important;
  }
  .contacts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4mm !important;
  }
  .disc-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 3mm !important;
  }
  .material-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4mm !important;
  }
  .spec-features, .tender-zones {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4mm !important;
  }
  .tender-stamp-row {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 2mm !important;
  }
  .pb-result-grid {
    grid-template-columns: 1fr !important;
    gap: 4mm !important;
  }
  .pb-result-stats {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 2mm !important;
  }
  .aqua1-inside-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 6mm !important;
  }
  .aqua1-compare {
    grid-template-columns: 1fr 1fr !important;
    gap: 4mm !important;
  }
  .aqua1-compare-arrow { display: none !important; }
  .aqua1-kpis {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 3mm !important;
  }
  .aqua1-first {
    grid-template-columns: 1fr 1fr !important;
    gap: 6mm !important;
  }
  .footer-inner {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4mm !important;
  }

  /* === CONFIGURATION MATRIX (system.html) — landscape page === */

  .matrix-table {
    font-size: 8pt !important;
  }
  .matrix-table th, .matrix-table td {
    padding: 4pt 6pt !important;
  }
  #configuration {
    page: landscape-matrix;
  }
  @page landscape-matrix {
    size: A4 landscape;
    margin: 14mm 12mm;
  }

  /* === PROJECT BUILDER — print-friendly === */

  .pb-shell { padding: 0 !important; max-width: none !important; }
  .pb-header { margin-bottom: 8mm !important; }
  .pb-anchor-preset { background: #F4F4F4 !important; border-color: #CCC !important; }
  .pb-anchor-preset h4 { color: #0A0A0A !important; }
  .pb-step-title { font-size: 18pt !important; margin-bottom: 4mm !important; }
  .pb-step-hint { font-size: 10pt !important; margin-bottom: 6mm !important; }
  .pb-disc-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 3mm !important;
  }
  .pb-form-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 4mm !important;
  }
  .pb-form-row {
    padding: 4mm !important;
  }
  .pb-input, .pb-btn, .pb-toggle {
    font-size: 9pt !important;
  }

  /* === FAQ accordion (index.html) === */

  .faq-list {
    page-break-inside: auto;
  }
  .faq-item {
    page-break-inside: avoid;
  }

  /* === ANTI-PATTERNS PROTECTION === */
  /* Скрыть pseudo-elements которые могут портить вывод */
  .palette-pill::before, .palette-pill::after { display: none !important; }

  /* Inline accent CTA banner (index.html pb-cta) === */
  #pb-cta {
    background: #F4F4F4 !important;
    page-break-before: always;
  }
  #pb-cta a[href$=".html"] {
    background: #0A0A0A !important;
    color: white !important;
    padding: 6pt 12pt !important;
  }
}
