/* Image gallery grid with hover-lift thumbnails. */

/**
 * .gallery / .wm-gallery
 * Responsive auto-fill image grid. Minimum cell width: 200 px.
 */
.gallery,
.wm-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

/**
 * .gallery-item / .wm-gallery-item
 * Individual image cell. Border, radius, overflow clip, and hover lift.
 * Wraps a plain <img> or an <a><img></a> pair.
 */
.gallery-item,
.wm-gallery-item {
  position: relative;
  margin: 0;
  border-radius: var(--wm-radius-base, 6px);
  overflow: hidden;
  border: 1px solid var(--wm-color-border);
  background: var(--wm-color-surface-muted);
  cursor: pointer;
  transition:
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.gallery-item:hover,
.wm-gallery-item:hover {
  box-shadow: var(--wm-shadow-soft);
  transform: translateY(-2px);
}

.gallery-item img,
.wm-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

/**
 * .gallery-item-caption / .wm-gallery-item-caption
 * Optional overlay caption that appears on hover.
 */
.gallery-item-caption,
.wm-gallery-item-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  color: var(--wm-color-text);
  background: color-mix(in srgb, var(--wm-color-surface) 88%, transparent);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-item-caption,
.wm-gallery-item:hover .wm-gallery-item-caption {
  opacity: 1;
}

/**
 * .gallery-item-figure / .wm-gallery-item-figure
 * Resume-style gallery tile with persistent figcaption below the media.
 */
.gallery-item-figure,
.wm-gallery-item-figure {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.gallery-item-figure figcaption,
.wm-gallery-item-figure figcaption {
  font-size: 0.75rem;
  color: var(--wm-color-text-muted);
  padding: 0.4rem 0.6rem;
  line-height: 1.4;
  border-top: 1px solid var(--wm-color-border);
  background: var(--wm-color-surface-solid);
}

/**
 * .gallery-item-diagram / .wm-gallery-item-diagram
 * Mermaid diagram tile used in resume project galleries.
 */
.gallery-item-diagram .mermaid,
.wm-gallery-item-diagram .wm-mermaid {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--wm-color-surface-muted);
}

.gallery-item-diagram .mermaid svg,
.wm-gallery-item-diagram .wm-mermaid svg {
  max-width: 100%;
  max-height: 100%;
  height: auto;
}

/**
 * .gallery-placeholder / .wm-gallery-placeholder
 * Design-first placeholder tile for when screenshots are not ready yet.
 * Keep aspect ratio consistent with real images so layout does not shift later.
 */
.gallery-placeholder,
.wm-gallery-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  padding: 0.9rem;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--wm-color-surface-strong) 88%, white) 0%,
      var(--wm-color-surface-muted) 52%,
      color-mix(in srgb, var(--wm-color-accent-soft) 24%, var(--wm-color-surface-muted)) 100%
    );
  color: var(--wm-color-text-muted);
  text-align: center;
}

.gallery-placeholder::before,
.wm-gallery-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
    45deg,
    transparent 0,
    transparent 46%,
    color-mix(in srgb, var(--wm-color-border) 64%, transparent) 46%,
    color-mix(in srgb, var(--wm-color-border) 64%, transparent) 54%,
    transparent 54%,
    transparent 100%
  );
  background-size: 22px 22px;
  opacity: 0.25;
}

.gallery-placeholder-content,
.wm-gallery-placeholder-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.35rem;
}

.gallery-placeholder-title,
.wm-gallery-placeholder-title {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wm-color-text-secondary);
  font-weight: 600;
}

.gallery-placeholder-meta,
.wm-gallery-placeholder-meta {
  margin: 0;
  font-size: 0.72rem;
  color: var(--wm-color-text-muted);
}

/**
 * .gallery-lightbox-overlay / .wm-gallery-lightbox-overlay
 * Full-screen lightbox for gallery items. Toggle with .active.
 */
.gallery-lightbox-overlay,
.wm-gallery-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, black 82%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 1.25rem;
}

.gallery-lightbox-overlay.active,
.wm-gallery-lightbox-overlay.wm-active {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-close,
.wm-gallery-lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.gallery-lightbox-close:hover,
.wm-gallery-lightbox-close:hover {
  opacity: 1;
}

.gallery-lightbox-img,
.wm-gallery-lightbox-img {
  max-width: min(92vw, 1200px);
  max-height: 84vh;
  border-radius: var(--wm-radius-base, 8px);
  box-shadow: 0 8px 40px color-mix(in srgb, black 48%, transparent);
  object-fit: contain;
  border: 1px solid color-mix(in srgb, var(--wm-color-border) 72%, transparent);
}

.gallery-lightbox-nav,
.wm-gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--wm-radius-pill);
  border: 1px solid color-mix(in srgb, var(--wm-color-border) 72%, transparent);
  background: color-mix(in srgb, var(--wm-color-surface-solid) 84%, transparent);
  color: var(--wm-color-text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.gallery-lightbox-nav:hover,
.wm-gallery-lightbox-nav:hover {
  background: color-mix(in srgb, var(--wm-color-surface-solid) 96%, transparent);
}

.gallery-lightbox-nav-prev,
.wm-gallery-lightbox-nav-prev {
  left: 1rem;
}

.gallery-lightbox-nav-next,
.wm-gallery-lightbox-nav-next {
  right: 1rem;
}

.gallery-lightbox-status,
.wm-gallery-lightbox-status {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.2rem 0.55rem;
  border-radius: var(--wm-radius-pill);
  background: color-mix(in srgb, black 42%, transparent);
  color: #fff;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}
