/* ═══════════════════════════════════════════════════════════════
   SERVICE GALLERY  v3  — Horizontal Strip + Lightbox
   ─────────────────────────────────────────────────────────────
   Behaviour (all driven by JS):
     • If thumbs fit: strip is centred, no scroll, no nav arrows
     • If thumbs overflow: continuous auto-scroll + prev/next arrows
   No image duplication. All colours via CSS variables.
   ═══════════════════════════════════════════════════════════════ */

/* ── Section ──────────────────────────────────────────────────── */
.svc-gallery {
  background: var(--sd-gallery-bg, #F0F2F5);
  padding: 3.5rem 0 3rem;
  border-top:    1px solid rgba(17,28,43,0.06);
  border-bottom: 1px solid rgba(17,28,43,0.06);
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────────── */
.svc-gallery__header {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 0 clamp(1rem,5vw,2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.svc-gallery__label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sd-icon-primary-start, #4C3A68);
}

.svc-gallery__label-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sd-btn-primary-bg, #F2BC3A);
  flex-shrink: 0;
  animation: galDotPulse 2.5s ease-in-out infinite;
}

@keyframes galDotPulse {
  0%,100% { box-shadow: 0 0 0 3px color-mix(in srgb,var(--sd-btn-primary-bg,#F2BC3A) 25%,transparent); }
  50%     { box-shadow: 0 0 0 6px color-mix(in srgb,var(--sd-btn-primary-bg,#F2BC3A) 10%,transparent); }
}

.svc-gallery__count {
  font-size: 0.8125rem;
  color: #94A3B8;
  font-weight: 500;
}

/* ── Outer shell: arrows + viewport ──────────────────────────── */
.svc-gallery__shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1rem,5vw,2rem);
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── Nav arrows ───────────────────────────────────────────────── */
.svc-gallery__arrow {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(17,28,43,0.14);
  background: #fff;
  color: #0E1621;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(17,28,43,0.10);
  transition: background 0.2s, border-color 0.2s, transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  /* hidden when images fit without scrolling */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, background 0.2s, border-color 0.2s,
              transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
}

.svc-gallery__arrow.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.svc-gallery__arrow:hover {
  background: var(--sd-btn-primary-bg, #F2BC3A);
  border-color: var(--sd-btn-primary-bg, #F2BC3A);
  color: var(--sd-btn-primary-text, #0E1621);
  box-shadow: 0 4px 18px rgba(17,28,43,0.18);
  transform: scale(1.1);
}

/* ── Viewport (clip window) ───────────────────────────────────── */
.svc-gallery__viewport {
  flex: 1;
  overflow: hidden;
  /* fade edges only when scrolling */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%
  );
}

.svc-gallery__viewport.is-fitted {
  -webkit-mask-image: none;
  mask-image: none;
  overflow: visible;        /* so hover shadow is not clipped when centred */
}

/* ── Track ────────────────────────────────────────────────────── */
.svc-gallery__track {
  display: flex;
  gap: 14px;
  width: max-content;
  padding: 6px 4px 10px;   /* room for shadows */
  /* centred by default; JS removes margin:auto when scrolling starts */
  margin: 0 auto;
  /* JS sets --gal-duration and --gal-dist, then adds .is-playing */
  will-change: transform;
}

/* Continuous scroll — JS adds this class */
.svc-gallery__track.is-playing {
  animation: galScroll var(--gal-duration, 20s) linear infinite;
}

/* Pause on hover / focus */
.svc-gallery__track.is-playing:hover,
.svc-gallery__track.is-playing:focus-within {
  animation-play-state: paused;
}

@keyframes galScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--gal-dist, 0px))); }
}

/* ── Thumbnail item ───────────────────────────────────────────── */
.svc-gallery__item {
  position: relative;
  flex-shrink: 0;
  width: 260px;
  height: 174px;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  background: #CBD5E1;
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 2px 12px rgba(17,28,43,0.10);
  transition: transform 0.35s cubic-bezier(0.23,1,0.32,1),
              box-shadow 0.35s ease,
              outline-color 0.25s;
}

.svc-gallery__item:hover {
  transform: translateY(-5px) scale(1.025);
  box-shadow: 0 14px 36px rgba(17,28,43,0.20);
}

.svc-gallery__item:focus-visible {
  outline-color: var(--sd-btn-primary-bg, #F2BC3A);
}

.svc-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.35s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.svc-gallery__item:hover img {
  filter: brightness(0.68);
}

/* Hover overlay */
.svc-gallery__item-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 2;
}

.svc-gallery__item:hover .svc-gallery__item-overlay { opacity: 1; }

.svc-gallery__item-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  border: 1.5px solid rgba(255,255,255,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transform: scale(0.8);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.svc-gallery__item:hover .svc-gallery__item-icon { transform: scale(1); }

.svc-gallery__item-caption {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.90);
  text-align: center;
  padding: 0 0.625rem;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.55);
  transform: translateY(4px);
  transition: transform 0.3s ease;
}

.svc-gallery__item:hover .svc-gallery__item-caption { transform: translateY(0); }

.svc-gallery__item-num {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 3;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.85);
  background: rgba(14,22,33,0.50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.svc-gallery__item:hover .svc-gallery__item-num { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════════════ */
.svc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem,3vw,2rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.svc-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.svc-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8,14,26,0.95);
  backdrop-filter: blur(14px) saturate(0.6);
  -webkit-backdrop-filter: blur(14px) saturate(0.6);
  cursor: pointer;
}

.svc-lightbox__container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  /* 74px each side = arrow (50px) + gap (12px) + breathing (12px)
     so arrows never touch the viewport edge on desktop            */
  max-width: calc(min(90vw, 1100px) + 148px);
  width: 100%;
  padding: 0 74px;
  box-sizing: border-box;
  transform: scale(0.94) translateY(14px);
  transition: transform 0.35s cubic-bezier(0.23,1,0.32,1);
}

.svc-lightbox.is-open .svc-lightbox__container {
  transform: scale(1) translateY(0);
}

/* Frame-wrap: arrows are positioned on THIS, not on the frame itself,
   so overflow:hidden on .svc-lightbox__frame never clips them.        */
.svc-lightbox__frame-wrap {
  position: relative;
  width: 100%;
}

/* Image frame — overflow:hidden clips image to rounded corners only */
.svc-lightbox__frame {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(90vh - 120px);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(14,22,33,0.50);
  box-shadow: 0 40px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
}

/* Natural size, never cropped */
.svc-lightbox__img {
  max-width: 100%;
  max-height: calc(90vh - 120px);
  width: auto;
  height: auto;
  display: block;
  border-radius: 8px;
  transition: opacity 0.25s;
}

.svc-lightbox__img.is-loading { opacity: 0; }

.svc-lightbox__spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.svc-lightbox__spinner.is-visible { opacity: 1; }

.svc-lightbox__spinner svg {
  width: 34px;
  height: 34px;
  color: rgba(255,255,255,0.35);
  animation: lbSpin 0.85s linear infinite;
}

@keyframes lbSpin { to { transform: rotate(360deg); } }

/* Lightbox arrows — anchored to .svc-lightbox__frame-wrap (not .frame)
   so overflow:hidden on the image frame never clips them.
   Offset = -(arrow width 50px + 12px gap) = -62px                    */
.svc-lightbox__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 99;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.22s, border-color 0.22s,
              transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

.svc-lightbox__arrow:hover {
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.50);
  transform: translateY(-50%) scale(1.1);
}

.svc-lightbox__arrow--prev { left: -62px; }
.svc-lightbox__arrow--next { right: -62px; }

/* Caption + counter */
.svc-lightbox__info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 0.25rem;
  gap: 1rem;
}

