/* Tractor-protection-valve explainer: a cutaway tractor-to-trailer air system. The tractor tank feeds a 0 to 140 PSI
   dial, the red trailer air supply knob in the cab controls the tractor protection valve, and the valve passes air to the
   red emergency and blue service glad-hand hoses that run to the trailer spring brake. Hero, film, course offer and
   return banner reuse spring-brakes.css (.sbp-*); this file styles only .tp-*. The script sets the stage's data-engine,
   data-knob, data-valve, data-trailer, data-brakes, data-hose, data-busy, data-range, data-saved and data-press states,
   turns the dial needle (1.9286 degrees per PSI) and sizes the tank fill. Without script the picture shows the engine
   running, the tank at 30 PSI, the red knob out, the valve closed and the trailer brakes applied. Every SVG label is
   at least 9.5px in the 360-wide drawing. */
.tp-page{--tp-air:#38bdf8;--tp-go:#31d67b;--tp-sig:#fbbf24;--tp-red:#ef4444;--tp-blue:#3b82f6;--tp-console:#151b20}
.tp-page .sbp-hero-grid.is-no-film{grid-template-columns:minmax(0,1fr)}
.tp-demo{padding-block:64px 72px;background:var(--paper)}
.tp-demo-grid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);grid-template-areas:"head head" "stage panel";gap:24px 40px;align-items:start}
.tp-head{grid-area:head}
.tp-stage{grid-area:stage;margin:0;padding:10px;border-radius:16px;background:linear-gradient(170deg,#222a30,#0d1114 80%);box-shadow:0 30px 60px -34px rgb(0 0 0/.75),inset 0 1px 0 rgb(255 255 255/.06)}
.tp-svg{display:block;width:100%;height:auto;border-radius:10px;background:#0f1316}
.tp-panel{grid-area:panel;display:grid;gap:14px;min-width:0}

/* the HUD: tractor PSI, red knob and protection valve; script on */
.tp-hud{display:none;align-items:center;gap:6px;flex-wrap:wrap;padding:0 2px 10px}
.tp-stage.is-js .tp-hud{display:flex}
.tp-chip{display:inline-flex;align-items:center;gap:7px;margin:0;padding:6px 10px 6px 8px;border-radius:8px;background:#080b0d;box-shadow:inset 0 0 0 1px rgb(255 255 255/.09);font-size:13px;line-height:1;white-space:nowrap}
.tp-chip i{flex:none;width:9px;height:9px;border-radius:50%;background:#3a4246;box-shadow:inset 0 0 0 1.5px #586166;transition:background .2s,box-shadow .2s}
.tp-chip span{color:#a9b3b8;font-weight:600}
.tp-chip b{color:#e8eef0;font-weight:800}
.tp-chip-psi i{background:var(--tp-air);box-shadow:0 0 0 2px rgb(56 189 248/.18)}
.tp-stage[data-range="in"] .tp-chip-psi i{background:var(--tp-sig);box-shadow:0 0 0 2px rgb(251 191 36/.2),0 0 10px rgb(251 191 36/.8)}
.tp-stage[data-range="in"] .tp-chip-psi b{color:#fde68a}
.tp-stage[data-knob="in"] .tp-chip-knob i{background:var(--tp-go);box-shadow:0 0 0 2px rgb(49 214 123/.18),0 0 10px rgb(49 214 123/.8)}
.tp-stage[data-knob="in"] .tp-chip-knob b{color:var(--tp-go)}
.tp-stage[data-knob="out"] .tp-chip-knob i{background:var(--tp-red);box-shadow:0 0 0 2px rgb(239 68 68/.2),0 0 10px rgb(239 68 68/.85)}
.tp-stage[data-knob="out"] .tp-chip-knob b{color:#fca5a5}
.tp-stage[data-valve="open"] .tp-chip-valve i{background:var(--tp-go);box-shadow:0 0 0 2px rgb(49 214 123/.18),0 0 10px rgb(49 214 123/.8)}
.tp-stage[data-valve="open"] .tp-chip-valve b{color:var(--tp-go)}
.tp-stage[data-valve="closed"] .tp-chip-valve i{background:var(--tp-sig);box-shadow:0 0 0 2px rgb(251 191 36/.2),0 0 10px rgb(251 191 36/.8)}
.tp-stage[data-valve="closed"] .tp-chip-valve b{color:#fde68a}

/* labels: every teaching label is 9.5px or larger, light on dark with a dark halo */
.tp-zone{fill:#c3ccd0;font-size:10px;font-weight:900;letter-spacing:.14em;text-transform:uppercase}
.tp-zone-end{text-anchor:end}
.tp-divide{fill:none;stroke:#c3ccd0;stroke-opacity:.28;stroke-width:1;stroke-dasharray:4 4}
.tp-part{fill:#d3dadd;font-size:10.5px;font-weight:800;paint-order:stroke;stroke:#0d1114;stroke-width:2.6px;stroke-linejoin:round}
.tp-part-mid{text-anchor:middle}
.tp-part-end{text-anchor:end}
.tp-part-strong{fill:#f2f6f7}
.tp-part-red{fill:#ff9b9b}
.tp-part-blue{fill:#93c5fd}
.tp-part-alarm{fill:#fca5a5;font-size:11px}

/* the dial */
.tp-dial-shade{fill:#000;opacity:.45}
.tp-dial-bezel{fill:#0b0d0e;stroke:url(#tp-g-chrome);stroke-width:4}
.tp-dial-band{fill:none;stroke:#f59e0b;stroke-width:6}
.tp-dial-ok{fill:none;stroke:#16a34a;stroke-width:6}
.tp-dial-major{fill:none;stroke:#1d1916;stroke-width:1.8;stroke-linecap:round}
.tp-dial-minor{fill:none;stroke:#6a615a;stroke-width:1;stroke-linecap:round}
.tp-dial-num{fill:#1f1c19;font-size:9.5px;font-weight:800;text-anchor:middle}
.tp-dial-unit{fill:#3f3b36;font-size:9.5px;font-weight:800;letter-spacing:.06em;text-anchor:middle}
.tp-dial-val{fill:#111;font-size:12px;font-weight:900;text-anchor:middle}
.tp-needle{transform-box:view-box;transform-origin:0 0;transform:rotate(-77.1deg)}
.tp-stage.is-js .tp-needle{transition:transform .15s linear}
.tp-needle-blade{fill:#c2410c;stroke:#7c2d12;stroke-width:.4}
.tp-needle-shadow{fill:#1c140c;opacity:.24}
.tp-dial-cap{fill:url(#tp-g-cap);stroke:#3b4446;stroke-width:.6}
.tp-dial-glass{fill:#fff;opacity:.3;pointer-events:none}

/* pipes and the tank */
.tp-pipe{fill:none;stroke:#3d464b;stroke-width:5;stroke-linecap:round}
.tp-pipe-air{fill:none;stroke:var(--tp-air);stroke-width:2;stroke-dasharray:4 6;stroke-linecap:round;opacity:.9}
.tp-tank-body{stroke:#0b0e10;stroke-width:1.2}
.tp-tank-well{fill:#0c1013}
.tp-tank-fill{fill:url(#tp-g-air)}
.tp-stage.is-js .tp-tank-fill{transition:y .15s linear,height .15s linear}

/* the dash and the red trailer air supply knob: pulled out, it rises and shows its chrome stem */
.tp-dash-face{fill:#0a0e11;stroke:#3d464b;stroke-width:1.2}
.tp-knob-well{fill:#05080a;stroke:#59636a;stroke-width:1.2}
.tp-knob-face{stroke:#4c0b0b;stroke-width:1}
.tp-knob-rim{fill:none;stroke:#ffb4b4;stroke-opacity:.55;stroke-width:1}
.tp-knob-face,.tp-knob-rim{transform-box:view-box;transform-origin:186px 78px;transition:transform .22s cubic-bezier(.3,1.5,.55,1)}
.tp-stage[data-knob="out"] .tp-knob-face,.tp-stage[data-knob="out"] .tp-knob-rim{transform:translateY(-9px) scale(1.08)}
.tp-knob-stem{stroke:#3a4246;stroke-width:.8}
.tp-knob-state{font-size:10px;font-weight:900;letter-spacing:.04em;text-anchor:middle;display:none}
.tp-knob-in{fill:var(--tp-go)}
.tp-knob-out{fill:#fca5a5}
.tp-stage[data-knob="in"] .tp-knob-in,.tp-stage[data-knob="out"] .tp-knob-out{display:inline}
.tp-control{fill:none;stroke:#59636a;stroke-width:1.8;stroke-dasharray:3 3}
.tp-stage[data-knob="in"] .tp-control{stroke:var(--tp-go)}

/* the valve: open lets air through; closed drops the gate across the passage */
.tp-valve-body{stroke:#2a3133;stroke-width:1.2}
.tp-valve-housing{fill:#0e1215;stroke:#000;stroke-width:.6}
.tp-valve-passage{fill:#0e1215}
.tp-valve-flow{fill:var(--tp-air);opacity:0;transition:opacity .2s}
.tp-stage[data-valve="open"] .tp-valve-flow{opacity:.75}
.tp-valve-gate{fill:var(--tp-sig);stroke:#7c5a06;stroke-width:.8;transform-box:view-box;transition:transform .18s cubic-bezier(.5,1.6,.6,1)}
.tp-stage[data-valve="closed"] .tp-valve-gate{transform:translateY(14px)}
.tp-valve-state{font-size:10px;font-weight:900;letter-spacing:.06em;text-anchor:middle;paint-order:stroke;stroke:#0d1114;stroke-width:2.6px;stroke-linejoin:round;display:none}
.tp-valve-open{fill:var(--tp-go)}
.tp-valve-shut{fill:#fde68a}
.tp-stage[data-valve="open"] .tp-valve-open,.tp-stage[data-valve="closed"] .tp-valve-shut{display:inline}

/* the hoses: the red line glows when the trailer is charged */
.tp-hose{fill:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round}
.tp-hose-red{stroke:#b91c1c}
.tp-hose-blue{stroke:#1d4ed8}
.tp-hose-air{fill:none;stroke-width:1.8;stroke-dasharray:4 6;stroke-linecap:round;opacity:0;transition:opacity .2s}
.tp-hose-air-red{stroke:#fecaca}
.tp-stage[data-trailer="charged"] .tp-hose-air,.tp-stage[data-trailer="leak"] .tp-hose-air{opacity:1}
.tp-stage[data-trailer="empty"] .tp-hose-red{stroke:#6b2020}
.tp-glad{stroke:#0b0d0e;stroke-width:1.2}
.tp-glad-red{fill:#ef4444}
.tp-glad-blue{fill:#3b82f6}

/* the breakaway */
.tp-break{opacity:0;transition:opacity .15s}
.tp-stage[data-hose="broken"] .tp-break{opacity:1}
.tp-break-gap{fill:#12171a}
.tp-break-end{fill:none;stroke:#ef4444;stroke-width:5;stroke-linecap:round}
.tp-break-stream{fill:none;stroke:#e6f6ff;stroke-width:1.5;stroke-linecap:round;stroke-dasharray:4 4;opacity:.85}
.tp-break-puff{fill:#e6f6ff;opacity:.5}
/* once the valve seals, the snapped hose stays but the tractor stops venting */
.tp-stage[data-hose="broken"][data-valve="closed"] .tp-break-stream,.tp-stage[data-hose="broken"][data-valve="closed"] .tp-break-puff{opacity:0}

/* the trailer spring brake: applied pushes the rod and locks the drum */
.tp-chamber{stroke:#2a3133;stroke-width:1.2}
.tp-chamber-split{fill:none;stroke:#2a3133;stroke-width:1.4}
.tp-rod{transform-box:view-box;transition:transform .2s}
.tp-rod-bar{fill:#d7dddd;stroke:#3a4246;stroke-width:.6}
.tp-stage[data-brakes="applied"] .tp-rod{transform:translateY(4px)}
.tp-drum{fill:#2a3236;stroke:#0b0d0e;stroke-width:1.4}
.tp-drum-ring{fill:none;stroke:#59636a;stroke-width:3;transition:stroke .2s}
.tp-stage[data-brakes="applied"] .tp-drum-ring{stroke:var(--tp-red)}
.tp-drum-hub{stroke:#2a3133;stroke-width:.8}

/* the trailer brake card */
.tp-card-box{fill:#080b0d;stroke:#59636a;stroke-width:1.2;transition:stroke .2s}
.tp-card-cap{fill:#c3ccd0;font-size:9.5px;font-weight:800;letter-spacing:.04em;text-anchor:middle;text-transform:uppercase}
.tp-card-big{font-size:13px;font-weight:900;letter-spacing:.04em;text-anchor:middle}
.tp-card-sub{fill:#d3dadd;font-size:9.5px;font-weight:700;text-anchor:middle}
.tp-card-state{display:none}
.tp-stage[data-brakes="released"] .tp-card-released,.tp-stage[data-brakes="applied"] .tp-card-applied{display:inline}
.tp-card-released .tp-card-big{fill:var(--tp-go)}
.tp-card-applied .tp-card-big{fill:#fca5a5}
.tp-stage[data-brakes="released"] .tp-card-box{stroke:var(--tp-go)}
.tp-stage[data-brakes="applied"] .tp-card-box{stroke:var(--tp-red)}

/* the pedal, the engine light and the saved-air badge */
.tp-floor{fill:none;stroke:#3d464b;stroke-width:3;stroke-linecap:round}
.tp-pedal{transform-box:view-box;transform-origin:22px 270px}
.tp-pedal-arm{fill:none;stroke:#8e989b;stroke-width:4;stroke-linecap:round}
.tp-pedal-plate{fill:#d7dddd;stroke:#3a4246;stroke-width:.8}
.tp-pedal-pivot{fill:#59636a}
.tp-stage.is-js[data-press="a"] .tp-pedal{animation:tp-press-a .45s ease-in-out}
.tp-stage.is-js[data-press="b"] .tp-pedal{animation:tp-press-b .45s ease-in-out}
.tp-engine-light{fill:#3a4246;stroke:#0b0d0e;stroke-width:1;transition:fill .2s}
.tp-stage[data-engine="on"] .tp-engine-light{fill:var(--tp-go)}
.tp-engine-txt{display:none}
.tp-stage[data-engine="on"] .tp-engine-on,.tp-stage[data-engine="off"] .tp-engine-off{display:inline}
.tp-saved{opacity:0;transition:opacity .2s}
.tp-stage[data-saved="on"] .tp-saved{opacity:1}
.tp-saved-box{fill:#052e16;stroke:var(--tp-go);stroke-width:1.2}
.tp-saved-txt{fill:#bbf7d0;font-size:10.5px;font-weight:900;letter-spacing:.04em;text-anchor:middle}

/* motion, script on: air flows while the valve is open, the broken hose vents */
.tp-stage.is-js[data-valve="open"] .tp-pipe-air,.tp-stage.is-js[data-trailer="charged"] .tp-hose-air{animation:tp-flow .6s linear infinite}
.tp-stage.is-js[data-trailer="leak"] .tp-hose-air,.tp-stage.is-js[data-busy="drain"] .tp-pipe-air{animation:tp-flow .25s linear infinite}
.tp-stage.is-js[data-hose="broken"][data-valve="open"] .tp-break-stream{animation:tp-flow .3s linear infinite}
.tp-stage.is-js[data-hose="broken"][data-valve="open"] .tp-break-puff{transform-box:fill-box;transform-origin:center;animation:tp-puff .8s ease-out infinite}
.tp-stage.is-js .tp-puff-b{animation-delay:.35s}
@keyframes tp-flow{to{stroke-dashoffset:-10}}
@keyframes tp-puff{from{transform:scale(.4);opacity:.75}to{transform:scale(1.8);opacity:0}}
@keyframes tp-press-a{50%{transform:rotate(14deg)}}
@keyframes tp-press-b{50%{transform:rotate(14deg)}}

/* controls: one dark console, every button the same dark face and white text, amber only when pressed or focused */
.tp-ask{margin:0;color:var(--ink);font-size:20px;line-height:1.25}
.tp-ask[hidden],.tp-controls[hidden]{display:none}
.tp-ask b{font-weight:800}
.tp-controls{display:grid;gap:10px;padding:14px;border-radius:16px;background:linear-gradient(180deg,#232b31,var(--tp-console));box-shadow:0 18px 40px -28px rgb(0 0 0/.8),inset 0 1px 0 rgb(255 255 255/.07);color:#e8eef0}
.tp-btn{position:relative;display:flex;align-items:center;gap:10px;min-width:0;min-height:52px;padding:10px 14px;border:0;border-radius:12px;background:linear-gradient(180deg,#303a41,#1b2227);box-shadow:inset 0 1px 0 rgb(255 255 255/.1),0 3px 0 #06090b,0 8px 16px -10px rgb(0 0 0/.7);color:#fff;font:inherit;font-size:16px;font-weight:700;line-height:1.25;text-align:left;cursor:pointer;transition:transform .08s,box-shadow .12s,background .12s}
.tp-btn:hover{background:linear-gradient(180deg,#38434b,#20282d)}
.tp-btn:active{transform:translateY(2px);box-shadow:inset 0 0 0 2px var(--sbp-amber,#ffb400),0 1px 0 #06090b}
.tp-btn:focus-visible{outline:3px solid var(--sbp-amber,#ffb400);outline-offset:3px}
.tp-reset{justify-self:start;gap:8px;min-height:44px;padding:8px 16px 8px 12px;font-size:15px}
.tp-reset-icon{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tp-status{display:block;min-height:7.3em;padding:12px 14px 12px 16px;border-left:5px solid var(--tp-sig);border-radius:0 10px 10px 0;background:var(--white,#fffffc);color:var(--ink);font-size:16px;font-weight:600;line-height:1.45;transition:border-color .2s}
.tp-stage[data-knob="in"]~.tp-panel .tp-status{border-left-color:var(--tp-go)}
.tp-stage[data-hose="broken"]~.tp-panel .tp-status{border-left-color:var(--tp-red)}
.tp-text{display:grid;gap:10px;max-width:40em;color:var(--ink);font-size:17px;line-height:1.6}
.tp-text p{margin:0}
.tp-steps{margin:0;padding-left:1.4em;display:grid;gap:6px}

@media (min-width:761px){
  .tp-page .sbp-film-frame.is-wide{aspect-ratio:auto;padding-bottom:58px;background:#0b0d0f}
  .tp-page .sbp-film-frame.is-wide video{aspect-ratio:16/9;width:100%;height:auto}
  .tp-page .sbp-film-frame.is-wide .sbp-play{bottom:58px}
  .tp-page .sbp-film-frame.is-wide .sbp-sound-on{left:12px;right:auto;top:auto;bottom:10px}
  .tp-page .sbp-film-frame.is-wide .sbp-pause{right:12px;top:auto;bottom:10px}
}
@media (max-width:900px){
  .tp-demo-grid{grid-template-columns:minmax(0,1fr);grid-template-areas:"head" "stage" "panel";gap:16px}
}
/* phone first screen: heading, answer, lead and the top of the film with its play button fit 360 by 800 */
@media (max-width:760px){
  .tp-page .sbp-hero{padding-block:18px 30px}
  .tp-page .sbp-hero h1{margin-top:6px;font-size:28px;line-height:1}
  .tp-page .sbp-answer{margin-top:14px;padding:10px 12px 12px}
  .tp-page .sbp-answer .sbp-answer-text{margin-top:0;font-size:17px;line-height:1.3;letter-spacing:-.005em}
  .tp-page .sbp-lead{margin-top:10px;font-size:15px;line-height:1.45}
  .tp-page .sbp-hero-grid{gap:16px}
  .tp-page .sbp-film-frame.is-phone .sbp-play{top:96px;bottom:auto}
  .tp-demo{padding-block:36px 44px}
  .tp-stage{margin-inline:-8px;padding:8px 6px 6px;border-radius:14px}
  .tp-svg{border-radius:8px}
  .tp-hud{gap:5px;padding:0 0 8px}
  .tp-chip{padding:5px 7px 5px 6px;font-size:11.5px;gap:5px}
  .tp-chip i{width:8px;height:8px}
  .tp-panel{gap:10px}
  .tp-ask{font-size:18px}
  .tp-controls{gap:8px;margin-inline:-8px;padding:12px 10px}
  .tp-btn{padding:8px 12px;font-size:15px}
  .tp-status{min-height:8.8em;padding:10px 12px;font-size:15px}
  .tp-text{font-size:16px}
}
@media (max-width:380px){
  .tp-chip{padding:5px 6px;font-size:11px;gap:4px}
}
@media (prefers-reduced-motion:reduce){
  .tp-page .tp-demo *{transition:none!important;animation:none!important}
}
