/* RESET */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Helvetica, Arial, sans-serif;
  background: #fafafa;
  color: #111;
}

/* HEADER */
header {
  padding: 2rem;
  text-align: center;
}

/* GALLERY GRID */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding: 2rem;
}

.grid-item {
  cursor: pointer;
}

.grid-item img {
  width: 100%;
  display: block;
}

.meta {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* DETAIL VIEW */
.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

#detail-view {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0 */
  background: #fafafa;
  z-index: 100;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.detail-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  height: 100vh;
}

.detail-content .images {
  padding: 2rem;
  overflow-y: auto;
}

.detail-content .images img {
  width: 100%;
  margin-bottom: 1rem;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.detail-content .images img.loaded {
  opacity: 1;
}

.detail-content .description {
  padding: 2rem;
  border-left: 1px solid #ddd;
  height: 100vh;
  overflow-y: auto;
}

/* CLOSE BUTTON */
#close-detail {
  position: fixed;
  top: 1rem;
  left: 1rem;
  background: rgba(250, 250, 250, 0.9);
  border: 1px solid #111;
  padding: 0.5rem 1rem;
  cursor: pointer;
  z-index: 200;
  backdrop-filter: blur(4px);
}

#close-detail:hover {
  background: #111;
  color: #fff;
}

/* NAV ARROWS */
.nav {
  position: absolute;
  top: 50%;
  font-size: 3rem;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
}

.prev {
  left: 1rem;
}

.next {
  right: 1rem;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-content {
    grid-template-columns: 1fr;
    height: auto;
  }

  .detail-content .images {
    height: auto;
    max-height: none;
  }

  .detail-content .description {
    border-left: none;
    border-top: 1px solid #ddd;
    height: auto;
  }
}

