/* ============================================================
   photos.css — Photos App: grid viewer with lightbox
   macOS Desktop Website
   ============================================================ */

/* ── Window content: this is the scroller ────────────────────── */
#window-photos .window-content {
  overflow-y: auto;
  overflow-x: hidden;
  background: #111;
  height: 100%;
}

/* ── Photo grid (CSS columns for natural aspect ratios) ──────── */
/* The grid grows to its natural height; the parent above scrolls */
.photos-grid {
  columns: 3;
  column-gap: 4px;
  padding: 4px;
  background: #111;
}

/* ── Grid item ───────────────────────────────────────────────── */
.photos-grid-item {
  break-inside: avoid;
  margin-bottom: 4px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background: #222;
  display: block;
  border-radius: 2px;
  outline: none;
}

.photos-grid-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

.photos-grid-item img {
  width: 100%;
  height: auto;          /* natural proportions — portrait, landscape, square all work */
  display: block;
  transition: transform 0.2s ease;
}

.photos-grid-item:hover img {
  transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
  .photos-grid-item img {
    transition: none;
  }
}


/* ── Empty state ─────────────────────────────────────────────── */
.photos-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: #666;
  font-size: 13px;
}

/* ── Lightbox ────────────────────────────────────────────────── */
.photos-lightbox {
  display: flex;
  flex-direction: column;
  background: #000;
  height: 100%;
  position: relative;
  outline: none;
}

/* Lightbox toolbar (top bar) */
.photos-lb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  gap: 8px;
  min-height: 44px;
}

.photos-lb-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  min-width: 72px;
  min-height: 30px;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.photos-lb-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.photos-lb-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.photos-lb-counter {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}

/* Lightbox image area */
.photos-lb-image-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.photos-lb-image-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}

/* Prev / Next buttons */
.photos-lb-prev,
.photos-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 16px 14px;
  border-radius: 6px;
  min-width: 52px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  z-index: 2;
}

.photos-lb-prev {
  left: 10px;
}

.photos-lb-next {
  right: 10px;
}

.photos-lb-prev:hover,
.photos-lb-next:hover {
  background: rgba(0, 0, 0, 0.72);
}

.photos-lb-prev:focus-visible,
.photos-lb-next:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .photos-lb-prev,
  .photos-lb-next,
  .photos-lb-close {
    transition: none;
  }
}

/* ── macOS-style scrollbars ──────────────────────────────────── */
#window-photos .window-content::-webkit-scrollbar {
  width: 8px;
}

#window-photos .window-content::-webkit-scrollbar-track {
  background: transparent;
}

#window-photos .window-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#window-photos .window-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* ── Mobile: 2 columns on narrow screens ─────────────────────── */
@media (max-width: 480px) {
  .photos-grid {
    columns: 2;
  }
}
