/* ==========================================================================
   COMPONENT: Projects (recent-projects view and projects-reel view)
   ========================================================================== */

.recent-projects {
  padding-block: var(--section-space);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 250px;
  gap: 14px;

  /* First card is large; the rest fill around it */
  .project-card:first-child {
    grid-column: span 2;
    grid-row: span 2;
  }
}

.project-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--secondary-color);

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
  }

  &:hover img {
    transform: scale(1.06);
  }

  .project-card-label {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 12px 16px;
    color: var(--text-on-dark-muted);
    background: color-mix(in srgb, var(--secondary-color) 84%, transparent);
    backdrop-filter: blur(6px);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary-color);
  }

  h3 {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    letter-spacing: 0;
    color: var(--text-on-dark);

    a {
      text-decoration: none;

      /* Whole card is clickable */
      &::after {
        content: "";
        position: absolute;
        inset: 0;
      }
    }
  }

  p {
    display: -webkit-box;
    margin: 2px 0 0;
    overflow: hidden;
    font-size: 0.85rem;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }
}

/* Full grid used on the Portfolio page */
.projects-reel {
  padding-block: 0 var(--section-space);
}

.reel-grid--projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 300px;
  gap: 16px;
}

/* Pagination controls rendered by the CMS */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 32px;

  .pagination-button {
    min-height: 42px;
    padding: 0 18px;
    font: 700 0.92rem var(--font-body);
    color: var(--text-on-dark);
    background: var(--secondary-color);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
  }

  .pagination-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .pagination-input {
    width: 48px;
    min-height: 42px;
    text-align: center;
    font: 600 1rem var(--font-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
  }
}

@media (max-width: 1000px) {
  .project-grid,
  .reel-grid--projects {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .project-grid,
  .reel-grid--projects {
    grid-template-columns: 1fr;
    grid-auto-rows: 240px;

    .project-card:first-child {
      grid-column: span 1;
      grid-row: span 1;
    }
  }
}
