/* =========================================================
   Phoenix Solutions — Gallery page styles
   ========================================================= */

.gallery-head-section {
  padding-top: clamp(140px, 18vw, 180px);
  border-top: none;
}

.gallery-head-section h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  margin-top: 14px;
}

/* ---------- Filter squares ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(28px, 4vw, 44px);
  margin-bottom: clamp(36px, 5vw, 56px);
}

.filter-tile {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line-bright);
  flex-shrink: 0;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.filter-tile:hover { transform: translateY(-2px); border-color: var(--brass); }

.filter-tile.active {
  border-color: var(--ember);
  box-shadow: 0 0 0 2px rgba(225, 98, 42, 0.35);
}

.filter-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* "All" tile has no image — styled as a plain toggle */
.filter-tile.all-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}
.filter-tile.all-tile span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--parchment-dim);
}
.filter-tile.all-tile.active span { color: var(--parchment); }

.filter-tile-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 6px 7px;
  background: linear-gradient(180deg, rgba(21,17,13,0) 0%, rgba(21,17,13,0.92) 75%);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--parchment);
  line-height: 1.25;
  text-align: left;
}

/* ---------- Gallery grid ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
}
@media (min-width: 620px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 860px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1120px) {
  .gallery-grid { grid-template-columns: repeat(5, 1fr); }
}

.gallery-tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 0;
  margin: 5px;
  cursor: pointer;
}
.gallery-tile:hover .gallery-tile-img { transform: scale(1.05); }

.gallery-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: scale-down;
  transition: transform 0.4s ease;
}

.gallery-tile-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(21, 17, 13, 0.72);
  backdrop-filter: blur(4px);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ember-bright);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.gallery-tile:hover .gallery-tile-tag,
.gallery-tile:focus-visible .gallery-tile-tag {
  opacity: 1;
  transform: translateY(0);
}

.gallery-empty {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--ash);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(21, 17, 13, 0.94);
  backdrop-filter: blur(6px);
  padding: 24px;
}
.lightbox.open { display: flex; }

.lightbox-figure {
  max-width: min(90vw, 1100px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 74vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-figure figcaption {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--parchment);
  text-align: center;
}
.lightbox-figure figcaption .tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ember-bright);
  border: 1px solid var(--line-bright);
  padding: 4px 10px;
  border-radius: 999px;
}

.lightbox-btn {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-bright);
  background: rgba(32, 26, 20, 0.7);
  color: var(--parchment);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.lightbox-btn:hover {
  border-color: var(--brass);
  color: var(--ember-bright);
}
.lightbox-btn svg { width: 20px; height: 20px; }

.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .lightbox-close { top: 12px; right: 12px; }
}