/* ============================================================
   CLOUVI STUDIOS — gallery.css
   The Collection page — gallery hero, filter strip, product grid
   ============================================================ */


/* ------------------------------------------------------------
   WRAPPER — reuses content-wrapper from pages.css
   Header and footer handled by pages.css
   ------------------------------------------------------------ */
.gallery-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 2;
  background: transparent;
}

.gallery-wrapper header {
  opacity: 0;
  animation: fadeIn 0.8s ease 0.2s forwards;
  position: sticky;
  top: 0;
  z-index: 500;
  background: #f5f4f0;
  border-bottom: 1px solid rgba(180,140,20,0.15);
}

.gallery-wrapper footer {
  opacity: 0;
  animation: fadeIn 0.8s ease 0.3s forwards;
  border-top: 1px solid rgba(180,140,20,0.2);
  margin-top: auto;
  background: #f5f4f0;
  color: #3a3228;
}


/* Fabric threads — visible on gallery page */
.gallery-wrapper #particles {
  opacity: 1;
}


/* ------------------------------------------------------------
   GALLERY HERO — page header area
   ------------------------------------------------------------ */
.gallery-hero {
  text-align: center;
  padding: 48px 40px 0;
  opacity: 0;
  animation: fadeIn 0.8s ease 0.4s forwards;
}

.gallery-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  color: #B8960A;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.gallery-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 400;
  letter-spacing: 8px;
  color: #0a0a0a;
  text-transform: uppercase;
}

.gallery-hero .gold-line {
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, #9A7200, #C8960C, #B8960A);
  box-shadow: 0 0 6px rgba(180,140,20,0.35);
  margin: 16px auto 0;
}


/* ------------------------------------------------------------
   FILTER STRIP — sticky below nav
   ------------------------------------------------------------ */
.gallery-filter {
  position: sticky;
  z-index: 100;
  background: rgba(236,231,222,0.97);
  border-bottom: 1px solid rgba(180,140,20,0.15);
  margin-top: 28px;
  opacity: 0;
  animation: fadeIn 0.8s ease 0.5s forwards;
}

.gf-inner {
  display: flex;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 56px;
  gap: 0;
}

.gf-inner::-webkit-scrollbar { display: none; }

.gf-btn {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(10,10,10,0.4);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.gf-btn:hover { color: rgba(10,10,10,0.7); }

.gf-btn.active {
  color: #0a0a0a;
  border-bottom-color: #B8960A;
}


/* ------------------------------------------------------------
   GALLERY MAIN — wider than content-main (1200px vs 700px)
   ------------------------------------------------------------ */
.gallery-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 56px 96px;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: fadeIn 0.8s ease 0.6s forwards;
}


/* ------------------------------------------------------------
   GALLERY SECTIONS — one per category
   ------------------------------------------------------------ */
.gallery-section {
  margin-top: 56px;
  transition: opacity 0.25s ease;
}

/* Section header row */
.gs-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 0;
}

.gs-num {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  color: #B8960A;
  text-transform: uppercase;
  flex-shrink: 0;
}

.gs-title {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 4px;
  color: #0a0a0a;
  text-transform: uppercase;
}

.gs-count {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(10,10,10,0.3);
  margin-left: auto;
  flex-shrink: 0;
}

/* Gold rule */
.gs-rule {
  height: 1px;
  background: rgba(180,140,20,0.2);
  margin: 12px 0 20px;
}

/* Category tagline */
.gs-tagline {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(140,100,10,0.65);
  font-style: italic;
  margin-bottom: 28px;
}


/* ------------------------------------------------------------
   PRODUCT GRID
   ------------------------------------------------------------ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}


/* ------------------------------------------------------------
   CHAPTERS — ALL view: one horizontal row per series.
   Series view (.mode-series): the full grid above + "← ALL SERIES".
   ------------------------------------------------------------ */
