/*
  service-gallery-lighting-service-template — dark gallery band.
  Desktop: Figma 292:806 (no mobile frame yet — mobile stacks the same parts).
  Order: centered header → one full-bleed main photo → thumbnail strip with arrows.
*/

.service-gallery-lighting-service-template {
  position: relative;
  isolation: isolate;
  /* Clip anything that bleeds past the viewport edge (wide thumb strip) */
  overflow-x: clip;
  background-color: var(--color-footer-bg); /* #191919 — Shine Grey */
  color: var(--color-text-inverse);
}

/*
  Inner band has vertical padding only.
  Side padding lives on the header and thumb row, so the photos can run edge to edge.
*/
.service-gallery-lighting-service-template__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl); /* 32px on mobile */
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: var(--header-frame-max); /* 1920px */
  margin-inline: auto;
  padding-block: var(--service-gallery-pad-y-mobile); /* 56px */
}

/* ---------- Header ---------- */

.service-gallery-lighting-service-template__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg); /* 24px on mobile */
  box-sizing: border-box;
  inline-size: 100%;
  padding-inline: var(--space-md); /* 16px */
  text-align: center;
}

.service-gallery-lighting-service-template__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--fw-black);
  font-size: var(--fs-service-gallery-title-mobile); /* 24px */
  line-height: var(--lh-service-gallery-title-mobile); /* 29px */
  text-transform: uppercase;
  color: var(--color-text-inverse);
}

.service-gallery-lighting-service-template__title-desktop {
  display: none;
}

.service-gallery-lighting-service-template__title-mobile {
  display: inline;
}

.service-gallery-lighting-service-template__intro {
  margin: 0;
  max-inline-size: var(--service-gallery-lighting-intro-w); /* 419px */
  font-family: var(--font-body-alt);
  font-weight: var(--fw-regular);
  font-size: var(--fs-service-gallery-intro); /* 18px */
  line-height: var(--lh-service-gallery-intro); /* 30px */
  letter-spacing: var(--ls-service-gallery);
  color: var(--color-text-inverse);
}

/*
  ---------- Main photo stage (one photo, full bleed) ----------
  Figma 292:809 splits this into two 960px plates — we show ONE photo full width.
  The .js swaps the photo when a thumbnail is clicked.
*/

.service-gallery-lighting-service-template__stage {
  position: relative;
  margin: 0;
  inline-size: 100%;
  /* Mobile: taller crop so the house stays readable (same ratio as one old plate) */
  aspect-ratio: 960 / 578;
  overflow: hidden;
}

.service-gallery-lighting-service-template__stage-image {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  max-width: none;
  /* Photos have different ratios — cover crops them all to the stage */
  object-fit: cover;
  object-position: center;
  transition: opacity var(--transition-base);
}

/* Spinner while the main photo preloads (large URLs on staging can be slow) */
.service-gallery-lighting-service-template__stage-loader {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background-color: rgb(0 0 0 / 35%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.service-gallery-lighting-service-template__stage-loader::after {
  content: "";
  inline-size: 3rem;
  block-size: 3rem;
  border: 3px solid rgb(255 255 255 / 35%);
  border-top-color: var(--color-text-inverse);
  border-radius: 50%;
  animation: service-gallery-lighting-stage-spin 0.65s linear infinite;
}

.service-gallery-lighting-service-template__stage.is-loading .service-gallery-lighting-service-template__stage-image {
  opacity: 0.55;
}

.service-gallery-lighting-service-template__stage.is-loading .service-gallery-lighting-service-template__stage-loader {
  opacity: 1;
  visibility: visible;
}

@keyframes service-gallery-lighting-stage-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .service-gallery-lighting-service-template__stage-loader::after {
    animation: none;
  }
}

/* ---------- Thumbnail strip ---------- */

.service-gallery-lighting-service-template__thumb-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm); /* 10px on mobile */
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: var(--service-gallery-lighting-thumbs-max); /* 1801px */
  padding-inline: var(--space-md); /* 16px */
}

