/* ═══════════════════════════════════════════════════════════════════
   VEXA — Our Work & Explore Flooring pages
   Load AFTER style.css (uses its tokens: --black, --gold, --nav-h …)

   Mobile-first. Breakpoints used in this file:
     ≥ 600px  tablet portrait   |  ≥ 900px  tablet landscape / laptop
     ≥ 1400px large desktop

   CONTENTS
     1. Page hero (header + stats)
     2. Category filter bar
     3. Cards grid
     4. Project card
     5. Lightbox modal
     6. Bottom CTA banner
     7. Loading / empty states
     8. Accessibility & motion
   ═══════════════════════════════════════════════════════════════════ */

/* Local tokens for this page */
:root {
  --gallery-max: 1350px;
  --gallery-gutter: clamp(1rem, 4vw, 3rem);
  --gallery-gap: clamp(1.1rem, 2.5vw, 2.25rem);
  --gallery-line: rgba(23, 21, 19, 0.08);
}


/* ═══ 1. PAGE HERO ═══════════════════════════════════════════════════ */

.gallery-page-header {
  position: relative;
  overflow: hidden;
  text-align: center;
  color: var(--white);
  background:
    radial-gradient(circle at 80% 20%, rgba(184, 137, 74, 0.12), transparent 50%),
    var(--black);
  border-bottom: 1px solid rgba(184, 137, 74, 0.25);
  padding:
    calc(var(--nav-h) + clamp(0.75rem, 2vw, 1.5rem))
    var(--gallery-gutter)
    clamp(1.25rem, 3vw, 2rem);
}

/* subtle pattern overlay */
.gallery-page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.02' fill-rule='evenodd'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
}

.gallery-header-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

.gallery-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.4rem;
  font-size: clamp(0.58rem, 1.4vw, 0.7rem);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.gallery-eyebrow::before,
.gallery-eyebrow::after {
  content: '';
  width: 16px;
  height: 1px;
  background: var(--gold);
  opacity: 0.6;
}

.gallery-title {
  margin-bottom: 0.5rem;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4.2vw, 2.3rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--white);
  overflow-wrap: anywhere;
}

.gallery-subtitle {
  max-width: 600px;
  margin: 0 auto 1rem;
  font-size: clamp(0.82rem, 1.8vw, 0.95rem);
  line-height: 1.5;
  color: var(--grey-light);
}

/* Stats strip: 3 compact columns on phones, centered row on larger screens */
.gallery-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.gallery-stat-num {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 3.4vw, 1.2rem);
  font-weight: 700;
  color: var(--gold);
}

.gallery-stat-label {
  font-size: clamp(0.54rem, 2vw, 0.66rem);
  letter-spacing: 0.07em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--grey-light);
}

@media (min-width: 600px) {
  .gallery-stats-bar {
    display: flex;
    justify-content: center;
    gap: clamp(1.5rem, 5vw, 3rem);
  }
}


/* ═══ 2. CATEGORY FILTER BAR ═════════════════════════════════════════ */

.gallery-filter-section {
  position: sticky;
  top: var(--nav-h);
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--gallery-line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  padding: 0.75rem 0;
}

/* Phones: one scrollable row (keeps the sticky bar short) */
.gallery-filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: var(--gallery-max);
  margin: 0 auto;
  padding: 0 var(--gallery-gutter);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery-filter-wrap::-webkit-scrollbar { display: none; }

.filter-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;                 /* comfortable touch target */
  padding: 0.45rem 1rem;
  scroll-snap-align: start;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--black);
  background: transparent;
  border: 1px solid rgba(23, 21, 19, 0.15);
  border-radius: 30px;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn.active {
  font-weight: 600;
  color: var(--gold-light);
  background: var(--black);
  border-color: var(--black);
  box-shadow: 0 4px 12px rgba(23, 21, 19, 0.15);
}

.filter-btn .filter-count {
  padding: 1px 6px;
  font-size: 0.7rem;
  opacity: 0.75;
  background: rgba(23, 21, 19, 0.08);
  border-radius: 10px;
}

.filter-btn.active .filter-count {
  color: var(--white);
  background: rgba(184, 137, 74, 0.3);
  opacity: 1;
}

/* Laptop+: centered and wrapping */
@media (min-width: 900px) {
  .gallery-filter-section { padding: 1.1rem 0; }
  .gallery-filter-wrap {
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
    gap: 0.6rem;
  }
}


/* ═══ 3. CARDS GRID ══════════════════════════════════════════════════ */

.gallery-main-section {
  min-height: 60vh;
  padding: clamp(2rem, 5vw, 4.5rem) var(--gallery-gutter);
  background: var(--white-off);
}

.gallery-grid-container {
  max-width: var(--gallery-max);
  margin: 0 auto;
}

/* min(100%, 300px) → never overflows, even on 320px phones */
.projects-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--gallery-gap);
}

@media (min-width: 1400px) {
  .projects-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}


/* ═══ 4. PROJECT CARD ════════════════════════════════════════════════ */

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--gallery-line);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.35s var(--transition), box-shadow 0.35s var(--transition), border-color 0.35s var(--transition);
}

.project-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: var(--black-card);
}

.project-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--transition);
}

/* Badges */
.project-badge-cat {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  max-width: calc(100% - 24px);
  padding: 5px 11px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-light);
  background: rgba(23, 21, 19, 0.85);
  border: 1px solid rgba(184, 137, 74, 0.4);
  border-radius: var(--radius-sm);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.project-badge-loc {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 24px);
  padding: 4px 10px;
  font-size: 0.72rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border-radius: var(--radius-sm);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.project-badge-loc svg { flex: none; width: 12px; height: 12px; color: var(--gold); }

