/**
 * Portfolio Depth widget (WebGL).
 *
 * The wrapper is a tall scroll track (--pd-len); the inner .pd-pin is pinned
 * full-viewport by ScrollTrigger and holds the <canvas> plus the meta overlay.
 * When WebGL can't run (.pd-static), the wrapper collapses and the .pd-fallback
 * list of real links/images is shown instead (also the crawlable markup).
 */

.portfolio-depth-block {
  position: relative;
  width: 100%;
}

.portfolio-depth-block.pd-active {
  height: var(--pd-len, 600vh);
}

/* ---------------------------------------------------------------------------
 * Pinned stage + canvas
 * ------------------------------------------------------------------------- */
.portfolio-depth-block .pd-pin {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.portfolio-depth-block .pd-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------------------------------------------------------------------------
 * Meta overlay (tracks the focused project)
 * ------------------------------------------------------------------------- */
.portfolio-depth-block .pd-meta {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32%;
  display: flex;
  align-items: center;
  z-index: 2;
  pointer-events: none;
  color: #f4f4f4;
  transition: color 0.6s ease;
}

.portfolio-depth-block.pd-panel-left .pd-meta {
  left: 6%;
}

.portfolio-depth-block.pd-panel-right .pd-meta {
  right: 6%;
  text-align: right;
}

.portfolio-depth-block .pd-meta-items {
  position: relative;
  width: 100%;
}

.portfolio-depth-block .pd-meta-item {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.portfolio-depth-block .pd-meta-item.is-active {
  opacity: 1;
  visibility: visible;
}

.portfolio-depth-block .pd-index {
  display: block;
  line-height: 1;
  margin-bottom: 0.5em;
  font-size: 1.1em;
  opacity: 0.7;
}

.portfolio-depth-block .pd-title {
  margin: 0 0 0.3em;
  color: inherit;
}

.portfolio-depth-block .pd-cat {
  margin-bottom: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8em;
  opacity: 0.85;
}

.portfolio-depth-block .pd-desc {
  margin-bottom: 1.4em;
  max-width: 32ch;
  opacity: 0.9;
}

.portfolio-depth-block.pd-panel-right .pd-desc {
  margin-left: auto;
}

/* The button is the click target — re-enable pointer events on it. Keep the
   theme's inline-flex layout (gap + ::before/::after ticks) intact: only the
   pointer-events and a little top spacing are added here. */
.portfolio-depth-block .pd-view {
  pointer-events: auto;
  margin-top: 0.4em;
}

/* ---------------------------------------------------------------------------
 * Fallback / SEO list (shown only when WebGL is off)
 * ------------------------------------------------------------------------- */
.portfolio-depth-block .pd-fallback {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.portfolio-depth-block .pd-fallback-item img {
  display: block;
  width: 100%;
  height: auto;
}

.portfolio-depth-block .pd-fallback-title {
  display: block;
  margin-top: 0.6em;
}

/* When WebGL is active the pin/canvas render; hide the fallback list. */
.portfolio-depth-block.pd-active .pd-fallback {
  display: none;
}

/* When static (no WebGL / editor / reduced motion): hide the canvas stage,
   collapse the scroll track, show the fallback grid. */
.portfolio-depth-block.pd-static {
  height: auto;
}

.portfolio-depth-block.pd-static .pd-pin {
  display: none;
}

/* ---------------------------------------------------------------------------
 * Mobile
 * ------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .portfolio-depth-block .pd-meta {
    width: 86%;
    left: 7%;
    right: 7%;
    align-items: flex-end;
    padding-bottom: 8vh;
  }

  .portfolio-depth-block.pd-panel-right .pd-meta {
    text-align: left;
  }

  .portfolio-depth-block .pd-fallback {
    grid-template-columns: 1fr;
  }
}
