/* ===========================
   PROJECTS SECTION CSS
   =========================== */

.projects {
  padding: var(--spacing-5xl) var(--spacing-4xl) var(--spacing-4xl);
}

.projects__container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-4xl);
  max-width: 1280px;
  margin: 0 auto;
}

/* Desktop Grid Layout */
.projects__carousel {
  position: relative;
  width: 100%;
}

.projects__track {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

.projects__slide {
  width: 100%;
}

/* Carousel Controls (Hidden on Desktop) */
.carousel__button {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(13, 13, 13, 0.8);
  backdrop-filter: blur(4px);
  border: 1px solid var(--color-border);
  color: var(--color-text-white);
  cursor: pointer;
  transition: all var(--transition-base);
  z-index: 10;
  align-items: center;
  justify-content: center;
}

.carousel__button--prev {
  left: var(--spacing-md);
}

.carousel__button--next {
  right: var(--spacing-md);
}

.carousel__button svg {
  width: 24px;
  height: 24px;
}

/* Carousel Dots */
.carousel__dots {
  display: none;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}

.carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  cursor: pointer;
  transition: all var(--transition-base);
}

.carousel__dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--color-primary);
}

/* Responsive - Carousel Mode */
@media (max-width: 1280px) {
  .projects {
    padding: var(--spacing-5xl) var(--spacing-3xl) var(--spacing-3xl);
  }
}

/* Carousel Active Mode - Only show controls when carousel is active */
.projects__carousel.carousel-active {
  overflow: hidden;
}

.projects__carousel.carousel-active .projects__track {
  display: flex;
  transition: transform var(--transition-base);
}

.projects__carousel.carousel-active .projects__slide {
  flex: 0 0 100%;
  width: 100%;
}

.projects__carousel.carousel-active .carousel__button {
  display: flex;
}

.projects__carousel.carousel-active .carousel__dots {
  display: flex;
}

@media (max-width: 768px) {
  .projects {
    padding: var(--spacing-4xl) var(--spacing-lg) var(--spacing-3xl);
  }
}

@media (max-width: 480px) {
  .projects {
    padding: var(--spacing-3xl) var(--spacing-md) var(--spacing-2xl);
  }

  .projects__track {
    display: flex;
    flex-direction: column;
  }

  .carousel__button {
    width: 40px;
    height: 40px;
  }

  .carousel__button--prev {
    left: var(--spacing-sm);
  }

  .carousel__button--next {
    right: var(--spacing-sm);
  }
}

/* Card Project */
.new-project-card {
  width: 628px;
  height: 520px;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  will-change: transform;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.project-card-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../../assets/communication.png');
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.3s ease;
  z-index: 1;
}

/* Your project background styles - preserved exactly */
.project-card-background.project-communication {
  background-image: url('../../assets/communication.png')
}

.project-card-background.project-navigation {
  background-image: url('../../assets/navigation.png')
}

.project-card-background.project-embedded {
  background-image: url('../../assets/embedded.png')
}

.project-card-background.project-cybers {
  background-image: url('../../assets/cybers.png')
}

.project-card-header {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 40px;
  height: 114px;
  transform: translateY(0);
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-right: 50px;
}

.project-card-title {
  color: white;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  flex: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.project-card-button {
  display: flex;
  justify-content: center;
  align-items: center;
  background: none;
  border-radius: 38px;
  border: 1px solid #CF1A1C;
  cursor: pointer;
  position: absolute;
  right: 40px;
  bottom: 40px;
  width: 40px;
  height: 40px;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: center;
  z-index: 4;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.arrow-icon.hover {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg);
}

/* Desktop arrow icons */
.arrow-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: center;
}

.arrow-icon.default {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

/* Mobile chevron icon */
.chevron-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  color: white;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: none;
}

.chevron-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.reveal-panel {
  position: absolute;
  top: 120px;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  border-radius: 0 0 20px 20px;
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  overflow: hidden;
}

.reveal-content {
  margin: 0 40px 40px;
  padding-top: 16px;
  border-top: 1px solid #504D4D;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
}

