/* ==========================================================================
   NEURIS — Estilos de Impressão
   Carregado (media="print") por index, projeto, privacidade, acessibilidade
   e carreiras. Objetivo: texto legível em papel, sem controlos inúteis.
   ========================================================================== */

@media print {

  /* ── 1. FUNDAÇÃO ─────────────────────────────────────────────────────────── */

  /* O papel é sempre claro — o tema escuro volta aos tokens do tema claro */
  [data-theme="dark"] {
    --color-bg: #ffffff;
    --color-surface: #e4ecf4;
    --color-surface-hover: #d8e3ee;
    --color-accent-dim: rgba(0, 200, 160, 0.10);
    --color-accent-text: #00705a;
    --color-text: #0d1117;
    --color-text-secondary: #4a5568;
    --color-text-tertiary: #56657a;
    --color-muted: #94a3b8;
    --color-border: rgba(0, 0, 0, 0.10);
    --color-border-strong: rgba(13, 17, 23, 0.48);
    --color-border-accent: rgba(0, 200, 160, 0.25);
    --color-danger-text: #b91c1c;
    --color-warn-text: #92400e;
    --color-watermark: rgba(0, 0, 0, 0.045);
  }

  /* Só as bandas navy (stats, ficha técnica) e o footer mantêm o fundo —
     o resto respeita a opção "Gráficos de fundo" do utilizador */
  .stats,
  .projeto-page__ficha,
  .footer {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Parar todas as animações — elementos ficam no estado final, não no inicial */
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-fill-mode: both !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }

  /* Revelar elementos que o JS ainda não animou (opacity:0 / translateY) */
  .reveal,
  html.js .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  /* ── 2. ELEMENTOS A OCULTAR ─────────────────────────────────────────────── */

  .navbar,
  .skip-link,
  .cookie-banner,
  .simbolo,
  .btn,
  .contacto__panel,
  .careers-page__panel,
  .network-diagram,
  .footer__theme-toggle,
  .footer__social {
    display: none !important;
  }

  /* Páginas de texto (privacidade, acessibilidade, carreiras) — sem footer */
  body:has(> main.privacy-page) .footer,
  body:has(> main.careers-page) .footer {
    display: none !important;
  }

  .privacy-page,
  .careers-page {
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  /* ── 3. LINKS ────────────────────────────────────────────────────────────── */

  /* Em texto corrido o URL externo fica visível no papel */
  main p a[href^="http"]::after,
  main li a[href^="http"]::after,
  main td a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }

  /* ── 4. TABELAS ──────────────────────────────────────────────────────────── */

  .table-scroll {
    overflow: visible !important;
  }

  .privacy-table,
  .privacy-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* ── 5. HERO ─────────────────────────────────────────────────────────────── */

  .hero {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    /* Sem padding-top extra para a navbar (que está oculta) */
    padding-top: 0 !important;
  }

  .hero__container {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  /* Placa PRR — título e barra de logótipos nunca separados entre páginas */
  .financiamento {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* ── 6. SECÇÕES — REDUZIR PADDING EXCESSIVO ─────────────────────────────── */

  .sobre,
  .pilares,
  .areas,
  .quote,
  .contacto,
  .footer {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }

  .stats {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  .projeto-page__header {
    padding-top: 2rem !important;
  }

  /* Overflow hidden pode cortar conteúdo em print */
  .hero,
  .contacto {
    overflow: visible !important;
  }

  /* ── 7. QUEBRAS DE PÁGINA ────────────────────────────────────────────────── */

  .sobre-block,
  .pilar,
  .area-card,
  .stats__item,
  .pilares__header,
  .areas__header,
  .contacto__inner,
  .privacy-highlight {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  h2, h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .sobre   { break-before: page; page-break-before: always; }
  .pilares { break-before: page; page-break-before: always; }
  .areas   { break-before: page; page-break-before: always; }

  .stats { break-before: avoid; page-break-before: avoid; }
  .quote { break-before: avoid; page-break-before: avoid; }

}
