/* 
 * Vexygram - Custom Styles
 * this_file: css/style.css
 */ 

/* --- General & Layout --- */

/* Fix for lightbox */
.uk-modal {
    z-index: 1000 !important;
}
.uk-modal-dialog {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5) !important;
    max-width: 90vw !important;
    width: auto !important;
}

/* Improved lightbox layout */
#image-lightbox .uk-modal-footer {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    width: 100%;
    box-sizing: border-box;
}
#lightbox-image {
    max-height: 80vh;
    max-width: 100%;
    display: block;
    margin: 0 auto;
}
#lightbox-download-button {
    /* display: inline-block !important; /* Controlled by JS */
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 14px;
}

/* --- Masonry Grid Styles (Isotope) --- */
.grid {
    width: 100%;
    /* Add a slight fade-in for the grid itself */
    transition: opacity 0.4s ease-in-out;
}

/* Clearfix - optional */
/* .grid:after { content: ''; display: block; clear: both; } */

/* Grid sizing elements */
.grid__col-sizer {
    width: 240px; /* Base column width */
}
.grid__gutter-sizer { 
    width: 10px; /* Space between items */
}

/* Grid items */
.grid__item {
    width: 240px; /* Must match col-sizer width */
    margin-bottom: 10px !important; /* Vertical space */
    float: left; /* Essential for Masonry */
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    /* Smooth transition for appearing/disappearing */
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
}

.grid__item img {
    width: 100% !important;
    height: auto !important;
    display: block;
    border-radius: 4px 4px 0 0;
    /* No transitions on image itself for masonry stability */
    transition: none !important;
}

/* No hover effects that change size/position for masonry */
/* Commented out as loupe effect handles hover interaction now
.grid__item:hover {
    z-index: 1; Bring to front
    Remove transform on hover to prevent layout shifts
    transform: none !important; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}
.grid__item:hover img {
    transform: none !important;
}
*/

/* Hide grid initially */
.grid.are-images-unloaded {
    opacity: 0;
}
/* Items are initially hidden by Isotope's hiddenStyle */

/* Item overlay - REMOVED OLD STYLES, REPLACED BELOW */

/* Download button in original overlay (adjust if needed) */
.download-button-small {
    padding: 3px 6px;
    font-size: 0.8em;
    line-height: 1;
    min-width: auto;
}

/* --- Loupe Effect Styles --- */

.grid__item {
  /* position: relative; is already set */
  /* Add background for visual feedback when image scales */
  background-color: #eee;
  /* Make sure hover brings it to the front */
   z-index: 1; /* Default z-index */
   /* Keep existing box-shadow */
   /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important; */
}
.grid__item:hover {
     z-index: 2; /* Higher z-index on hover for overlap */
     box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2) !important; /* Slightly enhance shadow on hover */
}

/* The anchor tag acts as the viewport for the loupe */
.grid__item > a {
  display: block; /* Ensure it takes up space */
  overflow: hidden; /* Clip the scaled image */
  position: relative; /* Context for the image if needed */
  cursor: crosshair; /* Indicate interaction */
  border-radius: 4px; /* Match item border radius */
}

/* The image that will be scaled and panned */
.grid__item > a > img {
  /* width: 100% and height: auto are already set */
  /* display: block; is already set */
  transform: scale(1); /* Start at normal size */
  transform-origin: center center; /* Default origin */
  transition: transform 0.1s ease, transform-origin 0s; /* Smooth scale, instant pan */
  will-change: transform; /* Hint for performance */
  border-radius: 0; /* Remove radius from image itself if anchor clips */
}

/* State when loupe is active (added via JS) */
.grid__item > a.loupe-active > img {
  /* Scale will be set by JS */
  /* transform-origin will be set by JS based on mouse */
  transition: none; /* Disable transitions during active panning */
}

/* --- Updated Overlay Styles --- */

.grid-item-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Remove background color to make it transparent */
  /* background-color: rgba(0, 0, 0, 0.6); */
  /* color: white; Removed as no text */
  /* Remove flexbox properties as button is absolutely positioned */
  /* display: flex; */
  /* flex-direction: column; */
  /* justify-content: flex-end; */
  /* align-items: flex-end; */
  opacity: 0; /* Hidden by default */
  transition: opacity 0.3s ease-in-out; /* Keep transition for button fade */
  pointer-events: none; /* Allows clicks/hovers to pass through to the anchor/image */
  /* text-align: center; Removed as no text */
  padding: 10px;
  box-sizing: border-box;
  z-index: 5; /* Below loupe interaction, above item content but below hovered item */
  border-radius: 4px; /* Match item */
}

/* Show overlay when loupe is active OR simply hovering the item */
.grid__item:hover .grid-item-overlay {
  opacity: 1; /* Show on hover */
}

/* Remove styles for non-existent .overlay-content, .caption, .author */
/*
.grid-item-overlay .overlay-content {
  margin-bottom: 5px; 
  max-height: calc(100% - 50px); 
  overflow-y: auto; 
  padding: 5px; 
}

.grid-item-overlay .caption {
  display: block;
  font-weight: bold;
  font-size: 0.9em;
  margin-bottom: 2px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.grid-item-overlay .author {
  display: block;
  font-size: 0.8em;
  color: #ccc;
   white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
*/

/* Make the download button clickable and position it */
.grid-item-overlay .download-button-overlay {
  pointer-events: auto; /* Make ONLY the button clickable */
  /* Use position absolute to fix to bottom right */
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 6; /* Ensure button is above overlay content */
}

/* Ensure download icon is visible */
.download-button-overlay span[uk-icon] {
    color: white; /* Or adjust as needed */
}

/* --- Loading Status (Infinite Scroll) --- */
.page-load-status {
    display: block !important; /* Ensure visibility */
    padding-top: 20px;
    text-align: center;
    color: #777;
    min-height: 50px; /* Reserve space */
}

/* Loading dots animation */
.loader-ellips {
    font-size: 16px;
    position: relative;
    width: 4em;
    height: 1em;
    margin: 10px auto;
}

.loader-ellips__dot {
    display: block;
    width: 1em;
    height: 1em;
    border-radius: 0.5em;
    background: #555;
    position: absolute;
    animation-duration: 0.5s;
    animation-timing-function: ease;
    animation-iteration-count: infinite;
}

.loader-ellips__dot:nth-child(1),
.loader-ellips__dot:nth-child(2) {
    left: 0;
}
.loader-ellips__dot:nth-child(3) { left: 1.5em; }
.loader-ellips__dot:nth-child(4) { left: 3em; }

@keyframes reveal {
    from { transform: scale(0.001); }
    to { transform: scale(1); }
}

@keyframes slide {
    to { transform: translateX(1.5em) }
}

.loader-ellips__dot:nth-child(1) {
    animation-name: reveal;
}

.loader-ellips__dot:nth-child(2),
.loader-ellips__dot:nth-child(3) {
    animation-name: slide;
}

.loader-ellips__dot:nth-child(4) {
    animation-name: reveal;
    animation-direction: reverse;
}

/* --- Responsive adjustments --- */
@media (max-width: 640px) {
    .grid__item,
    .grid__col-sizer {
        width: 180px !important;
    }
}

@media (max-width: 480px) {
    .grid__item,
    .grid__col-sizer {
        width: 140px !important;
    }
    .grid__gutter-sizer {
        width: 8px;
    }
}

/* Style for newly loaded items before layout */
.grid__item.is-loading {
  opacity: 0;
}

/* Ensure grid items have transition for opacity */
.grid__item {
  /* Add transition for opacity alongside other transitions if any */
  transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
  /* Other grid__item styles remain */
}