/* ═══════════════════════════════════════════════════════════════════════════
   Studio hero art: a miniature of the designer, in the .part window of
   /product-art.css (frame, title bar, tokens). Loaded on /studio/ only.

   The scene is one ~10 s loop, ease-in-out, and runs ONLY under .is-playing
   (main.js toggles it while the art is on screen):
     0.8-2 s   a tank glides from the palette onto the canvas and settles
     2.5 s     it is selected (soft accent outline), the inspector fills in
     3.2-3.7 s the binding chip "EQTank/Level" appears
     3.8-5.2 s the level fills 0 -> 62 %, then "Live from Nexus" shows
     5.5-6.5 s the cursor goes to Publish and clicks
     6.7-8 s   the beam runs under the toolbar (the one beam use: Raylux is
               working), then a "Published" toast
     9.5 s on  it fades and resets
   Without JS or under reduced motion the base styles below are the finished
   still frame: tank placed, selected and bound, no beam, no toast.

   Shared primitives defined here (part-studio- prefix): seg, pill, tree,
   inspector row, cursor. The operator screen keeps the fixed HP grays and
   steel blue (Raylux HMI Color Standard): they are the same in both themes.
   ═══════════════════════════════════════════════════════════════════════════ */

@property --part-studio-lvl { syntax: "<integer>"; inherits: true; initial-value: 62; }

.part-studio {
  /* HP operator screen: fixed colors, a screen is not themed. */
  --ps-screen: #d8d8d8;
  --ps-head: #c4c4c4;
  --ps-box: #e8e8e8;
  --ps-line: #b0b0b0;
  --ps-ink: #333333;
  --ps-ink2: #666666;
  --ps-val: #000000;
  --ps-pipe: #808080;
  --ps-bar: #4a6b8a;
  --ps-white: #ffffff;

  --ps-tree-w: 108px;
  --ps-insp-w: 150px;
  --ps-pad: 24px; /* screen padding either side of the tank */
  --ps-dx: -28px; /* palette tile -> tank spot */
  --ps-dy: 110px;
  /* cursor stops, px from the window's top / right edge */
  --ps-pal-t: 296px; --ps-pal-r: 404px;
  --ps-tank-t: 175px; --ps-tank-r: 366px;
  --ps-pub-t: 62px; --ps-pub-r: 32px;
}

/* ---------- toolbar ---------- */
.part-studio-tb {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}

.part-studio-seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-full);
  background: var(--fill);
}

.part-studio-seg span {
  padding: 4px 12px;
  border-radius: var(--r-full);
  color: var(--secondary);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
}

.part-studio-seg .on {
  background: var(--paper);
  border-radius: var(--r-full);
  color: var(--text-bright);
  font-weight: 600;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text-bright) 16%, transparent);
}

.part-studio-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.part-studio-pill {
  padding: 5px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--paper);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}

.part-studio-pub {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

/* The beam: a progress bar under the toolbar. Hidden in the still frame. */
.part-studio-beam {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--beam);
  opacity: 0;
  clip-path: inset(0 100% 0 0);
}

/* ---------- body: tree | canvas | inspector ---------- */
.part-studio-body {
  display: grid;
  grid-template-columns: var(--ps-tree-w) minmax(0, 1fr) var(--ps-insp-w);
  min-height: 262px;
}

.part-studio-tree {
  padding: 12px 8px;
  background: var(--paper);
  border-right: 1px solid var(--border);
}

.part-studio-tree .part-label {
  display: block;
  margin: 0 6px 8px;
}

.part-studio-node {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  color: var(--secondary);
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap;
}

.part-studio-node + .part-studio-node { margin-top: 2px; }
.part-studio-kid { margin-left: 14px; }

.part-studio-node i {
  flex: none;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
}

.part-studio-node.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.part-studio-node.on i { border-color: var(--accent); }

.part-studio-node.dir i {
  width: 7px;
  height: 7px;
  margin: 0 2px;
  border-width: 0 1.5px 1.5px 0;
  border-radius: 0;
  transform: rotate(45deg) translate(-2px, -2px);
}

/* ---------- canvas ---------- */
.part-studio-canvas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background-color: var(--bg);
}

.part-studio-screen {
  position: relative;
  height: 168px;
  flex: none;
  background: var(--ps-screen);
  border: 1px solid var(--ps-line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  color: var(--ps-ink);
}

.part-studio-sh {
  height: 24px;
  padding: 0 10px;
  background: var(--ps-head);
  border-bottom: 1px solid var(--ps-line);
  border-radius: 7px 7px 0 0;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 23px;
}

.part-studio-sb {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 10px var(--ps-pad) 0;
}

.part-studio-slot {
  position: absolute;
  left: calc(var(--ps-pad) - 6px);
  top: 4px;
  width: 64px;
  height: 116px;
  border: 1.5px dashed var(--ps-pipe);
  border-radius: var(--r-sm);
  opacity: 0;
}

.part-studio-tank {
  position: relative;
  z-index: 2;
  flex: none;
  width: 52px;
}

.part-studio-tank::after { /* the selection: a soft accent outline */
  content: "";
  position: absolute;
  inset: -6px;
  border: 1.5px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-wash);
}

