/* === GALLERY PREVIEW (shared component) ===
   "From the Driver Hub" — horizontal scroll-snap strip of the latest Driver Hub
   photos with a "View all" link, grouped prev/next pager, and a click-to-preview
   lightbox. Markup + behaviour: inc/gallery-preview.php (included by inc/cta.php,
   so it renders right above the shared CTA on every page that has one). Reads the
   same images as page-driverhub.php via drive4hhs_get_gallery_images(). The whole
   section is omitted when the library has no images (see the PHP guard), so it
   never renders empty. Depends on global.css for --maxw / --orange / --body-font. */
.gallery-preview { background: #ffffff; padding: 64px 0 72px; --gpad: 40px; }
.gallery-preview-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gpad); }
.gallery-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.gallery-preview-title {
  font-family: var(--body-font);
  font-size: 32px;
  font-weight: 700;
  color: #111111;
  line-height: 1.15;
}
.gallery-preview-sub {
  font-family: var(--body-font);
  font-size: 16px;
  color: #576371;
  margin-top: 8px;
}
/* Header control cluster: "View all" link + grouped prev/next pager. */
.gallery-preview-controls { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.gallery-arrows { display: inline-flex; gap: 8px; }
.gallery-preview-viewall {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 6px 2px;
  color: var(--orange);
  font-family: var(--body-font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-decoration: none;
  transition: color 0.15s ease;
}
.gallery-preview-viewall:hover { color: #9c410f; }
.gallery-viewall-icon { width: 16px; height: 16px; flex: 0 0 auto; }

/* Full-bleed track: cards bleed to the section edges, but the left/right runway
   (padding-inline) makes the first and last card stop aligned with the centered
   content gutter at the scroll ends. */
.gallery-track-wrap { position: relative; }
.gallery-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 6px 0;
  padding-inline: max(var(--gpad), calc((100% - var(--maxw)) / 2 + var(--gpad)));
  scroll-padding-inline: max(var(--gpad), calc((100% - var(--maxw)) / 2 + var(--gpad)));
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide {
  flex: 0 0 auto;
  width: 320px;
  height: 240px;
  scroll-snap-align: start;
  margin: 0;
  padding: 0;
  border: 0;
  background: #eeeeee;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  display: block;
}
.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.gallery-slide:hover img { transform: scale(1.05); }

/* End card: no border, no default background; the original background shows on hover. */
.gallery-slide--more {
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  transition: background 0.2s ease;
}
.gallery-slide--more:hover { background: #f4f5f6; }
.gallery-more-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--orange); }
.gallery-more-inner svg { width: 34px; height: 34px; }
.gallery-more-label { font-family: var(--body-font); font-size: 15px; font-weight: 700; letter-spacing: 0.5px; }

/* Arrows: a grouped pager in the header (aligned to the content gutter), not
   floating over the photos — keeps them balanced despite the full-bleed track. */
.gallery-arrow {
  width: 42px;
  height: 42px;
  border: 1px solid #d8dde3;
  border-radius: 50%;
  background: #ffffff;
  color: var(--orange);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.gallery-arrow svg { width: 20px; height: 20px; }
.gallery-arrow:hover { background: var(--orange); color: #ffffff; border-color: var(--orange); }
.gallery-arrow:disabled { opacity: 0.35; cursor: default; }
.gallery-arrow:disabled:hover { background: #ffffff; color: var(--orange); border-color: #d8dde3; }

/* Click-to-preview lightbox. */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
}
.gallery-lightbox.is-open { display: flex; }
.gallery-lightbox .glb-img { max-width: 92vw; max-height: 88vh; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.gallery-lightbox .glb-close,
.gallery-lightbox .glb-nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.gallery-lightbox .glb-close:hover,
.gallery-lightbox .glb-nav:hover { background: rgba(255, 255, 255, 0.3); }
.gallery-lightbox .glb-close { top: 18px; right: 20px; width: 44px; height: 44px; }
.gallery-lightbox .glb-close svg { width: 22px; height: 22px; }
.gallery-lightbox .glb-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.gallery-lightbox .glb-nav svg { width: 26px; height: 26px; }
.gallery-lightbox .glb-prev { left: 20px; }
.gallery-lightbox .glb-next { right: 20px; }

@media (max-width: 768px) {
  .gallery-preview { padding: 48px 0 56px; --gpad: 20px; }
  /* Keep the header a single row: title on the left, "View all" bottom-right
     (the arrows are hidden on touch, so controls = just the link). Bottom-
     aligning sits it level with the subtitle instead of the title's cap. */
  .gallery-preview-head { align-items: flex-end; gap: 16px; margin-bottom: 20px; }
  .gallery-preview-head > div:first-child { min-width: 0; }
  .gallery-preview-title { font-size: 26px; }
  .gallery-slide { width: 260px; height: 195px; }
  .gallery-arrows { display: none; }   /* touch devices swipe the strip instead */
  .gallery-lightbox .glb-nav { width: 44px; height: 44px; }
  .gallery-lightbox .glb-prev { left: 8px; }
  .gallery-lightbox .glb-next { right: 8px; }
}
