/* GRAINBUD: progressive page transitions and photo presentation. */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: 240ms; }
::view-transition-old(root) { animation: gb-page-out 240ms ease both; }
::view-transition-new(root) { animation: gb-page-in 240ms ease both; }
@keyframes gb-page-out { to { opacity: 0; } }
@keyframes gb-page-in { from { opacity: 0; } }
@keyframes gb-page-enter { from { opacity: .72; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  html.gb-nav-entry body { animation: gb-page-enter 220ms ease-out both; }
}

/* Explicit photo classes/paths only: logos, crests and reference scans retain their appearance. */
:is(img.gb-photo, img[data-gb-photo], img[data-gx-social-image], .gh-social-media img, .gh-hero-poster, .gh-article-photo,
    .gh-transport-image, .gh-service-card > img, .gh-office-visual > img,
    .hd-gallery img, .hd-hero-picture img, .gb-hero16-picture img,
    .gb-rental-card-image img,
    img[src*="/media/grainbud-refresh-20261003/photos/"],
    img[src*="/media/grainbud-domy-20261003/"],
    img[src*="/storage/equipment/"], img[src*="/storage/aktualnosci/"]) {
  filter: brightness(var(--gb-photo-brightness, .84));
  transition: filter 280ms ease, opacity 200ms ease;
}
@media (hover: hover) {
  :is(img:hover, a:hover, figure:hover, .gh-hero:hover, .hd-hero:hover,
      .gb-rental-hero:hover, section[class*="hero"]:hover,
      header[class*="hero"]:hover, [data-gb-hero16]:hover) { --gb-photo-brightness: 1; }
  :is(img.gb-photo:hover, img[data-gb-photo]:hover,
      a:hover > img.gb-photo, a:hover picture img.gb-photo,
      figure:hover img.gb-photo, .gb-photo-hero:hover img.gb-photo) {
    filter: brightness(1);
  }
}
:is(img.gb-photo:focus-visible, a:focus-visible img.gb-photo,
    button:focus-visible img.gb-photo, .gb-photo-hero:focus-within img.gb-photo,
    img.gb-photo[data-gb-photo-revealed],
    dialog[open] img.gb-photo, [role="dialog"] img.gb-photo,
    .fancybox__image, .fancybox-image, .lg-object, .glightbox-container img,
    #lightbox img, .gb-photo-viewer img) {
  filter: brightness(1) !important;
}
img[data-gb-photo-open] { cursor: zoom-in; }
img[data-gb-photo-open]:focus-visible { outline: 3px solid #f2bf36; outline-offset: 4px; }
.gb-photo-viewer {
  box-sizing: border-box; width: min(1440px, 96vw); max-width: 96vw;
  max-height: 94vh; max-height: 94dvh; margin: auto; padding: 48px 12px 14px;
  border: 0; border-radius: 10px; color: #fff; background: #17201c;
  overflow: auto; box-shadow: 0 16px 80px #0008;
}
.gb-photo-viewer::backdrop { background: rgba(4, 10, 7, .88); }
.gb-photo-viewer img {
  display: block; width: auto; max-width: 100%; height: auto;
  max-height: calc(88vh - 120px); max-height: calc(88dvh - 120px);
  margin: auto; object-fit: contain; filter: none !important;
}
.gb-photo-viewer__caption {
  margin: 13px auto 0; max-width: 1000px; font: 400 14px/1.5 Arial, sans-serif;
  color: #fff; text-align: center;
}
.gb-photo-viewer__close {
  position: absolute; top: 4px; right: 8px; min-height: 40px; padding: 6px 14px;
  border: 1px solid #ffffff70; border-radius: 5px; background: #17201c;
  color: #fff; font: 600 14px/1.4 Arial, sans-serif; cursor: pointer;
}
.gb-photo-viewer__close:hover { background: #344237; }
.gb-photo-viewer__close:focus-visible { outline: 3px solid #f2bf36; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation: none !important;
  }
  html.gb-nav-entry body { animation: none !important; }
  img { transition: none !important; }
}
