/** 
 * Theme for novaGallery - https://novagallery.org
 * Theme: "novaGallery"
 * Author: novafacile OÜ
 * License: AGPL-3.0 
 **/
:root {
  --bg-color: #333333;
  --text-color: #eeeeee;
  --link-color: #eeeeee;
  --link-color-hover: #eeeeee;
  --link-color-muted: rgba(222, 226, 230, 0.75);
  --link-color-muted-hover: rgba(222, 226, 230, 0.75);
  --lightbox-bg: #333333;
  --lightbox-color: #eeeeee;
}


body {
  background-color: var(--bg-color);
  padding: 0;
  margin: 0;
  color: var(--text-color);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 0.3rem;
}

a, a:visited {
  color: var(--link-color);
  text-decoration: none;
}

a:hover, a:active {
  color: var(--link-color-hover);
}

.text-muted a, .text-muted a:visited {
  color: var(--link-color-muted);
  text-decoration: none;
}

.text-muted a:hover, .text-muted a:active{
  color: var(--link-color-muted-hover); 
}

main .cover-image img {
  width: 100%;
  object-fit: cover;
}

@media (hover: hover) and (pointer: fine) {
  main .cover-image {
    transition: transform .4s;
  }

  main .cover-image:hover {
    transform: scale(1.02);
  }  
}

/** Lightbox **/
.sl-overlay {
  background: var(--lightbox-bg);
}

.sl-wrapper .sl-image .sl-caption {
  font-size: 1rem;
  opacity: 0.9 !important;
}

.sl-wrapper .sl-close,
.sl-wrapper .sl-navigation button,
.sl-wrapper .sl-counter { 
  color: var(--lightbox-color);
  opacity: 1;
  }
  
/* Custom Responsive Grid for Albums and Images */
.albums, .gallery {
  display: grid !important;
  /* Change 'auto-fill' to 'auto-fit' and ensure the max is 1fr */
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
  gap: 1.5rem;
  /* Disable the Bootstrap Flexbox behavior */
  width: 100% !important;
}

/* Ensure the item is allowed to grow but stays capped at 400px */
main .cover-image {
  width: 100% !important; 
  max-width: 400px;
  /* This ensures it tries to fill the '1fr' space */
  justify-self: stretch; 
}

/* Force only the image container to be square */
.cover-image a {
  display: block;
  width: 100%;
  text-decoration: none;
}

/* Target the image directly for the square ratio */
.cover-image img, 
.video-container {
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  height: auto !important;
  object-fit: cover;
  display: block;
}

/* Style the title text so it isn't hidden */
.cover-image .pb-3 {
  padding-top: 10px;
  text-align: center;
  word-wrap: break-word;
}

main .cover-image img {
  height: 100% !important;
  object-fit: cover;
}


/* Tighten the gap between image and text */
.filename-label {
  margin-top: 2px !important; /* The 2px gap you requested */
  padding-bottom: 10px;
  font-size: 0.85rem;
  color: var(--text-color);
  text-align: center;
  word-wrap: break-word;
  line-height: 1.2;
}

/* Ensure the image doesn't have default bottom margin */
main .cover-image img, 
.video-container {
  margin-bottom: 0 !important;
  display: block;
}

.cover-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 1/1; /* Keeps them perfectly square */
}