.svc-lightbox__caption {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.60);
  flex: 1;
  line-height: 1.4;
}

.svc-lightbox__counter {
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgba(255,255,255,0.30);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Filmstrip */
.svc-lightbox__film {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 4px;
  justify-content: center;
}

.svc-lightbox__film::-webkit-scrollbar { display: none; }

.svc-lightbox__film-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.38;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: opacity 0.22s, outline-color 0.22s, transform 0.22s;
  background: rgba(255,255,255,0.06);
}

.svc-lightbox__film-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.svc-lightbox__film-thumb:hover  { opacity: 0.72; transform: translateY(-2px); }
.svc-lightbox__film-thumb.is-active {
  opacity: 1;
  outline-color: var(--sd-btn-primary-bg, #F2BC3A);
}

/* Close */
.svc-lightbox__close {
  position: fixed;
  top: clamp(0.75rem,2vw,1.25rem);
  right: clamp(0.75rem,2vw,1.25rem);
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.09);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.22s, transform 0.28s;
}

.svc-lightbox__close:hover {
  background: rgba(255,255,255,0.20);
  transform: rotate(90deg) scale(1.1);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .svc-gallery__item  { width: 200px; height: 134px; }
  .svc-gallery__arrow { width: 34px;  height: 34px; }
  /* On tablet the lightbox container has less horizontal room —
     shrink arrows and tuck them right against the frame edge   */
  .svc-lightbox__arrow { width: 40px; height: 40px; }
  .svc-lightbox__arrow--prev { left: -48px; }
  .svc-lightbox__arrow--next { right: -48px; }
  .svc-lightbox__film-thumb { width: 52px; height: 36px; }
}

@media (max-width: 480px) {
  .svc-gallery__item  { width: 160px; height: 108px; }
  .svc-gallery__arrow { display: none; }
  /* native scroll on mobile */
  .svc-gallery__viewport {
    -webkit-mask-image: none;
    mask-image: none;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .svc-gallery__viewport::-webkit-scrollbar { display: none; }
  .svc-gallery__track {
    animation: none !important;
    margin: 0;
  }
  .svc-gallery__item { scroll-snap-align: start; }
}

/* ── Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .svc-gallery__track  { animation: none !important; }
  .svc-gallery__label-dot { animation: none; }
  .svc-gallery__item,
  .svc-gallery__item img,
  .svc-gallery__item-icon,
  .svc-gallery__item-caption,
  .svc-lightbox__container { transition: none; }
}