/* ==========================================================================
   products.css – Products main (Figma 1:4744) + product detail pages
   (GRP Pipes 1:4833 and siblings – one shared template). 1 Figma px = var(--u).
   Shared pieces: .page-hero, .portfolio-card, .cta-banner (pages.css).
   ========================================================================== */

/* ---------- Products main – grid (title y684, cards y908, 4 × 376 × 480, 32 gaps) ---------- */
.products-grid { position: relative; padding-top: calc(96 * var(--u)); }
.products-grid__triangles { position: absolute; width: calc(224 * var(--u)); height: calc(588 * var(--u)); max-width: none; pointer-events: none; }
.products-grid__triangles--left { left: calc(-2 * var(--u)); top: calc(-228 * var(--u)); }
.products-grid__triangles--right { right: 0; width: calc(221 * var(--u)); top: calc(1667 * var(--u)); z-index: -1; }
.products-grid__head { position: relative; width: calc(1600 * var(--u)); margin-inline: auto; }
.products-grid__sub {
  width: calc(1008 * var(--u));
  margin: calc(16 * var(--u)) auto 0;
  color: var(--c-text);
  font-size: calc(24 * var(--u));
  line-height: calc(36 * var(--u));
  text-align: center;
}
.products-grid__list {
  position: relative;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: calc(32 * var(--u));
  margin-top: calc(64 * var(--u));
}
.portfolio-card--static { cursor: default; }

/* ---------- Detail pages: solid black header bar (no hero), 96 under the header ---------- */
body:has(.product-page) .site-footer { margin-top: calc(96 * var(--u)); }

.product {
  display: grid;
  grid-template-columns: calc(648 * var(--u)) 1fr;
  column-gap: calc(80 * var(--u));
  align-items: start;
  padding-top: calc(224 * var(--u));
}

