/* =================================================================
   PROJECTS SCROLL — Pinned horizontal (GSAP, no Lenis)
   Paleta global tokens (amarillo crema / rojo / naranja)
   ================================================================= */

.px-section {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--cream);
  color: var(--garnet);
  font-family: var(--ff-body);
}

.px-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(255,162,57,0.18), transparent 60%),
    radial-gradient(900px 700px at 85% 95%, rgba(255,86,86,0.10), transparent 70%);
}

/* ==== LAYER 1: Giant titles fixed behind ==== */
.px-layer-titles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(20px, 5vh, 60px);
  overflow: hidden;
}
.px-title-row {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6vw;
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: clamp(110px, 18vw, 300px);
  line-height: 0.88;
  letter-spacing: -0.04em;
  color: var(--garnet);
  text-transform: none;
  will-change: transform;
}
.px-title-row.b {
  font-size: clamp(72px, 11vw, 180px);
  color: var(--terracotta);
  opacity: 0.9;
}
.px-title-row.b em { font-style: italic; }
.px-title-row .paren {
  font-family: var(--ff-display);
  font-style: italic;
  color: var(--olive);
  font-size: 0.6em;
  margin: 0 0.2em;
}
.px-title-row .star {
  color: var(--olive);
  font-size: 0.4em;
  margin: 0 0.5em;
  font-weight: 300;
}

/* ==== LAYER 2: Horizontal track ==== */
.px-track {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: stretch;
  padding: 0;
  width: max-content;
  will-change: transform;
}
.proj-card {
  position: relative;
  flex-shrink: 0;
  width: clamp(280px, 26vw, 420px);
  height: clamp(340px, 44vh, 520px);
  margin: 0 clamp(30px, 5vw, 70px);
  top: 10%;
  text-decoration: none;
  color: inherit;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.proj-card:first-child { margin-left: clamp(80px, 10vw, 140px); }
.proj-card:last-child  { margin-right: clamp(80px, 10vw, 140px); }

.proj-card-num {
  position: absolute;
  top: -32px;
  left: 4px;
  font-family: var(--ff-display);
  font-style: italic;
  font-weight: 400;
  font-size: 24px;
  color: var(--garnet);
  letter-spacing: -0.02em;
}
.proj-card-img {
  position: relative;
  width: 100%;
  height: 84%;
  overflow: hidden;
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(42, 10, 8, 0.25);
}
.proj-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1);
  filter: saturate(0.96) contrast(1.04);
}
.proj-card:hover .proj-card-img img { transform: scale(1.06); }

.proj-card-caption {
  position: absolute;
  inset: auto 0 -4px 0;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.proj-card-title {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.005em;
  color: var(--garnet);
  transition: color 0.4s ease;
}
.proj-card:hover .proj-card-title { color: var(--terracotta); }
.proj-card-short {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.proj-card:nth-child(2n)   { transform: rotate(-1deg); }
.proj-card:nth-child(3n)   { transform: rotate(1.2deg); }
.proj-card:nth-child(4n+1) { transform: rotate(-0.5deg); }
.proj-card:hover           { transform: rotate(0) translateY(-6px); }

/* ==== Meta (top-left) ==== */
.px-meta {
  position: absolute;
  top: 100px;
  left: var(--col-pad);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--garnet);
  pointer-events: none;
}
.px-meta-k {
  color: var(--terracotta);
  font-family: var(--ff-display);
  font-style: italic;
  text-transform: none;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.px-meta-k em { font-style: italic; color: var(--olive); }

/* Hint bottom-right */
.px-hint {
  position: absolute;
  bottom: 30px;
  right: var(--col-pad);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--garnet);
  pointer-events: none;
}
.px-hint-arrow {
  display: inline-block;
  animation: pxArrow 1.6s ease-in-out infinite;
  color: var(--terracotta);
  font-size: 16px;
}
@keyframes pxArrow {
  0%, 100% { transform: translateX(0); opacity: 0.6; }
  50%      { transform: translateX(10px); opacity: 1; }
}

/* Mobile fallback — native horizontal drag */
@media (max-width: 860px) {
  .px-section { height: auto; min-height: auto; padding: 60px 0 100px; }
  .px-layer-titles {
    position: static;
    inset: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 4px;
    padding: 0 20px 28px;
    overflow: visible;
    transform: none !important;
  }
  .px-title-row {
    font-size: 56px;
    line-height: 0.92;
    gap: 0.15em;
    white-space: nowrap;
    transform: none !important;
  }
  .px-title-row.b { font-size: 34px; }
  .px-title-row.a > *:nth-child(n+3) { display: none; }
  .px-title-row.b > *:nth-child(n+2) { display: none; }
  .px-track {
    position: relative;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 40px 20px 20px;
    width: 100%;
  }
  .proj-card {
    width: 76vw;
    height: 58vh;
    top: 0 !important;
    scroll-snap-align: center;
    margin: 0 14px;
  }
  .px-meta { display: none; }
  .px-hint { display: none; }
}
