/* Pose Studio page-specific styles. Shares tokens and components with /style.css
   (rail, panel, steps, seg, btn-primary, unit); only what is unique to this page lives here. */

/* app-mode shell: #panel_pose / #panel_base are both present in the DOM, one hidden. Each must be
   a flex column that fills #panel so its own .panel-body scrolls (overflow-y:auto) and .panel-foot
   stays pinned - otherwise a tall panel (Base with Fine-tuning expanded) overflows the clipped
   #panel and traps the status/controls off-screen. ID+class beats the plain .hidden reset. */
.hidden { display: none; }
#panel_pose, #panel_base { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#panel_pose.hidden, #panel_base.hidden { display: none; }

/* rail-tool is styled in /style.css for a <span>; the mode switch made both icons real
   <button> elements (clickable, focusable) - reset native button chrome (but NOT padding: the
   labelled rail sets its own padding in /style.css) so they render like the styled tool. */
button.rail-tool {
  font: inherit; cursor: pointer; appearance: none;
}

/* joints list (one entry per placed cut; a chip tints with the part it frees via CSSOM) */
#regions { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; min-height: 1.5rem; }
#regions .rg {
  display: flex; align-items: center; gap: 0.5rem;
  cursor: pointer; padding: 0.32rem 0.35rem 0.32rem 0.6rem;
  background: var(--surface); border: 1px solid var(--line-input);
  font-family: var(--f-mono); font-size: 0.69rem; letter-spacing: 0.06em; color: var(--ink-soft);
  transition: border-color .15s, color .15s;
}
/* freed-part tint chip (set) / awaiting-partner-cut chip (pending, dashed and empty) */
.rg-chip {
  display: inline-block; flex-shrink: 0;
  width: 0.75rem; height: 0.75rem; margin-right: 0.5rem;
  vertical-align: middle; border-radius: 2px;
  border: 1px solid transparent; background: transparent;
}
.rg-chip.pending { border: 1px dashed var(--muted); background: transparent; }
.rg-x {
  margin-left: auto; flex-shrink: 0;
  width: 1.25rem; height: 1.25rem; padding: 0; cursor: pointer;
  background: transparent; border: none; border-radius: 0;
  font-family: var(--f-mono); font-size: 0.85rem; line-height: 1;
  color: var(--muted); transition: color .15s;
}
.rg-x:hover { color: var(--danger); }
#regions .rg:hover { color: var(--ink); }
#regions .rg.sel { color: var(--ink); background: var(--panel-foot); }
.rg-empty { font-family: var(--f-mono); font-size: 0.66rem; color: var(--muted); letter-spacing: 0.06em; }

/* small secondary action (Undo / Reset / Demo) */
.btn-sub {
  display: inline-block; margin-top: 0.9rem; padding: 0.5rem 0.9rem; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-input); border-radius: 0;
  color: var(--ink); font-family: var(--f-sans); font-size: 0.78rem;
  transition: border-color .15s;
}
.btn-sub:hover { border-color: var(--accent); }
.filepick .btn-sub { margin-top: 0; flex-shrink: 0; }

/* how-to hint, spec-sheet footnote style */
.pose-hint {
  padding: 1.2rem 0 1.5rem;
  font-family: var(--f-mono); font-size: 0.66rem; line-height: 1.75;
  letter-spacing: 0.02em; color: var(--ink-soft);
}

/* #status / #base_status: hidden state carriers now (the [hidden] attribute keeps them out of the
   layout); the rules below still apply if a future surface un-hides them. */
#status, #base_status {
  margin-top: 0.85rem; min-height: 1rem;
  font-family: var(--f-mono); font-size: 0.63rem; letter-spacing: .08em;
  line-height: 1.5; color: var(--ink-soft); white-space: pre-wrap;
}
/* #base_status is given a className of "warn"/"error"/"ok" from pose.js's baseStatus() (staleness,
   generation failure, success) - colour it with the same tokens the old (removed) #warnings block
   used, so the state is actually visible instead of falling back to the neutral --ink-soft above. */
#base_status.warn { color: var(--warn); }
#base_status.error { color: var(--danger); }
#base_status.ok { color: var(--ok); }

/* STL load overlay: same spec-sheet voice as the vp-tag / corner marks. It must read while the
   main thread is frozen (sync parse+BVH), so the message is static text painted up-front; the
   sweep bar animates only in the frames before/after the freeze. */