#galleryBody {
  /* <main> is a centred flex column — without an explicit width the body would
     shrink-wrap its widest row instead of staying the width of the page */
  width: 100%;
  min-width: 0;
  /* where the page content starts, so rows can bleed to the screen edges */
  --gal-inset: max(56px, calc((var(--gal-vw, 100vw) - 1088px) / 2));
  --gal-gap: 20px;
  --gal-card-w: 280px;
}

/* text links ("VIEW SERIES →", "← ALL SERIES") — gold, no button chrome */
.gs-link {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #B8960A;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.25s ease;
}
.gs-link:hover { color: #0a0a0a; }
.gs-link:focus-visible { outline: 1px solid #B8960A; outline-offset: 4px; }

.gs-back { display: none; margin-bottom: 18px; }
.gs-view { margin-left: auto; flex-shrink: 0; }

/* mode switches */
.mode-all .gallery-grid { display: none; }
.mode-series .gs-chapter { display: none; }
.mode-series .gs-view { display: none; }
.mode-series .gs-back { display: block; }
.mode-all .gs-count { margin-left: 0; }
.mode-all .gs-tagline { margin-bottom: 22px; }

/* the row — native horizontal scroll, snap to card start, scrollbar hidden */
.gs-row {
  margin-left: calc(-1 * var(--gal-inset));
  margin-right: calc(-1 * var(--gal-inset));
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--gal-inset);
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -webkit-user-select: none;
  user-select: none;
}
.gs-row::-webkit-scrollbar { display: none; }
.gs-row:not(.is-static) { cursor: grab; }

.gs-track {
  display: flex;
  gap: var(--gal-gap);
  width: max-content;
  position: relative;
  padding: 0 var(--gal-inset);
}
.gs-track .gallery-card {
  flex: 0 0 var(--gal-card-w);
  scroll-snap-align: start;
}

/* soft fade on the right edge while more cards remain */
.gs-row.fade-right {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 90px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 90px), transparent);
}

/* few cards: no scrolling, no trailing space, no fade */
.gs-row.is-static { overflow-x: hidden; scroll-snap-type: none; }
.gs-row.is-static .gs-track { padding-right: 0; }

/* drag / scrub: snap off (re-snaps on release), no hover flicker, grabbing cursor */
.gs-row.is-dragging,
.gs-row.is-scrubbing { scroll-snap-type: none; }
.gs-row.is-dragging,
.gs-row.is-dragging * { cursor: grabbing !important; }
.gs-row.is-dragging .gallery-card { pointer-events: none; }

/* footer: progress line (+ arrows on desktop) — only when the row overflows */
.gs-foot { display: none; align-items: center; gap: 24px; margin-top: 8px; }
.gs-chapter.has-overflow .gs-foot { display: flex; }

.gs-progress {
  position: relative;
  flex: 1;
  height: 28px;               /* big hit area around a 1px line */
  cursor: pointer;
  touch-action: none;         /* only here — rows keep native touch scrolling */
  -webkit-user-select: none;
  user-select: none;
}
.gs-progress::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: rgba(180,140,20,0.22);
}
.gs-thumb {
  position: absolute;
  left: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: #B8960A;
  will-change: transform;
}

.gs-arrows { display: flex; gap: 8px; }
.gs-arrow {
  background: none;
  border: 0;
  padding: 8px 6px;
  color: #B8960A;
  cursor: pointer;
  line-height: 0;
  transition: opacity 0.25s ease, color 0.25s ease;
}
.gs-arrow:hover { color: #0a0a0a; }
.gs-arrow.is-off { opacity: 0; pointer-events: none; }   /* hidden but space kept */

/* mobile / touch: progress line only, no arrows */
@media (max-width: 768px), (hover: none) {
  .gs-arrows { display: none; }
}


/* ------------------------------------------------------------
   PRODUCT CARD
   ------------------------------------------------------------ */
.gallery-card {
  display: flex;
  flex-direction: column;
  background: #f5f4f0;
  border: 1px solid rgba(180,140,20,0.1);
  transition: border-color 0.3s ease;
  cursor: pointer;
}

.gallery-card:hover {
  border-color: rgba(180,140,20,0.3);
}

/* Image area */
.gc-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #ddd8ce;
  overflow: hidden;
  cursor: pointer;
}

