/* ============================================
   PROJ-3 V2: Projekt-Carousel
   Modern swipe-affordance: peek, drag, nudge, progress pills
   ============================================ */

/* Override the grid layout from style.css */
.projekte-carousel-section .projekte-grid {
  display: none;
}

.projekte-carousel-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Carousel Wrapper: positions arrows + viewport */
.projekte-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Viewport: clips the overflow, shows a peek of the next tile */
.projekte-carousel-viewport {
  flex: 1;
  overflow: hidden;
  border-radius: 20px;
  position: relative;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.projekte-carousel-viewport.is-dragging {
  cursor: grabbing;
}

/* Edge fade: subtle gradient on the right to signal "more content" */
.projekte-carousel-viewport::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80px;
  pointer-events: none;
  background: linear-gradient(to left, rgba(240, 240, 225, 0.6) 0%, rgba(240, 240, 225, 0) 100%);
  z-index: 2;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.projekte-carousel-viewport.at-end::after {
  opacity: 0;
}

/* Track: slides horizontally */
.projekte-carousel-track {
  display: flex;
  gap: 28px;
  transition: transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: transform;
}

.projekte-carousel-track.is-dragging {
  transition: none;
}

/* Each carousel item: 2.2 items visible (2 full + ~0.2 peek of 3rd) */
.kachel-carousel-item {
  flex: 0 0 calc((100% - 28px * 2.2) / 2.2);
  min-width: calc((100% - 28px * 2.2) / 2.2);
  aspect-ratio: 4 / 3;
  min-height: 480px;
}

.projekte-carousel-section .kachel-container {
  aspect-ratio: 4 / 3;
}

.projekte-carousel-section .kachel-title {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  margin-bottom: 8px;
}

.projekte-carousel-section .kachel-badge {
  font-size: 0.8rem;
  padding: 6px 18px;
  margin-bottom: 12px;
}

.projekte-carousel-section .kachel-hint {
  font-size: 0.9rem;
}

.projekte-carousel-section .kachel-front-overlay {
  padding: 40px 32px 32px;
}

.projekte-carousel-section .kachel-back {
  padding: 48px 40px;
}

.projekte-carousel-section .kachel-back-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  margin-bottom: 20px;
}

.projekte-carousel-section .kachel-back-text {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 28px;
}

.projekte-carousel-section .kachel-back-impact {
  font-size: 1.15rem;
  margin-bottom: 32px;
}

.projekte-carousel-section .btn-kachel {
  font-size: 1rem;
  padding: 14px 36px;
}


/* ============================================
   Carousel Arrows
   ============================================ */

.carousel-arrow {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  background: var(--color-bg-warm-white);
  color: var(--color-primary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0, 85, 80, 0.1);
}

.carousel-arrow:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 85, 80, 0.25);
}

.carousel-arrow:active {
  transform: scale(0.96);
}

.carousel-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.carousel-arrow:disabled:hover {
  background: var(--color-bg-warm-white);
  color: var(--color-primary);
}


/* ============================================
   Pagination Pills (Progress-Style)
   Modern: active pill is a wider bar, inactive pills are dots
   ============================================ */

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 85, 80, 0.25);
  cursor: pointer;
  transition: width 0.45s cubic-bezier(0.25, 0.8, 0.25, 1),
              background 0.3s ease,
              transform 0.2s ease;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.carousel-dot:hover {
  background: var(--color-secondary);
  transform: scale(1.15);
}

.carousel-dot.active {
  width: 44px;
  background: var(--color-primary);
  transform: none;
}


/* ============================================
   Carousel Counter (1 / 3)
   ============================================ */

.carousel-counter {
  text-align: center;
  margin-top: 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 2px;
}

.carousel-current {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.1rem;
}


/* ============================================
   Swipe-Hint: animated icon overlay (mobile)
   Shows once when carousel first becomes visible
   ============================================ */

.swipe-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(0, 85, 80, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 18px 24px;
  border-radius: 18px;
  opacity: 0;
  transition: opacity 0.4s ease;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.swipe-hint.is-visible {
  opacity: 1;
}

.swipe-hint-icon {
  width: 54px;
  height: 36px;
  position: relative;
  animation: swipeIconMove 1.4s ease-in-out infinite;
}

.swipe-hint-icon::before {
  content: '';
  position: absolute;
  inset: 50% 0 0 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25);
}

@keyframes swipeIconMove {
  0%, 100% { transform: translateX(-14px); }
  50%      { transform: translateX(14px); }
}


/* ============================================
   Nudge-Animation: signals "there's more" on first view
   ============================================ */

@keyframes carouselNudge {
  0%    { transform: translateX(var(--carousel-offset, 0)); }
  25%   { transform: translateX(calc(var(--carousel-offset, 0) - 24px)); }
  55%   { transform: translateX(calc(var(--carousel-offset, 0) + 8px)); }
  80%   { transform: translateX(calc(var(--carousel-offset, 0) - 4px)); }
  100%  { transform: translateX(var(--carousel-offset, 0)); }
}

.projekte-carousel-track.nudge {
  animation: carouselNudge 1200ms cubic-bezier(0.25, 0.8, 0.25, 1) both;
}


/* ============================================
   Responsive: Tablet
   ============================================ */

@media (max-width: 1199px) {
  .kachel-carousel-item {
    min-height: 420px;
  }

  .projekte-carousel-section .kachel-back {
    padding: 36px 28px;
  }
}


/* ============================================
   Responsive: Mobile — 1.15 items (1 full + peek both sides)
   ============================================ */

@media (max-width: 767px) {
  .projekte-carousel-track {
    gap: 14px;
  }

  .kachel-carousel-item {
    flex: 0 0 calc(100% - 56px);
    min-width: calc(100% - 56px);
    min-height: 400px;
    aspect-ratio: 3 / 4;
  }

  .projekte-carousel-section .kachel-container {
    aspect-ratio: 3 / 4;
  }

  /* Hide desktop edge fade on mobile (peek is symmetric here) */
  .projekte-carousel-viewport::after {
    display: none;
  }

  /* Arrows smaller and below on mobile */
  .carousel-arrow {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .projekte-carousel-wrapper {
    flex-wrap: wrap;
    justify-content: center;
  }

  .projekte-carousel-viewport {
    order: 1;
    width: 100%;
    border-radius: 16px;
  }

  .carousel-arrow-left {
    order: 2;
  }

  .carousel-arrow-right {
    order: 3;
  }

  .projekte-carousel-section .kachel-back {
    padding: 28px 24px;
  }

  .projekte-carousel-section .kachel-front-overlay {
    padding: 30px 20px 20px;
  }

  .carousel-dots {
    margin-top: 24px;
  }

  .carousel-dot.active {
    width: 34px;
  }
}

@media (max-width: 575px) {
  .kachel-carousel-item {
    min-height: 360px;
  }

  .projekte-carousel-container {
    padding: 0 12px;
  }
}


/* ============================================
   Reduced-motion accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .projekte-carousel-track,
  .carousel-dot {
    transition: none;
  }

  .projekte-carousel-track.nudge,
  .swipe-hint-icon {
    animation: none;
  }

  .swipe-hint {
    display: none;
  }
}