#vp_loading {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(22, 22, 22, 0.72);
}
#vp_loading[hidden] { display: none; }
.vpl-box {
  display: flex; flex-direction: column; gap: 0.55rem;
  padding: 1.1rem 1.4rem; min-width: 16rem;
  background: #161616; border: 1px solid var(--accent);
}
/* The sweep animates TRANSFORM (runs on the compositor thread), NOT background-position (main
   thread). The STL parse + BVH build freeze the main thread for seconds, and a main-thread
   animation stalls with it (the bar looked frozen). A transform animation keeps ticking on the
   compositor while the main thread is blocked, so the bar reads as "working" during the load. The
   overlay is painted (double-rAF in loadFile) before the heavy work starts, so the layer is
   promoted in time; will-change pins it to its own compositor layer. */
.vpl-bar {
  position: relative; overflow: hidden;
  height: 2px; width: 100%;
  background: rgba(255, 255, 255, 0.08);   /* faint track under the moving highlight */
}
.vpl-bar::before {
  content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  will-change: transform;
  animation: vpl-sweep 1.1s linear infinite;
}
@keyframes vpl-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) { .vpl-bar::before { animation: none; transform: translateX(75%); } }
#vp_loading_text {
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: #F5F4F0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24rem;
}
.vpl-sub { font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.08em; color: #8a8a86; }

/* imported custom base: file chip under the "Base model" segment - shows WHICH file is in use
   and offers one clear action (change). Spec-sheet voice like the joints list. */
.base-import-file {
  display: flex; align-items: center; gap: 0.6rem;
  margin-top: 0.5rem; margin-bottom: 0.9rem; padding: 0.45rem 0.6rem;
  background: var(--surface); border: 1px solid var(--line-input);
}
.bif-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--f-mono); font-size: 0.69rem; letter-spacing: 0.04em; color: var(--ink);
}
.base-import-file .bif-name:empty::before,
.base-import-file[data-empty="true"] .bif-name { color: var(--muted); }
.bif-change {
  flex-shrink: 0; padding: 0.15rem 0.3rem; cursor: pointer;
  background: transparent; border: none;
  font-family: var(--f-mono); font-size: 0.63rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.bif-change:hover { text-decoration: underline; }
.bif-change:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* quiet auto-regen badge: a pose change rebuilds the base in the background - viewport tag
   (top-left, inside the crop mark) with a pulsing accent square (LINESIGHT loader voice),
   never the blocking overlay */
#vp_regen {
  position: absolute; left: 2.125rem; top: 1.9rem; z-index: 3; pointer-events: none;
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--f-mono); font-size: 1.26rem; letter-spacing: 0.16em; color: var(--d-muted);
}
#vp_regen[hidden] { display: none; }
#vp_regen::before {
  content: ""; width: 0.8rem; height: 0.8rem; background: var(--accent);
  animation: vp-regen-pulse 0.9s ease-in-out infinite;
}
@keyframes vp-regen-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #vp_regen::before { animation: none; } }

/* outliner-lite: the scene's two assets (mini, base) above the tool panels - always visible,
   mode-agnostic. Same chip recipe as .base-import-file, same mono spec-sheet voice. */
#outliner {
  padding: 0.9rem var(--pad-x);
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.35rem;
}
.ol-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface); border: 1px solid var(--line-input);
}
.ol-eye {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; padding: 0;
  background: transparent; border: none; cursor: pointer; color: var(--ink-soft);
}
.ol-eye svg { width: 1rem; height: 1rem; }
.ol-eye:hover:not(:disabled) { color: var(--ink); }
.ol-eye:disabled { color: var(--muted); opacity: 0.5; cursor: default; }
.ol-eye:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.ol-eye .ol-eye-slash { display: none; }
.ol-eye[aria-pressed="false"] { color: var(--muted); }
.ol-eye[aria-pressed="false"] .ol-eye-slash { display: initial; }
.ol-kind {
  flex: 0 0 auto;
  font-family: var(--f-mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.14em; color: var(--ink-soft);
}
.ol-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--f-mono); font-size: 0.69rem; letter-spacing: 0.04em; color: var(--ink);
}
.ol-row[data-empty="true"] .ol-name { color: var(--muted); }
.ol-name.stale { color: var(--warn); }
.ol-act {
  flex: 0 0 auto; padding: 0.15rem 0.3rem; cursor: pointer;
  background: transparent; border: none;
  font-family: var(--f-mono); font-size: 0.63rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.ol-act:hover { text-decoration: underline; }
.ol-act:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* rail caption at the bottom of the tool page */
#rail > .rl-cap { letter-spacing: 0.3em; }

/* selected-part tint chip in the Pose step head; hidden (via inline visibility) when nothing
   is selected, shown at the right of the "Pose" label otherwise */
#sel_chip { float: right; margin-right: 0; visibility: hidden; }
