/* Photography & videography portfolio gallery - Google Photos / Apple Photos style */

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color, rgba(10, 10, 10, 0.08));
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
}

.gallery-toolbar-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 100%;
  max-width: 100%;
}

.gallery-media-filters-wrapper {
  display: block;
  text-align: center;
  width: 100%;
}

.gallery-media-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.gallery-media-filters .filter-btn {
  padding: 0.5rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted, #666);
  background: transparent;
  border: none;
  border-radius: 0;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.gallery-media-filters .filter-btn::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-ochre, #B8924E);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-media-filters .filter-btn:hover {
  color: var(--text-dark, #0A0A0A);
  letter-spacing: 0.18em;
  transform: translateY(-1px) scale(1.02);
}

.gallery-media-filters .filter-btn:hover::after {
  width: 100%;
}

.gallery-media-filters .filter-btn.active {
  color: #FFFFFF;
  background: var(--text-dark, #0A0A0A);
  border: none;
  box-shadow: none;
  border-radius: 30px;
  padding: 0.5rem 1.25rem;
  letter-spacing: 0.15em;
}

.gallery-media-filters .filter-btn.active::after {
  width: 0;
  background: transparent;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  gap: 12px 10px;
}

@media (min-width: 992px) {
  .gallery-filters {
    justify-content: center;
  }
}

.gallery-filters .filter-btn {
  padding: 11px 22px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dark, #0A0A0A);
  background: var(--bg-pure, #FFFFFF);
  border: 1px solid rgba(10, 10, 10, 0.12);
  border-radius: 0;
  position: relative;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  white-space: nowrap;
}

.gallery-filters .filter-btn:hover {
  color: var(--text-dark, #0A0A0A);
  border-color: var(--accent-ochre, #B8924E);
  background: rgba(184, 146, 78, 0.08);
  transform: translateY(-1px);
}

.gallery-filters .filter-btn.active {
  color: #D4B87A;
  background: linear-gradient(135deg, var(--text-dark, #0A0A0A) 0%, #1a1a1a 100%);
  border-color: var(--text-dark, #0A0A0A);
  box-shadow: 0 8px 20px rgba(10, 10, 10, 0.15);
}

.gallery-filters .filter-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 18%;
  right: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-ochre, #B8924E), transparent);
  z-index: 1;
}

.gallery-count {
  font-size: 0.85rem;
  color: var(--text-muted, #666);
  margin: 0;
  white-space: nowrap;
}

/* PREMIUM GOOGLE PHOTOS STYLE GALLERY GRID */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: 150px;
  grid-auto-flow: dense;
  gap: 16px;
}

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: var(--bg-off, #F8F9FA);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05), 0 1px 4px rgba(0, 0, 0, 0.03);
}

/* Mixed card sizes - consistent layout */
.gallery-item.size-small {
  grid-column: span 1;
  grid-row: span 1;
}

.gallery-item.size-medium-wide {
  grid-column: span 2;
  grid-row: span 1;
}

.gallery-item.size-medium-tall {
  grid-column: span 1;
  grid-row: span 2;
}

.gallery-item.size-large {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-item:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.06);
  z-index: 10;
}

.gallery-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

/* GALLERY ITEM OVERLAY */
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 35%, rgba(0,0,0,0) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 5;
}

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

.gallery-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery-item-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  color: white;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.gallery-item:hover .gallery-item-icon {
  background: white;
  color: #0a0a0a;
  transform: scale(1.1);
  border-color: transparent;
}

.gallery-item-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gallery-item-category {
  font-family: var(--heading-font, 'Syne', sans-serif);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.85);
}

.gallery-item-cta {
  font-family: var(--body-font, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gallery-item-cta i {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-item-cta i {
  transform: translateX(4px);
}

/* VIDEO PLAY BADGE (TOP RIGHT) - Google Photos style */
.gallery-item-play-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 6;
  pointer-events: none;
}

/* VIDEO PLAY BUTTON (CENTERED) */
.gallery-item-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.gallery-item--video:hover .gallery-item-play {
  opacity: 1;
}

.gallery-item-play i {
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  padding-left: 3px;
  transition: all 0.15s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  color: white;
  font-size: 1.1rem;
}

.gallery-item:hover .gallery-item-play i {
  transform: scale(1.05);
  background: white;
  color: #0a0a0a;
  border-color: white;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}

.gallery-item.is-previewing .gallery-item-play {
  opacity: 0;
}

.gallery-empty {
  grid-column: 1 / -1;
  padding: 2rem 0;
  color: var(--text-muted, #666);
  font-size: 0.95rem;
}

.gallery-note {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-off, #F8F9FA);
  border-left: 3px solid var(--accent-ochre, #B8924E);
  font-size: 0.9rem;
  color: var(--text-muted, #666);
  line-height: 1.65;
}

.gallery-note strong {
  color: var(--text-dark, #0A0A0A);
}

/* Typewriter Animation */
.typewriter-text {
  display: inline-block;
  color: var(--accent-ochre, #B8924E);
  font-weight: 700;
}

.typewriter-cursor {
  display: inline-block;
  color: var(--accent-ochre, #B8924E);
  font-weight: 300;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(8, 8, 8, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-media {
  max-width: min(92vw, 1200px);
  max-height: 86vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox img,
.gallery-lightbox video {
  max-width: min(92vw, 1200px);
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: #000;
  border-radius: 8px;
}

.gallery-lightbox video {
  width: min(92vw, 1200px);
}

.gallery-lightbox-caption {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  text-align: center;
  max-width: 90vw;
}

.gallery-lightbox-close,
.gallery-lightbox-prev,
.gallery-lightbox-next {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  border-radius: 50%;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.gallery-lightbox-close:hover,
.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
  transform: scale(1.05);
}

.gallery-lightbox-close {
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.25rem;
}

.gallery-lightbox-prev {
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox-next {
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 1199.98px) {
  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: 140px;
    gap: 14px;
  }
}

@media (max-width: 991.98px) {
  .gallery-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-toolbar-main {
    padding: 0 20px;
  }

  .gallery-media-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    gap: 12px;
    scrollbar-width: none;
  }

  .gallery-media-filters::-webkit-scrollbar {
    display: none;
  }

  .gallery-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    gap: 10px;
    scrollbar-width: none;
  }

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

  .gallery-filters .filter-btn,
  .gallery-media-filters .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    grid-auto-rows: 130px;
    gap: 12px;
    padding: 0 20px;
  }

  .gallery-item-icon {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  .gallery-item-play i {
    width: 56px;
    height: 56px;
    font-size: 1rem;
  }
}

@media (max-width: 767.98px) {
  .gallery-toolbar-main {
    padding: 0 20px;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    grid-auto-rows: 110px;
    gap: 10px;
    padding: 0 20px;
  }

  /* Adjust large cards for mobile */
  .gallery-item.size-large {
    grid-column: span 2;
    grid-row: span 1;
  }

  .gallery-item-icon {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }

  .gallery-item-play i {
    width: 48px;
    height: 48px;
    font-size: 0.9rem;
  }

  .gallery-item-category {
    font-size: 0.65rem;
  }

  .gallery-item-cta {
    font-size: 0.85rem;
  }

  .gallery-lightbox-prev { left: 1rem; }
  .gallery-lightbox-next { right: 1rem; }
  .gallery-lightbox-close { top: 1rem; right: 1rem; }

  /* Clear spacing for counter text */
  .gallery-count {
    display: block;
    width: 100%;
    margin-top: 12px;
    margin-bottom: 20px;
    padding: 0 20px;
  }
}

@media (max-width: 575.98px) {
  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    grid-auto-rows: 100px;
    gap: 8px;
    padding: 0 20px;
  }

  /* Keep large cards as 2x1 on small mobile */
  .gallery-item.size-large {
    grid-column: span 2;
    grid-row: span 1;
  }

  main.container {
    padding: 0;
  }

  .gallery-note {
    margin: 2rem 20px 0;
  }
}
