/* css/gallery.css — Gallery grid + tile styles */

.view--gallery {
  padding-top: calc(var(--header-height) + var(--filter-height));
  padding-bottom: var(--space-8);
}

/* ── Filter Bar ─────────────────────────────────────────── */
.filter-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--filter-height);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-6);
  background: rgba(8, 8, 8, 0.88);
  backdrop-filter: var(--blur-ui);
  -webkit-backdrop-filter: var(--blur-ui);
  border-bottom: 1px solid rgba(235, 228, 215, 0.05);
  z-index: 90;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

@media (max-width: 640px) {
  .filter-bar {
    padding: 0 var(--space-3);
    gap: var(--space-2);
    height: 48px;
  }
  .filter-select {
    font-size: 11px;
    padding: 5px 20px 5px 8px;
    flex-shrink: 0;
    white-space: nowrap;
  }
}

.filter-select {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 24px 5px 10px;
  cursor: pointer;
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(235,228,215,0.3)' stroke-width='1.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.filter-select:hover {
  border-color: var(--border-hover);
  color: var(--ink-primary);
}

.filter-select option {
  background: #111010;
  color: rgba(235, 228, 215, 0.85);
}

/* ── Gallery Grid ───────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: var(--space-4);
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    padding: var(--space-3);
  }
}

@media (max-width: 380px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* ── Gallery Tile ───────────────────────────────────────── */
.gallery-tile {
  aspect-ratio: 1;
  border-radius: var(--radius-tile);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  transition:
    transform 0.2s var(--ease-spring),
    box-shadow 0.2s var(--ease-out),
    border-color 0.15s var(--ease-out);
  will-change: transform;
}

.gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.gallery-tile img[src=""] {
  opacity: 0;
}

.gallery-tile:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  border-color: rgba(235, 228, 215, 0.14);
}

.gallery-tile:active {
  transform: scale(0.98);
  transition-duration: 0.08s;
}

/* ── Tile Hover Overlay ─────────────────────────────────── */
.tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0.18) 55%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
}

.gallery-tile:hover .tile-overlay {
  opacity: 1;
}

/* Touch devices: always show tile info (hover doesn't exist) */
@media (hover: none) {
  .tile-overlay {
    opacity: 1;
  }
  /* Disable scale-up lift on touch — causes layout flash */
  .gallery-tile:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
  }
  .gallery-tile:active {
    transform: scale(0.96);
    transition-duration: 0.06s;
  }
}

.tile-date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(235, 228, 215, 0.95);
  line-height: 1.4;
}

.tile-stats {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(235, 228, 215, 0.65);
  letter-spacing: 0.04em;
  margin-top: 3px;
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.empty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--ink-tertiary);
  margin: 0 auto var(--space-4);
}

.empty-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: rgba(235, 228, 215, 0.45);
  margin-bottom: var(--space-3);
}

.empty-sub {
  font-family: var(--font-ui);
  font-size: 14px;
  color: rgba(235, 228, 215, 0.28);
  line-height: 1.8;
}
