/* ===============================
   SVCS Gallery — Clean CSS
   =============================== */

/* Vars */
:root{
  --gallery-bg: rgba(0,0,0,0.96);
  --gallery-max: 1160px;
  --accent-red: #e40000;

  /* thumbs (mobile) */
  --thumb-size: 72px;
  --thumb-gap: 8px;
}

/* Section + container */
.gallery-section{ background: var(--gallery-bg); }
.gallery-container{
  max-width: var(--gallery-max);
  margin: 0 auto;
  padding: 24px 16px 32px; /* top / sides / bottom */
}

/* Intro */
.gallery-intro .et_pb_text_inner h4{
  margin: 0 0 6px 0;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: clamp(28px, 4vw, 42px);
  color: #e6e6e6;
}
.gallery-intro .et_pb_text_inner p{
  margin: 0;
  color: #bdbdbd;
  line-height: 1.4;
}

/* Tiles grid (desktop defaults) */
.gallery-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 250px));
  gap: 24px;
  justify-content: start;
  margin-top: 16px;
}
.gallery-tile{
  width:250px; height:250px;
  border-radius:16px; overflow:hidden; cursor:pointer; position:relative;
  box-shadow:0 12px 36px rgba(0,0,0,.35);
}
.gallery-tile img{ width:100%; height:100%; object-fit:cover; display:block; }
.gallery-tile .label{
  position:absolute; left:10px; bottom:10px;
  background:rgba(0,0,0,.55); color:#fff;
  padding:6px 10px; border-radius:999px; font-weight:700; letter-spacing:.06em;
}

