/* === gallery.css === */
/* =========================================================
   === SECTION === GALLERY (SANITY • HORIZONTAL CAROUSEL)
   ===
   === Self-contained: every custom property carries a
   === fallback, so this file renders correctly on its own.
   ========================================================= */

/* Single row of cards: centre it in the full-height section
   instead of pinning it to the top of a mostly empty screen. */
.section--gallery{
  display: grid;
  align-content: center;
}

.card--gallery{ position: relative; }

/* Same top-left tick as the about / activities / projects cards */
.card--gallery::before{
  content: "";
  position: absolute;
  left: 22px;
  top: 22px;
  width: 46px;
  height: 4px;
  border-radius: var(--pill, 999px);
  background: var(--primary);
  opacity: 0.30;
}

/* Same head rhythm as .card--projects */
.card--gallery .section-head{
  margin-bottom: 16px;
  padding-top: 14px;
}

/* --- Carousel wrapper: [prev] [track] [next] ------------- */
.gallery-carousel{
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Track ---------------------------------------------- */
.gallery-grid{
  flex: 1 1 auto;
  min-width: 0;                       /* let the flex child actually shrink */

  display: flex;
  gap: 14px;

  overflow: auto hidden;              /* x scrolls, y never does */
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;

  /* breathing room so item borders/outlines are not clipped */
  padding: 4px 2px 6px;

  scrollbar-width: none;
  -ms-overflow-style: none;
}
.gallery-grid::-webkit-scrollbar{ display: none; }

/* --- Items and skeletons share one box (no layout shift) - */
.gallery-item,
.gallery-skel{
  flex: 0 0 clamp(240px, 32%, 360px);
  aspect-ratio: 4 / 3;
  border-radius: var(--radius, 18px);
  overflow: hidden;
  scroll-snap-align: start;
}

.gallery-item{
  display: block;
  position: relative;
  background: var(--surface-2, rgba(255,255,255,0.46));
  border: 1px solid var(--line-soft, rgba(0,0,0,0.06));
  box-shadow: var(--shadow-panel, 0 18px 44px rgba(0,0,0,0.06));
  transition: border-color .25s ease, box-shadow .25s ease;
}

.gallery-item img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
}

.gallery-item:hover,
.gallery-item:focus-visible{
  border-color: rgba(0,90,187,0.18);
  box-shadow: var(--shadow-hover, 0 24px 56px rgba(0,90,187,0.12));
}
.gallery-item:hover img{ transform: scale(1.05); }

.gallery-item:focus-visible{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- Arrows --------------------------------------------- */
.gallery-nav{
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;

  border-radius: var(--pill, 999px);
  border: 1px solid var(--line, rgba(0,0,0,0.08));
  background: var(--surface-4, rgba(255,255,255,0.85));
  box-shadow: var(--shadow-float, 0 10px 24px rgba(0,0,0,0.10));
  color: rgba(7,19,15,0.75);
  font-size: 15px;
  cursor: pointer;

  display: grid;
  place-items: center;
  transition: transform .2s ease, opacity .2s ease, background-color .2s ease;
}
.gallery-nav:hover:not(:disabled){
  transform: scale(1.08);
  background: #fff;
}
.gallery-nav:disabled{
  opacity: .32;
  cursor: default;
  box-shadow: none;
}

/* --- Loading skeleton ----------------------------------- */
.gallery-skel{
  border: 1px solid var(--line-soft, rgba(0,0,0,0.06));
  background:
    linear-gradient(90deg,
      rgba(0,0,0,0.05) 25%,
      rgba(0,0,0,0.09) 50%,
      rgba(0,0,0,0.05) 75%) 0 0 / 200% 100%;
  animation: gallery-shimmer 1.4s linear infinite;
}

@keyframes gallery-shimmer{
  from{ background-position: 200% 0; }
  to{ background-position: -200% 0; }
}

/* --- Phones: swipe, no arrows --------------------------- */
@media (max-width: 820px){
  .gallery-nav{ display: none; }
  .gallery-carousel{ gap: 0; }

  .gallery-item,
  .gallery-skel{ flex-basis: min(78%, 300px); }

  /* match the smaller tick the other cards use on phones */
  .card--gallery::before{
    top: 14px;
    left: 14px;
    width: 34px;
    height: 3px;
  }
}

@media (prefers-reduced-motion: reduce){
  .gallery-skel{ animation: none; }
  .gallery-grid{ scroll-behavior: auto; }
  .gallery-item img{ transition: none; }
}
