/* Basis: Items standardmäßig ausblenden, im expanded alle anzeigen */
[class*="fbg-limit-"] .filebird-gallery-item {
  display: none !important;
}

[class*="fbg-limit-"].is-expanded .filebird-gallery-item {
  display: block !important;
}

/* Button-Container: Button steht als direktes Geschwisterelement nach der Galerie */
[class*="fbg-limit-"] + .fbg-toggle-wrap {
  text-align: center;
}

/* Elementor-Button-Optik, aber halb so groß */
.fbg-toggle.elementor-button {
  line-height: 1;
  display: inline-block;
}

.fbg-toggle.elementor-button.fbg-size-50 {
  --fbg-scale: .5;
  font-size: calc(1em * var(--fbg-scale));
  padding: calc(.75em * var(--fbg-scale)) calc(1.5em * var(--fbg-scale));
  border-radius: calc(var(--e-button-border-radius, .5rem) * var(--fbg-scale));
}

.fbg-toggle.elementor-button:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ===== Sichtbare Items pro Limit + Auto-Hide Button (per :has) =====
   Wir zählen nur .filebird-gallery-item-DIVs via :nth-of-type,
   damit evtl. fremde <br>/<b>-Warnungen nicht mitgezählt werden. */

/* 1 */
.fbg-limit-1 .filebird-gallery-item:nth-of-type(-n+1) {
  display: block !important;
}
.fbg-limit-1:not(:has(.filebird-gallery-item:nth-of-type(2))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 2 */
.fbg-limit-2 .filebird-gallery-item:nth-of-type(-n+2) {
  display: block !important;
}
.fbg-limit-2:not(:has(.filebird-gallery-item:nth-of-type(3))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 3 */
.fbg-limit-3 .filebird-gallery-item:nth-of-type(-n+3) {
  display: block !important;
}
.fbg-limit-3:not(:has(.filebird-gallery-item:nth-of-type(4))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 4 */
.fbg-limit-4 .filebird-gallery-item:nth-of-type(-n+4) {
  display: block !important;
}
.fbg-limit-4:not(:has(.filebird-gallery-item:nth-of-type(5))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 5 */
.fbg-limit-5 .filebird-gallery-item:nth-of-type(-n+5) {
  display: block !important;
}
.fbg-limit-5:not(:has(.filebird-gallery-item:nth-of-type(6))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 6 */
.fbg-limit-6 .filebird-gallery-item:nth-of-type(-n+6) {
  display: block !important;
}
.fbg-limit-6:not(:has(.filebird-gallery-item:nth-of-type(7))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 7 */
.fbg-limit-7 .filebird-gallery-item:nth-of-type(-n+7) {
  display: block !important;
}
.fbg-limit-7:not(:has(.filebird-gallery-item:nth-of-type(8))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 8 */
.fbg-limit-8 .filebird-gallery-item:nth-of-type(-n+8) {
  display: block !important;
}
.fbg-limit-8:not(:has(.filebird-gallery-item:nth-of-type(9))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 9 */
.fbg-limit-9 .filebird-gallery-item:nth-of-type(-n+9) {
  display: block !important;
}
.fbg-limit-9:not(:has(.filebird-gallery-item:nth-of-type(10))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 10 */
.fbg-limit-10 .filebird-gallery-item:nth-of-type(-n+10) {
  display: block !important;
}
.fbg-limit-10:not(:has(.filebird-gallery-item:nth-of-type(11))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 11 */
.fbg-limit-11 .filebird-gallery-item:nth-of-type(-n+11) {
  display: block !important;
}
.fbg-limit-11:not(:has(.filebird-gallery-item:nth-of-type(12))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 12 */
.fbg-limit-12 .filebird-gallery-item:nth-of-type(-n+12) {
  display: block !important;
}
.fbg-limit-12:not(:has(.filebird-gallery-item:nth-of-type(13))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 13 */
.fbg-limit-13 .filebird-gallery-item:nth-of-type(-n+13) {
  display: block !important;
}
.fbg-limit-13:not(:has(.filebird-gallery-item:nth-of-type(14))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 14 */
.fbg-limit-14 .filebird-gallery-item:nth-of-type(-n+14) {
  display: block !important;
}
.fbg-limit-14:not(:has(.filebird-gallery-item:nth-of-type(15))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 15 */
.fbg-limit-15 .filebird-gallery-item:nth-of-type(-n+15) {
  display: block !important;
}
.fbg-limit-15:not(:has(.filebird-gallery-item:nth-of-type(16))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 16 */
.fbg-limit-16 .filebird-gallery-item:nth-of-type(-n+16) {
  display: block !important;
}
.fbg-limit-16:not(:has(.filebird-gallery-item:nth-of-type(17))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 17 */
.fbg-limit-17 .filebird-gallery-item:nth-of-type(-n+17) {
  display: block !important;
}
.fbg-limit-17:not(:has(.filebird-gallery-item:nth-of-type(18))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 18 */
.fbg-limit-18 .filebird-gallery-item:nth-of-type(-n+18) {
  display: block !important;
}
.fbg-limit-18:not(:has(.filebird-gallery-item:nth-of-type(19))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 19 */
.fbg-limit-19 .filebird-gallery-item:nth-of-type(-n+19) {
  display: block !important;
}
.fbg-limit-19:not(:has(.filebird-gallery-item:nth-of-type(20))) + .fbg-toggle-wrap {
  display: none !important;
}

/* 20 */
.fbg-limit-20 .filebird-gallery-item:nth-of-type(-n+20) {
  display: block !important;
}
.fbg-limit-20:not(:has(.filebird-gallery-item:nth-of-type(21))) + .fbg-toggle-wrap {
  display: none !important;
}

/* Basis: alle Bilder füllen ihre Kachel und werden sauber beschnitten */
.filebird-gallery .filebird-gallery-item {
  overflow: hidden;
}

.filebird-gallery .filebird-gallery-item a,
.filebird-gallery .filebird-gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
}

.filebird-gallery .filebird-gallery-item img {
  object-fit: cover;
}

/* Ratio-Profile – wähle eins pro Galerie über zusätzliche Klasse am Wrapper */
.fbg-aspect-1x1 .filebird-gallery-item {
  aspect-ratio: 1 / 1;
}

.fbg-aspect-4x3 .filebird-gallery-item {
  aspect-ratio: 4 / 3;
}

.fbg-aspect-3x2 .filebird-gallery-item {
  aspect-ratio: 3 / 2;
}

.fbg-aspect-16x9 .filebird-gallery-item {
  aspect-ratio: 16 / 9;
}
