/* =========================================================
   SignGuy.MS — Gallery
   Own stylesheet so main styles.css stays untouched.
   Relies on CSS variables already defined in ../css/styles.css
   ========================================================= */

/* Page base */
.gallery-page {
  background: var(--grey-100, #F4F4F4);
}

/* Intro block under fixed header */
.gallery-intro {
  padding: calc(var(--header-height, 72px) + 48px) 0 32px;
  text-align: center;
  background: var(--white, #fff);
  border-bottom: 1px solid var(--grey-200, #e5e5e5);
}

.gallery-intro .eyebrow {
  color: var(--orange, #E85D04);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.gallery-intro h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--grey-900, #1A1A1A);
  margin: 0 0 12px;
  line-height: 1.2;
}

.gallery-lead {
  max-width: 540px;
  margin: 0 auto;
  color: var(--grey-600, #666);
  font-size: 1.05rem;
  line-height: 1.55;
}

/* ---------- Filters ---------- */
.gallery-filters-wrap {
  position: sticky;
  top: var(--header-height, 72px);
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--grey-200, #e5e5e5);
  padding: 14px 0;
}

/* On landscape mobile the header is relative & scrolls, so sticky under it still works */
@media (max-width: 1024px) and (orientation: landscape) {
  .gallery-filters-wrap {
    top: 0;
  }
}

.gallery-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

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

.filter-chip {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid var(--grey-300, #d4d4d4);
  background: var(--white, #fff);
  color: var(--grey-800, #333);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--orange, #E85D04);
  color: var(--orange, #E85D04);
}

.filter-chip.active {
  background: var(--orange, #E85D04);
  border-color: var(--orange, #E85D04);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 93, 4, 0.25);
}

.filter-chip:focus-visible {
  outline: 2px solid var(--orange, #E85D04);
  outline-offset: 2px;
}

/* ---------- Grid ---------- */
.gallery-section {
  padding: 36px 0 72px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

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

.gallery-card {
  position: relative;
  background: var(--white, #fff);
  border-radius: var(--radius, 12px);
  overflow: hidden;
  box-shadow: var(--shadow, 0 8px 30px rgba(0, 0, 0, 0.12));
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gallery-card:hover,
.gallery-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
}

.gallery-card:focus-visible {
  outline: 2px solid var(--orange, #E85D04);
  outline-offset: 3px;
}

.gallery-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--grey-200, #e5e5e5);
  overflow: hidden;
}

.gallery-card-media img {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.35s ease;
}

.gallery-card:hover .gallery-card-media img {
  transform: scale(1.04);
}

/* Per-image fit options (set via data-fit / class in JS) */
.gallery-card-media img.fit-cover   { object-fit: cover; }
.gallery-card-media img.fit-contain { object-fit: contain; background: #111; }
.gallery-card-media img.fit-width   { object-fit: none; width: 100%; height: auto; max-height: 100%; margin: auto; }
.gallery-card-media img.fit-height  { object-fit: none; height: 100%; width: auto; max-width: 100%; margin: auto; display: block; }

.gallery-card-caption {
  padding: 14px 16px 16px;
}

.gallery-card-caption p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--grey-800, #333);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.gallery-card-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--orange, #E85D04);
  background: rgba(232, 93, 4, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
}

.gallery-empty {
  text-align: center;
  color: var(--grey-600, #666);
  padding: 48px 16px;
  font-size: 1.05rem;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10, 10, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.lightbox[hidden] {
  display: none;
}

.lightbox-inner {
  position: relative;
  max-width: min(1100px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(90vh - 80px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: #111;
}

.lightbox-meta {
  margin-top: 16px;
  text-align: center;
  color: #fff;
  max-width: 640px;
}

.lightbox-caption {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
}

.lightbox-cats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.lightbox-cats span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--orange-light, #F48C06);
  background: rgba(244, 140, 6, 0.15);
  padding: 4px 10px;
  border-radius: 4px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 10;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-close {
  top: 16px;
  right: 16px;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 600px) {
  .lightbox {
    padding: 12px;
  }
  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
  .lightbox-close {
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
  }
  .lightbox-img {
    max-height: calc(85vh - 70px);
  }
}

/* Active nav state (optional visual cue) */
.main-nav a.active,
.main-nav a[aria-current="page"] {
  color: var(--orange, #E85D04);
  font-weight: 600;
}

/* Ensure container still respects site max-width */
.gallery-page .container {
  max-width: var(--max-width, 1140px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}
