/* ============================================
   ASSEMBLY LINE — tv variant (displays page).
   TVs ride a belt conveyor through a station gantry; the unit under the
   gantry powers on. Shared shell, screen and nav styles: assembly-line.css.
   Vertical budget, in u, from the rig's bottom: legs 6–36, frame 36–56, belt
   edge 56–61, belt top 61–100, units from 67 (pallet front) to 371 (TV top
   face), gantry beam 386–419, andon to ~449; the rig is 456u. Height caps use
   84cqh, so the rig fills ~96% of the stage (456/400 × 84) and the stack light
   keeps a gap below the header.
   ============================================ */

.line__bed,
.line__pallet {
  display: none;
}

.line--tv .line__unit {
  position: relative;
  flex: none;
  width: var(--line-w);
  height: calc(305 * var(--u));
}

/* Static units have no pallet, so drop the stand to the unit's floor. */
.line--tv:not(.line--live) .line__unit {
  height: calc(285 * var(--u));
}

.line--tv:not(.line--live) .line__foot { bottom: 0; }
.line--tv:not(.line--live) .line__neck { bottom: calc(12 * var(--u)); }
.line--tv:not(.line--live) .line__panel   { bottom: calc(34 * var(--u)); }

/* ── Unit: pallet, stand, TV (the panel) ── */
.line__pallet {
  left: calc(50 * var(--u));
  width: calc(300 * var(--u));
  bottom: 0;
  height: calc(14 * var(--u));
  --d: calc(28 * var(--u));
  --f: var(--line-steel);
  --t: var(--line-steel-top);
  --s: var(--line-steel-side);
}

.line__foot {
  left: calc(130 * var(--u));
  width: calc(150 * var(--u));
  bottom: calc(20 * var(--u));
  height: calc(6 * var(--u));
  --d: calc(16 * var(--u));
}

.line__neck {
  left: calc(195 * var(--u));
  width: calc(22 * var(--u));
  bottom: calc(32 * var(--u));
  height: calc(28 * var(--u));
  --d: calc(7 * var(--u));
}

.line--tv .line__panel {
  bottom: calc(54 * var(--u));
}

/* The set rocks on its foot when the belt starts and stops (JS springs --lean
   on the track). Pivot = the foot's centre, 34u below the TV and 22u below
   the neck. */
.line--tv.line--live .line__panel {
  transform: rotate(var(--lean, 0deg));
  transform-origin: 51.25% calc(100% + 34 * var(--u));
}

.line--tv.line--live .line__neck {
  transform: rotate(var(--lean, 0deg));
  transform-origin: 50% calc(100% + 12 * var(--u));
}

.line--tv.line--live .line__rig {
  --line-w: min(720px, 56cqw, 84cqh);
  --pitch: calc(var(--line-w) * 1.3);
  --rig-h: 456;
}

@media (max-width: 1023px) {
  .line--tv.line--live .line__rig {
    --line-w: min(600px, 70cqw, 84cqh);
    --pitch: calc(var(--line-w) + 64px);
  }
}

@media (max-width: 640px) {
  .line--tv.line--live .line__rig {
    --line-w: min(92cqw, 84cqh);
    --pitch: calc(var(--line-w) + 28px);
  }
}

.line--live .line__bed {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.line--live .line__pallet {
  display: block;
}

/* ── The belt's track of units ── */
.line--tv.line--live .line__track {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: calc(67 * var(--u));
  display: flex;
  gap: calc(var(--pitch) - var(--line-w));
  max-width: none;
  margin: 0;
  padding: 0;
  /* Parked one pitch right of the station until JS takes over. */
  transform: translate3d(calc(var(--line-w) * -0.5 + var(--pitch)), 0, 0);
  will-change: transform;
}


/* ── Scene: floor shadow, light cone, gantry, guard rail, belt surface ── */

/* Shop lamps above the gantry and a safety stripe on the floor. Both sit
   outside the rig's 456u box, so the stage clips them away when the rig fills
   it (most desktops) and they furnish the spare height on phones and tablets. */
.line__pendant {
  position: absolute;
  bottom: calc(474 * var(--u));
  width: calc(40 * var(--u));
  height: 100vh;
}

.line__pendant--l { left: calc(50% - var(--line-w) * 0.3 - 20 * var(--u)); }
.line__pendant--r { left: calc(50% + var(--line-w) * 0.3 - 20 * var(--u)); }

.line__pendant::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: calc(14 * var(--u));
  width: 1.5px;
  margin-left: -0.75px;
  background: rgba(255, 255, 255, 0.18);
}

.line__shade {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: calc(15 * var(--u));
  box-sizing: border-box;
  border: var(--line-stroke) solid var(--line-ink);
  border-radius: 50% 50% 3px 3px / 100% 100% 3px 3px;
  background: var(--line-alloy);
}

.line__shade::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: calc(12 * var(--u));
  height: calc(5 * var(--u));
  transform: translateX(-50%);
  border-radius: 0 0 99px 99px;
  background: #FFE6B8;
  box-shadow: 0 0 22px 8px rgba(255, 214, 150, 0.22);
}