.part-studio-vessel {
  position: relative;
  display: block;
  height: 80px;
  overflow: hidden;
  background: var(--ps-box);
  border: 2px solid var(--ps-ink);
  border-radius: 5px 5px 10px 10px;
}

.part-studio-fill {
  position: absolute;
  inset: 0;
  background: var(--ps-bar);
  transform-origin: 50% 100%;
  transform: scaleY(0.62);
}

.part-studio-v {
  display: block;
  margin-top: 6px;
  color: var(--ps-val);
  font-size: 15px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
}

.part-studio-v small {
  margin-left: 2px;
  color: var(--ps-ink2);
  font-size: 11px;
  font-weight: 500;
}

.part-studio-pipe {
  flex: 1;
  height: 4px;
  margin-top: 62px;
  background: var(--ps-pipe);
}

.part-studio-pump {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: 49px;
  background: var(--ps-white);
  border: 2px solid var(--ps-ink);
  border-radius: 50%;
}

.part-studio-pump::before {
  content: "";
  position: absolute;
  inset: 6px 5px 6px 8px;
  background: var(--ps-ink);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.part-studio-pump b {
  position: absolute;
  top: 31px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ps-ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

/* ---------- palette ---------- */
.part-studio-pal {
  display: flex;
  gap: 6px;
  flex: none;
  padding: 5px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.part-studio-pal span {
  position: relative;
  width: 34px;
  height: 28px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
}

.part-studio-pal span::before { /* glyph: tank */
  content: "";
  position: absolute;
  inset: 5px 11px;
  border: 1.5px solid var(--secondary);
  border-radius: 2px 2px 4px 4px;
}

.part-studio-pal span:nth-child(2)::before { /* pump */
  inset: 5px 8px;
  border-radius: 50%;
}

.part-studio-pal span:nth-child(3)::before { /* valve */
  inset: 7px 6px;
  border: 0;
  border-radius: 0;
  background: var(--secondary);
  clip-path: polygon(0 0, 50% 50%, 0 100%, 100% 100%, 50% 50%, 100% 0);
}

.part-studio-pal span:nth-child(4)::before { /* gauge */
  inset: 5px 8px;
  border-radius: 50% 50% 3px 3px;
}

/* ---------- inspector ---------- */
.part-studio-insp {
  display: grid;
  align-content: start;
  padding: 12px 12px;
  background: var(--paper);
  border-left: 1px solid var(--border);
}

.part-studio-insp > * { grid-area: 1 / 1; }

.part-studio-insp .part-label {
  align-self: start;
}

.part-studio-none {
  align-self: start;
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
}

.part-studio-fields {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding-top: 24px; /* under the Properties label */
}

.part-studio-kind {
  color: var(--text-bright);
  font-size: 13.5px;
  font-weight: 600;
}

.part-studio-kind span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.part-studio-row {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.part-studio-bind {
  justify-self: start;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--f-mono);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.part-studio-live {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--secondary);
  font-size: 12px;
  white-space: nowrap;
}

.part-studio-live i {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.part-studio-live i::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--success);
  opacity: 0;
}

.part-studio-range {
  color: var(--secondary);
  font-size: 12px;
}

/* ---------- toast and cursor ---------- */
.part-studio-toast {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--shadow);
  color: var(--text-bright);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0;
}

.part-studio-toast::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.part-studio-cursor {
  position: absolute;
  top: var(--ps-pal-t);
  right: var(--ps-pal-r);
  z-index: 6;
  width: 14px;
  height: 20px;
  opacity: 0;
  filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--text-bright) 35%, transparent));
}

.part-studio-cursor::before,
.part-studio-cursor::after {
  content: "";
  position: absolute;
  clip-path: polygon(0 0, 0 100%, 28% 76%, 50% 100%, 66% 92%, 46% 68%, 100% 68%);
}

.part-studio-cursor::before {
  inset: -1.5px;
  background: var(--paper);
}

.part-studio-cursor::after {
  inset: 0;
  background: var(--text-bright);
}

