/* ══════════════════════════════════════════
   GALLERY — FSJ masonry grid
══════════════════════════════════════════ */
#gallery {
  background-color: var(--black);
  padding: var(--section-pad) 0 0;
  position: relative;
}
/* Ghost watermark */
#gallery::after {
  content: 'CUTS';
  position: absolute;
  top: clamp(2rem, 6vh, 5rem);
  left: -0.03em;
  font-family: var(--font-display);
  font-size: clamp(8rem, 18vw, 18rem);
  color: rgba(255, 255, 255, 0.014);
  pointer-events: none;
  line-height: 1;
  z-index: 0;
  user-select: none;
  letter-spacing: 0.05em;
}

#gallery .sec-header {
  padding: 0 clamp(1.5rem, 5vw, 6rem);
  margin-bottom: clamp(2rem, 4vh, 3.5rem);
  position: relative;
  z-index: 1;
}

/* FSJ-style full-bleed grid — 4 columns, variable row spans */
.g-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 300px;
  grid-auto-flow: dense;
  gap: 3px;
}

.g-item {
  position: relative;
  overflow: hidden;
  background: var(--elevated);
}

/* Span rules for masonry rhythm */
.g-item:nth-child(1)  { grid-row: span 2; }    /* skin-fade — tall */
.g-item:nth-child(8)  { grid-column: span 2; } /* exterior-organic — wide */
.g-item:nth-child(10) { grid-row: span 2; }    /* interior-7 — tall */

.g-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
  transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  user-select: none;
  will-change: transform;
}
.g-item:hover img { transform: scale(1.06); }

/* Hover overlay — gradient bottom + label */
.g-ov {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(3, 5, 8, 0.92) 0%,
    rgba(3, 5, 8, 0.4)  40%,
    transparent 70%
  );
  display: flex;
  align-items: flex-end;
  padding: 1.5rem 1.25rem;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.g-item:hover .g-ov { opacity: 1; }

/* Red corner accent — top-left  */
.g-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 36px 36px 0 0;
  border-color: var(--red) transparent transparent transparent;
  z-index: 3;
  pointer-events: none;
  opacity: 0.85;
}

.g-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  position: relative;
  z-index: 2;
}

/* Bottom red rule on hover */
.g-item::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0;
  height: 2px;
  background: var(--red);
  z-index: 3;
  pointer-events: none;
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.g-item:hover::after { width: 100%; }

/* Scroll reveal — items start invisible, JS triggers */
.g-item.rv {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.g-item.rv.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ── Lightbox ── */
#g-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
  background: rgba(3, 5, 8, 0.96);
}
#g-lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.g-lb-overlay {
  position: absolute;
  inset: 0;
  cursor: zoom-out;
}

.g-lb-img-wrap {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.g-lb-img {
  max-width: 100%;
  max-height: 84vh;
  object-fit: contain;
  border-radius: var(--r-md);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  display: block;
}

.g-lb-caption {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.g-lb-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.4);
  z-index: 2;
  pointer-events: none;
}

.g-lb-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2;
  background: none;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.g-lb-close:hover {
  border-color: var(--red);
  background: rgba(220, 38, 38, 0.15);
  color: var(--white);
}
.g-lb-close svg { width: 18px; height: 18px; }

.g-lb-prev,
.g-lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: none;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast), transform 0.3s var(--ease-out);
}
.g-lb-prev { left: 1.5rem; }
.g-lb-next { right: 1.5rem; transform: translateY(-50%); }
.g-lb-prev:hover,
.g-lb-next:hover {
  border-color: var(--red);
  background: rgba(220, 38, 38, 0.12);
  color: var(--white);
}
.g-lb-prev svg,
.g-lb-next svg { width: 20px; height: 20px; }
