/* ══════════════════════════════════════════════════════════════
   iamnordic galleri
   1. Larger tiles: justified rows, every photo in its own shape
   2. The viewer: the photo lifts out of the grid and fills the screen
   Loaded after the theme's style.css and built on its markup:
   .masonry > .mi[data-src] > .mi-photo
══════════════════════════════════════════════════════════════ */

/* ── 1. Gallery ──────────────────────────────────────────────── */
.cat-section .masonry { --ig-gap:6px; }

/* Before the script has run (or without it): three large tiles per row */
.cat-section .masonry,
.cat-section .masonry.cols5,
.cat-section .masonry.cols4 { grid-template-columns:repeat(3,1fr); gap:var(--ig-gap); }
.cat-section .masonry .mi,
.cat-section .masonry.cols5 .mi,
.cat-section .masonry.cols4 .mi { height:auto; aspect-ratio:3 / 2; }

@media (max-width:900px) {
  .cat-section .masonry,
  .cat-section .masonry.cols5,
  .cat-section .masonry.cols4 { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:600px) {
  .cat-section .masonry { --ig-gap:4px; }
}

/* Justified rows — widths and shapes are set per tile by galleri.js */
.cat-section .masonry.ig-j { display:flex; flex-wrap:wrap; align-items:flex-start; gap:var(--ig-gap); }
.cat-section .masonry.ig-j .mi { min-width:0; height:auto; }

/* Sharper version of a tile, faded in over the small one once it has loaded */
.mi-photo::after {
  content:''; position:absolute; inset:0;
  background-image:var(--ig-hi,none); background-size:cover; background-position:center;
  opacity:0; transition:opacity .5s ease;
}
.mi-photo.ig-hi-on::after { opacity:1; }

.mi:focus-visible { outline:2px solid var(--orange,#f06820); outline-offset:-2px; }
/* The tile whose photo is flying to or from the viewer */
.mi.ig-lifted { visibility:hidden; }

/* ── 2. Viewer ───────────────────────────────────────────────── */
.igv {
  position:fixed; inset:0; z-index:9000; overflow:hidden;
  color:rgba(235,228,210,.94);
  font-family:'Barlow Condensed','Helvetica Neue',Arial,sans-serif;
  -webkit-tap-highlight-color:transparent;
  overscroll-behavior:contain;
}
.igv[hidden] { display:none; }
.igv-bg { position:absolute; inset:0; background:#050704; opacity:0; transition:opacity .38s ease; }
.igv-topo {
  position:absolute; inset:0; pointer-events:none;
  background-size:38vw auto; background-repeat:repeat;
  filter:invert(1) brightness(6) grayscale(1);
  opacity:0; transition:opacity .6s ease;
}
.igv.igv-on .igv-bg   { opacity:1; }
.igv.igv-on .igv-topo { opacity:.04; }

.igv-stage {
  position:absolute; inset:0;
  touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;
}
.igv-track,.igv-slide { position:absolute; inset:0; will-change:transform; }
.igv-pic { position:absolute; transform-origin:50% 50%; will-change:transform; }
.igv-pic img {
  position:absolute; inset:0; width:100%; height:100%; display:block;
  pointer-events:none; user-select:none; -webkit-user-select:none; -webkit-user-drag:none;
}
.igv-pic .igv-hi { opacity:0; transition:opacity .4s ease; }
.igv-pic .igv-hi.on { opacity:1; }

/* Controls: one pill at the thumb */
.igv-bar {
  position:absolute; left:50%; z-index:4;
  bottom:max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  transform:translateX(-50%);
  display:flex; align-items:center; gap:2px; padding:5px;
  border-radius:999px;
  background:rgba(14,17,10,.66);
  -webkit-backdrop-filter:blur(14px) saturate(1.2); backdrop-filter:blur(14px) saturate(1.2);
  border:1px solid rgba(190,210,135,.16);
  box-shadow:0 8px 30px rgba(0,0,0,.35);
  opacity:0; transition:opacity .3s ease, transform .3s ease;
}
.igv.igv-on .igv-bar { opacity:1; }
.igv.igv-idle .igv-bar,
.igv.igv-ui-off .igv-bar,
.igv.igv-drag .igv-bar { opacity:0; pointer-events:none; transform:translateX(-50%) translateY(8px); }

.igv-btn {
  width:46px; height:46px; padding:0; border:0; border-radius:50%;
  background:transparent; color:inherit;
  display:grid; place-items:center;
  cursor:pointer; transition:background .2s ease, color .2s ease;
}
.igv-btn:hover,.igv-btn:focus-visible { background:var(--orange,#f06820); color:#fff; outline:none; }
.igv svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }

.igv-info { min-width:104px; padding:0 8px; text-align:center; line-height:1.2; }
.igv-count { display:block; font-size:17px; font-weight:500; letter-spacing:2px; font-variant-numeric:tabular-nums; }
.igv-cat   { display:block; font-size:13px; font-weight:500; letter-spacing:3px; text-transform:uppercase; color:rgba(185,208,132,.8); }
.igv-cat:empty { display:none; }
.igv-sep { width:1px; height:24px; margin:0 4px; background:rgba(235,228,210,.18); }

/* Side zones: click the edge of the screen to step, mouse only */
.igv-edge {
  position:absolute; top:0; bottom:0; z-index:3;
  width:14vw; min-width:84px; padding:0 24px; border:0;
  background:transparent; color:inherit;
  display:none; align-items:center;
  opacity:0; transition:opacity .3s ease;
  cursor:pointer;
}
.igv-edge-prev { left:0;  justify-content:flex-start; }
.igv-edge-next { right:0; justify-content:flex-end; }
.igv-edge svg { width:34px; height:34px; stroke-width:1.2; filter:drop-shadow(0 1px 6px rgba(0,0,0,.7)); transition:transform .25s ease; }
@media (hover:hover) and (pointer:fine) {
  .igv-edge { display:flex; }
}
.igv.igv-on .igv-edge { opacity:.6; }
.igv.igv-on .igv-edge:hover,
.igv.igv-on .igv-edge:focus-visible { opacity:1; outline:none; }
.igv-edge-prev:hover svg { transform:translateX(-4px); }
.igv-edge-next:hover svg { transform:translateX(4px); }
.igv.igv-idle .igv-edge { opacity:0; }
.igv.igv-zoomed .igv-edge,
.igv.igv-single .igv-edge,
.igv.igv-single .igv-prev,
.igv.igv-single .igv-next { display:none; }

/* Nothing of the page on top of the photo: the theme's scroll-progress line steps aside */
.ig-viewing .progress-bar { opacity:0; }

/* The theme draws its own cursor dot on desktop; keep it the only cursor */
.igv.igv-tc, .igv.igv-tc * { cursor:none; }

@media (max-width:600px) {
  .igv-btn { width:44px; height:44px; }
  .igv-info { min-width:92px; }
}
@media (prefers-reduced-motion:reduce) {
  .igv-bg,.igv-topo,.igv-bar,.igv-edge,.igv-pic .igv-hi,.mi-photo::after { transition-duration:.01s; }
}
