/* =========================
   Gallery Index
   ========================= */

.galleries-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 10px;
}

.galleries-title {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 2.2vw, 2.1rem);
  letter-spacing: -0.02em;
}

.galleries-subtitle {
  margin: 0;
  line-height: 1.65;
  opacity: 0.85;
  max-width: 70ch;
}

/* =========================
   Rows container
   ========================= */

.galleries-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 26px;
}

.galleries-rows {
  display: grid;
  gap: 18px; /* spacing between card rows */
}

.albums-row-wrap {
  position: relative;
}

/* =========================
   Desktop / tablet layout
   ========================= */

.albums-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* 2-up on medium screens */
@media (max-width: 920px) {
  .albums-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================
   Mobile: horizontal swipe per row
   ========================= */

@media (max-width: 640px) {
  .albums-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding: 4px 2px 10px;

    /* focus ring target for keyboard */
    border-radius: 14px;
  }

  .albums-row:focus-visible {
    outline: 3px solid rgba(0, 80, 255, 0.35);
    outline-offset: 3px;
  }

  .gallery-card {
    flex: 0 0 86%;
    scroll-snap-align: start;
  }
}

/* =========================
   Card
   ========================= */

.gallery-card {
  display: block;
}

.gallery-card-link {
  display: block;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;

  text-decoration: none;
  color: inherit;

  background: rgba(0, 0, 0, 0.012);
  border: 1px solid rgba(0, 0, 0, 0.05);

  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.gallery-card-link:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.10);
}

.gallery-card-link:focus-visible {
  outline: 3px solid rgba(0, 80, 255, 0.45);
  outline-offset: 3px;
}

/* =========================
   Cover image
   ========================= */

.gallery-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.gallery-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;

  transform: scale(1.01);
  transition: transform 200ms ease;

  user-select: none;
  -webkit-user-select: none;
}

.gallery-card-link:hover .gallery-thumb {
  transform: scale(1.035);
}

.gallery-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.00),
    rgba(0, 0, 0, 0.14)
  );
  pointer-events: none;
}

/* =========================
   Region badge
   ========================= */

.gallery-badge {
  position: absolute;
  top: 12px;
  left: 12px;

  padding: 6px 10px;
  border-radius: 999px;

  font-size: 12px;
  letter-spacing: 0.02em;

  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
}

/* =========================
   Card body
   ========================= */

.gallery-card-body {
  padding: 14px 14px 16px;
  display: grid;
  gap: 10px;
}

.gallery-card-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.gallery-card-meta {
  margin: 6px 0 0;
  font-size: 0.92rem;
  opacity: 0.72;
}

.gallery-card-description {
  margin: 0;
  line-height: 1.55;
  opacity: 0.84;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Option 2: feature query wrapper */
@supports (-webkit-line-clamp: 3) {
  .gallery-card-description {
    -webkit-line-clamp: 3;
  }
}

.gallery-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  font-size: 0.95rem;
  opacity: 0.88;
}

.gallery-card-arrow {
  transition: transform 160ms ease;
}

.gallery-card-link:hover .gallery-card-arrow {
  transform: translateX(2px);
}

/* =========================
   Rail buttons
   - they will be hidden by JS when not needed
   ========================= */

.rail-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;

  width: 40px;
  height: 40px;
  border-radius: 999px;

  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);

  display: none;
  place-items: center;
  cursor: pointer;
}

.rail-btn span {
  font-size: 22px;
  line-height: 1;
  opacity: 0.9;
}

.rail-btn-left { left: -10px; }
.rail-btn-right { right: -10px; }

/* Buttons only make sense on mobile rails */
@media (max-width: 640px) {
  .rail-btn {
    display: grid;
  }
}

/* =========================
   Reduced motion
   ========================= */

@media (prefers-reduced-motion: reduce) {
  .gallery-card-link,
  .gallery-thumb,
  .gallery-card-arrow {
    transition: none !important;
  }
}

/* =========================
   Empty state
   ========================= */

.galleries-empty {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
  opacity: 0.85;
}
