/* =========================================
   Projects Component
   ========================================= */

.projects-section {
  padding: 2rem 2rem 0 2rem;
  width: 100%;
  border-top: 1px solid var(--color-border);
  margin-top: -1px;
}

.projects-header {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 2rem;
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
}

.projects-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* Gaps removed to create precise wireframe container bounds */
}

.project-item {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

/* Hide the right border on the last item of each row to prevent edge bleeding */
.project-item:nth-child(2n),
.project-item-link:nth-child(2n) .project-item {
  border-right: none;
}

.project-item-link {
  display: contents;
  text-decoration: none;
  color: inherit;
}

.project-item__image {
  width: 100%;
  aspect-ratio: 21/9;
  object-fit: contain;
  background-color: #ffffff;
  margin-bottom: 1.5rem;
}

.project-item__title {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.project-item__desc {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  text-align: justify;
}

@media (max-width: 768px) {
  .projects-header {
    font-size: 1.5rem;
  }

  .projects-list {
    grid-template-columns: 1fr;
  }

  .project-item {
    border-right: none;
    /* Strip out visual vertical dividers on mobile single column layout */
    margin-left: -2rem;
    margin-right: -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .project-item__image {
    aspect-ratio: 16/9;
  }

  .project-item__title {
    font-size: 1.125rem;
  }

  .project-item__desc {
    font-size: 0.875rem;
  }
}

/* =========================================
   Project Detail Page
   ========================================= */

.project-detail-section {
  padding: 2rem 2rem 0 2rem;
  width: 100%;
  margin-bottom: -1px; /* Overlap newsletter top border */
}

/* Ensure the grid itself sits perfectly flush to the bottom */
.project-detail__gallery {
  margin-bottom: 0;
}

.project-detail__nav {
  margin-bottom: 2rem;
}

.project-detail__back {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 0.25rem;
}

.project-detail__header {
  margin-bottom: 4rem;
  max-width: none;
}

.project-detail__title {
  font-family: var(--font-body);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.project-detail__desc {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
}

.project-detail__gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--color-border);
}

.project-detail__gallery-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.project-detail__gallery-item:nth-child(3n) {
  border-right: none;
}

.project-detail__image {
  width: 100%;
  aspect-ratio: 4/3; /* Standard shop proportion */
  object-fit: contain;
  background-color: var(--color-bg);
}

@media (max-width: 768px) {
  .project-detail-section {
    padding: 1rem 0 0 0; /* no bottom padding, right/left 0 */
  }
  .project-detail__nav, .project-detail__header {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  .project-detail__header {
    margin-bottom: 2rem;
  }
  .project-detail__title {
    font-size: 2rem;
  }
  
  .project-detail__gallery {
    grid-template-columns: 1fr 1fr; /* 2-column mobile grid matching shop */
  }

  .project-detail__gallery-item {
    padding: 0.5rem;
    border-right: 1px solid var(--color-border);
  }

  .project-detail__gallery-item:nth-child(3n) {
    border-right: 1px solid var(--color-border); /* restore right border */
  }

  /* Remove right border on 2nd item of mobile layout */
  .project-detail__gallery-item:nth-child(2n) {
    border-right: none;
  }
}