/* ---------- motion: only while on screen ---------- */
.part-studio.is-playing .part-studio-slot { animation: part-studio-slot 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-tank { animation: part-studio-drop 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-tank::after { animation: part-studio-sel 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-fill { animation: part-studio-fill 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-num { display: none; }
.part-studio.is-playing .part-studio-n { animation: part-studio-lvl 10s ease-in-out infinite; }

.part-studio.is-playing .part-studio-n::before {
  counter-reset: part-studio-c var(--part-studio-lvl);
  content: counter(part-studio-c);
}

.part-studio.is-playing .part-studio-none { animation: part-studio-none 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-fields { animation: part-studio-fields 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-bind { animation: part-studio-bind 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-live { animation: part-studio-liverow 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-live i::after { animation: part-studio-pulse 2.5s ease-out infinite; }
.part-studio.is-playing .part-studio-pub { animation: part-studio-press 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-beam { animation: part-studio-beam 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-toast { animation: part-studio-toast 10s ease-in-out infinite; }
.part-studio.is-playing .part-studio-cursor { animation: part-studio-cursor 10s ease-in-out infinite; }

@keyframes part-studio-slot {
  0%, 14% { opacity: 1; }
  20%, 97% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes part-studio-drop {
  0%, 6% { opacity: 0; transform: translate(var(--ps-dx), var(--ps-dy)) scale(0.45); }
  9% { opacity: 1; transform: translate(var(--ps-dx), var(--ps-dy)) scale(0.45); }
  20%, 94% { opacity: 1; transform: none; }
  98%, 100% { opacity: 0; transform: none; }
}

@keyframes part-studio-sel {
  0%, 21% { opacity: 0; }
  26%, 94% { opacity: 1; }
  98%, 100% { opacity: 0; }
}

@keyframes part-studio-fill {
  0%, 38% { transform: scaleY(0); }
  52%, 98% { transform: scaleY(0.62); }
  100% { transform: scaleY(0); }
}

@keyframes part-studio-lvl {
  0%, 38% { --part-studio-lvl: 0; }
  52%, 98% { --part-studio-lvl: 62; }
  100% { --part-studio-lvl: 0; }
}

@keyframes part-studio-none {
  0%, 22% { opacity: 1; }
  27%, 96% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes part-studio-fields {
  0%, 24% { opacity: 0; transform: translateY(4px); }
  30%, 94% { opacity: 1; transform: none; }
  98%, 100% { opacity: 0; transform: none; }
}

@keyframes part-studio-bind {
  0%, 32% { opacity: 0; transform: translateY(5px) scale(0.96); }
  37%, 100% { opacity: 1; transform: none; }
}

@keyframes part-studio-liverow {
  0%, 49% { opacity: 0; }
  55%, 100% { opacity: 1; }
}

@keyframes part-studio-pulse {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(2.6); opacity: 0; }
}

@keyframes part-studio-press {
  0%, 64% { transform: none; background-color: var(--accent); }
  66% { transform: scale(0.94); background-color: var(--accent-hover); }
  69%, 100% { transform: none; background-color: var(--accent); }
}

@keyframes part-studio-beam {
  0%, 66% { opacity: 0; clip-path: inset(0 100% 0 0); }
  67% { opacity: 1; clip-path: inset(0 100% 0 0); }
  80%, 83% { opacity: 1; clip-path: inset(0 0 0 0); }
  87%, 100% { opacity: 0; clip-path: inset(0 0 0 0); }
}

@keyframes part-studio-toast {
  0%, 80% { opacity: 0; transform: translateY(8px); }
  84%, 93% { opacity: 1; transform: none; }
  97% { opacity: 0; transform: none; }
  100% { opacity: 0; transform: translateY(8px); }
}

@keyframes part-studio-cursor {
  0% { opacity: 0; top: var(--ps-pal-t); right: var(--ps-pal-r); }
  4%, 8% { opacity: 1; top: var(--ps-pal-t); right: var(--ps-pal-r); }
  20%, 55% { opacity: 1; top: var(--ps-tank-t); right: var(--ps-tank-r); }
  65%, 93% { opacity: 1; top: var(--ps-pub-t); right: var(--ps-pub-r); }
  97% { opacity: 0; top: var(--ps-pub-t); right: var(--ps-pub-r); }
  100% { opacity: 0; top: var(--ps-pal-t); right: var(--ps-pal-r); }
}

/* Reduced motion: the base styles are the finished frame (product-art.css
   also switches every .part animation off). */

/* ---------- phone: the tree goes, the rest stacks under the hero text ---------- */
@media (max-width: 560px) {
  .part-studio {
    --ps-insp-w: 132px;
    --ps-pad: 18px;
    --ps-dx: -22px;
    --ps-pal-t: 294px;
    --ps-pal-r: 310px;
    --ps-tank-t: 173px;
    --ps-tank-r: 288px;
    --ps-pub-r: 25px;
  }

  .part-studio-tree { display: none; }
  .part-studio-body { grid-template-columns: minmax(0, 1fr) var(--ps-insp-w); }
  .part-studio-tb { gap: 6px; padding: 8px 10px; }
  .part-studio-seg span { padding: 4px 9px; }
  .part-studio-btns { gap: 6px; }
  .part-studio-pill { padding: 5px 11px; }
  .part-studio-canvas { padding: 10px; }
  .part-studio-insp { padding: 12px 10px; }
  .part-studio-bind { font-size: 11px; padding-inline: 8px; }
}