.line__cone {
  position: absolute;
  left: calc(50% - var(--line-w) / 2 - 24 * var(--u));
  width: calc(var(--line-w) + 48 * var(--u));
  bottom: calc(100 * var(--u));
  height: calc(286 * var(--u));
  clip-path: polygon(24% 0, 76% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom, rgba(255, 228, 186, 0.15), rgba(255, 228, 186, 0) 88%);
  opacity: 0.3;
  transition: opacity 0.35s ease;
}

.line__frame.is-docked .line__cone {
  opacity: 1;
}

.line__post {
  bottom: calc(100 * var(--u));
  height: calc(286 * var(--u));
  width: calc(14 * var(--u));
  --d: calc(10 * var(--u));
  --f: var(--line-alloy);
  --t: var(--line-alloy-top);
  --s: var(--line-alloy-side);
}

.line__post--l { left: calc(50% - var(--line-w) / 2 - 48 * var(--u)); }
.line__post--r { left: calc(50% + var(--line-w) / 2 + 34 * var(--u)); }

.line__beam {
  left: calc(50% - var(--line-w) / 2 - 60 * var(--u));
  width: calc(var(--line-w) + 120 * var(--u));
  bottom: calc(386 * var(--u));
  height: calc(22 * var(--u));
  --d: calc(11 * var(--u));
  --f: var(--line-alloy);
  --t: var(--line-alloy-top);
  --s: var(--line-alloy-side);
}

.line__andon {
  position: absolute;
  left: calc(50% + var(--line-w) / 2 - 34 * var(--u));
  bottom: calc(413 * var(--u));
  width: calc(15 * var(--u));
  display: flex;
  flex-direction: column;
  padding-bottom: calc(5 * var(--u));
}

/* Mounting stem */
.line__andon::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(4 * var(--u));
  height: calc(6 * var(--u));
  transform: translateX(-50%);
  background: var(--line-alloy-side);
  border: 1.5px solid var(--line-ink);
}

.line__andon::before {
  content: '';
  height: calc(4 * var(--u));
  margin-inline: calc(1.5 * var(--u));
  border: 1.5px solid var(--line-ink);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: var(--line-alloy);
}

.line__lamp {
  display: block;
  height: calc(9 * var(--u));
  border: 1.5px solid var(--line-ink);
  border-bottom-width: 0;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.line__lamp--g { border-bottom-width: 1.5px; }

.line__lamp--r { background: #5A2622; }
.line__lamp--a { background: #5E4A16; }
.line__lamp--g { background: #1C4A2E; }

.line__frame.is-docked .line__lamp--g {
  background: #3DDC7A;
  box-shadow: 0 0 14px 2px rgba(61, 220, 122, 0.55);
}

.line__frame:not(.is-docked) .line__lamp--a {
  background: #FFC21A;
  box-shadow: 0 0 14px 2px rgba(255, 194, 26, 0.5);
}

.line__frame.is-moving .line__lamp--a {
  animation: line-blink 0.5s steps(1, end) infinite;
}

@keyframes line-blink {
  50% { background: #5E4A16; box-shadow: none; }
}

/* Saffron guard rail along the back edge of the belt. */
.line__guard {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100 * var(--u));
  height: calc(6 * var(--u));
  background: var(--color-saffron-dark);
  border-block: var(--line-stroke) solid var(--line-ink);
}

.line__belt {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(61 * var(--u));
  height: calc(39 * var(--u));
  overflow: hidden;
  background: linear-gradient(to bottom, #242A34, var(--line-belt));
}

/* Slats run along the depth axis (45°); JS slides them with the units. */
.line__slats {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% + 66 * var(--u));
  background: repeating-linear-gradient(135deg,
    rgba(255, 255, 255, 0.09) 0 calc(1.3 * var(--u)),
    transparent calc(1.3 * var(--u)) calc(15.556 * var(--u)));
  will-change: transform;
}


/* ── Bed: belt edge, frame with roller caps, legs ── */
.line__edge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(56 * var(--u));
  height: calc(5 * var(--u));
  background: #151A21;
  border-top: var(--line-stroke) solid var(--line-ink);
}

.line__rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(36 * var(--u));
  height: calc(20 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(46 * var(--u));
  overflow: hidden;
  background: var(--color-saffron);
  border-block: var(--line-stroke) solid var(--line-ink);
}

.line__cap {
  position: relative;
  flex: none;
  width: calc(10 * var(--u));
  aspect-ratio: 1;
  border-radius: 50%;
  background: #FFE0B5;
  border: 1.5px solid var(--line-ink);
  transform: rotate(var(--roll, 0rad));
}

.line__cap::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 14%;
  bottom: 14%;
  width: 1.5px;
  background: var(--line-ink);
  transform: translateX(-50%);
}

.line__legs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(6 * var(--u));
  height: calc(30 * var(--u));
  display: flex;
  justify-content: center;
  gap: calc(170 * var(--u));
  overflow: hidden;
}

.line__leg {
  position: relative;
  flex: none;
  width: calc(12 * var(--u));
  height: 100%;
  --d: calc(8 * var(--u));
  --f: var(--line-steel);
  --t: var(--line-steel-top);
  --s: var(--line-steel-side);
}
