/* ==========================================================================
   NavigatieInbouwen.nl - galerij op de voorkant ([ni_galerij])
   Minimalistisch: donkere tegels, filter op merk + model + bouwjaar,
   subtiel label. Tokens komen uit het thema, met fallback zodat de plugin
   los ook werkt.
   ========================================================================== */

.ni-gal {
  padding: clamp(48px, 7vw, 96px) 0;
  background: var(--black, #000);
  color: var(--white, #fff);
}

.ni-gal__head { margin-bottom: 26px; }
.ni-gal__head .section-sub { margin-top: 10px; }

/* ---------- Filterbalk ---------- */

.ni-gal__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-dark, #242424);
  border-radius: var(--radius, 14px);
  background: var(--dark-2, #121212);
  margin-bottom: 22px;
}

.ni-gal__select {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 1 220px;
  min-width: 180px;
  padding: 12px 40px 12px 16px;
  border: 1px solid var(--line-dark, #242424);
  border-radius: var(--radius-pill, 999px);
  background-color: var(--dark-3, #1a1a1a);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  color: var(--white, #fff);
  font-size: 15px;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.ni-gal__select:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.28); }
.ni-gal__select:disabled { opacity: 0.45; cursor: not-allowed; }
.ni-gal__select option { background: #1a1a1a; color: #fff; }

.ni-gal__count {
  margin-left: auto;
  font-size: 13.5px;
  color: var(--grey, #9a9a96);
  white-space: nowrap;
  padding: 0 4px;
}

.ni-gal__reset {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--grey, #9a9a96);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 8px;
  transition: color 0.2s ease;
}

.ni-gal__reset:hover { color: var(--yellow, #febe14); }
.ni-gal__reset[hidden] { display: none; }

/* ---------- Bouwjaar (dubbele schuifregelaar) ---------- */

.ni-gal__years {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 300px;
  min-width: 250px;
  padding: 0 16px 0 18px;
  height: 46px;
  border: 1px solid var(--line-dark, #242424);
  border-radius: var(--radius-pill, 999px);
  background: var(--dark-3, #1a1a1a);
}

.ni-gal__years-label {
  font-size: 13.5px;
  color: var(--grey, #9a9a96);
  white-space: nowrap;
}

.ni-gal__years-out {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  color: var(--white, #fff);
  white-space: nowrap;
  min-width: 92px;
  text-align: right;
}

.ni-gal__years.is-active .ni-gal__years-out { color: var(--yellow, #febe14); }

.ni-gal__range {
  position: relative;
  flex: 1 1 auto;
  min-width: 70px;
  height: 20px;
  display: flex;
  align-items: center;
}

.ni-gal__range-track,
.ni-gal__range-fill {
  position: absolute;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 3px;
  pointer-events: none;
}

.ni-gal__range-track {
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.14);
}

.ni-gal__range-fill {
  left: 0;
  width: 100%;
  background: var(--yellow, #febe14);
}

.ni-gal__range input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 20px;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}

.ni-gal__range input[type="range"]:focus { outline: none; }

.ni-gal__range input[type="range"]::-webkit-slider-runnable-track {
  height: 20px;
  background: none;
  border: 0;
}

.ni-gal__range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 0;
  background: var(--white, #fff);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  cursor: grab;
  transition: transform 0.15s ease, background 0.15s ease;
}

.ni-gal__range input[type="range"]::-webkit-slider-thumb:hover { background: var(--yellow, #febe14); }
.ni-gal__range input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.ni-gal__range input[type="range"]:focus-visible::-webkit-slider-thumb { background: var(--yellow, #febe14); }

.ni-gal__range input[type="range"]::-moz-range-track {
  height: 20px;
  background: none;
  border: 0;
}

.ni-gal__range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 0;
  background: var(--white, #fff);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  cursor: grab;
  transition: transform 0.15s ease, background 0.15s ease;
}

.ni-gal__range input[type="range"]::-moz-range-thumb:hover { background: var(--yellow, #febe14); }
.ni-gal__range input[type="range"]:focus-visible::-moz-range-thumb { background: var(--yellow, #febe14); }

@media (max-width: 900px) {
  .ni-gal__years { flex: 1 1 100%; }
}

@media (max-width: 560px) {
  .ni-gal__select { flex: 1 1 100%; min-width: 0; }
  .ni-gal__years { min-width: 0; padding: 0 14px; gap: 10px; }
  .ni-gal__years-label { display: none; }
  .ni-gal__count { margin-left: 0; }
}

/* ---------- Raster ---------- */

.ni-gal__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 900px) {
  .ni-gal__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}

@media (max-width: 560px) {
  .ni-gal__grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

.ni-gal__item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius, 14px);
  border: 1px solid var(--line-dark, #242424);
  background: var(--dark-2, #121212);
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.ni-gal__item[hidden] { display: none; }
.ni-gal__item:hover { border-color: rgba(254, 190, 20, 0.55); transform: translateY(-2px); }

.ni-gal__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease, cubic-bezier(.22,.61,.36,1));
}

.ni-gal__item:hover img { transform: scale(1.04); }

.ni-gal__label {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 7px;
  padding: 34px 16px 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.86) 12%, rgba(0, 0, 0, 0));
  text-align: left;
  pointer-events: none;
}

.ni-gal__brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--white, #fff);
}

.ni-gal__model {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.72);
}

.ni-gal__year {
  font-size: 12.5px;
  color: var(--grey, #9a9a96);
}

/* ---------- Meer laden / leeg ---------- */

.ni-gal__foot {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.ni-gal__more[hidden] { display: none; }

.ni-gal__empty {
  padding: 48px 0;
  text-align: center;
  color: var(--grey, #9a9a96);
}

.ni-gal__empty[hidden] { display: none; }

/* ---------- Lightbox ---------- */

.ni-gal__lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 4vw, 48px);
  background: rgba(0, 0, 0, 0.94);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ni-gal__lb[hidden] { display: none; }
.ni-gal__lb.is-open { opacity: 1; }

.ni-gal__lb-fig {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.ni-gal__lb-fig img {
  max-width: min(1100px, 100%);
  max-height: calc(100vh - 160px);
  width: auto;
  border-radius: var(--radius, 14px);
  object-fit: contain;
}

.ni-gal__lb-cap {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  max-width: 60ch;
}

.ni-gal__lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.ni-gal__lb-btn:hover { background: var(--yellow, #febe14); color: #000; }
.ni-gal__lb-prev { left: clamp(8px, 2vw, 28px); }
.ni-gal__lb-next { right: clamp(8px, 2vw, 28px); }

.ni-gal__lb-close {
  position: absolute;
  top: clamp(10px, 2vw, 24px);
  right: clamp(10px, 2vw, 24px);
  transform: none;
}

@media (max-width: 560px) {
  .ni-gal__lb-btn { width: 40px; height: 40px; }
  .ni-gal__lb-fig img { max-height: calc(100vh - 180px); }
}
