/* Goldman Titanium — Minimal Print Stylesheet */
/* Only addresses specific issues, leaves default browser print behavior intact */

/* Page size and margins to match desired browser defaults */
@page {
  size: Letter;
  margin: 0.5in;
}

/* Typography: tighten line spacing for print to better match on-screen */
@media print {
  html, body { line-height: 1.35 !important; }
  p, li, .small, .card p, .card .small { line-height: 1.35 !important; }
  /* Cards and product descriptions can be a touch tighter */
  .card-body p { line-height: 1.28 !important; }
  /* Reduce vertical margins to avoid excessive whitespace */
  p { margin-bottom: 0.5rem !important; }
  h1, h2, h3, h4, h5, h6 { margin-top: 0.6rem !important; margin-bottom: 0.6rem !important; }
  /* Help long words wrap more efficiently in narrow columns */
  p, li { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
}

/* Processing pages: Balance hero visibility with space efficiency */
/* Make hero sections small but visible */
.hero-band { 
  height: 1in !important; 
  max-height: 1in !important; 
  min-height: 1in !important;
  overflow: hidden !important; 
  margin: 0 !important;
  padding: 0.1in 0 !important;
}

/* Hide navigation elements but keep navbar structure for logo */
.navbar-nav, 
.navbar-collapse,
.navbar-toggler,
.navbar-other,
.offcanvas,
.dropdown-menu {
  display: none !important; 
}

/* Show navbar and logo in print */
.navbar {
  display: block !important;
  position: static !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  border: none !important;
}

.navbar .container {
  display: block !important;
  padding: 0 !important;
}

.navbar-brand {
  display: block !important;
  position: static !important;
  padding: 0 !important;
  text-align: left !important;
}

.navbar-brand a {
  display: block !important;
  padding: 0 !important;
}

.navbar-brand img {
  display: block !important;
  height: 0.6in !important;
  width: auto !important;
  max-width: 3in !important;
}

/* Remove all padding and margins from sections */
section { 
  page-break-before: avoid !important; 
  break-before: avoid !important;
  padding-top: 0.1in !important;
  padding-bottom: 0.1in !important;
  margin: 0 !important;
}

/* Remove container padding */
.container { 
  padding-top: 0 !important; 
  padding-bottom: 0 !important; 
}

/* Minimal orphan/widow constraints */
* { 
  orphans: 1 !important; 
  widows: 1 !important; 
}

/* Ensure images never overflow their containers in print */
img, svg, canvas, video { 
  max-width: 100% !important; 
  height: auto !important; 
}

/* Hide site footer, replace with simple print footer */
footer { display: none !important; }

/* Print footer styling */
.print-footer { 
  margin-top: 0.5in; 
  padding-top: 0.25in; 
  border-top: 1px solid #ccc; 
  text-align: center; 
  font-size: 11px; 
  color: #333; 
}
.print-footer .pf-logo { 
  max-width: 200px !important; 
  height: auto !important; 
  display: block !important; 
  margin: 0 auto 8px auto !important; 
}
.print-footer .pf-tagline { 
  font-size: 12px !important; 
  margin: 4px 0 !important; 
  font-weight: 500;
}
.print-footer .pf-copy { 
  font-size: 10px !important; 
  color: #666 !important; 
  margin: 2px 0 !important;
}

/* Homepage: Reduce hero size to allow content on page 1 */
.swiper-hero { 
  height: 3in !important; 
  max-height: 3in !important; 
  overflow: hidden !important; 
}

/* Processing pages: Simple approach - reduce hero and force content */
/* Target hero sections and make them very small */
.hero-band { 
  height: 1in !important; 
  max-height: 1in !important; 
  min-height: 1in !important;
  overflow: hidden !important; 
}

/* Force all content to avoid page breaks */
section, .wrapper, .container, .row { 
  page-break-before: avoid !important; 
  break-before: avoid !important;
}

/* Minimal orphan/widow constraints globally */
* { 
  orphans: 1 !important; 
  widows: 1 !important; 
}

/* History page print layout fixes - restore original desktop layout */
@media print {
  /* Reset mobile order classes for print to match desktop layout */
  body#page-about .row .col-lg-6[class*="order-"] {
    order: unset !important;
    float: none !important;
    width: 50% !important;
    display: inline-block !important;
    vertical-align: top !important;
  }
  
  /* Force proper layout for history page - left column with image and "Looking Ahead" */
  body#page-about .row .col-lg-6:first-child {
    width: 48% !important;
    margin-right: 2% !important;
  }
  
  /* Right column with "Generations of Expertise" */
  body#page-about .row .col-lg-6:nth-child(2) {
    width: 48% !important;
    margin-left: 2% !important;
  }
  
  /* Third element (Looking Ahead card) should appear under the first image */
  body#page-about .row .col-lg-6:nth-child(3) {
    width: 48% !important;
    margin-right: 2% !important;
    margin-top: 1rem !important;
    clear: left !important;
  }
  
  /* Clear floats after the row */
  body#page-about .row::after {
    content: "";
    display: table;
    clear: both;
  }
}

