/* =========================================================
   PROJECTS.CSS â€” Recent Projects carousel
   Wide 2.1:1 landscape cards, full-bleed image, bottom-left
   black gradient, uppercase brand typography (scroll-snap).
   ========================================================= */

.projects {
  padding: clamp(2.75rem, 5vw, 4rem) 0;
}

/* Section heading stays aligned with the site's main content container */
.projects-head {
  max-width: var(--container);
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
}

.projects-head .section-head {
  margin-bottom: 0;
}

/* ---- Full-bleed viewport ----
   Spans the full browser width (no 100vw â€” avoids scrollbar-induced
   horizontal page scrolling). overflow: hidden clips the track;
   a very subtle ~20px fade sits ONLY at the actual screen edges so
   cards soften naturally as they enter/leave. Fully opaque everywhere
   else, including the whole main-content area. */
.projects-bleed {
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  padding: 0.5rem 0 1.25rem;
  margin: -0.5rem 0 -1.25rem;
}

/* Track: free to extend horizontally. Its inline padding is derived
   from the main container's calculated left offset â€”
   max((viewport - container)/2, 0) + container side padding â€” so the
   first card aligns exactly with the section headings. Upcoming cards
   continue past the content boundary toward the right viewport edge. */
.projects-track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: calc(max((100% - var(--container)) / 2, 0px) + 1.5rem);
  padding-inline: calc(max((100% - var(--container)) / 2, 0px) + 1.5rem);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.projects-track::-webkit-scrollbar {
  display: none;
}

/* ---- Card: wide landscape, generous rounded corners ---- */
.project-card {
  position: relative;
  flex: 0 0 auto;
  width: min(860px, 88vw);
  aspect-ratio: 2.1 / 1;
  border-radius: clamp(18px, 2.5vw, 28px);
  overflow: hidden;
  scroll-snap-align: start;
  background: linear-gradient(135deg, #1d2a1a 0%, #0e1116 60%, #233322 100%); /* fallback before image loads */
  box-shadow: 0 18px 45px -18px rgba(14, 17, 22, 0.45);
  isolation: isolate;
}

/* Desktop: shorter card â€” wider ratio brings the height down
   (~345px instead of ~410px at the 860px max width) */
@media (min-width: 641px) {
  .project-card {
    aspect-ratio: 2.5 / 1;
  }
}

.project-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease);
}

.project-card:hover img {
  transform: scale(1.04);
}

/* Bottom-left concentrated black gradient â€” fades to transparent
   toward the center / upper-right so the product stays bright */
.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(120% 130% at 0% 100%,
      rgba(0, 0, 0, 0.78) 0%,
      rgba(0, 0, 0, 0.45) 32%,
      rgba(0, 0, 0, 0.12) 58%,
      transparent 78%);
  pointer-events: none;
}

/* ---- Caption: lower-left, bold uppercase brand + subtitle ---- */
.project-caption {
  position: absolute;
  left: clamp(1.1rem, 3.5vw, 2.5rem);
  bottom: clamp(1rem, 3vw, 2.1rem);
  z-index: 2;
  max-width: 70%;
}

.project-brand {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

.project-sub {
  margin: 0.45em 0 0;
  font-size: clamp(0.72rem, 1.3vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

@media (max-width: 640px) {
  /* Phone peek: ~1.4 cards visible per viewport width
     (1 full card + ~40% of the next) */
  .project-card {
    width: calc(100vw / 1.4 - 1.5rem);
    /* ~30% taller than the desktop card (ratio 2.1/1 Ã· 1.3) */
    aspect-ratio: 2.1 / 1.3;
  }

  /* Smaller caption typography on phone */
  .project-brand {
    font-size: 1rem;
  }

  .project-sub {
    font-size: 0.6rem;
    letter-spacing: 0.18em;
  }

  .project-caption {
    max-width: 85%;
  }
}

/* CTA row — "Check All Projects" */
.projects-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  padding: 0 1.5rem;
}

/* All-projects page grid */
.projects-grid-page {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.projects-grid-page .project-card {
  width: 100%;
  scroll-snap-align: none;
}

@media (max-width: 900px) {
  .projects-grid-page {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .projects-grid-page .project-card {
    aspect-ratio: 2.1 / 1.3;
  }

  .projects-grid-page .project-brand {
    font-size: 1rem;
  }

  .projects-grid-page .project-sub {
    font-size: 0.6rem;
    letter-spacing: 0.18em;
  }
}

/* Full projects page heading variant */
.projects-page .section-head {
  padding-top: clamp(1.5rem, 4vw, 3rem);
}
