/* ============================================
   AWA — GALLERY GRID CSS
   Instagram-style fixed ratio grid
   ============================================ */

:root {
  --gal-gray:   #a1a1a1;
  --gal-border: rgba(10,10,10,0.1);
}

/* ============================================
   TOOLBAR
   ============================================ */
.gallery-toolbar {
  width: 100%;
  border-bottom: 1px solid var(--gal-border);
  padding: 0 80px;
  min-height: 56px;
  height: auto; /* Allow submenu to expand vertically */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 24px;
  background: #ffffff;
  position: relative;
  overflow: visible; /* CRITICAL: allow submenu dropdowns to show */
  z-index: 200;
}

.gallery-filters {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  scrollbar-width: none;
  width: 100%;
  overflow: visible; /* CRITICAL: don't clip absolute submenu */
  padding: 0 0 0 0;
}
.gallery-filters::-webkit-scrollbar { display: none; }


.filter-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 20px;
  height: 56px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gal-gray);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
  align-self: flex-start; /* align to top so submenu drops below */
}


.filter-btn:hover     { color: #0a0a0a; }
.filter-btn.is-active { color: #0a0a0a; border-bottom-color: #0a0a0a; }

/* ── Hierarchical filter group ── */
.filter-group {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  overflow: visible; /* let submenu escape the group bounds */
  z-index: 300;
}


/* Parent button with chevron */
.filter-btn--parent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.filter-chevron {
  font-size: 16px;
  line-height: 1;
  color: var(--gal-gray);
  transition: transform 0.25s ease, color 0.2s;
  display: inline-block;
  transform: rotate(0deg);
}

.filter-group.is-open .filter-chevron {
  transform: rotate(90deg);
  color: #0a0a0a;
}

.filter-submenu {
  display: none;
  position: absolute;
  top: 56px; /* exactly at the bottom of the 56px filter-btn */
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid var(--gal-border);
  border-top: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 500;
  white-space: nowrap;
  flex-direction: column;
  min-width: 200px;
  overflow: visible;
}

.filter-group.is-open .filter-submenu {
  display: flex;
}


/* Child filter buttons */
.filter-btn--child {
  border-bottom: none;
  border-top: 1px solid var(--gal-border);
  height: 44px;
  padding: 0 20px;
  text-align: left;
  justify-content: flex-start;
  width: 100%;
  font-size: 10px;
  letter-spacing: 0.18em;
}

.filter-btn--child:first-child {
  border-top: none;
}

.filter-btn--child:hover {
  background: #f5f5f5;
  color: #0a0a0a;
}

.filter-btn--child.is-active {
  background: #0a0a0a;
  color: #ffffff;
  border-bottom-color: transparent;
}


.view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.view-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gal-gray);
  transition: border-color 0.2s, color 0.2s;
}
.view-btn:hover     { color: #0a0a0a; }
.view-btn.is-active { border-color: var(--gal-border); color: #0a0a0a; }
.view-btn svg { width: 15px; height: 15px; }

/* ============================================
   GALLERY WRAPPER
   ============================================ */
.gallery-wrap {
  padding: 48px 80px 100px;
  background: #ffffff;
}

/* ============================================
   GRID — INSTAGRAM STYLE (fixed square ratio)
   ============================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;                    /* tight gap like Instagram */
  align-items: start;
}

/* ─── ITEM ─── */
.g-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #111;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;

  /* FIXED SQUARE RATIO — same for photos and videos */
  aspect-ratio: 1 / 1;
}

.g-item.is-visible { opacity: 1; transform: translateY(0); }

/* Image container — fills the square card completely */
.g-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* All thumbnails — photos and video thumbnails */
.g-img .g-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.45s ease;
  display: block;
}

/* Adjust video thumbnail framing to focus more on the bottom */
.g-item--video .g-img .g-thumb {
  object-position: bottom;
}

.g-item:hover .g-img .g-thumb {
  transform: scale(1.06);
}

/* Loading state for thumbnails being generated */
.g-thumb--loading {
  background: #1a1a1a;
}

/* No media placeholder */
.g-no-media {
  position: absolute;
  inset: 0;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
}

/* ─── VIDEO BADGE ─── */
.g-video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 2px solid rgba(255,255,255,0.4);
  transition: background 0.25s, transform 0.25s;
  pointer-events: none;
}

.g-item--video:hover .g-video-badge {
  background: rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -50%) scale(1.08);
}

.g-video-badge svg {
  margin-left: 3px; /* optical center for play icon */
}

/* ─── OVERLAY (hover info) ─── */
.g-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,10,10,0.88) 0%, transparent 52%);
  opacity: 0;
  transition: opacity 0.38s ease;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 20px;
  gap: 3px;
}

.g-item:hover .g-overlay { opacity: 1; }

.g-title {
  font-family: 'TradeGothic LT Extended', sans-serif !important;
  font-weight: 700;
  font-size: clamp(11px, 1.1vw, 15px);
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.2;
  transform: translateY(7px);
  transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.g-item:hover .g-title { transform: translateY(0); }

.g-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  transform: translateY(7px);
  transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.04s;
}

.g-item:hover .g-sub { transform: translateY(0); }

