/* ============================================
   PROCEDURAL GALLERY — Zenith Design System
   ============================================ */

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.gallery-header {
  text-align: center;
  padding: 80px 24px 32px;
  max-width: 720px;
  margin: 0 auto;
}

.gallery-title {
  font-family: Georgia, 'Playfair Display', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(42px, 6vw, 64px);
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.gallery-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 480px;
  margin: 0 auto;
}

/* --- Stats --- */
.gallery-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 24px 0;
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.gallery-stats span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- Filters --- */
.gallery-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 24px 8px;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}

.filter-pill {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
}

.filter-pill:hover { border-color: var(--accent); color: var(--accent); }

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 500;
}

.search-input {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', system-ui, sans-serif;
  outline: none;
  width: 180px;
  transition: border-color 0.25s ease, width 0.3s var(--ease-out);
}

.search-input:focus { border-color: var(--accent); width: 240px; }
.search-input::placeholder { color: var(--text-muted); }

/* --- Grid --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  padding: 32px 40px 80px;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Card wrapper (own perspective per card) --- */
.card-perspective {
  perspective: 1000px;
}

/* --- Card --- */
.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transform-style: preserve-3d;
  will-change: transform;
  /* Only box-shadow + border animate via CSS — transform is JS-driven */
  transition: box-shadow 0.5s var(--ease-out), border-color 0.3s ease;
}

.gallery-card:hover {
  box-shadow:
    0 24px 64px rgba(0,0,0,0.35),
    0 8px 20px rgba(0,0,0,0.15);
  border-color: var(--accent);
  z-index: 10;
}

/* Depth of field — blur siblings via the wrapper, not the card (avoids filter conflict) */
.gallery-grid:hover .card-perspective:not(:hover) .gallery-card {
  filter: blur(1.5px);
  transition: box-shadow 0.5s ease, border-color 0.3s ease, filter 0.5s ease;
}

/* ============================================
   Z-LAYERED PARALLAX — each element has its
   own depth, shadow, and border-radius
   ============================================ */

/* Shared transition — transform only, no filter */
.gallery-card .card-thumb,
.gallery-card .card-category,
.gallery-card .card-title,
.gallery-card .card-subtitle,
.gallery-card .card-tags {
  transform: translateZ(0);
  transition: transform 0.5s cubic-bezier(0.03, 0.98, 0.52, 0.99),
              box-shadow 0.5s cubic-bezier(0.03, 0.98, 0.52, 0.99),
              text-shadow 0.5s cubic-bezier(0.03, 0.98, 0.52, 0.99),
              border-radius 0.5s ease,
              background 0.5s ease,
              color 0.3s ease,
              letter-spacing 0.3s ease;
}

/* --- Thumb: base layer --- */
.card-thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.gallery-card:hover .card-thumb {
  transform: translateZ(20px);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}

.card-thumb canvas { width: 100%; height: 100%; display: block; }

/* --- Card body: content container --- */
.card-body {
  padding: 16px 20px 20px;
  transform-style: preserve-3d;
}

/* --- Category label --- */
.card-category {
  display: inline-block;
  font-size: 10px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.gallery-card:hover .card-category {
  transform: translateZ(10px);
  letter-spacing: 0.14em;
  text-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* --- Title --- */
.card-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.gallery-card:hover .card-title {
  transform: translateZ(20px);
  color: var(--accent);
  text-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* --- Subtitle --- */
.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.4;
}

.gallery-card:hover .card-subtitle {
  transform: translateZ(12px);
  text-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* --- Tags --- */
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.card-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}

.gallery-card:hover .card-tags {
  transform: translateZ(8px);
}

.gallery-card:hover .card-tag {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text-secondary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* --- Stagger delays (cascade reveal) --- */
.gallery-card .card-thumb     { transition-delay: 0s; }
.gallery-card .card-category  { transition-delay: 0.04s; }
.gallery-card .card-title     { transition-delay: 0.09s; }
.gallery-card .card-subtitle  { transition-delay: 0.12s; }
.gallery-card .card-tags      { transition-delay: 0.15s; }

/* --- Empty state --- */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.gallery-empty-title {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 24px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.gallery-empty-text { font-size: 14px; }

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 40px 24px 48px;
  border-top: 1px solid var(--border-subtle);
}

.site-footer__title {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 4px;
}

.site-footer__credit {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .gallery-header { padding: 60px 20px 24px; }
  .gallery-grid { grid-template-columns: 1fr; padding: 24px 16px 64px; gap: 16px; }
  .gallery-filters { padding: 24px 16px 8px; }
  .gallery-stats { flex-wrap: wrap; gap: 12px; }
  .search-input { width: 140px; }
  .search-input:focus { width: 180px; }
  /* Disable 3D tilt on mobile */
  .card-perspective { perspective: none; }
  .gallery-card:hover .card-thumb,
  .gallery-card:hover .card-body,
  .gallery-card:hover .card-category,
  .gallery-card:hover .card-title,
  .gallery-card:hover .card-subtitle,
  .gallery-card:hover .card-tags { transform: none; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .card-title { font-size: 18px; }
}