.service-gallery-lighting-service-template__nav {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.service-gallery-lighting-service-template__nav:focus-visible {
  outline: 2px solid var(--color-text-inverse);
  outline-offset: 4px;
}

.service-gallery-lighting-service-template__nav-icon {
  display: block;
  inline-size: var(--service-gallery-lighting-nav-size-mobile); /* 32px */
  block-size: var(--service-gallery-lighting-nav-size-mobile);
  object-fit: contain;
}

/* Same chevron asset, flipped for “previous” */
.service-gallery-lighting-service-template__nav-icon--prev {
  transform: rotate(180deg);
}

/* Clipping window between the arrows */
.service-gallery-lighting-service-template__viewport {
  flex: 1 1 auto;
  min-inline-size: 0;
  overflow: hidden;
}

/*
  Infinite loop track — the .js slides it with transform and rotates
  thumbnails from one end to the other, so it never runs out.
*/
.service-gallery-lighting-service-template__thumbs {
  display: flex;
  gap: var(--space-md); /* 16px on mobile */
  margin: 0;
  padding: 0;
  list-style: none;
  will-change: transform;
}

.service-gallery-lighting-service-template__thumb {
  position: relative;
  flex: 0 0 auto;
  /* Fixed thumb box so every thumbnail is the same size (Figma 293×208) */
  inline-size: var(--service-gallery-lighting-thumb-w-mobile);
  block-size: var(--service-gallery-lighting-thumb-h-mobile);
  overflow: hidden;
}

/* Each thumbnail is a button — clicking it shows that photo in the main stage */
.service-gallery-lighting-service-template__thumb-btn {
  position: relative;
  /* Own stacking context, so the img's z-index: -1 stays inside the button */
  isolation: isolate;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  /* Inactive thumbs are dimmed so the selected one stands out */
  opacity: 0.6;
  transition: opacity var(--transition-base);
}

.service-gallery-lighting-service-template__thumb-btn:hover,
.service-gallery-lighting-service-template__thumb-btn.is-active {
  opacity: 1;
}

/* Inset outline — the viewport clips anything drawn outside the thumb */
.service-gallery-lighting-service-template__thumb-btn.is-active {
  box-shadow: inset 0 0 0 3px var(--color-text-inverse);
}

.service-gallery-lighting-service-template__thumb-btn:focus-visible {
  outline: 3px solid var(--color-text-inverse);
  outline-offset: -3px;
  opacity: 1;
}

.service-gallery-lighting-service-template__thumb-btn img {
  position: absolute;
  inset: 0;
  z-index: -1; /* keep the active box-shadow drawn on top of the photo */
  inline-size: 100%;
  block-size: 100%;
  max-width: none;
  object-fit: cover;
}

/* ---------- Desktop — Figma 292:806 ---------- */
/* --bp-lg: 1024px */

@media (min-width: 1024px) {
  .service-gallery-lighting-service-template__inner {
    gap: var(--service-gallery-lighting-stack-gap); /* 60px */
    padding-block: var(--service-gallery-lighting-pad-y); /* 140px */
  }

  .service-gallery-lighting-service-template__header {
    gap: var(--service-gallery-lighting-header-gap); /* 32px */
    padding-inline: var(--header-pad-x);
  }

  .service-gallery-lighting-service-template__title {
    font-size: var(--fs-service-gallery-title); /* 54px */
    line-height: var(--lh-service-gallery-title); /* 54px */
  }

  .service-gallery-lighting-service-template__title-desktop {
    display: inline;
  }

  .service-gallery-lighting-service-template__title-mobile {
    display: none;
  }

  /* Desktop stage: full band width × 578px tall (Figma 1920×578) */
  .service-gallery-lighting-service-template__stage {
    aspect-ratio: 1920 / 578;
  }

  .service-gallery-lighting-service-template__thumb-row {
    gap: var(--service-gallery-lighting-nav-gap); /* 36px */
    padding-inline: var(--space-xl); /* 32px — keeps arrows off the edge below 1801px */
  }

  .service-gallery-lighting-service-template__nav-icon {
    inline-size: var(--service-gallery-lighting-nav-size); /* 52px */
    block-size: var(--service-gallery-lighting-nav-size);
  }

  .service-gallery-lighting-service-template__thumbs {
    gap: var(--service-gallery-lighting-thumb-gap); /* 40px */
  }

  .service-gallery-lighting-service-template__thumb {
    inline-size: var(--service-gallery-lighting-thumb-w); /* 293px */
    block-size: var(--service-gallery-lighting-thumb-h); /* 208px */
  }
}
