@media (max-width: 800px) {
    .bilberry-hugo-theme .main article {
        margin: 5px;
        width: 100%;
        padding: 0.5em;
    }
    .bilberry-hugo-theme article .content {
        padding: 0.5em;
    }

    .swiper-slide figure {
        margin-inline-start: 5px;
        margin-inline-end: 5px;
    }
}

:root {
  --swiper-theme-color: #666666; /* Or whatever value you want */
  --swiper-navigation-color: #cecece;
  --dv-max-image-height: 500px;
}

/* Admonition styling */
div.content > blockquote.alert.alert-note {
  font-family: "Open Sans", sans-serif;
  font-size: 0.9em;
}
div.content > blockquote.alert.alert-note > p.alert-heading {
  margin-bottom: 1rem;
}
div.content > blockquote.alert.alert-note > p.alert-heading > span.alert-heading-text {
  font-style: italic;
}
/* END Admonition styling*/

.dv-image {
  position: relative;
  display: inline-block;
  overflow: hidden;
  max-width: 100%;
  text-align: center;
}

article > div.content > figure.dv-image {
  margin-bottom: 2.5rem;
}

article .content figure.dv-image {
  display: block;
  margin-left: auto;   /* center horizontally */
  margin-right: auto;  /* center horizontally */
  text-align: center;
  max-width: fit-content; 
}

.dv-image img {
  display: block;
  max-width: 100%;
  max-height: var(--dv-max-image-height);
}

.dv-image figcaption {
  position: absolute;
  inset: auto 0 0 0;        /* left:0; right:0; bottom:0 */
  width: 100%;
  padding: 0.5em;
  font-size: 0.9em;
  color: white;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
}


/* BEGIN Gallery styles */
/* ====== Gallery grid ====== */
ul.dv-gallery {
  --dv-gap: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--dv-gap);
  list-style: none;
  padding: 0;
  margin: 0;
  margin-bottom: 2.5rem;
}

/* ====== Items & figure ====== */
ul.dv-gallery > li {
  /* no flex here; let grid sizing/alignment do the work */
  margin-bottom: 0;
}

ul.dv-gallery > li .dv-image {
  position: relative;       /* for caption overlay */
  aspect-ratio: 1 / 1;      /* square */
  width: 100%;
  overflow: hidden;
}

ul.dv-gallery > li .dv-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;        /* crop to square */
}

/* ====== Caption overlay (desktop hover) ====== */
ul.dv-gallery > li .dv-image figcaption {
  position: absolute;
  inset: auto 0 0 0;        /* left:0; right:0; bottom:0 */
  padding: 0.5em;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: .9em;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
ul.dv-gallery > li .dv-image:hover figcaption {
  opacity: 1;
  pointer-events: auto;
}

/* Touch devices: show caption below image */
@media (hover: none) and (pointer: coarse) {
  ul.dv-gallery > li .dv-image figcaption {
    position: static;
    background: none;
    color: inherit;
    opacity: 1;
    pointer-events: auto;
    padding: .5em 0 0 0;
  }
}

/* ====== Center the last item if count is odd (2-col only) ======
   Use :last-of-type so scripts/comments don't break it.
   Span both columns, then make the grid item as wide as ONE column:
   width = (full width - gap) / 2, and center it. */
ul.dv-gallery > li:last-of-type:nth-of-type(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc((100% - var(--dv-gap)) / 2);
}

/* ====== Portrait + narrow: switch to 1 column ====== */
@media (max-width: 600px) and (orientation: portrait) {
  ul.dv-gallery {
    grid-template-columns: 1fr;
  }
  /* In 1-col mode, the “odd last” hack isn’t needed */
  ul.dv-gallery > li:last-of-type:nth-of-type(odd) {
    grid-column: auto;
    justify-self: stretch;
    width: auto;
  }
}

/* END Gallery styles*/

/* BEGIN Slider styles */
ul.dv-slider li {
    list-style: none;
    padding-left: 0; /* optional: remove default indent */
    margin-left: 0;  /* optional: remove default spacing */
}

article.gallery .dv-slider-gallery {
    margin-top: 25px;
}

.swiper-wrapper {
    align-items: center;
    margin-top: 5px;
}

.swiper-slide {
    text-align: center;
    font-size: 18px;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: var(--dv-max-image-height);
  }

.swiper-slide figure {
    align-items: center;
    margin-inline-start: 32px;
    margin-inline-end: 32px;
}

.swiper-slide img {
    display: block;
    height: auto;
    width: auto;
    max-width: 100%;
    max-height: var(--dv-max-image-height);
    object-fit: contain;
  }
  
.swiper-button-prev,
.swiper-button-next {
  background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent dark grey */
  width: 50px;
  height: 50px;
  border-radius: 50%; /* Makes them circular */
  /* Invisible when not hovering over Swiper */
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; /* prevents clicking when hidden */
}

.swiper:hover .swiper-button-prev,
.swiper:hover .swiper-button-next {
  opacity: 1;
  pointer-events: auto;
}


.swiper-button-next:after, .swiper-button-prev:after {
    font-size: calc(var(--swiper-navigation-size)*0.7);
}

.swiper-button-prev::after {
  padding-right: 3px; /* Shift right */
}

.swiper-button-next::after {
  padding-left: 3px; /* Shift left */
}

/* END Slider Styles */