/*
 * app.css — styles for the interactive behaviours added by app.js
 * (lightbox overlay, mobile nav reveal, floating back-to-top). Layout and
 * typography come from main.css + theme.css; this only covers the JS-driven UI.
 */

/* main.css ships `.transition-enabled { opacity: 0 }` — the original Adobe JS
 * faded the page in on load. We don't do page transitions, so force the body
 * fully visible. (Defensive: keeps the site visible even if JS fails to run.) */
.transition-enabled { opacity: 1 !important; }

/* The masonry image grid (.grid--main) ships `visibility: hidden` and relied on
 * Adobe's "flexbox-sizer" JS to add `.grid--ready` once it measured the layout.
 * Each grid item already carries its width / flex-grow / aspect-ratio inline,
 * so the layout is correct without any JS — we just need to reveal it.
 * (Defensive: shows the grid even if JS never runs.) */
.grid--main { visibility: visible !important; }

/* Lazy images fade in once their real source loads. */
img.js-lazy { transition: opacity .35s ease; }
img.js-lazy:not(.is-loaded) { opacity: 0; }
img.js-lazy.is-loaded { opacity: 1; }

/* Single-image and "tree" collage modules ship each <img> with an inline
 * `height="0"; padding-bottom:<ratio>%; background:rgba(0,0,0,.03)` aspect-ratio
 * reservation. Adobe's JS painted the image into that padded box; without it the
 * content box is 0px tall, so only the grey placeholder background shows. Once the
 * real source is in, drop the padding/background and let the image size naturally.
 * Grid (`.grid__item-image`) and cover (`.cover__img`) thumbnails use absolute
 * positioning instead, so they're explicitly excluded. */
img.js-lazy.is-loaded:not(.grid__item-image):not(.cover__img) {
  height: auto !important;
  padding-bottom: 0 !important;
  background: transparent !important;
}

/* ---------- Lightbox ---------- */
.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .94); /* matches the original lightbox opacity/colour */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.lb-overlay.is-open { display: flex; }
.lb-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
  cursor: zoom-out;
}
.lb-overlay button {
  position: absolute;
  background: none;
  border: 0;
  color: #111;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  opacity: .55;
  transition: opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.lb-overlay button:hover { opacity: 1; }
.lb-close { top: 18px; right: 24px; font-size: 44px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 64px; padding: 0 18px; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
body.lb-locked { overflow: hidden; }

@media (max-width: 640px) {
  .lb-close { font-size: 36px; top: 10px; right: 14px; }
  .lb-prev, .lb-next { font-size: 44px; padding: 0 8px; }
}

/* ---------- Mobile responsive nav ---------- */
/* The slide-in panel is hidden until body.nav-open is set by the hamburger. */
.js-responsive-nav {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
body.nav-open .js-responsive-nav { opacity: 1; visibility: visible; }
.js-responsive-nav .responsive-nav { text-align: center; }
.js-responsive-nav .close-responsive-click-area {
  position: absolute;
  top: 22px;
  right: 26px;
  cursor: pointer;
}
.js-responsive-nav .close-responsive-button { position: relative; width: 28px; height: 28px; }
.js-responsive-nav .close-responsive-button::before,
.js-responsive-nav .close-responsive-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background: #111;
}
.js-responsive-nav .close-responsive-button::before { transform: rotate(45deg); }
.js-responsive-nav .close-responsive-button::after { transform: rotate(-45deg); }
.js-responsive-nav .pages a { display: block; padding: 14px 0; font-size: 24px; }

/* On wide screens the hamburger + slide-in nav stay hidden; the header nav shows.
   On narrow screens, hide the header's inline nav and reveal the hamburger.
   These breakpoints mirror the original theme (single-column under ~768px). */
.hamburger-click-area { display: none; }
@media (max-width: 768px) {
  .site-header nav { display: none; }
  .hamburger-click-area { display: block; cursor: pointer; }
}
@media (min-width: 769px) {
  .js-responsive-nav { display: none; }
}

/* ---------- Floating back-to-top ---------- */
.back-to-top-fixed {
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.back-to-top-fixed.is-visible { opacity: .8; visibility: visible; }
.back-to-top-fixed:hover { opacity: 1; }