/* Homepage print fixes - replace video with thumbnail and fix layout */
@media print {
  /* Remove excessive spacing from homepage */
  body#page-home {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Remove spacing from header wrapper on homepage */
  body#page-home header.wrapper {
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Make sure all homepage content sections are visible */
  body#page-home section,
  body#page-home .wrapper,
  body#page-home .container {
    display: block !important;
    visibility: visible !important;
  }
  
  /* Homepage hero section - replace video with thumbnail */
  body#page-home .swiper-hero {
    position: relative !important;
    height: 1.25in !important;
    min-height: 1.25in !important;
    max-height: 1.25in !important;
    overflow: hidden !important;
    display: block !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Hide video elements and carousel controls */
  body#page-home .swiper-hero video,
  body#page-home .swiper-navigation,
  body#page-home .swiper-pagination,
  body#page-home .swiper-button-prev,
  body#page-home .swiper-button-next,
  body#page-home .swiper-controls {
    display: none !important;
  }
  
  /* Show only the first slide and hide others */
  body#page-home .swiper-hero .swiper-slide:not(:first-child) {
    display: none !important;
  }
  
  /* Replace video background with thumbnail image for first slide only */
  body#page-home .swiper-hero .swiper-slide:first-child {
    background-image: url('/images/gt_turnings_video_thumbnail.jpg') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    height: 1.25in !important;
    min-height: 1.25in !important;
    display: block !important;
  }
  
  /* Remove video element completely */
  body#page-home .swiper-hero .swiper-slide:first-child .video-bg {
    display: none !important;
  }
  /* If background graphics are disabled, show explicit hero IMG injected by JS */
  body#page-home .print-hero-img { 
    display: block !important; 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: cover !important; 
  }
  
  /* Ensure overlay content is visible with proper contrast and centered */
  body#page-home .swiper-hero .swiper-slide .container {
    position: relative !important;
    z-index: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    text-align: center !important;
  }
  
  body#page-home .swiper-hero .swiper-slide .row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
  }
  
  body#page-home .swiper-hero .swiper-slide .col-md-11 {
    display: block !important;
    text-align: center !important;
    margin: 0 auto !important;
  }
  
  /* Left align hero text for print - simpler and more reliable */
  body#page-home .swiper-hero .swiper-slide h2 {
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    font-size: 18pt !important;
    line-height: 1.2 !important;
  }
  
  body#page-home .swiper-hero .swiper-slide p,
  body#page-home .swiper-hero .swiper-slide .lead {
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    font-size: 12pt !important;
    line-height: 1.3 !important;
  }
  
  body#page-home .swiper-hero .swiper-slide .d-flex {
    display: flex !important;
    justify-content: flex-start !important;
    text-align: left !important;
  }
  
  /* Ensure container and columns align left */
  body#page-home .swiper-hero .col-md-11,
  body#page-home .swiper-hero .col-lg-8,
  body#page-home .swiper-hero .col-xl-7,
  body#page-home .swiper-hero .col-xxl-6 {
    text-align: left !important;
    margin-left: 0 !important;
    float: none !important;
  }
  
  /* Remove any dark overlays that might obscure the thumbnail */
  body#page-home .swiper-hero .bg-overlay::before,
  body#page-home .swiper-hero .bg-overlay-200::before {
    display: none !important;
  }

  /* Hide hero overlay text/box for print to avoid clutter and wasted space */
  body#page-home .carousel-content-box,
  body#page-home .swiper-hero h1,
  body#page-home .swiper-hero h2,
  body#page-home .swiper-hero p,
  body#page-home .swiper-hero .btn,
  body#page-home .swiper-hero .d-flex[role="group"] {
    display: none !important;
  }
  
  /* Force content to appear immediately after hero on same page */
  body#page-home .wrapper.bg-dark {
    page-break-after: avoid !important;
    margin-bottom: 0 !important;
  }
  
  /* Ensure homepage content sections appear after hero */
  body#page-home .home-bg-repeat {
    display: block !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important; /* remove textured background in print */
  }

  /* Also remove texture helper class */
  body#page-home .bg-texture { background: none !important; }
  
  /* Gentle spacing reduction without blocking natural page breaks */
  body#page-home .home-bg-repeat section {
    display: block !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
    height: auto !important;
  }
  
  /* Force first content section to appear on first page */
  body#page-home .home-bg-repeat section:first-child {
    page-break-before: avoid !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
  }
  
  /* Reduce container/row spacing without zeroing everything */
  body#page-home .home-bg-repeat section .container,
  body#page-home .home-bg-repeat section .row { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
  body#page-home .home-bg-repeat section h2,
  body#page-home .home-bg-repeat section h3 { margin-top: 0.4rem !important; margin-bottom: 0.4rem !important; }
  
  /* Allow normal page breaking for homepage — no global forcing */

  /* Simplify Who We Are montage: keep only main image */
  body#page-home .who-stack { min-height: auto !important; }
  body#page-home .who-stack::before { display: none !important; }
  body#page-home .who-stack .who-main { width: 100% !important; margin: 0 !important; }
  body#page-home .who-stack .who-side-1,
  body#page-home .who-stack .who-side-2 { display: none !important; }

  /* Hide the quality bar entirely in print to avoid wrapping issues */
  body#page-home .quality-bar { display: none !important; }

  /* Hide counters section to save pages */
  body#page-home section.bg-soft-primary { display: none !important; }

  /* Who We Are: enforce two-column layout with text left, image right */
  body#page-home section.bg-texture .row.align-items-center { 
    display: flex !important; 
    align-items: flex-start !important; 
    gap: 0.75rem !important;
  }
  body#page-home section.bg-texture .row.align-items-center > .col-lg-6 { 
    width: 50% !important; 
    float: none !important; 
    display: block !important; 
  }
  /* Source order: first col is image, second is text. Swap for print */
  body#page-home section.bg-texture .row.align-items-center > .col-lg-6:first-child { order: 2 !important; }
  body#page-home section.bg-texture .row.align-items-center > .col-lg-6:nth-child(2) { order: 1 !important; }
}

