/* ===== PORTFOLIO PAGE — IMMERSIVE GALLERY LAYOUT ===== */

/* Remove narrow container, go full-bleed */
.portfolio-page {
  max-width: none;
  padding: 0;
  position: relative;
  z-index: 1;
}

/* ===== CATEGORY TITLE (top of page) ===== */
.portfolio-heading {
  text-align: center;
  padding: 3rem 2rem 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  margin: 0;
}

.portfolio-intro {
  text-align: center;
  max-width: 52ch;
  margin: 0 auto 1.5rem;
  padding: 0 2rem;
  opacity: 0.85;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ===== PROJECT SECTION ===== */
.project {
  position: relative;
}

.project + .project {
  margin-top: 0;
}

/* ===== PROJECT DIVIDER ===== */
.project-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4rem, 8vw, 7rem) clamp(2rem, 8vw, 10rem);
  gap: 2rem;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.04) 30%,
    rgba(0, 0, 0, 0.06) 50%,
    rgba(0, 0, 0, 0.04) 70%,
    transparent 100%
  );
}

.project-divider::before,
.project-divider::after {
  content: '';
  flex: 1;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--text), transparent);
  opacity: 0.5;
}

.project-divider__icon {
  font-size: 1.3rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.7;
  font-weight: 900;
  font-family: var(--font-display);
  white-space: nowrap;
}

/* ===== HERO — FULL VIEWPORT ===== */
.project-hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* Video hero — iframe "object-fit: cover" trick */
.project-hero__video {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.project-hero__video iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 177.78vh;   /* 16:9 → width = height * 16/9 */
  height: 100vh;
  min-width: 100%;
  min-height: 56.25vw; /* 16:9 → height = width * 9/16 */
  transform: translate(-50%, -50%);
  border: 0;
  pointer-events: none;
}

/* Image hero — for projects without video */
.project-hero--image {
  height: 80vh;
}

.project-hero--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Overlay — gradient scrim with title */
.project-hero__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4rem clamp(2rem, 5vw, 6rem) 3rem;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
  color: #fff;
  z-index: 2;
}

.project-hero__number {
  display: block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.project-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
  letter-spacing: -0.01em;
}

.project-hero__subtitle {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  margin: 0.6rem 0 0;
  opacity: 0.85;
  max-width: 55ch;
  line-height: 1.5;
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

/* ===== TEXT SECTION — NO BOX ===== */
.project-text {
  max-width: 70ch;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 5vw, 6rem);
  line-height: 1.8;
  color: var(--text);
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
}

.project-text p {
  margin: 0;
}

.project-text p + p {
  margin-top: 1rem;
}

.project-text__tech {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 1.5rem !important;
}

/* ===== HORIZONTAL SCROLL GALLERY ===== */
.project-gallery {
  position: relative;
  padding: 1.5rem 0 3rem;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(124, 58, 237, 0.045) 15%,
    rgba(124, 58, 237, 0.045) 85%,
    transparent 100%
  );
}

.project-gallery__track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding: 1.5rem clamp(1.5rem, 5vw, 6rem);
  -webkit-overflow-scrolling: touch;

  /* Thin styled scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

/* Only snap when user is manually scrolling (paused), not during auto-scroll */
.project-gallery__track.is-paused {
  scroll-snap-type: x proximity;
}

.project-gallery__track::-webkit-scrollbar {
  height: 6px;
}

.project-gallery__track::-webkit-scrollbar-track {
  background: transparent;
}

.project-gallery__track::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

/* Drag cursor state */
.project-gallery__track.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  scroll-snap-type: none;
  user-select: none;
}

.project-gallery__track:not(.is-dragging) {
  cursor: grab;
}

.project-gallery__card {
  flex: 0 0 auto;
  width: clamp(280px, 35vw, 500px);
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: var(--neo-shadow-raised);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin: 0;
  background: var(--surface);
}

.project-gallery__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.project-gallery__card:hover {
  transform: translateY(-4px);
  box-shadow: var(--neo-shadow-raised-lg);
}

.project-gallery__card:hover img {
  transform: scale(1.03);
  filter: brightness(0.97);
}

/* ===== VIDEO CARD IN GALLERY ===== */
.project-gallery__card--video {
  aspect-ratio: 16 / 9;
  width: clamp(320px, 40vw, 560px);
  position: relative;
  background: #000;
}

.project-gallery__card--video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.project-gallery__card--video:hover {
  transform: translateY(-4px);
  box-shadow: var(--neo-shadow-raised-lg);
}

/* ===== AUTO-SCROLL INDICATOR ===== */
.project-gallery__track.is-autoscrolling {
  cursor: default;
}

.project-gallery__track.is-paused {
  cursor: grab;
}

/* ===== MINIMAL PROJECT (no hero/gallery, just text) ===== */
.project--minimal {
  padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 5vw, 6rem);
  max-width: 70ch;
  margin: 0 auto;
}

.project--minimal .project-hero__number {
  color: var(--accent);
  opacity: 1;
}

.project--minimal .project-hero__title {
  color: var(--text);
  text-shadow: none;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.project--minimal .project-hero__subtitle {
  color: var(--text-muted);
  text-shadow: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .project-hero {
    height: 60vh;
  }

  .project-hero--image {
    height: 55vh;
  }

  .project-hero__overlay {
    padding: 2rem 1.5rem;
  }

  .project-gallery__card {
    width: 80vw;
  }

  .project-gallery__track {
    padding: 1rem 1rem;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .project-hero {
    height: 50vh;
  }

  .project-hero--image {
    height: 45vh;
  }

  .project-gallery__card {
    width: 85vw;
  }

  .portfolio-heading {
    padding-top: 2rem;
  }
}
