/* Projects Section & Difference Container Integration (matching Image 3 reference) */

:root {
  --project-card-w: clamp(260px, 22vw, 310px);
  --project-card-aspect: (319 / 440);
  --project-card-h: calc(var(--project-card-w) / var(--project-card-aspect));
  --project-overlap-amount: calc(var(--project-card-h) * 0.62);
  --project-gap: clamp(18px, 1.8vw, 28px);
}

/* Projects Section */
.projects-section.page-section {
  position: relative;
  z-index: 2;
  overflow: visible;
  padding-top: 28px;
  padding-bottom: 0;
  background: transparent;
}

.projects-heading {
  margin-bottom: 0;
}

.projects-heading h2 {
  font-size: clamp(2.2rem, 3.2vw, 2.65rem);
  line-height: 1.15;
}

/* Project Carousel */
.projects-section .project-carousel {
  position: relative;
  margin-top: 36px;
  width: 100%;
}

.projects-section .project-track {
  position: relative;
  display: flex;
  gap: var(--project-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}

.projects-section .project-track::-webkit-scrollbar {
  display: none;
}

.projects-section .project-card {
  position: relative;
  flex: 0 0 var(--project-card-w);
  width: var(--project-card-w);
  height: var(--project-card-h);
  aspect-ratio: 319 / 440;
  min-width: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-lavender);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: transform 280ms cubic-bezier(0.2, 0, 0.2, 1), box-shadow 280ms ease;
  scroll-snap-align: start;
}

.projects-section .project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.projects-section .project-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 320ms ease;
  pointer-events: none;
  user-select: none;
}

.projects-section .project-card:hover img {
  transform: scale(1.04);
}

.projects-section .project-card span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 16px 12px 14px;
  color: #ffffff;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.02) 100%);
  font-family: var(--font-ui);
  font-size: clamp(0.92rem, 1.15vw, 1.15rem);
  font-weight: 500;
  text-align: center;
  pointer-events: none;
}

/* Project cards - click/tap toggle on all screen sizes */
.projects-section .project-card--toggle {
  cursor: pointer;
}

.projects-section .project-card--toggle:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.projects-section .project-card--toggle:hover img {
  transform: scale(1.04);
}

.projects-section .project-card--toggle:focus-visible {
  outline: 2px solid #664095;
  outline-offset: -2px;
}

.projects-section .project-card--toggle img {
  transition: transform 320ms ease, filter 320ms ease;
  will-change: transform, filter;
}

.projects-section .project-toggle-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 320ms ease;
  pointer-events: none;
}

.projects-section .project-toggle-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  opacity: 0;
  transition: opacity 320ms ease;
  pointer-events: none;
}

.projects-section .project-toggle-copy strong {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.5vw, 1.45rem);
  font-weight: 700;
  line-height: 1.25;
}

.projects-section .project-toggle-copy span {
  position: static;
  max-width: 300px;
  padding: 0;
  background: none;
  color: rgba(255, 255, 255, 0.95);
  font: 400 clamp(0.8rem, 1vw, 0.95rem) / 1.5 var(--font-body);
  text-align: center;
}

.projects-section .project-card--toggle.is-open .project-toggle-overlay {
  opacity: 1;
}

.projects-section .project-card--toggle.is-open img {
  filter: brightness(0.62) saturate(0.85);
}

.projects-section .project-card--toggle.is-open .project-toggle-copy {
  opacity: 1;
}

/* Carousel Controls & 6 Dots */
.projects-section .carousel-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 18px;
  padding-right: 4px;
}

.projects-section .carousel-control {
  display: none;
}

.projects-section .carousel-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.projects-section .carousel-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #08070a;
  cursor: pointer;
  transition: background-color 200ms ease, transform 200ms ease;
}

.projects-section .carousel-dot[aria-current='true'] {
  background: #f26233;
  transform: scale(1.15);
}

.projects-section .carousel-dot:hover {
  background: #f26233;
}

.projects-section .carousel-dot:focus-visible {
  outline: 2px solid #664095;
  outline-offset: 2px;
}

/* Difference Section - Seamless Overlap behind bottom of Project Cards */
.difference-section.page-section {
  position: relative;
  z-index: 1;
  overflow: hidden;
  margin-left: 1.65%;
  margin-right: 0;
  margin-top: calc(-1 * var(--project-overlap-amount) - 42px);
  padding-top: calc(var(--project-overlap-amount) + 42px + 36px);
  padding-bottom: 64px;
  border-radius: 28px 0 0 28px;
  background: var(--color-lavender);
}

.difference-shell {
  padding-top: 0;
  padding-bottom: 0;
}

.difference-shell .section-heading h2 {
  font-size: clamp(2.15rem, 3.15vw, 2.55rem);
  line-height: 1.18;
  margin: 0;
}

.difference-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  gap: clamp(24px, 3.5vw, 50px);
  margin-top: 36px;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  cursor: grab;
}

.difference-grid::-webkit-scrollbar {
  display: none;
}

.difference-grid.is-dragging {
  scroll-snap-type: none;
  cursor: grabbing;
  user-select: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  :root {
    --project-card-w: clamp(240px, 30vw, 290px);
    --project-gap: 18px;
  }

  .difference-section.page-section {
    border-radius: 24px 0 0 24px;
    padding-bottom: 50px;
  }
}

@media (max-width: 768px) {
  :root {
    --project-card-w: clamp(250px, 76vw, 310px);
    --project-gap: 16px;
    --project-overlap-amount: calc(var(--project-card-h) * 0.45);
  }

  .projects-section.page-section {
    padding-top: 20px;
  }

  .projects-section .carousel-controls {
    justify-content: center;
    margin-top: 16px;
    margin-bottom: 4px;
    padding-right: 0;
  }

  .difference-section.page-section {
    margin-inline: 0;
    border-radius: 24px 0 0 24px;
    margin-top: calc(-1 * var(--project-overlap-amount) - 48px);
    padding-top: calc(var(--project-overlap-amount) + 48px + 28px);
    padding-bottom: 44px;
  }

  .difference-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
  }
}

