/* ═══════════════════════════════════════════════════════════════
   GFS DESIGN SYSTEM v10.0 — COMPREHENSIVE PRINT STYLESHEET
   Optimized for A4/Letter export and PDF generation
   ═══════════════════════════════════════════════════════════════ */

@media print {

  /* ── PAGE SETUP ── */
  @page {
    margin: 0.75in;
    size: auto;
  }

  /* ── HIDE NON-PRINT ELEMENTS ── */
  .topbar,
  .scroll-nav,
  .toc,
  .hub-search,
  .hub-stats,
  .hub-grid,
  .back-to-top,
  .reading-progress,
  .skip-link,
  .hero-barcode,
  .big-barcode,
  .globe,
  .dark-toggle,
  input[type="text"],
  input[type="search"],
  [onclick]:not(a),
  button:not(.print-keep),
  .topbar-btn,
  .search-input,
  .hub-search-wrap,
  .scroll-indicator,
  .theme-toggle,
  nav.toc-nav,
  .cookie-banner,
  .chat-widget {
    display: none !important;
    visibility: hidden !important;
  }

  /* ── FORCE ALL CONTENT VISIBLE ── */
  details { open: true; }
  details[open] summary ~ * { display: block !important; }
  .collapsed,
  [aria-hidden="true"],
  .hidden,
  [hidden] {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
  }

  /* ── BASE TYPOGRAPHY & COLORS ── */
  *,
  *::before,
  *::after {
    color: #000 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: none !important;
    animation: none !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
    color: #000 !important;
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── LAYOUT ── */
  .page,
  .container,
  main,
  article {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* ── HEADINGS ── */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
    orphans: 3;
    widows: 3;
  }

  h1 { font-size: 20pt; }
  h2 { font-size: 16pt; }
  h3 { font-size: 13pt; }

  /* ── SECTIONS & CARDS ── */
  .s,
  section.s,
  section,
  .card,
  .spec-card,
  .slide-card,
  .doc-card,
  figure,
  blockquote,
  pre {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc;
    margin-bottom: 12pt;
  }

  .s-head {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 6pt 10pt;
    border-bottom: 1px solid #ccc;
  }

  /* ── COBALT ACCENTS — preserve brand color in print ── */
  .s-head h2,
  .s-head h3,
  .section-title,
  .cobalt-text {
    color: #092F64 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── LINKS — show URLs ── */
  a,
  a:visited {
    color: #092F64 !important;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555 !important;
    font-style: italic;
    word-break: break-all;
  }

  /* Don't show URL for anchors, js links, or nav links */
  a[href^="#"]::after,
  a[href^="javascript"]::after,
  nav a::after,
  .topbar a::after,
  .toc a::after,
  a.no-print-url::after {
    content: "" !important;
  }

  /* ── TABLES — high-contrast borders ── */
  table {
    border-collapse: collapse;
    width: 100%;
    font-size: 9pt;
    break-inside: auto;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  th,
  td {
    border: 1px solid #333 !important;
    padding: 4pt 6pt;
    text-align: left;
    background: transparent !important;
  }

  th {
    background: #e8e8e8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-weight: 700;
  }

  /* Alternate row shading for readability */
  tbody tr:nth-child(even) td {
    background: #f7f7f7 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── IMAGES & SVGs ── */
  img,
  svg,
  canvas {
    max-width: 100% !important;
    height: auto !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  img {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  svg {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    fill: currentColor;
  }

  /* ── CODE BLOCKS ── */
  pre,
  code {
    font-size: 9pt;
    border: 1px solid #ddd;
    padding: 4pt;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #f8f8f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── GRID / FLEX LAYOUTS — linearize for print ── */
  .grid,
  .hub-grid,
  .card-grid,
  .flex-grid {
    display: block !important;
  }

  .grid > *,
  .card-grid > *,
  .flex-grid > * {
    margin-bottom: 8pt;
  }

  /* ── STATUS BADGES & PILLS — force readability ── */
  .badge,
  .pill,
  .tag,
  .status {
    border: 1px solid #666 !important;
    padding: 1pt 4pt;
    font-size: 8pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── ORPHAN/WIDOW CONTROL ── */
  p,
  li,
  dd {
    orphans: 3;
    widows: 3;
  }

  /* ── LISTS ── */
  ul, ol {
    page-break-before: avoid;
  }

  li {
    page-break-inside: avoid;
  }

  /* ── PRINT FOOTER STAMP ── */
  body::after {
    content: "Global Food Solutions, Inc. — Printed from GFS Design System v10.0";
    display: block;
    text-align: center;
    font-size: 8pt;
    color: #999 !important;
    margin-top: 24pt;
    padding-top: 8pt;
    border-top: 1px solid #ddd;
  }
}
