/* ── Gallery view layout ─────────────────────────────────────── */
#gallery-view {
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

/* ── Gallery header ──────────────────────────────────────────── */
.gallery-header {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gallery-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gallery-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: #222;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.gallery-back-btn:hover {
  opacity: 0.6;
}

.gallery-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Gallery main ────────────────────────────────────────────── */
.gallery-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 20px 32px 4px;
  gap: 20px;
  position: relative;
  z-index: 1;
}

/* ── Gallery wrapper (tabs + box stacked) ────────────────────── */
.gallery-wrapper {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* ── Gallery cards box ───────────────────────────────────────── */
.gallery-cards-box {
  width: 100%;
  background: #ffffff;
  border: 1px solid #111;
  border-radius: 0 0 40px 40px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  padding: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ── Category tabs (bookmark style, outside box) ─────────────── */
.gallery-tabs {
  display: flex;
  align-items: flex-end;
  width: 100%;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  overflow-x: auto;
  overflow-y: clip;
  scrollbar-width: none;
  margin-bottom: -1px;
  overscroll-behavior-x: none;
}

.gallery-tabs::-webkit-scrollbar {
  display: none;
}

.gallery-tab {
  flex: 1;
  padding: 8px 18px;
  border-radius: 0 14px 0 0;
  font-family: 'Baloo Thambi 2', system-ui, sans-serif;
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  border: 1px solid #111;
  color: #111;
  position: relative;
  margin-right: -14px;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
}

.gallery-tabs > .gallery-tab:last-child {
  margin-right: 0;
}

.gallery-tabs > .gallery-tab:first-child {
  border-radius: 14px 14px 0 0;
}

.gallery-tab--active {
  background: white;
  padding: 10px 22px;
  border-radius: 14px 14px 0 0;
  border-bottom: none;
  z-index: 1;
}


/* ── Gallery scroll — two-row flex column ────────────────────── */
.gallery-cards-box .cards-scroll {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 24px 36px;
  overflow-x: auto;
  scrollbar-width: none;
  min-height: 430px;
}

.gallery-cards-box .cards-scroll::-webkit-scrollbar {
  display: none;
}

.gallery-row {
  display: flex;
  flex-direction: row;
  gap: 28px;
}

.gallery-row::after {
  content: '';
  flex-shrink: 0;
  width: 12px;
}

/* ── Image card ──────────────────────────────────────────────── */
.img-card {
  cursor: pointer;
  flex-shrink: 0;
  width: 135px;
  height: 175px;
  border-radius: 17px;
  border: 1px solid #111;
  background: var(--cat-color, #eee);
  overflow: hidden;
  padding: 6px;
  box-sizing: border-box;
  transition: transform 0.2s ease;
}

.img-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  border: 1px solid #111;
  box-sizing: border-box;
}

.img-card:hover  { transform: scale(1.05); }
.img-card:active { transform: scale(0.95); }

/* ── View all drawings button (hidden on desktop) ────────────── */
.gallery-view-all-btn {
  display: none;
}

/* ── Gallery slider (uses category color) ────────────────────── */
.gallery-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  background: transparent;
}

.gallery-slider::-webkit-slider-runnable-track {
  height: 16px;
  border-radius: 99px;
  border: 1px solid var(--cat-color, #111);
  background: linear-gradient(to right, var(--cat-color, #111) var(--fill-pct, 0%), #fff var(--fill-pct, 0%));
}

.gallery-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cat-color, #111);
  cursor: pointer;
  margin-top: -6px;
  transition: transform 0.15s;
}

.gallery-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.gallery-slider::-moz-range-track {
  height: 16px;
  border-radius: 99px;
  border: 1px solid var(--cat-color, #111);
  background: #fff;
}

.gallery-slider::-moz-range-progress {
  height: 16px;
  border-radius: 99px 0 0 99px;
  background: var(--cat-color, #111);
}

.gallery-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cat-color, #111);
  border: none;
  cursor: pointer;
}

@media (max-width: 767px) {
  /* Match gallery-main vertical position to home-main on mobile */
  .gallery-main {
    justify-content: flex-start;
    padding: 0 12px 4px;
    gap: 16px;
  }

  /* 2-column vertical layout, no horizontal scroll */
  .gallery-cards-box .cards-scroll {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    overflow-x: hidden;
    padding: 20px 0;
    min-height: unset;
  }


  /* Hide scroll controls */
  #gallery-view .scroll-controls {
    display: none;
  }

  #gallery-view .gallery-cards-box {
    padding-bottom: 8px;
  }

  /* Hide cards beyond first 6 by default */
  #gallery-scroll .img-card:nth-child(n+7) {
    display: none;
  }

  /* When show-all is active, show all cards and hide the button */
  #gallery-scroll.show-all .img-card {
    display: block;
  }

  .gallery-view-all-btn {
    display: block;
    margin: 8px auto 16px;
    padding: 13px 60px;
    width: fit-content;
    min-width: 240px;
    background: #58C1B9;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
  }

  #gallery-scroll.show-all ~ .gallery-view-all-btn {
    display: none;
  }
}