/* Primary image */
.gc-img-primary {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.5s ease;
}

/* Secondary image — crossfades in on hover */
.gc-img-secondary {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.gallery-card:hover .gc-img-secondary { opacity: 1; }
.gallery-card:hover .gc-img-primary   { transform: scale(1.03); }

/* QUICK VIEW overlay — slides up on hover */
.gc-quick-view {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(10,10,10,0.72);
  color: #D4AF37;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-align: center;
  padding: 13px 0;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}

.gallery-card:hover .gc-quick-view {
  opacity: 1;
  transform: translateY(0);
}

/* Hide quick view on touch devices — tap opens modal directly */
@media (hover: none) {
  .gc-quick-view { display: none; }
}

/* LIMITED badge */
.gc-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: #D4AF37;
  border: 1px solid rgba(212,175,55,0.4);
  background: rgba(10,10,10,0.82);
  padding: 4px 10px;
  text-transform: uppercase;
  z-index: 2;
}

/* Card body */
.gc-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}

.gc-cat {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.5px;
  color: #B8960A;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.gc-name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 2px;
  color: #0a0a0a;
  text-transform: uppercase;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Meta row — pins to bottom of card body */
.gc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
/* Color dots */
.gc-colors {
  display: flex;
  gap: 6px;
  align-items: center;
}

.gc-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-sizing: border-box;
  display: inline-block;
  flex-shrink: 0;
}

.gc-dot-b      { background: #0a0a0a; }
.gc-dot-w      { background: #f5f5f5; border: 1.5px solid rgba(10,10,10,0.28); }
.gc-dot-maroon { background: #5c1a1a; }

/* Price */
.gc-price {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: #B8960A;
}

/* ------------------------------------------------------------
   BOTTOM CTA ROW
   ------------------------------------------------------------ */
.gallery-cta-row {
  margin-top: 72px;
  padding-top: 48px;
  border-top: 1px solid rgba(180,140,20,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.gallery-cta-text {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(140,100,10,0.65);
  font-style: italic;
}


/* Archived badge */
.gc-badge-archived {
  background: rgba(245,244,240,0.9) !important;
  color: rgba(10,10,10,0.45) !important;
  border-color: rgba(10,10,10,0.2) !important;
}

/* Archived card — greyed, no hover */
.gc-archived {
  opacity: 0.55;
  cursor: default !important;
  pointer-events: none;
}

/* Archive section — slightly muted */
.gallery-section-archive .gs-title {
  color: rgba(10,10,10,0.5);
}

.gallery-section-archive .gs-rule {
  background: rgba(10,10,10,0.08);
}


/* ------------------------------------------------------------
   ACTIVE NAV STATE — highlights COLLECTION link
   ------------------------------------------------------------ */
.nav-link-active {
  color: #0a0a0a !important;
  pointer-events: none;
}


/* ------------------------------------------------------------
   FOOTER LINKS — inherits from pages.css
   ------------------------------------------------------------ */
.gallery-wrapper .footer-links a {
  color: rgba(60,40,10,0.6);
}

.gallery-wrapper .footer-links a:hover {
  color: #0a0a0a;
}


/* ------------------------------------------------------------
   MEDIA QUERIES
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .gallery-hero {
    padding: 32px 28px 0;
  }

  .gallery-main {
    padding: 0 20px max(80px, calc(64px + env(safe-area-inset-bottom)));
  }

  .gf-inner {
    padding: 0 20px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  #galleryBody {
    --gal-inset: 20px;
    --gal-gap: 14px;
    --gal-card-w: min(280px, calc(var(--gal-vw, 100vw) * 0.64));   /* next card peeks */
  }

  .gs-title {
    font-size: 13px;
    letter-spacing: 3px;
  }

  .gc-body {
    padding: 12px 14px 16px;
  }

  .gc-name {
    font-size: 11px;
  }
}

@media (max-width: 380px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}