/* Hover overlay ("View Project") */
.project-card-overlay-btn {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 21, 19, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-view-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--black);
  background: var(--white);
  border-radius: 30px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(10px);
  transition: transform 0.3s ease;
}

/* Card body */
.project-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.1rem 1.2rem 1.25rem;
}

.project-card-title {
  margin-bottom: 0.4rem;
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--black);
  overflow-wrap: anywhere;
}

.project-card-desc {
  flex: 1;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #55504a;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  font-size: 0.76rem;
  color: var(--grey);
  border-top: 1px solid var(--gallery-line);
}

.project-link-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: var(--gold-dark);
  transition: gap 0.2s ease, color 0.2s ease;
}

/* Hover effects only where a real pointer exists (no sticky hover on phones) */
@media (hover: hover) and (pointer: fine) {
  .project-card:hover {
    transform: translateY(-6px);
    border-color: var(--gold);
    box-shadow: 0 16px 36px rgba(23, 21, 19, 0.12);
  }
  .project-card:hover .project-card-media img { transform: scale(1.07); }
  .project-card:hover .project-card-overlay-btn { opacity: 1; }
  .project-card:hover .btn-view-preview { transform: translateY(0); }
  .project-card:hover .project-link-action { gap: 7px; color: var(--black); }
}

/* Touch: subtle press feedback instead */
@media (hover: none) {
  .project-card:active { transform: scale(0.985); }
}


/* ═══ 5. LIGHTBOX MODAL ══════════════════════════════════════════════ */

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(0.75rem, var(--safe-top))
    max(0.75rem, var(--safe-right))
    max(0.75rem, var(--safe-bottom))
    max(0.75rem, var(--safe-left));
  background: rgba(15, 14, 12, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-modal.active { opacity: 1; visibility: visible; }

.gallery-modal-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 1.5rem);     /* fallback */
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--white);
  background: var(--black-soft);
  border: 1px solid rgba(184, 137, 74, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
  transition: transform 0.3s var(--transition);
}

.gallery-modal.active .gallery-modal-dialog { transform: scale(1); }

.gallery-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;                          /* touch-friendly */
  height: 44px;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  background: rgba(23, 21, 19, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .gallery-modal-close:hover { color: var(--black); background: var(--gold); transform: rotate(90deg); }
}

.gallery-modal-img-wrap {
  flex: none;
  width: 100%;
  max-height: clamp(200px, 42vh, 520px);
  overflow: hidden;
  background: #000;
}

.gallery-modal-img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: inherit;
  object-fit: contain;
}

.gallery-modal-content { padding: 1.25rem 1.25rem 1.5rem; }

.gallery-modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 0.6rem;
}

.gallery-modal-title {
  margin-bottom: 0.75rem;
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 4vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--white);
  overflow-wrap: anywhere;
}

.gallery-modal-desc {
  margin-bottom: 1.25rem;
  font-size: clamp(0.9rem, 2.4vw, 0.95rem);
  line-height: 1.65;
  color: var(--grey-light);
}

/* Phones: buttons stack full-width */
.gallery-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.gallery-modal-actions .btn { width: 100%; justify-content: center; text-align: center; }

@media (min-width: 600px) {
  .gallery-modal { padding: clamp(1rem, 3vw, 2.5rem); }
  .gallery-modal-dialog { max-height: 90vh; max-height: 90dvh; }
  .gallery-modal-content { padding: 1.75rem 2rem 2rem; }
  .gallery-modal-actions { flex-direction: row; flex-wrap: wrap; gap: 1rem; }
  .gallery-modal-actions .btn { width: auto; }
}

/* Short landscape phones: image left, details right */
@media (max-height: 500px) and (orientation: landscape) {
  .gallery-modal-dialog { flex-direction: row; max-height: calc(100dvh - 1rem); }
  .gallery-modal-img-wrap { flex: 0 0 45%; max-height: none; }
  .gallery-modal-content { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
}


/* ═══ 6. BOTTOM CTA BANNER ═══════════════════════════════════════════ */

.gallery-cta-banner {
  text-align: center;
  color: var(--white);
  background: linear-gradient(135deg, var(--black) 0%, #201c18 100%);
  border-top: 1px solid rgba(184, 137, 74, 0.3);
  padding:
    clamp(2.5rem, 6vw, 5rem)
    var(--gallery-gutter)
    calc(clamp(2.5rem, 6vw, 5rem) + var(--safe-bottom));
}

.gallery-cta-inner { max-width: 750px; margin: 0 auto; }

.gallery-cta-title {
  margin-bottom: 0.75rem;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.2;
}

.gallery-cta-copy {
  margin-bottom: 1.75rem;
  font-size: clamp(0.92rem, 2.2vw, 1rem);
  line-height: 1.6;
  color: var(--grey-light);
}

.gallery-cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gallery-cta-buttons .btn { width: 100%; justify-content: center; }

@media (min-width: 600px) {
  .gallery-cta-buttons { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 1rem; }
  .gallery-cta-buttons .btn { width: auto; }
}


/* ═══ 7. LOADING / EMPTY STATES ══════════════════════════════════════ */

.gallery-state-msg {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  font-size: 1rem;
  color: #55504a;
}


/* ═══ 8. ACCESSIBILITY & MOTION ══════════════════════════════════════ */

.project-card:focus-visible,
.filter-btn:focus-visible,
.gallery-modal-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .project-card-media img,
  .project-card-overlay-btn,
  .btn-view-preview,
  .gallery-modal,
  .gallery-modal-dialog,
  .gallery-modal-close { transition: none; }
  .project-card:hover { transform: none; }
  .project-card:hover .project-card-media img { transform: none; }
}