/* Portfolio page color overrides */
.portfolio-page {
  background-color: #fff;
  color: #000;
  overflow: hidden;
}

/* Hide content until loaded */
.portfolio-page .gallery {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.portfolio-page.loaded .gallery {
  opacity: 1;
}

.portfolio-page .container {
  height: 100vh;
  overflow: hidden;
}

.portfolio-page .header,
.portfolio-page .footer,
.portfolio-page .side-number {
  color: #000;
}

.portfolio-page .header-left,
.portfolio-page .header-right {
  color: #000;
  text-decoration: none;
}

.portfolio-page .header-left:hover,
.portfolio-page .header-right:hover {
  opacity: 0.6;
}

/* Gallery Grid - 12 column layout */
.gallery {
  position: absolute;
  top: 7%;
  left: 0;
  right: 0;
  bottom: 8%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 0 20px;
  padding: 0 40px;
}

.gallery-item {
  display: flex;
  flex-direction: column;
}

.gallery-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s;
}

.gallery-link:hover img {
  opacity: 0;
}

/* Grid placements - portrait = 1 col, landscape = 2 cols */
.gallery-item:nth-child(1) {
  grid-column: 6 / span 1;
  grid-row: 1;
}

/* portrait */
.gallery-item:nth-child(2) {
  grid-column: 1 / span 2;
  grid-row: 2;
}

/* landscape */
.gallery-item:nth-child(3) {
  grid-column: 10 / span 2;
  grid-row: 2;
}

/* landscape */
.gallery-item:nth-child(4) {
  grid-column: 3 / span 1;
  grid-row: 3;
}

/* portrait */
.gallery-item:nth-child(5) {
  grid-column: 7 / span 1;
  grid-row: 3;
}

/* portrait */
.gallery-item:nth-child(6) {
  grid-column: 10 / span 1;
  grid-row: 3;
}

/* portrait */
.gallery-item:nth-child(7) {
  grid-column: 7 / span 2;
  grid-row: 4;
}

/* landscape */
.gallery-item:nth-child(8) {
  grid-column: 10 / span 2;
  grid-row: 4;
}

/* landscape */
.gallery-item:nth-child(9) {
  grid-column: 1 / span 2;
  grid-row: 5;
}

/* landscape */
.gallery-item:nth-child(10) {
  grid-column: 7 / span 2;
  grid-row: 5;
}

/* landscape */
.gallery-item:nth-child(11) {
  grid-column: 10 / span 2;
  grid-row: 5;
}

/* landscape */

.item-label {
  font-family: Georgia, serif;
  font-size: clamp(9px, 1vw, 11px);
  line-height: 1.2;
  font-feature-settings: 'dlig' 1;
  margin: 0 0 0.5vh 0;
  width: 170%;
}

.item-label span {
  font-style: normal;
}

.item-label em {
  font-style: italic;
}

.item-count {
  font-family: 'Geist', sans-serif;
  font-weight: 500;
  font-size: clamp(9px, 1vw, 11px);
  letter-spacing: -0.02em;
  margin-left: 1vw;
}

.item-image {
  overflow: hidden;
  width: 100%;
  height: 13vh;
  background: #000;
}

.item-image.landscape {
  /* fills 2 columns */
}

.item-image.portrait {
  height: 13vh;
  margin-bottom: 18px;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
}

/* Empty slot placeholder */
.gallery-item.empty {
  pointer-events: none;
}

.item-placeholder {
  width: 100%;
  max-height: 13vh;
  aspect-ratio: 16 / 9;
}

/* Responsive */
@media (max-width: 768px) {
  .portfolio-page {
    overflow-y: auto;
  }

  .portfolio-page .container {
    height: auto;
    min-height: 100vh;
  }

  .gallery {
    position: relative;
    top: auto;
    bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 100px 0 80px 0;
  }

  .footer-left {
    display: none;
  }

  .gallery-item {
    width: fit-content;
  }

  .item-image {
    max-height: none;
  }

  .item-image.landscape,
  .item-image.portrait {
    width: 100%;
    max-width: 280px;
    height: auto;
  }

  .item-image.landscape {
    aspect-ratio: 222 / 125;
  }

  .item-image.portrait {
    aspect-ratio: 100 / 133;
  }

  /* Hide empty slots on mobile */
  .gallery-item.empty {
    display: none;
  }
}