/* ════════════════════════════════════════════
   WORKS / OUARZAZATE — Image Crossfade
   6 AI images stacked full-bleed.
   JS controls opacity per scroll progress.
   ════════════════════════════════════════════ */

/* ── Scroll wrapper — 12 steps × 100vh + 35vh release = 1235vh ── */
.projects-scroll {
  position: relative;
  height: 1235vh;
  z-index: 2;
  background: #050308;
}

/* ── Sticky viewport ── */
.projects {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #050308;
  z-index: 2;
}

/* ── Environment container ── */
.projects__env {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* ── Each image layer ── */
.projects__env-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: 62% center;
  background-repeat: no-repeat;
  opacity: 0;
  will-change: opacity;
  transition: opacity 0.12s ease-out;
}

/* First layer visible by default */
.projects__env-layer[data-layer="0"] {
  opacity: 1;
}

/* ── Film grain ── */
.projects__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  animation: grainShift 0.15s steps(1) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-4px, -6px); }
  50%  { transform: translate(6px, 2px); }
  75%  { transform: translate(-2px, 5px); }
  100% { transform: translate(4px, -4px); }
}

/* ── Progress bar ── */
.projects__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(196, 122, 42, 0.1);
  z-index: 10;
}

.projects__progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ouarza-accent, #c47a2a);
  transition: width 0.05s linear;
  box-shadow: 0 0 6px var(--ouarza-accent, #c47a2a);
}

/* ── Track — horizontal scroll content ── */
.projects__track {
  display: flex;
  width: 300vw;
  height: 100vh;
  will-change: transform;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 15;
  background: transparent;
}

/* ── Panel ── */
.projects__panel {
  position: relative;
  width: 100vw;
  height: 100vh;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
}

/* ════════════════════════════════════════════
   PANEL 0 — ENTRY
   ════════════════════════════════════════════ */
.projects__panel--entry {
  flex-direction: column;
}

.projects__entry-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2.4rem 3rem;
  max-width: 60vw;
}

.projects__entry-glyph {
  font-family: var(--font-ouarza, 'Cinzel', serif);
  font-size: clamp(4rem, 10vw, 9rem);
  line-height: 1;
  display: block;
  margin-bottom: 2rem;
  color: rgba(220, 200, 170, 0.5);
  text-shadow:
    1px 1px 0 rgba(180, 150, 110, 0.15),
    -1px -1px 0 rgba(0, 0, 0, 0.4),
    0 0 30px rgba(0, 0, 0, 0.3);
  animation: glyphPulse 4s ease-in-out infinite;
}

@keyframes glyphPulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.7; }
}

.projects__entry-line {
  font-family: var(--font-ouarza, 'Cinzel', serif);
  font-size: clamp(2.8rem, 6vw, 6rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin: 0 0 3rem;
  color: rgba(235, 225, 210, 0.85);
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(0, 0, 0, 0.4);
}

.projects__entry-hint {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  opacity: 0.35;
  animation: hintPulse 2.4s ease-in-out infinite;
}

.projects__entry-hint-text {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(220, 200, 170, 0.6);
}

.projects__entry-hint-arrow {
  font-size: 1rem;
  color: var(--ouarza-accent, #c47a2a);
  display: inline-block;
  animation: arrowSlide 2.4s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.6; }
}

@keyframes arrowSlide {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(6px); }
}

/* ════════════════════════════════════════════
   ENGRAVED TEXT — project info panels
   ════════════════════════════════════════════ */
.project__engraved {
  position: relative;
  z-index: 4;
  max-width: 42vw;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 2rem 0;
}

.project__bg-name {
  position: absolute;
  font-family: var(--font-ouarza, 'Cinzel', serif);
  font-size: clamp(8rem, 18vw, 18rem);
  font-weight: 400;
  letter-spacing: 0.1em;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  white-space: nowrap;
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%);
  line-height: 1;
  color: rgba(255, 255, 255, 0.04);
  text-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

.project__index {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(196, 122, 42, 0.75);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.project__name {
  font-family: var(--font-ouarza, 'Cinzel', serif);
  font-size: clamp(2.4rem, 4.5vw, 4.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  margin: 0;
  color: rgba(240, 230, 215, 0.92);
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.7),
    0 0 25px rgba(0, 0, 0, 0.4);
}

.project__truth {
  font-family: var(--font-serif, 'Playfair Display', serif);
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  line-height: 1.8;
  max-width: 30ch;
  color: rgba(230, 220, 200, 0.82);
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.6),
    0 0 15px rgba(0, 0, 0, 0.3);
}

.project__truth em {
  font-style: italic;
  color: rgba(196, 122, 42, 0.75);
}

.project__enter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  text-decoration: none;
  width: fit-content;
  margin-top: 0.6rem;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(196, 122, 42, 0.3);
  color: rgba(230, 220, 200, 0.72);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.project__enter:hover {
  color: var(--ouarza-accent, #c47a2a);
  border-color: var(--ouarza-accent, #c47a2a);
}

#panel-rezoum {
  justify-content: center;
  align-items: center;
}

#panel-omefree {
  justify-content: center;
  align-items: center;
}

/* ── Panel activation ── */
.projects__panel:not(.projects__panel--entry) .project__engraved {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.projects__panel.is-active .project__engraved {
  opacity: 1;
  transform: translateY(0);
}

/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 900px) {
  .projects-scroll {
    height: auto;
    min-height: 100vh;
  }

  .projects {
    position: relative;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 8rem 0;
  }

  .projects__track {
    flex-direction: column;
    width: 100%;
    height: auto;
    transform: none !important;
  }

  .projects__panel {
    width: 100%;
    height: auto;
    min-height: 80vh;
    padding: 4rem 6vw;
    flex-direction: column;
    gap: 3rem;
    align-items: flex-start;
    justify-content: center;
  }

  .project__engraved {
    max-width: 100%;
  }

  .project__bg-name {
    font-size: clamp(4rem, 20vw, 8rem);
  }

  .projects__panel--entry {
    padding: 4rem 6vw;
    align-items: flex-start;
    justify-content: center;
  }

  .projects__entry-content {
    padding: 0;
    max-width: 100%;
  }

  .projects__panel.is-active .project__engraved {
    opacity: 1;
    transform: translateY(0);
  }

  .projects__panel:not(.projects__panel--entry) .project__engraved {
    opacity: 1;
    transform: translateY(0);
    transition: none;
  }

  .projects__progress {
    display: none;
  }
}

@media (max-width: 600px) {
  .projects__entry-line {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .project__name {
    font-size: clamp(2rem, 7vw, 2.8rem);
  }
}

/* ════════════════════════════════════════════
   HAND WITH ROCK — scroll-driven rising hand
   A hand holding a stone with carved text rises
   from the bottom at each image, then descends.
   ════════════════════════════════════════════ */

/* ── Container — anchored at bottom center of the viewport ── */
.projects__hand-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100vh;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* ── Each hand element ── */
.projects__hand {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(105%);
  width: clamp(260px, 30vw, 440px);
  opacity: 0;
  will-change: transform, opacity;
  /* Smooth out scroll jitter — 100ms is imperceptible but cinematic */
  transition: transform 0.1s ease-out, opacity 0.1s ease-out;
  filter: drop-shadow(0 -8px 30px rgba(0, 0, 0, 0.6))
          drop-shadow(0 -2px 10px rgba(0, 0, 0, 0.4));
}

/* ── The rock image ── */
.projects__hand-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* ════════════════════════════════════════════
   HAND — RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 900px) {
  .projects__hand-container {
    display: none;
  }
}
