/* =========================================================
   Pacoche explorer — click a stack layer to view that date.
   Depends on tokens from style.css (:root variables, .device, .traj).
   ========================================================= */

.forest__viewer { margin: 0; justify-self: center; width: min(340px, 100%); }
.forest__viewer figcaption { text-align: center; margin-top: 14px; font-size: 15px; color: var(--mist); }

/* viewer inside the device frame */
.pv {
  position: relative; aspect-ratio: 549 / 1040; border-radius: 26px; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #15283a 0%, #08121b 70%);
}
.pv__img {
  position: absolute; left: 8%; top: 18%; width: 84%; height: 72%;
  object-fit: contain; opacity: 0; transform: scale(.97);
  transition: opacity .45s var(--ease), transform .6s var(--ease);
}
.pv__img.is-on { opacity: 1; transform: none; }
.pv__label { position: absolute; left: 20px; top: 18px; right: 20px; display: grid; gap: 2px; }
.pv__year {
  font-family: var(--display); font-weight: 800; font-size: clamp(36px, 4vw, 46px); line-height: 1;
  letter-spacing: -0.03em; font-variation-settings: "wdth" 80; font-variant-numeric: tabular-nums;
}
.pv__year.is-swap { animation: pvSwap .45s var(--ease); }
@keyframes pvSwap { from { opacity: 0; transform: translateY(10px); } }
.pv__note { font-family: var(--display); font-size: 13px; color: var(--mist); }
.pv__key { position: absolute; left: 16px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px 12px; font-family: var(--display); font-size: 12px; color: var(--mist); }
.pv__key span { display: inline-flex; align-items: center; gap: 6px; }
.pv__key i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.pv.is-sum .pv__img { top: 15%; height: 50%; }
.pv__key.is-sum {
  flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 3px;
  left: 14px; right: 14px; bottom: 12px; font-size: 11px; line-height: 1.15;
}
.traj__title { font-family: var(--display); font-weight: 700; font-size: 15px; margin: 0 0 10px; }
.forest__stack .traj { flex-direction: column; align-items: flex-start; gap: 8px; }

/* clickable 3D stack */
.pstack { position: relative; height: clamp(360px, 38vw, 470px); perspective: 1600px; margin: 18px 0 12px; overflow: hidden; contain: paint; }
.pstack__iso { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(58deg) rotateZ(-36deg); }
.player {
  position: absolute; left: 44%; top: 62%; width: min(170px, 36%); aspect-ratio: 549 / 936;
  translate: -50% -50%; padding: 0; border: 0; background: none; cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .55s var(--ease), opacity .3s, filter .3s;
}
.player img {
  width: 100%; height: 100%; pointer-events: none;
  filter: drop-shadow(0 0 1px rgba(230, 234, 216, .55)) drop-shadow(0 14px 14px rgba(0, 0, 0, .45));
}
.player:hover, .player.is-hover { filter: brightness(1.25); }
.pstack.has-active .player:not(.is-active) { opacity: .8; }
.player.is-active img {
  filter: drop-shadow(0 0 1.5px #f4f1d0) drop-shadow(0 0 12px rgba(143, 194, 90, .75)) drop-shadow(0 18px 16px rgba(0, 0, 0, .5));
}

/* date buttons (also the keyboard / mobile control) */
.pdates { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.pdates button {
  font-family: var(--display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums;
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.pdates button:hover, .pdates button.is-hover { border-color: var(--lichen); }
.pdates button[aria-selected="true"] { background: var(--lichen); color: var(--orbit); border-color: var(--lichen); }

/* on one-column layouts, show the viewer right under the controls */
@media (max-width: 860px) {
  .forest__viewer { order: 2; width: min(300px, 100%); }
}
@media (max-width: 600px) {
  .pstack { height: 340px; }
  .player { width: 40%; top: 66%; }
}
