/* M3 Design — Galería Isotope (isogallery): what every layout shares.
   The layouts live in layouts/<name>/option.css; this file is the frame they
   work in: the measures per device, the filters, the pictures, the lightbox.
   Nothing here depends on the script: the canvas of the builder runs none, and
   a page whose script never arrives still shows every picture. */

.bsl-iso {
  --bsl-iso-cols: var(--bsl-iso-cols-xs, 2);
  --bsl-iso-row-eff: calc(var(--bsl-iso-row, 320px) * .66);
  position: relative;
}

@media (min-width: 768px) {
  .bsl-iso {
    --bsl-iso-cols: var(--bsl-iso-cols-md, 3);
    --bsl-iso-row-eff: var(--bsl-iso-row, 320px);
  }
}

@media (min-width: 992px) {
  .bsl-iso {
    --bsl-iso-cols: var(--bsl-iso-cols-lg, 4);
  }
}

/* A layout that changes with the screen waits for the script to choose — and
   shows anyway after a moment if the script never comes */
.bsl-iso.is-pending .bsl-iso-stage {
  opacity: 0;
  animation: bsl-iso-reveal 0s 1.2s forwards;
}

@keyframes bsl-iso-reveal {
  to { opacity: 1; }
}

/* The stage, before any layout says otherwise: a plain grid */
.bsl-iso-stage {
  display: grid;
  grid-template-columns: repeat(var(--bsl-iso-cols), minmax(0, 1fr));
  gap: var(--bsl-iso-gap, 10px);
  align-items: start;
}

.bsl-iso-item {
  position: relative;
  margin: 0;
  min-width: 0;
}

.bsl-iso-item.is-hidden {
  display: none !important;
}

.bsl-iso-link {
  display: block;
  position: relative;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}

.bsl-iso-item img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
}

.bsl-iso[data-rounded="1"] .bsl-iso-link {
  border-radius: .5rem;
}

/* Crop: the picture fills a box of that shape */
.bsl-iso[data-crop="1x1"] .bsl-iso-item img { aspect-ratio: 1 / 1; object-fit: cover; }
.bsl-iso[data-crop="4x5"] .bsl-iso-item img { aspect-ratio: 4 / 5; object-fit: cover; }
.bsl-iso[data-crop="3x2"] .bsl-iso-item img { aspect-ratio: 3 / 2; object-fit: cover; }
.bsl-iso[data-crop="16x9"] .bsl-iso-item img { aspect-ratio: 16 / 9; object-fit: cover; }

/* Hover */
.bsl-iso[data-hover="zoom"] .bsl-iso-link img {
  transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}

.bsl-iso[data-hover="zoom"] .bsl-iso-link:hover img {
  transform: scale(1.04);
}

.bsl-iso[data-hover="fade"] .bsl-iso-link img {
  transition: opacity .3s ease;
}

.bsl-iso[data-hover="fade"] .bsl-iso-link:hover img {
  opacity: .8;
}

/* Captions */
.bsl-iso-caption {
  padding-top: .35rem;
  font-size: .8125rem;
  line-height: 1.35;
  color: var(--bs-secondary-color, #6c757d);
}

.bsl-iso[data-captions="overlay"] .bsl-iso-caption,
.bsl-iso.is-fixed .bsl-iso-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.5rem .75rem .6rem;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.bsl-iso[data-captions="overlay"] .bsl-iso-item:hover .bsl-iso-caption,
.bsl-iso.is-fixed .bsl-iso-item:hover .bsl-iso-caption {
  opacity: 1;
}

/* A layout that places every picture itself (masonry, justified, spread):
   the stage is the box and the pictures sit where the script says */
.bsl-iso.is-absolute.is-arranged .bsl-iso-stage {
  display: block;
  position: relative;
}

.bsl-iso.is-absolute.is-arranged .bsl-iso-item {
  position: absolute;
}

/* …and when it also sets the height, the picture fills it */
.bsl-iso.is-fixed.is-arranged .bsl-iso-link,
.bsl-iso.is-fixed.is-arranged .bsl-iso-item img {
  width: 100%;
  height: 100%;
}

.bsl-iso.is-fixed.is-arranged .bsl-iso-item img {
  aspect-ratio: auto;
  object-fit: cover;
}

/* What leaves when a filter changes: a copy that fades where it was */
.bsl-iso-ghost {
  position: absolute !important;
  margin: 0;
  z-index: 1;
  pointer-events: none;
}

.bsl-iso-ghost .bsl-iso-link,
.bsl-iso-ghost img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Filters */
.bsl-iso-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  margin-bottom: 1rem;
}