/* Index badge */
.g-index {
  position: absolute;
  top: 11px;
  left: 13px;
  font-size: 11px;
  font-style: italic;
  color: rgba(255,255,255,0.3);
  z-index: 3;
  transition: opacity 0.25s;
  font-family: Georgia, serif;
}
.g-item:hover .g-index { opacity: 0; }

/* ============================================
   LIST VIEW
   ============================================ */
.gallery-grid.is-list {
  grid-template-columns: 1fr;
  gap: 0;
}

.gallery-grid.is-list .g-item {
  grid-column: span 1 !important;
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--gal-border);
  padding: 18px 0;
  background: none;
  overflow: visible;
  opacity: 1;
  transform: none;
  aspect-ratio: unset;       /* Remove 1:1 ratio in list view */
}

.gallery-grid.is-list .g-img {
  position: relative;
  inset: unset;
  width: 180px;
  height: 120px;
  flex-shrink: 0;
  overflow: hidden;
}

.gallery-grid.is-list .g-img .g-thumb {
  position: absolute;
  inset: 0;
}

.gallery-grid.is-list .g-overlay,
.gallery-grid.is-list .g-index { display: none; }

.gallery-grid.is-list .g-video-badge {
  width: 36px;
  height: 36px;
}

/* Caption area in list view */
.gallery-grid.is-list .g-overlay-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.g-arrow {
  font-size: 18px;
  color: var(--gal-gray);
  display: none;
  flex-shrink: 0;
  transition: transform 0.25s, color 0.25s;
}
.gallery-grid.is-list .g-arrow { display: block; }
.gallery-grid.is-list .g-item:hover .g-arrow {
  transform: translateX(4px);
  color: #0a0a0a;
}

/* ============================================
   LIGHTBOX — Photo & Video
   ============================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5,5,5,0.97);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.is-open { opacity: 1; pointer-events: auto; }

.lb-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 100px;
}

/* ─── IMAGE ─── */
.lb-img-wrap {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.lb-img-wrap img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: calc(100vh - 200px);
  object-fit: contain;
  display: block;
}

/* ─── VIDEO ─── */
.lb-video-wrap {
  display: none;             /* hidden by default, shown for video */
  flex: 1;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.lb-video-wrap video {
  width: 100%;
  height: 100%;
  max-width: 960px;
  max-height: calc(100vh - 200px);
  object-fit: contain;
  display: block;
  background: #000;
  border-radius: 3px;
}

/* ─── Controls ─── */
.lb-close {
  position: absolute;
  top: 22px;
  right: 28px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  font-size: 22px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.lb-close:hover { background: rgba(255,255,255,0.18); color: #fff; }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  border-radius: 3px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.lb-nav:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.4); color: #fff; }
.lb-prev { left: 28px; }
.lb-next { right: 28px; }

.lb-info {
  position: absolute;
  bottom: 0;
  left: 100px;
  right: 100px;
  text-align: center;
  padding-bottom: 40px;
  z-index: 10;
  /* Removed white-space: nowrap so titles wrap on mobile */
}

.lb-info-title {
  font-family: 'TradeGothic LT Extended', sans-serif !important;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  display: block;
}
.lb-info-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  display: block;
  margin-top: 4px;
}
.lb-counter {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-style: italic;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  font-family: Georgia, serif;
}

/* ============================================
   RESPONSIVE — TABLET 1024px
   ============================================ */
@media (max-width: 1024px) {
  .gallery-toolbar { padding: 0 40px; }
  .gallery-wrap    { padding: 36px 40px 80px; }
  .gallery-grid    { grid-template-columns: repeat(3, 1fr); gap: 2px; }
}

/* ============================================
   RESPONSIVE — MOBILE 768px
   ============================================ */
@media (max-width: 768px) {
  .gallery-toolbar { padding: 0 20px; }
  .filter-btn      { padding: 0 12px; font-size: 10px; }
  .view-toggle     { display: none; }

  .gallery-wrap { padding: 12px 12px 64px; }

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

  /* Overlay permanent mobile */
  .g-overlay { opacity: 1; }
  .g-title   { transform: translateY(0); font-size: 10px; }
  .g-sub     { transform: translateY(0); font-size: 9px; }

  /* Lightbox mobile */
  .lb-inner { padding: 56px 8px 80px; }
  .lb-prev  { left: 8px; }
  .lb-next  { right: 8px; }

  /* Fix title cut-off: remove left/right constraints and allow wrapping */
  .lb-info {
    left: 20px;
    right: 20px;
    white-space: normal;
    word-break: break-word;
    padding-bottom: 24px;
  }

  .lb-img-wrap img { max-height: calc(100vh - 180px); }
  .lb-video-wrap video { max-height: calc(100vh - 180px); }

  /* List view mobile */
  .gallery-grid.is-list .g-img { width: 120px; height: 90px; }
}


/* ============================================
   RESPONSIVE — SMALL MOBILE 480px
   ============================================ */
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 2px; }
  .gallery-wrap { padding: 8px 8px 64px; }

  .gallery-grid.is-list { grid-template-columns: 1fr; }
  .gallery-grid.is-list .g-img { width: 100px; height: 80px; }
}