.content-text {
  color: white;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 20px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.content-text:last-child {
  margin-bottom: 0;
}

/* DESKTOP ONLY - True hover with mouse/trackpad */
@media (hover: hover) and (pointer: fine) and (min-width: 1025px) {
  .carousel__button:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
  }

  .project-card-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
  }

  .new-project-card {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  /* Remove focus-visible from desktop hover effects */
  .new-project-card:hover {
    transform: translateY(-8px);
    background-image: url('../../assets/background-projects.png');
    background-position: center;
    background-repeat: no-repeat;
  }

  .new-project-card:hover .project-card-background {
    background-image: url('../../assets/background-projects.png');
  }

  .new-project-card:hover .project-card-header {
    transform: translateY(-400px);
  }

  .new-project-card:hover .reveal-panel {
    transform: translateY(0);
  }

  .new-project-card:hover .reveal-content {
    opacity: 1;
    transform: translateY(0);
  }

  .new-project-card:hover .arrow-icon.default {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg);
    transition: opacity 0.2s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .new-project-card:hover .arrow-icon.hover {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg);
    transition: opacity 0.2s ease 0.15s, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .new-project-card:hover .project-card-button {
    transform: scale(1.1);
    background: #CF1A1C;
    right: 40px;
    top: 40px;
    bottom: auto;
  }

  .new-project-card:hover .project-card-button { display: none; }
}

/* Tablet click-to-reveal styles (481px - 1024px) */
@media (min-width: 481px) and (max-width: 1024px) {
  .new-project-card {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
  }

  .new-project-card.tablet-active {
    transform: translateY(-8px);
    background-image: url('../../assets/background-projects.png');
    background-position: center;
    background-repeat: no-repeat;
  }

  .new-project-card.tablet-active .project-card-background {
    background-image: url('../../assets/background-projects.png');
  }

  .new-project-card.tablet-active .project-card-header { transform: translateY(-400px); }
  .new-project-card.tablet-active .reveal-panel { transform: translateY(0); }
  .new-project-card.tablet-active .reveal-content { opacity: 1; transform: translateY(0); }
  .new-project-card.tablet-active .arrow-icon.default {
    opacity: 0; transform: translate(-50%, -50%) rotate(90deg);
    transition: opacity 0.2s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  .new-project-card.tablet-active .arrow-icon.hover {
    opacity: 1; transform: translate(-50%, -50%) rotate(0deg);
    transition: opacity 0.2s ease 0.15s, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  .new-project-card.tablet-active .project-card-button {
    transform: scale(1.1);
    background: #CF1A1C;
    right: 40px; top: 40px; bottom: auto;
  }
}

/* Mobile accordion behavior */
@media (max-width: 480px) {
  .new-project-card {
    width: 90vw;
    max-width: 500px;
    height: auto;
    min-height: 80px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }

  .new-project-card.is-open { min-height: 350px; }

  .project-card-header {
    display: flex;
    height: 80px;
    position: relative !important;
    padding: 20px;
    bottom: auto !important; top: auto !important;
    transform: none !important; transition: none !important;
  }

  .header-inner { width: 100%; justify-content: space-between; align-items: center; padding-right: 0; }
  .project-card-title { font-size: 20px; flex: 1; margin-right: 15px; }

  .project-card-button {
    position: relative;
    bottom: auto !important; top: auto !important; right: auto !important;
    transform: none !important; width: 40px; height: 40px;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  /* Hide desktop arrows, show mobile chevron */
  .arrow-icon { display: none !important; opacity: 0 !important; }
  .chevron-icon {
    display: flex !important; position: absolute !important;
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 24px; height: 24px; align-items: center; justify-content: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  .new-project-card.is-open .chevron-icon {
    transform: translate(-50%, -50%) rotate(180deg) !important;
  }

  /* Mobile reveal panel */
  .reveal-panel {
    position: relative; top: auto;
    transform: none; max-height: 0;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
    opacity: 0; border-radius: 0; overflow: hidden;
  }
  .new-project-card.is-open .reveal-panel { max-height: 600px; opacity: 1; }

  .reveal-content {
    padding-top: 16px; margin: 0 16px 16px;
    transform: none; transition: opacity 0.3s ease 0.1s; opacity: 0;
  }
  .new-project-card.is-open .reveal-content { opacity: 1; }

  .content-text {
    font-size: 14px;
  }
}

/* ACCESSIBILITY - Only for desktop with real hover capability */
@media (hover: hover) and (pointer: fine) and (min-width: 1025px) {
  .new-project-card:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
  }

  .project-card-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
  }
}
