/* ── Dock Scroll Layout ─────────────────────────────────────────────── */

/* Hide scrollbar on the home panel without disabling scroll */
.home-panel {
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* IE/Edge */
}
.home-panel::-webkit-scrollbar {
  display: none;                   /* Chrome/Safari */
}

.dock-spacer {
  width: 100%;
  pointer-events: none;
}

.dock-overlay {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  /* Negative margin pulls subsequent content up so spacer alone drives scroll height */
  margin-bottom: -100vh;
}

.dock-track {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22vw;
  height: 100%;
  background: transparent;
  pointer-events: none;
  z-index: 0;
}

.dock-stack {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.dock-item {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: auto;
  will-change: transform;
  overflow: visible;
  text-decoration: none;
}

.dock-item figure {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* Exit timing (unhover): expo-out — figure reveals smoothly while text rises away */
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Hover effect (pointer devices only) ──────────────────────────── */
@media (hover: hover) and (pointer: fine) {
  .dock-item:hover figure {
    opacity: 0.25;
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

.dock-hover-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  text-align: center;
  color: #fff;
  font-size: 1rem;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
}

.dock-hover-text p {
  margin: 0;
  color: #fff;
  max-width: none; /* override global "p { max-width: 90% }" rule */
}

/* Enter: text moves up from below, expo-out (decelerating) */
@keyframes dockHoverEnter {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 24px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Exit: text moves up (expo-in feel), opacity holds then smoothly fades in the final stretch */
@keyframes dockHoverExit {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%);
    /* Segment 0→55%: expo-in on the upward movement */
    animation-timing-function: cubic-bezier(0.7, 0, 0.84, 0);
  }
  55% {
    opacity: 1;
    transform: translate(-50%, calc(-50% - 14px));
    /* Segment 55→100%: gentle ease-out on the fade + remaining movement */
    animation-timing-function: cubic-bezier(0.33, 1, 0.68, 1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 24px));
  }
}

.dock-item.is-hover .dock-hover-text {
  animation: dockHoverEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dock-item.is-leaving .dock-hover-text {
  /* Timing functions defined per-segment inside the keyframes */
  animation: dockHoverExit 0.4s linear forwards;
}

.dock-item .thumb-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dock-item .thumb-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  border: 0;
  pointer-events: none;
  /* Scale slightly larger than container so video fully covers the poster
     edges and there's no subpixel bleed. Figure's overflow: hidden clips it. */
/*
  transform: scale(1.02);
  transform-origin: center center;
*/
  transition: opacity 0.3s ease;
}

.dock-item figure.video-ready .thumb-video {
  opacity: 1;
}

/* Placeholder for items with no image */
.dock-item .dock-placeholder {
  width: 100%;
  height: 100%;
  background: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0,0,0,0.22);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
}


/* ── Info Panel ────────────────────────────────────────────────────── */

.info-panel {
  background: #28201B;
  color: #fff;
  overflow-y: auto;
}

.info-panel p,
.info-panel ul,
.info-panel li,
.info-panel a,
.info-panel a:visited {
  color: #fff;
}

