/* PB005 — Living Pyramid · Optical Motion. Isolated creative branch.
   Every rule is scoped to .pb005* — nothing here touches the host page. */

.pb005 {
  --pb-lemon: #f0e20f;
  --pb-lemon-pale: #fff6aa;
  --pb-warm: #f7f5f0;
  --pb-dim: rgba(247, 245, 240, 0.7);
  --pb-faint: rgba(247, 245, 240, 0.46);
  --pb-hair: rgba(247, 245, 240, 0.14);
  --pb-char: #111311;
  --pb-char-2: #181a17;
  --pb-serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --pb-sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --pb-mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  --pb-size: clamp(70px, 6.6vw, 96px); /* object height; width follows the solid */
  position: relative;
  font-family: var(--pb-sans);
  color: var(--pb-warm);
}

/* —— RESTING OBJECT ———————————————————————————————————————— */
.pb005-open {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 0.55rem;
  min-width: 44px;
  min-height: 44px;
  padding: 4px;
  margin: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.pb005-open:focus { outline: none; }
.pb005-open:focus-visible {
  outline: 2px solid var(--pb-lemon);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(6, 7, 6, 0.6);
}
.pb005-open__obj {
  display: block;
  height: var(--pb-size);
  flex: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}
.pb005-open__obj svg { height: 100%; width: auto; display: block; overflow: visible; }
.pb005-open__obj, .pb005-stage { contain: layout style; }
.pb005-host-dock { contain: layout style; }
.pb005-open__cap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding-bottom: 0.55rem;
  text-align: right;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.pb005-open__side {
  font: 500 0.625rem/1.2 var(--pb-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pb-lemon);
}
.pb005-open__name {
  font: italic 400 0.8125rem/1.25 var(--pb-serif);
  color: var(--pb-warm);
  max-width: 11rem;
}
.pb005--no-caption .pb005-open__cap { display: none; }

/* —— OBJECT MATERIALS ————————————————————————————————————— */
.pb005-obj { overflow: visible; }
.pb005-obj .pb005-face,
.pb005-obj .pb005-envelope,
.pb005-obj .pb005-seam,
.pb005-obj .pb005-marks *,
.pb005-obj .pb005-keyline polygon { vector-effect: non-scaling-stroke; }
.pb005-obj .pb005-face { stroke-linejoin: round; }
.pb005-obj .pb005-envelope { stroke: rgba(247, 245, 240, 0.2); stroke-width: 0.8; stroke-dasharray: 1.5 3.5; }
.pb005-obj .pb005-seam { stroke: var(--pb-lemon, #f0e20f); stroke-width: 1.4; stroke-linecap: round; }
.pb005-obj .pb005-sheen { mix-blend-mode: screen; pointer-events: none; }
.pb005-obj .pb005-core { mix-blend-mode: screen; pointer-events: none; }
.pb005-obj .pb005-caustic { mix-blend-mode: screen; }
.pb005-obj .pb005-glow { pointer-events: none; mix-blend-mode: screen; }
.pb005-obj .pb005-inner polygon { vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.pb005-obj .pb005-ripple { mix-blend-mode: screen; pointer-events: none; }
.pb005-obj--pressure .pb005-envelope { stroke-opacity: 0.6; }
.pb005-obj--pressure .pb005-seam { stroke: rgba(247, 245, 240, 0.55); stroke-width: 1; }

.pb005-obj--registration .pb005-marks { fill: none; stroke: rgba(247, 245, 240, 0.85); stroke-width: 0.9; }
.pb005-obj--registration .pb005-envelope { stroke: rgba(247, 245, 240, 0.22); stroke-dasharray: 2 5; }
.pb005-obj--registration .pb005-plate { fill: rgba(22, 24, 22, 0.92); }
.pb005-obj--registration .pb005-plate.is-preview { fill: rgba(70, 73, 67, 0.95); }
.pb005-obj--registration .pb005-plate-shadow { fill: rgba(0, 0, 0, 0.32); }
.pb005-obj--registration .pb005-ink { fill: var(--pb-lemon, #f0e20f); mix-blend-mode: normal; }
.pb005-obj--registration .pb005-keyline polygon { fill: none; stroke: rgba(247, 245, 240, 0.92); stroke-width: 0.9; }

.pb005-obj.is-pickable [data-side] { cursor: pointer; }
.pb005-obj.is-pickable { touch-action: manipulation; }

/* —— EXPANDED INSTRUMENT ————————————————————————————————————— */
.pb005-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pb-warm);
  overflow: hidden;
  font-family: var(--pb-sans);
}
.pb005-panel::backdrop { background: transparent; }
.pb005-panel[open] { display: grid; place-items: center; }
.pb005-veil {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(10, 12, 10, 0.7), rgba(4, 5, 4, 0.92));
}
.pb005-surface {
  position: relative;
  width: min(880px, calc(100vw - 2rem));
  max-height: min(92vh, 92dvh);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.6rem 1.75rem 1.4rem;
  border-radius: 14px;
  background:
    radial-gradient(90% 70% at 22% 30%, rgba(240, 226, 15, 0.045), transparent 60%),
    linear-gradient(180deg, var(--pb-char-2), var(--pb-char));
  box-shadow: 0 0 0 1px rgba(247, 245, 240, 0.1), 0 30px 90px rgba(0, 0, 0, 0.55);
}
.pb005-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  align-items: start;
  padding-bottom: 1.1rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--pb-hair);
}
.pb005-kicker {
  margin: 0;
  grid-column: 1;
  font: 500 0.6875rem/1.3 var(--pb-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pb-lemon);
}
.pb005-title {
  margin: 0;
  grid-column: 1;
  font: 400 clamp(1.4rem, 2.6vw, 1.85rem)/1.15 var(--pb-serif);
  letter-spacing: -0.01em;
  color: var(--pb-warm);
}
.pb005-close {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.95rem;
  border: 1px solid rgba(247, 245, 240, 0.32);
  border-radius: 999px;
  background: transparent;
  color: var(--pb-warm);
  font: 500 0.6875rem/1 var(--pb-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.pb005-close:hover { border-color: var(--pb-warm); }
.pb005-close:focus-visible,
.pb005-dest:focus-visible { outline: 2px solid var(--pb-lemon); outline-offset: 3px; }

.pb005-body {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 1.75rem;
  align-items: center;
}
.pb005-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.86;
  max-height: 320px;
}
.pb005-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.pb005[data-treatment="registration"] .pb005-stage { display: none; }
.pb005[data-treatment="registration"] .pb005-body { grid-template-columns: 1fr; }

.pb005-dests { display: flex; flex-direction: column; gap: 0.35rem; }
.pb005-dest {
  display: grid;
  grid-template-columns: 7.25rem 1fr;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: 64px;
  padding: 0.85rem 1rem 0.85rem 0.6rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background-color 0.18s ease;
}
.pb005-dest:hover { background: rgba(247, 245, 240, 0.045); }
.pb005-dest.is-current {
  background: rgba(240, 226, 15, 0.06);
  box-shadow: inset 2px 0 0 var(--pb-lemon);
}
.pb005-key { display: flex; justify-content: center; align-items: center; height: 100%; }
.pb005-key__svg { width: calc(6.5rem * var(--kw)); height: 1.625rem; overflow: visible; display: block; }
.pb005-key__plate { fill: #22241f; }
.pb005-key__ink { fill: var(--pb-lemon); }
.pb005-key__line { fill: none; stroke: rgba(247, 245, 240, 0.62); stroke-width: 1; }
.pb005[data-treatment="crystal"] .pb005-key__plate { fill: rgba(214, 222, 218, 0.1); }
.pb005[data-treatment="crystal"] .pb005-key__ink { fill: rgba(240, 226, 15, 0.82); }
.pb005[data-treatment="pressure"] .pb005-key__plate { fill: #34362f; }
.pb005[data-treatment="pressure"] .pb005-key__line { stroke: rgba(0, 0, 0, 0.6); }
.pb005-flight svg { z-index: 4; pointer-events: none; }

.pb005-dest__text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.pb005-dest__meta {
  font: 500 0.6875rem/1.3 var(--pb-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pb-faint);
}
.pb005-dest.is-current .pb005-dest__meta { color: var(--pb-lemon); }
.pb005-dest__name {
  font: 400 clamp(1.15rem, 2.1vw, 1.45rem)/1.2 var(--pb-serif);
  color: var(--pb-warm);
}
.pb005-dest__desc { font: 400 0.875rem/1.45 var(--pb-sans); color: var(--pb-dim); }
.pb005-foot {
  margin: 1.25rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--pb-hair);
  font: 400 0.6875rem/1.4 var(--pb-mono);
  letter-spacing: 0.06em;
  color: var(--pb-faint);
}
.pb005-flight { position: fixed; inset: 0; pointer-events: none; z-index: 3; }

/* 03 — the list IS the exploded pyramid: strata keys on one registration axis */
.pb005[data-treatment="registration"] .pb005-surface { width: min(720px, calc(100vw - 2rem)); }
.pb005[data-treatment="registration"] .pb005-dests { position: relative; gap: 0.15rem; }
.pb005[data-treatment="registration"] .pb005-dests::before {
  content: "";
  position: absolute;
  left: calc(0.6rem + 5.5rem);
  top: 0.25rem;
  bottom: 0.25rem;
  border-left: 1px dashed rgba(247, 245, 240, 0.2);
  pointer-events: none;
}
.pb005[data-treatment="registration"] .pb005-dest { grid-template-columns: 11rem 1fr; min-height: 78px; }
.pb005[data-treatment="registration"] .pb005-key__svg { width: calc(10rem * var(--kw)); height: 2.5rem; }

html.pb005-scroll-lock { overflow: hidden; }

/* —— PHONE —————————————————————————————————————————————— */
@media (max-width: 640px) {
  .pb005 { --pb-size: 66px; }
  .pb005-open__name { display: none; }
  .pb005-panel[open] { place-items: stretch; }
  .pb005-surface {
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding:
      max(1.1rem, env(safe-area-inset-top, 0px))
      max(1rem, env(safe-area-inset-right, 0px))
      max(1.2rem, env(safe-area-inset-bottom, 0px))
      max(1rem, env(safe-area-inset-left, 0px));
  }
  .pb005-body { grid-template-columns: 1fr; gap: 0.5rem; }
  /* the object stays above the list visually; it is aria-hidden and not in tab order */
  .pb005-stage { order: -1; aspect-ratio: auto; height: min(26vh, 210px); max-height: none; margin: 0.25rem 0 0.5rem; }
  .pb005-dest { grid-template-columns: 5.25rem 1fr; gap: 0.75rem; padding: 0.75rem 0.75rem 0.75rem 0.4rem; }
  .pb005-key__svg { width: calc(4.75rem * var(--kw)); height: 1.2rem; }
  .pb005-dest__desc { font-size: 0.8125rem; }
  .pb005[data-treatment="registration"] .pb005-surface { width: 100%; }
  .pb005[data-treatment="registration"] .pb005-dest { grid-template-columns: 7rem 1fr; }
  .pb005[data-treatment="registration"] .pb005-dests::before { left: calc(0.4rem + 3.5rem); }
  .pb005[data-treatment="registration"] .pb005-key__svg { width: calc(6.5rem * var(--kw)); height: 1.6rem; }
}
@media (max-width: 640px) and (orientation: landscape) {
  .pb005-body { grid-template-columns: 0.8fr 1.2fr; }
  .pb005-stage { order: 0; height: 60vh; }
}

/* —— STILL / REDUCED MOTION ———————————————————————————————— */
.pb005[data-motion="still"] .pb005-dest { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .pb005 .pb005-dest { transition: none; }
}

/* —— HOST DOCK (Room 002 instrument, ?pb005-optical only) ——————————— */
.pb005-host-dock {
  /* last child of the instrument: owns a quiet row at the very end, and while
     the reader is inside the instrument it rides the lower-right of the photograph */
  position: sticky;
  bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + var(--pb005-lift, 0px));
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
  pointer-events: none;
}
.pb005-host-dock__in { pointer-events: auto; }
.pb005-devfield__row { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