.bsl-iso-filters[data-align="center"] { justify-content: center; }
.bsl-iso-filters[data-align="end"] { justify-content: flex-end; }

button.bsl-iso-filter {
  appearance: none;
  padding: .25rem 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--bs-secondary-color, #6c757d);
  font: inherit;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}

button.bsl-iso-filter:hover {
  color: var(--bs-body-color, #212529);
}

button.bsl-iso-filter.is-active {
  color: var(--bs-body-color, #212529);
  border-bottom-color: currentColor;
}

/* Builder only: a gallery with nothing to show yet */
.bsl-iso-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: .875rem;
  color: #6c757d;
  border: 1px dashed #c8c8c8;
}

/* ------------------------------------------------------------------ */
/* Lightbox (one for the page, appended to the body)                   */
/* ------------------------------------------------------------------ */

html.bsl-iso-lb-open {
  overflow: hidden;
}

.bsl-iso-lb {
  --bsl-lb-bg: rgba(255, 255, 255, .98);
  --bsl-lb-ink: #111;
  --bsl-lb-soft: #6c757d;
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) 4rem;
  grid-template-rows: 3rem minmax(0, 1fr) auto;
  background: var(--bsl-lb-bg);
  color: var(--bsl-lb-ink);
  opacity: 0;
  transition: opacity .2s ease;
}

.bsl-iso-lb[data-theme="dark"] {
  --bsl-lb-bg: rgba(10, 10, 10, .96);
  --bsl-lb-ink: #f2f2f2;
  --bsl-lb-soft: #a0a0a0;
}

.bsl-iso-lb.is-open {
  opacity: 1;
}

.bsl-iso-lb[hidden] {
  display: none;
}

.bsl-iso-lb-count {
  grid-column: 1 / 3;
  grid-row: 1;
  align-self: center;
  padding-left: 1.25rem;
  font-size: .75rem;
  letter-spacing: .08em;
  color: var(--bsl-lb-soft);
}

.bsl-iso-lb-figure {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  margin: 0;
}

.bsl-iso-lb-figure img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
}

.bsl-iso-lb-caption {
  grid-column: 2;
  grid-row: 3;
  min-height: 2.5rem;
  padding: .5rem 0 1rem;
  text-align: center;
  font-size: .8125rem;
  color: var(--bsl-lb-soft);
}

.bsl-iso-lb button {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--bsl-lb-ink);
  cursor: pointer;
  opacity: .6;
  transition: opacity .2s ease;
}

.bsl-iso-lb button:hover,
.bsl-iso-lb button:focus-visible {
  opacity: 1;
}

.bsl-iso-lb button:focus {
  outline: none;
}

/* `display: flex` above would otherwise win over the attribute */
.bsl-iso-lb button[hidden] {
  display: none;
}

.bsl-iso-lb button:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: -.5rem;
}

.bsl-iso-lb svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
  stroke-width: 1.25;
  fill: none;
}

.bsl-iso-lb-close {
  grid-column: 3;
  grid-row: 1;
}

.bsl-iso-lb-prev,
.bsl-iso-lb-next {
  grid-row: 2;
}

.bsl-iso-lb-prev { grid-column: 1; }
.bsl-iso-lb-next { grid-column: 3; }

@media (max-width: 767.98px) {
  .bsl-iso-lb {
    grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bsl-iso *,
  .bsl-iso-lb {
    transition: none !important;
  }
}