.info-inner {
  padding: 6vw 3vw 3vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.info-portrait {
  display: flex;
  justify-content: center;
  margin-bottom: 2vw;
}

.info-portrait img {
  display: block;
  width: auto;
  max-width: 10.08vw;
  height: auto;
}

.info-hero {
  font-family: 'NeueHaasGrot', sans-serif;
  font-size: 4.5vw;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 4vw;
  max-width: 85vw;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.info-hero br {
  display: block;
}

.info-columns {
  padding-top: 2vw;
}

.info-columns h4 {
  color: #808080 !important;
}

/* ── Index overlay ─────────────────────────────────────────────────── */

.index-overlay {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  margin-bottom: -100vh;
  background: #28201B;
  z-index: 5;
  overflow-y: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 400ms ease;
  color: #ccc;
  /* Only handle vertical pans here; horizontal swipes propagate up to the
     page slider so users can swipe to the info panel from the index. */
  touch-action: pan-y;
}

body.index-open .index-overlay {
  opacity: 1;
  pointer-events: auto;
}

.index-list {
  padding: 12vh 3vw 3vw 3vw;
  width: 100%;
  box-sizing: border-box;
}

.index-overlay .index-row,
.index-overlay .index-row:visited {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-areas:
    "title tags year"
    "description . .";
  column-gap: 3vw;
  align-items: start;
  padding: 1.5rem 0;
  min-height: 10rem;
  box-sizing: border-box;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-decoration: none !important;
  color: #fff;

  opacity: 0;
  transform: translateY(60px);
  transition:
    opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0ms;
  will-change: opacity, transform;
}

.index-col-title       { grid-area: title; }
.index-col-tags        { grid-area: tags; }
.index-col-year        { grid-area: year; }
.index-col-description { grid-area: description; }

body.index-open .index-overlay .index-row,
body.index-open .index-overlay .index-row:visited {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(var(--row-index, 0) * 120ms + 250ms);
}

/* Each row carries its own thumb HTML, but only as a data source.
   The actual rendered thumb lives in a single shared .index-hover-thumb
   container at the overlay level (so the iframe sits in the overlay's
   layout flow and Safari can route wheel events to the scroll container). */
.index-col-thumb {
  display: none;
}

.index-hover-thumb {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 250ms ease;
  z-index: 10;
  width: auto;
}

.index-hover-thumb.is-active {
  opacity: 1;
}

/* Transparent overlay above the iframe so Safari's iframe wheel-capture
   doesn't break index overlay scroll when the cursor sits over the thumb. */
.index-thumb .index-thumb-shield {
  position: absolute;
  inset: 0;
  z-index: 99;
  transform: translateZ(0);
}

.index-thumb {
  aspect-ratio: var(--ratio, 1);
  /* Fallback for browsers without sqrt(): fixed 30vw width (slightly off optical size) */
  width: 30vw;
  /* Optical-equivalent sizing: area ≈ 30vw² regardless of ratio */
  width: calc(30vw * sqrt(var(--ratio, 1)));
  height: auto;
  max-width: 60vw;
  max-height: 80vh;
  margin: 0;
  background: transparent;
}

.index-row:hover .index-col-thumb {
  opacity: 1;
}

.index-col-description {
  margin-top: 1em;
  width: 60%;
  height: 5em;
  overflow: hidden;
  opacity: 0;
  transition: opacity 250ms ease;
}

.index-col-description,
.index-col-description p {
  color: #fff;
}

.index-col-tags,
.index-col-year {
  color: #fff;
  opacity: 0.7;
  transition: opacity 250ms ease;
}

.index-row:hover .index-col-description,
.index-row:hover .index-col-tags,
.index-row:hover .index-col-year {
  opacity: 1;
}

.index-col-description p:last-of-type {
  margin: 0;
}

.index-thumb img,
.index-thumb iframe,
.index-thumb video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  pointer-events: none;
}

/* Home thumbnails scale down (opposite of intro) when index opens */
.dock-stack {
  transform-origin: center center;
  transition:
    transform 600ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 250ms;
}

body.index-open .home-panel .dock-stack {
  transform: scale(0);
  opacity: 0;
  transition:
    transform 600ms cubic-bezier(0.7, 0, 0.84, 0),
    opacity 600ms cubic-bezier(0.7, 0, 0.84, 0);
  pointer-events: none;
}


.index-thumb-poster .index-thumb-img {
  width: auto;
  height: 90%;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  object-fit: contain;
}

.index-thumb-poster .index-thumb-video {
  height: 90%;
  top: 5%;
}

@media (max-width: 900px) {
  .info-hero {
    font-size: 7vw;
    margin-bottom: 8vw;
  }

  .info-portrait {
    margin-top: 6vw;
    margin-bottom: 4vw;
  }

  .info-portrait img {
    max-width: 25vw;
  }

  .textColumns.info-columns {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    height: auto;
  }

  .info-columns .col-4 {
    width: 50%;
    padding: 0 1.5vw;
    margin: 0 0 2rem 0;
    box-sizing: border-box;
  }

  .index-overlay .index-row,
  .index-overlay .index-row:visited {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "title description"
      "title year"
      "title tags";
    row-gap: 1em;
    min-height: 0;
  }

  /* Hide the thumb entirely on mobile (no hover effect on touch devices). */
  .index-col-thumb,
  .index-hover-thumb {
    display: none;
  }

  .index-col-description {
    opacity: 0.7;
    width: auto;
    height: auto;
    overflow: visible;
    margin-top: 0;
  }
}