/* gallery – 648 × 505 photo with an 82px top-left cut, 4 × 150 thumbnails, prev / next */
.gallery { position: sticky; top: calc(160 * var(--u)); }
.gallery__main {
  height: calc(505 * var(--u));
  overflow: hidden;
  clip-path: polygon(calc(82 * var(--u)) 0, 100% 0, 100% 100%, 0 100%, 0 calc(82 * var(--u)));
}
.gallery__main img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s; }
.gallery__main img.is-fading { opacity: 0; }
.gallery__strip { position: relative; margin-top: calc(15 * var(--u)); }
.gallery__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: calc(16 * var(--u)); }
.gallery__thumb { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; overflow: hidden; }
.gallery__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease-out), opacity 0.3s; }
.gallery__thumb:hover img, .gallery__thumb:focus-visible img { transform: scale(1.06); }
.gallery__thumb:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }
/* Figma 1:4987 / 1:4984 – 32px white circles, #c2c2c2 border, chevron #0284c7 (disabled #c8c8c8) */
.gallery__arrow {
  position: absolute; z-index: 1; top: calc(59 * var(--u));
  width: calc(32 * var(--u)); height: calc(32 * var(--u));
  display: grid; place-items: center;
  padding: 0; border: 1px solid var(--c-btn-border); border-radius: 50%;
  background: #fff; color: var(--c-blue); cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.gallery__arrow--prev { left: calc(-8 * var(--u)); }
.gallery__arrow--next { right: calc(-8 * var(--u)); }
.gallery__arrow span {
  width: calc(7 * var(--u)); height: calc(12 * var(--u));
  background: currentColor;
  -webkit-mask: url("../assets/svg/chevron-right.svg") center / contain no-repeat;
          mask: url("../assets/svg/chevron-right.svg") center / contain no-repeat;
}
.gallery__arrow--prev span { transform: scaleX(-1); }
.gallery__arrow:not(:disabled):hover, .gallery__arrow:not(:disabled):focus-visible { background: var(--c-blue); border-color: var(--c-blue); color: #fff; }
.gallery__arrow:disabled { color: #c8c8c8; cursor: default; }

/* details column – 872 wide; 16 between items, 40 between sections */
.product__crumb { color: var(--c-date); font-size: calc(20 * var(--u)); line-height: calc(32 * var(--u)); }
.product__crumb a { transition: color 0.3s; }
.product__crumb a:hover, .product__crumb a:focus-visible { color: var(--c-blue); }
.product__crumb [aria-current] { color: var(--c-blue); }
.product__title {
  margin-top: calc(16 * var(--u));
  color: var(--c-navy);
  font-weight: 700;
  font-size: calc(56 * var(--u));
  line-height: calc(72 * var(--u));
  text-transform: uppercase;
}
.product__body > .product__text, .product__body > .product__list { margin-top: calc(16 * var(--u)); }
/* two intro paragraphs in a row sit in separate Figma blocks (40 apart) */
.product__body > .product__text + .product__text { margin-top: calc(40 * var(--u)); }
.product__text { color: var(--c-text); font-size: calc(24 * var(--u)); line-height: calc(36 * var(--u)); }
/* bullets: Figma Vector 1:4896 (18 × 18, #004b98) */
/* keep Figma's double spaces so lines wrap where they do in the design */
.product__text, .product__list li { white-space: pre-wrap; }
.product__section { margin-top: calc(40 * var(--u)); }
.product__section > * + * { margin-top: calc(16 * var(--u)); }
.product__heading {
  color: #000;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: calc(24 * var(--u));
  line-height: calc(32 * var(--u));
}
.product__list { display: grid; row-gap: calc(16 * var(--u)); }
.product__list li {
  position: relative;
  padding-left: calc(30 * var(--u));
  color: #141414;
  font-size: calc(20 * var(--u));
  line-height: calc(28 * var(--u));
}
.product__list li::before {
  content: ""; position: absolute; left: 0; top: calc(5 * var(--u));
  width: calc(18 * var(--u)); height: calc(18 * var(--u));
  background: url("../assets/svg/bullet-triangle-br.svg") center / contain no-repeat;
}
.product__list b { font-weight: 600; }

/* enquiry banner – same component as Manufacturing; two buttons 76 under the text */
.product-cta__actions { display: flex; flex-wrap: wrap; gap: calc(32 * var(--u)); margin-top: calc(76 * var(--u)); }
.product-cta__actions .btn { height: calc(58 * var(--u)); padding-block: 0; }

/* ==========================================================================
   TABLET + MOBILE (< 1200px)
   ========================================================================== */
@media (max-width: 1199.98px) {
  .products-grid { padding-top: 64px; }
  .products-grid__triangles { display: none; }
  .products-grid__head { width: auto; padding-inline: var(--gutter); }
  .products-grid .section-title { font-size: clamp(26px, 3.6vw, 36px); line-height: 1.25; }
  .products-grid__sub { width: auto; max-width: 640px; margin-top: 12px; font-size: 17px; line-height: 1.6; }
  .products-grid__list { grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }

  .product { grid-template-columns: 1fr 1.25fr; column-gap: 32px; padding-top: 112px; }
  .gallery { top: 88px; }
  .gallery__main { height: auto; aspect-ratio: 648 / 505; clip-path: polygon(48px 0, 100% 0, 100% 100%, 0 100%, 0 48px); }
  .gallery__strip { margin-top: 10px; }
  .gallery__thumbs { gap: 8px; }
  .gallery__arrow { top: calc(50% - 14px); width: 28px; height: 28px; }
  .gallery__arrow--prev { left: -6px; }
  .gallery__arrow--next { right: -6px; }
  .gallery__arrow span { width: 7px; height: 12px; }
  .product__crumb { font-size: 15px; line-height: 24px; }
  .product__title { margin-top: 8px; font-size: clamp(26px, 3.6vw, 36px); line-height: 1.25; overflow-wrap: anywhere; }
  .product__body > .product__text, .product__body > .product__list { margin-top: 12px; }
  .product__text { font-size: 17px; line-height: 1.6; }
  .product__section { margin-top: 28px; }
  .product__section > * + * { margin-top: 12px; }
  .product__heading { font-size: 19px; line-height: 27px; }
  .product__list { row-gap: 10px; }
  .product__list li { padding-left: 26px; font-size: 16px; line-height: 24px; }
  .product__list li::before { top: 5px; width: 14px; height: 14px; }
  .product-cta { margin-top: 72px; }
  .product-cta__actions { gap: 16px; margin-top: 28px; }
  .product-cta__actions .btn { height: auto; padding-block: 10px; }
  body:has(.product-page) .site-footer { margin-top: 72px; }
}

@media (max-width: 767.98px) {
  .products-grid__list { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .products-grid .portfolio-card__title { font-size: 15px; line-height: 21px; }
  .product { grid-template-columns: 1fr; row-gap: 28px; padding-top: 96px; }
  .gallery { position: relative; top: auto; }
}

/* ==========================================================================
   Photo lightbox (js/product-gallery.js) – the large gallery photo opens it
   ========================================================================== */
.gallery__main img.is-zoomable { cursor: zoom-in; }
.gallery__main img.is-zoomable:focus-visible { outline: 3px solid var(--c-blue); outline-offset: -3px; }
html.has-lightbox { overflow: hidden; }

.lightbox { position: fixed; inset: 0; z-index: 1100; opacity: 0; transition: opacity 0.25s ease; }
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox__backdrop { position: absolute; inset: 0; background: rgba(2, 16, 36, 0.92); cursor: zoom-out; }
.lightbox__stage {
  position: absolute; inset: 72px 96px;
  display: flex; align-items: center; justify-content: center;
  margin: 0; cursor: zoom-out;
}
.lightbox__img {
  display: block; max-width: 100%; max-height: 100%;
  cursor: default;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  transform: scale(0.97); transition: opacity 0.25s ease, transform 0.35s var(--ease-out);
}
.lightbox.is-open .lightbox__img { transform: none; }
.lightbox__img.is-fading { opacity: 0; }

/* close (X) – same white circle as the video player */
.lightbox__close {
  position: absolute; z-index: 2; top: 16px; right: 16px;
  width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  background: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s, transform 0.3s var(--ease-out);
}
.lightbox__close span, .lightbox__close span::after {
  position: absolute; left: 50%; top: 50%; width: 20px; height: 2px; margin: -1px 0 0 -10px;
  background: var(--c-navy); transform: rotate(45deg); content: ""; transition: background-color 0.3s;
}
.lightbox__close span::after { left: 0; top: 0; margin: 0; transform: rotate(90deg); }
.lightbox__close:hover, .lightbox__close:focus-visible { background: var(--c-blue); transform: rotate(90deg); }
.lightbox__close:hover span, .lightbox__close:hover span::after,
.lightbox__close:focus-visible span, .lightbox__close:focus-visible span::after { background: #fff; }

/* previous / next – same circle + chevron as the gallery arrows */
.lightbox__arrow {
  position: absolute; z-index: 2; top: 50%;
  display: grid; place-items: center;
  width: 56px; height: 56px; margin-top: -28px; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, opacity 0.3s;
}
.lightbox__arrow--prev { left: 24px; }
.lightbox__arrow--next { right: 24px; }
.lightbox__arrow span {
  width: 10px; height: 17px;
  background: currentColor;
  -webkit-mask: url("../assets/svg/chevron-right.svg") center / contain no-repeat;
          mask: url("../assets/svg/chevron-right.svg") center / contain no-repeat;
}
.lightbox__arrow--prev span { transform: scaleX(-1); }
.lightbox__arrow:not(:disabled):hover, .lightbox__arrow:focus-visible { background: var(--c-blue); border-color: var(--c-blue); }
.lightbox__arrow:disabled { opacity: 0.3; cursor: default; }
.lightbox__count {
  position: absolute; left: 0; right: 0; bottom: 22px;
  color: rgba(255, 255, 255, 0.85); font-size: 16px; line-height: 24px; text-align: center;
  pointer-events: none;
}

@media (max-width: 767.98px) {
  .lightbox__stage { inset: 76px 12px 84px; }
  .lightbox__close { top: 14px; right: 14px; width: 44px; height: 44px; }
  .lightbox__arrow { top: auto; bottom: 16px; margin-top: 0; width: 48px; height: 48px; }
  .lightbox__arrow--prev { left: calc(50% - 72px); }
  .lightbox__arrow--next { right: calc(50% - 72px); }
  .lightbox__count { bottom: 28px; }
}
