/* Project stack: text column + draggable image rail (home page and NDA vault) */

.stack { position: relative; }
.proj {
  position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--ink);
  display: grid; grid-template-columns: minmax(280px, 30%) minmax(0, 1fr);
  align-items: center; column-gap: 4vw; padding-left: var(--gutter);
  border-top: 1px solid rgba(244,239,232,.08);
}
.proj-bg { position: absolute; inset: -60px; z-index: 0; }
.proj-bg img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(28px); opacity: 0; transition: opacity .7s ease;
}
.proj-bg img.on { opacity: .28; }
.proj-text { position: relative; z-index: 2; max-height: 82svh; overflow-y: auto; padding: 8px 0; scrollbar-width: thin; }
.proj-title {
  font-family: var(--font-head); font-size: clamp(30px, 3.4vw, 56px);
  line-height: 1; letter-spacing: -.02em; margin: 0 0 10px;
}
.proj-cat { display: flex; flex-wrap: wrap; gap: 6px; }
.proj-desc { margin-top: 22px; font-size: 15px; line-height: 1.65; color: rgba(244,239,232,.78); }
.proj-links { margin-top: 28px; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.proj-count { margin-top: 26px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.proj-count b { font-family: var(--font-head); font-size: 20px; color: var(--paper); font-weight: 400; }
.proj-rail { position: relative; z-index: 2; min-width: 0; }
.track {
  display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.track::-webkit-scrollbar { display: none; }
.track::after { content: ""; flex: 0 0 18%; }
.track.dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
.slide {
  flex: 0 0 min(80%, 100svh); aspect-ratio: 4/3; scroll-snap-align: start;
  border-radius: 12px; overflow: hidden; background: #000;
  transition: opacity .4s ease, transform .4s ease;
}
.slide:not(.active) { opacity: .45; cursor: pointer; }
.slide img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
/* Videos come in all shapes (portrait, square, wide): show them whole on black instead of cropping */
.slide video { width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; display: block; }
.slide.is-video { position: relative; }
/* Play/pause and sound buttons, only on the slide you're looking at */
.vctl { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.slide.active .vctl { opacity: 1; pointer-events: auto; }
.vctl button {
  width: 44px; height: 44px; border-radius: 999px; border: 0; cursor: pointer; display: grid; place-items: center;
  color: #fff; background: rgba(23,19,26,.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .2s ease, transform .15s ease;
}
.vctl button:hover { background: var(--magenta); }
.vctl button:active { transform: scale(.94); }
.vctl button:focus-visible { outline: 3px solid var(--magenta-hot); outline-offset: 2px; }
.vctl svg { width: 20px; height: 20px; }
.proj.single .slide { flex-basis: min(88%, 105svh); }
.proj.single .track::after { display: none; }
/* Slideshow arrows: flat magenta */
.rail-arrow {
  position: absolute; top: 50%; z-index: 3;
  width: 62px; height: 62px; border-radius: 999px; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: var(--magenta);
  transform: translateY(-50%);
  transition: background .2s ease, transform .2s ease;
}
.rail-arrow svg { width: 28px; height: 28px; display: block; }
.rail-prev svg { transform: scaleX(-1); }
.rail-arrow:hover { background: var(--magenta-hot); }
.rail-arrow:active { transform: translateY(-50%) scale(.94); }
.rail-arrow:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.rail-arrow[hidden] { display: none; }
.rail-next { right: calc(var(--gutter) + 2%); }
.rail-prev { left: 16px; }
/* Hint: the arrow inside the next button nudges forward now and then */
.rail-next svg { animation: nudge 2.4s ease-in-out infinite; }
.rail-next:hover svg { animation: none; }
.rail-next.restart svg { animation: none; }
/* Round "next project" button, stacked under the back-to-start button on a project's last image */
.rail-nextproj { top: calc(50% + 43px); right: calc(var(--gutter) + 2%); transform: none; }
.rail-nextproj:active { transform: scale(.94); }
/* Next project is teal (like the intro) so it reads apart from the magenta image arrows */
.rail-nextproj { background: var(--teal); color: var(--ink); }
.rail-nextproj:hover { background: #b8cfc2; }
/* Single-image projects: no slideshow arrows, so the next-project button takes the arrow's place */
.proj.single .rail-nextproj { top: 50%; transform: translateY(-50%); }
.proj.single .rail-nextproj:active { transform: translateY(-50%) scale(.94); }
@keyframes nudge { 0%, 70%, 100% { transform: translateX(0); } 80% { transform: translateX(4px); } 90% { transform: translateX(0); } }

@media (max-width: 720px) {
  .proj {
    position: relative; height: auto; display: flex; flex-direction: column; align-items: stretch;
    padding: 72px 0 56px;
  }
  .proj-text { display: contents; }
  .proj-head { order: 1; padding: 0 var(--gutter) 18px; }
  .proj-rail { order: 2; }
  .proj-body { order: 3; padding: 0 var(--gutter); }
  .track { padding-left: var(--gutter); scroll-padding-left: var(--gutter); gap: 12px; }
  .slide, .proj.single .slide { flex-basis: 84%; }
  .proj.single .slide { flex-basis: calc(100% - 2 * var(--gutter)); }
  .rail-arrow { width: 48px; height: 48px; }
  .rail-arrow svg { width: 22px; height: 22px; }
  .rail-next { right: 12px; }
  .rail-nextproj { right: 12px; top: calc(50% + 34px); }
  .proj.single .rail-nextproj { top: 50%; }
  .proj-count { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rail-next svg { animation: none; }
}