/* Preserve common Bootstrap-like column widths for print to keep two-column layouts */
@media print {
  /* Make rows act as block containers */
  .row { display: block !important; margin-left: 0 !important; margin-right: 0 !important; }
  .row::after { content: ""; display: table; clear: both; }

  /* Tighten gutters on columns */
  [class^="col-"], [class*=" col-"] { padding-left: 0.4rem !important; padding-right: 0.4rem !important; }

  /* Generic column width helpers (print-only) using floats so content can break across pages */
  .col-md-6 { width: 50% !important; float: left !important; display: block !important; break-inside: auto !important; }
  .col-lg-4 { width: 33.333% !important; float: left !important; display: block !important; break-inside: auto !important; }
  .col-lg-8 { width: 66.666% !important; float: left !important; display: block !important; break-inside: auto !important; }

  /* Products page: keep main/aside as two columns and make product cards denser */
  body#page-products .row > .col-lg-8 { width: 66.666% !important; float: left !important; }
  body#page-products .row > .col-lg-4 { width: 33.333% !important; float: left !important; }

  /* Product cards grid: prefer 2 columns on print for readability */
  .products-grid .col-md-6,
  .products-grid .col-lg-4 { width: 48% !important; float: left !important; display: block !important; break-inside: auto !important; }
  .products-grid { text-align: left !important; }
}
