/* ============================================================
   GALLERIES + LIGHTBOX
   Used by article, job and product pages. All five layouts share
   the same markup; only the wrapper class changes.
   ============================================================ */

.gal { margin: 34px 0 38px; }
.gal-cap {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: 1.1px;
  line-height: 1.5; color: #6d7365; margin: 11px 0 0;
}
.gal a {
  display: block; position: relative; overflow: hidden;
  background: #e2dfcf; border: 1px solid #ddd9c7; text-decoration: none;
}
.gal a img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .8s cubic-bezier(.19,.75,.22,1);
}
.gal a:hover img { transform: scale(1.04); }
.gal a::after {
  content: "⤢"; position: absolute; right: 9px; bottom: 8px;
  width: 27px; height: 27px; display: flex; align-items: center; justify-content: center;
  background: rgba(18,24,13,.78); color: #e7ebdc; font-size: 12px;
  opacity: 0; transition: opacity .3s ease;
}
.gal a:hover::after, .gal a:focus-visible::after { opacity: 1; }
.gal a:focus-visible { outline: 2px solid #61b83a; outline-offset: 2px; }

/* --- even grid --- */
.gal-grid { display: grid; gap: 10px; }
.gal-grid a { aspect-ratio: 1 / 1; }
.gal-2 { grid-template-columns: repeat(2, 1fr); }
.gal-3 { grid-template-columns: repeat(3, 1fr); }
.gal-4 { grid-template-columns: repeat(4, 1fr); }

/* --- mosaic: first image twice the size --- */
.gal-mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gal-mosaic a { aspect-ratio: 1 / 1; }
.gal-mosaic a:first-child { grid-column: span 2; grid-row: span 2; }

/* --- masonry: natural heights, staggered --- */
.gal-masonry { columns: 3; column-gap: 10px; }
.gal-masonry a { margin: 0 0 10px; break-inside: avoid; }
.gal-masonry a img { height: auto; }

/* --- side by side pair --- */
.gal-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gal-pair a { aspect-ratio: 4 / 5; }

/* --- slider: one at a time --- */
.gal-slider { position: relative; }
.gal-track {
  display: flex; gap: 0; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch;
}
.gal-track::-webkit-scrollbar { display: none; }
.gal-track a { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 16 / 10; border-left: 0; border-right: 0; }
.gal-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  background: rgba(241,238,227,.93); color: #171d12; border: 1px solid #12180d;
  font-size: 17px; cursor: pointer; z-index: 3; padding: 0;
}
.gal-nav:hover { background: #12180d; color: #f4f2e8; }
.gal-nav[disabled] { opacity: .3; cursor: default; }
.gal-prev { left: 12px; }
.gal-next { right: 12px; }
.gal-dots { display: flex; gap: 7px; justify-content: center; margin-top: 12px; }
.gal-dots button {
  width: 8px; height: 8px; padding: 0; border: 1px solid #6d7365;
  background: transparent; cursor: pointer; border-radius: 50%;
}
.gal-dots button[aria-current="true"] { background: #2f7d0e; border-color: #2f7d0e; }

@media (max-width: 860px) {
  .gal-3, .gal-4 { grid-template-columns: repeat(2, 1fr); }
  .gal-masonry { columns: 2; }
  .gal-mosaic { grid-template-columns: repeat(2, 1fr); }
  .gal-mosaic a:first-child { grid-column: span 2; grid-row: span 1; aspect-ratio: 16 / 10; }
  .gal-nav { width: 42px; height: 42px; }
}
@media (max-width: 520px) {
  .gal-2, .gal-3, .gal-4, .gal-pair, .gal-mosaic { grid-template-columns: 1fr; }
  .gal-masonry { columns: 1; }
  .gal-mosaic a:first-child { grid-column: span 1; }
  .gal a { aspect-ratio: 4 / 3; }
  .gal-pair a { aspect-ratio: 4 / 5; }
}

/* ---------------- lightbox ---------------- */
.lb {
  position: fixed; inset: 0; z-index: 1000; background: rgba(12,16,9,.94);
  display: flex; flex-direction: column; opacity: 0; transition: opacity .28s ease;
}
.lb.on { opacity: 1; }
.lb-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(14px, 3vw, 30px); color: #b9c3a8;
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; letter-spacing: 1.6px;
}
.lb-close {
  background: transparent; border: 1px solid #45503a; color: #dfe6d2;
  width: 44px; height: 44px; font-size: 17px; cursor: pointer;
}
.lb-close:hover { background: #1d2616; }
.lb-stage {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 0 clamp(14px, 8vw, 90px);
}
.lb-stage img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; display: block;
}
.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 54px; height: 54px; display: flex; align-items: center; justify-content: center;
  background: rgba(241,238,227,.1); border: 1px solid #45503a; color: #f4f2e8;
  font-size: 20px; cursor: pointer; padding: 0;
}
.lb-arrow:hover { background: #f4f2e8; color: #12180d; }
.lb-prev { left: clamp(8px, 2vw, 26px); }
.lb-next { right: clamp(8px, 2vw, 26px); }
.lb-foot {
  padding: 14px clamp(14px, 3vw, 30px) 24px; text-align: center;
  color: #8b9478; font-size: 14px; line-height: 1.55; min-height: 20px;
}
@media (max-width: 640px) {
  .lb-stage { padding: 0 8px; }
  .lb-arrow { width: 46px; height: 46px; top: auto; bottom: -64px; transform: none; }
  .lb-prev { left: 50%; margin-left: -54px; }
  .lb-next { right: 50%; margin-right: -54px; }
  .lb-foot { padding-bottom: 82px; }
}
@media (prefers-reduced-motion: reduce) {
  .lb, .gal a img { transition: none !important; }
}
