/* ---- OGS Gallery Block — frontend styles ---- */

.ogs-gl {
  background: #1a1a1a;
  user-select: none;
  -webkit-user-select: none;
}

/* Main viewer */
.ogs-gl-main {
  position: relative;
  width: 100%;
  height: 75vh;
  overflow: hidden;
  cursor: zoom-in;
  background: #111;
}
.ogs-gl-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}
.ogs-gl-main-img.ogs-fading { opacity: 0; }

/* Hero title overlay */
.ogs-gl-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 42%;
  background: linear-gradient(to top,
    rgba(26, 26, 26, 0.82) 0%,
    rgba(26, 26, 26, 0.38) 45%,
    rgba(26, 26, 26, 0)    100%
  );
  display: flex;
  align-items: flex-end;
  padding: 0 2.25rem 1.75rem;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.ogs-gl-main:hover .ogs-gl-overlay { opacity: 0.12; }

/* Hero counter */
.ogs-gl-counter {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: rgba(244, 241, 236, 0.5);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  font-family: 'DM Sans', sans-serif;
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Hero keyboard focus */
.ogs-gl-main:focus { outline: none; }
.ogs-gl-main:focus-visible {
  outline: 1px solid rgba(140, 74, 47, 0.6);
  outline-offset: -1px;
}

.ogs-gl-title {
  color: #f4f1ec;
  font-family: 'DM Sans', sans-serif;
  font-size: 3rem;
  font-weight: 300;
  font-style: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(26, 26, 26, 0.5);
}

/* Filmstrip */
.ogs-gl-strip {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  gap: 2px;
  padding-top: 8px;
  background: #1a1a1a;
}
.ogs-gl-strip::-webkit-scrollbar { display: none; }

.ogs-gl-thumb {
  flex: 0 0 auto;
  height: 150px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: none;
  padding: 0;
  background: none;
  display: block;
}
.ogs-gl-thumb img {
  height: 150px;
  width: auto;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

/* Dim inactive thumbnails */
.ogs-gl-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.5);
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.ogs-gl-thumb.ogs-active::after              { opacity: 0; }
.ogs-gl-thumb:not(.ogs-active):hover::after  { opacity: 0.2; }

/* Cedar accent bar on active thumbnail */
.ogs-gl-thumb.ogs-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #8c4a2f;
  z-index: 2;
}

/* Lightbox */
.ogs-lb {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.97);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.ogs-lb.ogs-lb-open { display: flex; }

.ogs-lb-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 4.5rem 5.5rem;
  box-sizing: border-box;
}
.ogs-lb-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  will-change: transform;
  touch-action: none;
  cursor: zoom-in;
}

/* Cursor states driven by JS classes on .ogs-lb */
.ogs-lb.ogs-zoomed   .ogs-lb-img { cursor: grab; }
.ogs-lb.ogs-grabbing .ogs-lb-img { cursor: grabbing; }

/* Ghost-white buttons — hard edge per brand spec */
.ogs-lb-btn {
  position: fixed;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  line-height: 1;
  padding: 0;
  touch-action: manipulation; /* prevents double-tap page zoom on rapid taps */
  z-index: 2; /* always above the lightbox image, which creates its own stacking context via will-change */
}
.ogs-lb-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.9);
}

.ogs-lb-close { top: 1.25rem; right: 1.25rem; width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }
.ogs-lb-prev  { left: 1.25rem; top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; font-size: 1.6rem; }
.ogs-lb-next  { right: 1.25rem; top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; font-size: 1.6rem; }

/* Image counter */
.ogs-lb-count {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(244, 241, 236, 0.4);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  z-index: 2;
}

/* "Scroll to zoom" hint — desktop only, injected by JS */
.ogs-lb-hint {
  position: fixed;
  bottom: 3.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(244, 241, 236, 0.45);
  font-size: 0.62rem;
  letter-spacing: 0.13em;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 3;
}
.ogs-lb-hint.ogs-lb-hint-visible { opacity: 1; }

/* Zoom level badge — injected by JS, fades out 1.5s after last zoom */
.ogs-lb-zoom-badge {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(244, 241, 236, 0.6);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 3;
}
.ogs-lb-zoom-badge.ogs-lb-zoom-badge-visible { opacity: 1; }

@media (max-width: 768px) {
  .ogs-gl-main          { height: 56vw; min-height: 220px; }
  .ogs-gl-counter       { font-size: 0.6rem; }
  .ogs-gl-thumb         { height: 110px; }
  .ogs-gl-thumb img     { height: 110px; }
  .ogs-lb-frame         { padding: 3.5rem 1rem 3rem; }
  .ogs-lb-prev          { left: 0.5rem; }
  .ogs-lb-next          { right: 0.5rem; }
  /* Dark pill ensures arrows are readable over any photo on narrow screens */
  .ogs-lb-prev,
  .ogs-lb-next          { background: rgba(26, 26, 26, 0.55); border-color: rgba(255, 255, 255, 0.25); }
  .wp-block-offgrid-gallery.alignfull .ogs-gl,
  .wp-block-offgrid-gallery.alignwide .ogs-gl { padding: 0 12px 0; }
  .ogs-gl-overlay       { padding: 0 1.5rem 1.25rem; height: 45%; }
  .ogs-gl-title         { font-size: 2.2rem; }
}

@media (max-width: 480px) {
  .ogs-gl-overlay       { justify-content: center; padding: 0 1rem 1rem; }
  .ogs-gl-title         { font-size: 1.6rem; text-align: center; }
}

/* Full-width alignment — break out of Astra's content container */
.wp-block-offgrid-gallery.alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: 0;
  padding-right: 0;
}

/* Inner padding — dark background bleeds to viewport, photos inset slightly */
.wp-block-offgrid-gallery.alignfull .ogs-gl,
.wp-block-offgrid-gallery.alignwide .ogs-gl {
  padding: 0 20px 0;
  box-sizing: border-box;
}

/* Wide alignment — same breakout approach, narrower inset */
.wp-block-offgrid-gallery.alignwide {
  padding-left: 0;
  padding-right: 0;
}

/* Section filter bar */
.ogs-gl .ogs-filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 0 2px;
  background: #1a1a1a;
  overflow-x: auto;
  scrollbar-width: none;
}
.ogs-gl .ogs-filter-bar::-webkit-scrollbar { display: none; }

.ogs-filter-btn {
  flex: 0 0 auto;
  background: none;
  border: 1px solid rgba(212, 201, 188, 0.18);
  color: rgba(212, 201, 188, 0.4);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.28rem 0.85rem;
  cursor: pointer;
  border-radius: 0;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ogs-filter-btn:hover {
  color: #d4c9bc;
  border-color: rgba(212, 201, 188, 0.5);
}
.ogs-filter-btn.ogs-filter-active {
  color: #f4f1ec;
  border-color: #8c4a2f;
}

@media (max-width: 768px) {
  .ogs-gl .ogs-filter-bar { gap: 4px; padding: 8px 0 2px; }
  .ogs-filter-btn { font-size: 0.58rem; padding: 0.25rem 0.65rem; }
}