/* Hover/focus on tiles */
.gallery-tile img{ transition: transform .2s ease; will-change: transform; }
.gallery-tile .label{
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.gallery-tile:hover img{ transform: scale(1.05); }
.gallery-tile:hover .label,
.gallery-tile:focus-within .label{
  background: var(--accent-red);
  transform: scale(1.05);
  box-shadow: 1px 3px 5px rgba(0,0,0,.6);
  opacity: 0.9;
}
.gallery-tile:focus-visible{ outline:2px solid var(--accent-red); outline-offset:4px; }

/* ===============================
   Modal (shared)
   =============================== */
.gallery-modal .modal-content{ background:#fff; color:#111; border-radius:14px; min-height:80vh; }
.gallery-modal .modal-header{ border-bottom:1px solid #eee; }
.gallery-modal .modal-footer{ border-top:1px solid #eee; }

/* Tabs strip (desktop) */
.gallery-modal .nav-tabs .nav-link{
  border:none; border-bottom:2px solid transparent; color:#444;
  margin:2px; margin-bottom:10px; background:#f3f3f3; text-align:center;
}
.gallery-modal .nav-tabs .nav-link.active{ color:#000; border-color:#000; background:transparent; }

/* Tabs: arrow-scroll wrapper */
.gallery-modal .tab-scroll-wrap{
  display:flex; align-items:center; gap:8px; position:relative; margin-top:4px;
}
.gallery-modal .tab-scroll-viewport{
  position:relative; flex:1 1 auto; overflow:hidden;
}
/* The scroller is the <ul> */
.gallery-modal .nav-tabs.tab-scroll{
  display:flex; flex-wrap:nowrap;
  overflow-x:auto; overflow-y:hidden;
  white-space:nowrap;
  -webkit-overflow-scrolling:touch;
  scroll-behavior:smooth;
  scrollbar-width:none;           /* Firefox hide */
  -ms-overflow-style:none;        /* old Edge hide */
}
.gallery-modal .nav-tabs.tab-scroll::-webkit-scrollbar{ display:none; } /* WebKit hide */
.gallery-modal .nav-tabs.tab-scroll .nav-item{ flex:0 0 auto; }
.gallery-modal .nav-tabs.tab-scroll .nav-link{ white-space:nowrap; }

/* Arrow buttons (desktop: hidden until overflow; mobile: always visible) */
.gallery-modal .tab-scroll-btn{
  display:none; align-items:center; justify-content:center;
  width:20px; font-size:28px; cursor:pointer; background:transparent; border:0;
}
.gallery-modal .tab-scroll-btn[disabled]{ opacity:.35; cursor:default; }
.gallery-modal .tab-scroll-wrap.is-overflowing .tab-scroll-btn{ display:flex; }

/* Optional soft edge fades on the scroll viewport */
.gallery-modal .tab-scroll-viewport::before,
.gallery-modal .tab-scroll-viewport::after{
  content:""; position:absolute; top:0; bottom:0; width:24px; pointer-events:none; display:none;
}
.gallery-modal .tab-scroll-wrap.is-overflowing .tab-scroll-viewport::before,
.gallery-modal .tab-scroll-wrap.is-overflowing .tab-scroll-viewport::after{ display:block; }
.gallery-modal .tab-scroll-viewport::before{ left:0;  background:linear-gradient(to right, #fff, rgba(255,255,255,0)); }
.gallery-modal .tab-scroll-viewport::after { right:0; background:linear-gradient(to left,  #fff, rgba(255,255,255,0)); }
.gallery-modal .tab-scroll-viewport.at-start::before{ display:none; }
.gallery-modal .tab-scroll-viewport.at-end::after  { display:none; }

/* Main image grid (desktop shows 4) */
.gallery-modal .main-grid{
  display:grid; gap:10px; grid-template-columns:repeat(3,1fr);
}
.gallery-modal .main-grid img{
  width:100%; aspect-ratio:1 / 1; object-fit:cover; border-radius:10px; border:1px solid #e6e6e6; padding:5px;
}

/* Thumbnails (desktop: scrollable strip) */
.gallery-modal .thumbs{ padding:5px; }
.gallery-modal .thumbs .thumbs-wrap{
  display:flex; align-items:center; gap:8px;
}
.gallery-modal .thumbs .thumbs-viewport{
  overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
  overscroll-behavior-x: contain; /* keeps horizontal swipe inside the strip */
}
.gallery-modal .thumbs .thumb-row{ display:flex; gap:8px; }
.gallery-modal .thumbs img{
  width:96px; height:96px; object-fit:cover; border:1px solid #ddd; border-radius:6px; cursor:pointer; flex:0 0 auto;
  transition:transform .12s; padding:5px;
}
.gallery-modal .thumbs img:hover{ transform:scale(1.05); }
.gallery-modal .thumbs img.active{ box-shadow: 1px 3px 5px #000; opacity:0.8; }

/* Hide thumbs arrows unless we’re on mobile AND overflowing */
.gallery-modal .thumbs .thumbs-btn{
  display:none; align-items:center; justify-content:center;
  width:36px; height:36px; border:1px solid #ddd; background:#fff; border-radius:999px;
  cursor:pointer; font-size:18px; line-height:1;
}
.gallery-modal .thumbs .thumbs-btn[disabled]{ opacity:.35; cursor:default; }
.gallery-modal .thumbs .thumbs-wrap.is-overflowing .thumbs-btn{ display:flex; }

/* Mobile tweaks */
.gallery-modal .tab-current{ display:none; } /* hidden on desktop */

/* ===============================
   ≤ 768px (Mobile)
   =============================== */
@media (max-width: 768px){

  /* Tabs: show centered current label; hide the strip; always show arrows */
  .gallery-modal .tab-scroll-viewport{ display:none; }
  .gallery-modal .tab-current{
    display:block; flex:1 1 auto; min-width:0;
    text-align:center; font-weight:700; font-size:1rem;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    background: rgba(255,193,7,0.93); color:#222;
    border-radius:10px; padding:.45rem .75rem;
  }
  .gallery-modal .tab-scroll-btn{
    display:flex; padding:0; background:#fff; border-radius:90px;
  }

  /* Tiles: one per row, centered, 90vw square */
  .gallery-grid{
    grid-template-columns: 1fr;
    justify-content: center;
  }
  .gallery-tile{
    width: 90vw; height: 90vw; margin: 0 auto;
  }

  /* Main image grid: 1 column on mobile */
  .gallery-modal .main-grid{ grid-template-columns: 1fr; }

  /* Thumbs: exactly 3 visible + native scrollbar + arrows */
  .gallery-modal .thumbs .thumbs-viewport{
    max-width: calc(5 * var(--thumb-size) + 2 * var(--thumb-gap));
    overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
  }
  .gallery-modal .thumbs .thumbs-viewport::-webkit-scrollbar{ height: 6px; }
  .gallery-modal .thumbs .thumbs-viewport::-webkit-scrollbar-track{ background:#eee; border-radius:4px; }
  .gallery-modal .thumbs .thumbs-viewport::-webkit-scrollbar-thumb{ background:#bbb; border-radius:4px; }

  .gallery-modal .thumbs .thumb-row{ gap: var(--thumb-gap); }
  .gallery-modal .thumbs img{ width: var(--thumb-size); height: var(--thumb-size); }
}
