/* CINEMATIC PROJECTS SECTION */

:root {
  --ease-cinematic: cubic-bezier(0.19, 1, 0.22, 1);
}

/* --- CONTAINER (Vertical Scroll Track) --- */
.projects-container {
  height: 500vh;
  /* Determines length of horizontal scroll */
  position: relative;
  background: var(--bg-dark);
}

/* --- STICKY VIEWPORT --- */
.projects-sticky-view {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #0b0b0b;
}

/* --- INTRO SECTION --- */
.projects-intro {
  position: absolute;
  top: 10%;
  left: 5%;
  z-index: 10;
  max-width: 400px;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.projects-intro.fade-out {
  opacity: 0;
  pointer-events: none;
}

.projects-intro h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  color: #fff;
}

.projects-intro p {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.scroll-hint {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.scroll-hint .line {
  width: 40px;
  height: 1px;
  background: var(--text-muted);
}

/* --- HORIZONTAL WRAPPER --- */
.horizontal-scroll-wrapper {
  display: flex;
  gap: 150px;
  /* Space between cards */
  padding-left: 40vw;
  /* Initial offset so first card enters */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  will-change: transform;
}

/* --- PROJECT CARD --- */
.project-card {
  position: relative;
  width: 60vw;
  /* Large cinematic width */
  max-width: 900px;
  aspect-ratio: 16/9;
  flex-shrink: 0;
  perspective: 1000px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  /* Tech/Sharp feel, slight round */
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: transform 0.6s var(--ease-cinematic);
}

.project-card:hover .card-inner {
  transform: scale(1.02);
}

.card-image {
  width: 100%;
  height: 100%;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-cinematic);
}

/* Parallax/Zoom Effect on Hover */
.project-card:hover .card-image img {
  transform: scale(1.1);
}

/* --- OVERLAY --- */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.project-card:hover .card-overlay {
  opacity: 1;
}

.overlay-content {
  transform: translateY(20px);
  transition: transform 0.5s var(--ease-cinematic);
}

.project-card:hover .overlay-content {
  transform: translateY(0);
}

.project-category {
  display: inline-block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 10px;
  background: rgba(255, 215, 0, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  backdrop-filter: blur(5px);
}

.overlay-content h3 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.overlay-content p {
  font-size: 1.1rem;
  color: #ccc;
  max-width: 600px;
  margin-bottom: 24px;
}

.btn-view {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  padding-bottom: 4px;
  transition: 0.3s;
}

.btn-view:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

/* --- PROGRESS BAR --- */
.projects-progress {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 2px;
}

/* --- MODAL --- */
.project-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: 0.4s var(--ease-cinematic);
  backdrop-filter: blur(10px);
}

.project-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 90%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  transform: scale(0.95) translateY(20px);
  transition: 0.5s var(--ease-cinematic);
  padding: 0;
}

.project-modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.3s;
}

.modal-close:hover {
  background: var(--accent);
  color: #000;
}

/* Modal Internal Styles */
.modal-hero {
  width: 100%;
  height: 400px;
  position: relative;
}

.modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-details {
  padding: 60px;
}

.modal-details h2 {
  font-size: 2.5rem;
  color: #fff;
  margin-bottom: 10px;
}

.modal-details .meta {
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  margin-bottom: 40px;
  letter-spacing: 0.1em;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
}

.detail-block h4 {
  color: #fff;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.detail-block p {
  color: #aaa;
  line-height: 1.7;
  font-size: 1rem;
}

.tech-stack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.tech-pill {
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 12px;
  border-radius: 4px;
  color: #ccc;
  font-size: 0.85rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .projects-intro {
    position: relative;
    top: 0;
    left: 0;
    padding: 100px 20px 40px;
    max-width: 100%;
    text-align: center;
    background: #0b0b0b;
  }

  .projects-intro.fade-out {
    opacity: 1;
    /* Keep visible on mobile? or adjust logic */
    display: none;
    /* Just hide it if scrolling */
  }

  .projects-container {
    height: auto;
    /* Dissable horizontal scroll on mobile */
    overflow: hidden;
  }

  .projects-sticky-view {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .horizontal-scroll-wrapper {
    position: relative;
    flex-direction: column;
    transform: none !important;
    /* Disable JS transform */
    padding: 40px 20px;
    top: 0;
    gap: 60px;
  }

  .project-card {
    width: 100%;
    aspect-ratio: auto;
    /* Remove fixed aspect ratio */
    margin-bottom: 30px;
    /* Add spacing between cards */
  }

  /* Make the card a column flex container */
  .card-inner {
    display: flex;
    flex-direction: column;
    height: auto;
    /* Let content dictate height */
  }

  .card-image {
    height: 250px;
    /* Fixed height for image */
    flex-shrink: 0;
  }

  .projects-progress {
    display: none;
  }

  /* Move overlay below image */
  .card-overlay {
    position: relative;
    inset: auto;
    opacity: 1;
    background: #161616;
    /* Solid dark background */
    padding: 30px;
    transform: none;
  }

  .overlay-content {
    transform: translateY(0);
  }

  .project-category {
    margin-bottom: 8px;
  }

  .overlay-content h3 {
    font-size: 1.8rem;
  }

  .overlay-content p {
    font-size: 1rem;
    color: #bbb;
    margin-bottom: 20px;
  }


  .detail-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .modal-details {
    padding: 30px;
  }
}