/**
 * Infinite 2D Grid Gallery — Styles
 *
 * Layout values (card size, border-radius, gap) are set in CSS
 * and overridden by responsive breakpoints at the bottom.
 * Animation timing is controlled via main.js CONFIG section.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

/* ===== LOADER ===== */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  background: #111;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  transition: opacity 0.5s ease;
}
.loader.hidden {
  opacity: 0;
  pointer-events: none;
}
.loader-bar-track {
  width: 200px; height: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 1px;
  overflow: hidden;
}
.loader-bar-fill {
  width: 0%; height: 100%;
  background: #fff;
  transition: width 0.3s ease;
}
.loader-percent {
  font-size: 12px; font-weight: 400;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
}
body {
  background: #111; color: #fff;
  font-family: 'Outfit', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}
body.detail-open { cursor: default; }

/* ===== GRID ===== */
.grid-viewport {
  position: fixed; inset: 0;
  will-change: transform;
  transform-origin: 0 0;
}

.grid-item {
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 100px;
  overflow: hidden;
  will-change: transform;
  cursor: pointer;
}
.grid-item:hover { outline: 2px solid rgba(255,255,255,0.12); outline-offset: -2px; }

.grid-item-inner {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 56px;
  position: relative;
  overflow: hidden;
}

.grid-item-img,
.grid-item-photo {
  position: absolute; inset: -30px;
  background-size: cover;
  background-position: center;
}
.grid-item-photo {
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 1;
}
.grid-item-photo.loaded { opacity: 1; }

.grid-item-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.05) 100%);
  z-index: 2;
}

.grid-item-title {
  position: relative; z-index: 2;
  font-size: 16px; font-weight: 500;
  letter-spacing: -0.2px;
}

.grid-item-tag {
  position: relative; z-index: 2;
  font-size: 11px; font-weight: 400;
  color: rgba(255,255,255,0.6);
  letter-spacing: 1px; text-transform: uppercase;
  margin-top: 6px;
}

/* ===== DETAIL OVERLAY ===== */
.detail-overlay {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none; opacity: 0;
}
.detail-overlay.active { pointer-events: all; opacity: 1; }

.detail-content {
  position: absolute; inset: 0;
  z-index: 10;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 60px;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.0) 45%);
  opacity: 0;
  pointer-events: none;
}
.detail-overlay.active .detail-content { pointer-events: all; }

.detail-title {
  font-size: 48px; font-weight: 700;
  letter-spacing: -1px; line-height: 1.1;
}
.detail-tag {
  font-size: 13px; font-weight: 400;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px; text-transform: uppercase;
  margin-top: 12px;
}
.detail-desc {
  font-size: 16px; font-weight: 300;
  color: rgba(255,255,255,0.7);
  line-height: 1.6; max-width: 480px;
  margin-top: 24px;
}

.detail-close {
  position: absolute; top: 32px; right: 36px;
  width: 48px; height: 48px;
  border: none;
  border-radius: 50%;
  background: #000; color: #fff;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: all;
  z-index: 20;
}

/* Image clone */
.detail-image {
  position: absolute;
  overflow: hidden;
  border-radius: 100px;
  will-change: transform;
  z-index: 2;
}
.detail-image-inner {
  position: absolute;
  background-size: cover;
  background-position: center;
}
.detail-click-layer {
  position: absolute; inset: 0; z-index: 3;
}

/* ===== MOBILE (≤768px) ===== */
@media (max-width: 768px) {
  .grid-item {
    width: 260px; height: 260px;
    border-radius: 40px;
  }
  .grid-item-inner { padding: 24px; }
  .grid-item-title { font-size: 13px; }
  .grid-item-tag { font-size: 9px; margin-top: 4px; }

  .detail-content { padding: 28px; }
  .detail-title { font-size: 28px; }
  .detail-tag { font-size: 11px; margin-top: 8px; }
  .detail-desc { font-size: 14px; margin-top: 16px; }
  .detail-close {
    top: 20px; right: 20px;
    width: 40px; height: 40px;
    font-size: 16px;
  }
  .detail-image { border-radius: 40px; }
}
