/*
 * "Направи запитване" (templates/partials/inquiry_form.html, static/js/inquiry.js): the form on the
 * left, the robot that assembles on the right. A part is hidden until its field is done (.on), then
 * its lines draw themselves in (pathLength="1" + dash offset). The motion (sway, welding) is in JS.
 */
.iq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "head stage" "body stage";
  grid-template-rows: auto 1fr; column-gap: clamp(28px, 4vw, 56px); row-gap: 28px; align-items: stretch; }
.iq-head { grid-area: head; }
.iq-body { grid-area: body; min-width: 0; }
.iq-stage { grid-area: stage; }

.iq-stage { position: relative; display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; color: #fff; min-height: 460px;
  background: radial-gradient(120% 80% at 70% 20%, rgba(229, 72, 77, .14), transparent 60%), #0f1215; }
.iq-stage::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .9;
  background-image: linear-gradient(#1b2229 1px, transparent 1px), linear-gradient(90deg, #1b2229 1px, transparent 1px); background-size: 28px 28px;
  -webkit-mask: radial-gradient(circle at 50% 45%, #000 30%, transparent 80%); mask: radial-gradient(circle at 50% 45%, #000 30%, transparent 80%); }
.iq-bot { position: relative; flex: 1; width: 100%; min-height: 0; padding: 36px 28px 8px; }
.iq-fly circle { fill: #ffd28a; }

/* the lines */
.iq-floor { stroke: #2b3239; stroke-width: 2; }
.iq-dim { stroke: #3a434b; stroke-width: 2; }
.iq-plate { fill: #1d242a; stroke: #5d676f; stroke-width: 1.5; }
.iq-seam { stroke: #ffb347; stroke-width: 3.5; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 4px #ff9a3c); }
.iq-seam.cool { stroke: #b0653a; filter: none; transition: stroke 2.5s, filter 2.5s; }
.iq-shadow { fill: rgba(229, 72, 77, .14); }
.iq-o { stroke: #f2f4f6; stroke-width: 2; fill: #161b21; }
.iq-r { stroke: #e5484d; stroke-width: 2.6; }
.iq-j { fill: #e5484d; }
.iq-lk { stroke: #f2f4f6; stroke-width: var(--w, 28px); }
.iq-lk-in { stroke: #161b21; stroke-width: calc(var(--w, 28px) - 4px); }
.iq-led { fill: #3a434b; transition: fill .4s; }
.iq-stage.ready .iq-led { fill: #22c55e; animation: iq-led 1.6s ease-in-out infinite; }
@keyframes iq-led { 50% { opacity: .35; } }

/* the blueprint under the parts (inquiry.js clones each part) */
.iq-ghost { opacity: .3; }
.iq-ghost * { fill: none !important; filter: none; }
.iq-ghost [pathLength] { stroke-dasharray: .025 .02; stroke: #8b959d; stroke-width: 1.5; }
/* a link: a thick dashed line with its middle covered, so only its dashed outline shows */
.iq-ghost .iq-lk { stroke-width: var(--w, 28px); }
.iq-ghost .iq-lk-in { stroke: #0f1215; stroke-dasharray: none; stroke-width: calc(var(--w, 28px) - 3px); }
.iq-ghost .iq-j, .iq-ghost .iq-led, .iq-ghost .iq-shadow, .iq-ghost .iq-spark { display: none; }

/* a part draws itself in when its field is done */
.iq-p { opacity: 0; transition: opacity .3s; }
.iq-p.on { opacity: 1; }
.iq-p [pathLength] { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s cubic-bezier(.6, 0, .2, 1); }
.iq-p.on [pathLength] { stroke-dashoffset: 0; }
.iq-p .iq-o, .iq-p .iq-lk-in { fill-opacity: 0; transition: stroke-dashoffset .9s cubic-bezier(.6, 0, .2, 1), fill-opacity .5s .6s; }
.iq-p.on .iq-o, .iq-p.on .iq-lk-in { fill-opacity: 1; }
.iq-tool { display: none; }
.iq-tool.cur { display: inline; }
.iq-spark { display: none; stroke: #ffc46b; stroke-width: 2; }
.iq-stage.weld .iq-spark { display: inline; animation: iq-spark .12s steps(2) infinite; }
@keyframes iq-spark { 50% { opacity: .35; transform: translate(1px, -1px); } }

/* ===== the scenes (templates/partials/iq/<scene>.html) ===== */
.iq-label { position: absolute; top: 16px; left: 20px; z-index: 1; font: 600 10.5px ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase;
  color: #9aa3ab; padding: 5px 9px; border: 1px solid #262e35; border-radius: 999px; background: rgba(15, 18, 21, .6); }
.iq-label::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #3a434b; vertical-align: 1px; transition: background .4s; }
.iq-stage.ready .iq-label::before { background: #22c55e; }
.iq-w { stroke: #f2f4f6; stroke-width: 2.4; }
.iq-c { stroke: #38d6f5; stroke-width: 2; }
.iq-txt { fill: #f2f4f6; stroke: none; font: 700 9px ui-monospace, monospace; letter-spacing: .08em; }
.iq-big { font-size: 13px; fill: #9aa3ab; }
.iq-ghost text, .iq-ghost .iq-wpt, .iq-ghost .iq-prog, .iq-ghost .iq-fill, .iq-ghost .iq-cur, .iq-ghost .iq-beam, .iq-ghost .iq-scan,
.iq-ghost .iq-tag, .iq-ghost .iq-wrap, .iq-ghost .iq-lamp, .iq-ghost .iq-rod { display: none; }
.iq-ghost .iq-bar { transform: none; stroke: #8b959d; stroke-width: 1.5; stroke-dasharray: 3 3; transition: none; }
.iq-ghost .iq-land, .iq-ghost .iq-home { stroke: #8b959d; stroke-width: 1.5; stroke-dasharray: 4 4; }
.iq-fly rect { stroke: none; }
/* a ✓ that draws in at the end of the finale */
.iq-okc { fill: #22c55e; stroke: none; opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.3); }
.iq-okp { stroke: #fff; stroke-width: 2.6; stroke-dasharray: 20; stroke-dashoffset: 20; }
.iq-stage.go .iq-okc { animation: iq-pop .5s var(--ok, 1.6s) cubic-bezier(.3, 1.6, .5, 1) forwards; }
.iq-stage.go .iq-okp { animation: iq-draw .4s calc(var(--ok, 1.6s) + .3s) forwards; }
@keyframes iq-pop { to { opacity: 1; transform: none; } }
@keyframes iq-draw { to { stroke-dashoffset: 0; } }

/* line: parts run along the conveyor through the three stations */
.iq-item { fill: #e5484d; opacity: 0; }
.iq-stage.ready .iq-item { animation: iq-run 6s linear infinite; }
.iq-stage.go .iq-item { animation-duration: 2.4s; }
@keyframes iq-run { 0% { opacity: 0; transform: translateX(0); } 6%, 90% { opacity: 1; } 100% { opacity: 0; transform: translateX(270px); } }
.iq-lamp { fill: #3a434b; transition: fill .4s; }
.iq-stage.ready .iq-lamp { fill: #22c55e; }
.iq-stage.go .iq-lamp { animation: iq-led .3s 4 steps(2); }

/* car: the guns go down and up, the spot welds light up one by one in the finale */
.iq-gun { transform-box: view-box; }
.iq-stage.ready .iq-gun { animation: iq-gun 2.4s ease-in-out infinite; }
@keyframes iq-gun { 40%, 60% { transform: translateY(10px); } }
.iq-spot { fill: #ffd28a; opacity: 0; }
.iq-stage.go .iq-spot { animation: iq-spot 1.2s var(--d) forwards; }
@keyframes iq-spot { 0% { opacity: 0; } 10% { opacity: 1; fill: #fff6d6; filter: drop-shadow(0 0 5px #ff9a3c); } 100% { opacity: 1; fill: #b0653a; } }

/* orbit: ROKAE in the middle, the robots and the equipment turning around it */
.iq-core { stroke: #e5484d; stroke-width: 2.6; fill: rgba(229, 72, 77, .12); }
.iq-ring { stroke: #3a434b; stroke-width: 1.6; }
.iq-ghost .iq-ring { stroke: #8b959d; }
.iq-rot1, .iq-rot2 { transform-origin: 160px 115px; }
.iq-stage.ready .iq-rot1 { animation: iq-spin 24s linear infinite; }
.iq-stage.ready .iq-rot2 { animation: iq-spin 40s linear infinite reverse; }
@keyframes iq-spin { to { transform: rotate(360deg); } }
.iq-wave { stroke: #e5484d; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.iq-stage.ready .iq-wave { animation: iq-wave 2.4s ease-out infinite; }
.iq-stage.go .iq-wave { animation-duration: 1s; }
@keyframes iq-wave { 0% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(3.4); } }

/* map: the offices, then a paper plane to Dimitrovgrad */
.iq-land { fill: #1a2026; stroke: #2e363e; stroke-width: 1.4; }
.iq-home { fill: rgba(229, 72, 77, .28); stroke: #e5484d; stroke-width: 1.2; }
.iq-arc { stroke: #e5484d; stroke-width: 2; }
.iq-stage.ready .iq-arc { stroke-dasharray: .03 .02; animation: iq-flow 1.6s linear infinite; }
@keyframes iq-flow { to { stroke-dashoffset: -.1; } }
.iq-guide { stroke: none; }
[data-scene="map"] .iq-bot { -webkit-mask: radial-gradient(85% 80% at 50% 50%, #000 60%, transparent 100%); mask: radial-gradient(85% 80% at 50% 50%, #000 60%, transparent 100%); }

/* press: the page floats; the finale stamps it */
.iq-stage.ready .iq-sheet { animation: iq-float 4s ease-in-out infinite; }
@keyframes iq-float { 50% { transform: translateY(-4px); } }
.iq-hl { stroke: #f2f4f6; stroke-width: 5; }
.iq-lines { stroke: #5d676f; stroke-width: 2.4; }
.iq-stamp { opacity: 0; stroke: #22c55e; stroke-width: 3.5; fill: rgba(34, 197, 94, .12); transform-box: fill-box; transform-origin: center; }
.iq-stage.go .iq-stamp { animation: iq-stamp .45s .2s cubic-bezier(.5, 0, .7, 1.4) forwards; }
@keyframes iq-stamp { 0% { opacity: 0; transform: scale(2.4) rotate(-20deg); } 100% { opacity: 1; transform: rotate(-12deg); } }

/* cobot: the arm is moved by inquiry.js */
.iq-target { stroke: #3a434b; stroke-width: 1.5; stroke-dasharray: 3 3; }
.iq-box { fill: #2a2216; stroke: #ffb347; stroke-width: 1.8; }
.iq-p .iq-box { fill-opacity: 0; transition: stroke-dashoffset .9s cubic-bezier(.6, 0, .2, 1), fill-opacity .5s .6s; }
.iq-p.on .iq-box { fill-opacity: 1; }
.iq-scr { stroke: #38d6f5; stroke-width: 2; }
.iq-stage.go .iq-scr { stroke: #22c55e; }

/* sim: the TCP follows the planned path, the timeline plays */
.iq-mesh { stroke: #232b32; stroke-width: 1.2; }
.iq-path { stroke: #38d6f5; stroke-width: 1.6; stroke-opacity: .7; }
.iq-p.on .iq-path { stroke-dasharray: .02 .015; transition: none; }
.iq-wpt { fill: #0f1215; stroke: #38d6f5; stroke-width: 2; }
.iq-prog { stroke: #38d6f5; stroke-width: 4; stroke-dasharray: 210; stroke-dashoffset: 210; }
.iq-stage.ready .iq-prog { animation: iq-prog 3.4s linear infinite; }
.iq-stage.go .iq-prog { animation: iq-prog 1.4s ease-out forwards; stroke: #22c55e; }
@keyframes iq-prog { to { stroke-dashoffset: 0; } }

/* net: packets travel between the machines */
.iq-links path { stroke: none; }
.iq-bars { stroke: #38d6f5; stroke-width: 5; }
[data-scene="net"].ready .iq-core { animation: iq-led 2s ease-in-out infinite; }
[data-scene="net"].go .iq-mover circle { fill: #22c55e; }

/* cell: the cap is thrown in the finale */
.iq-cap { transform-box: fill-box; transform-origin: center; }
.iq-stage.ready .iq-cap { animation: iq-float 3s ease-in-out infinite; }
.iq-stage.go .iq-cap { animation: iq-toss 1.3s cubic-bezier(.3, 0, .6, 1) forwards; }
@keyframes iq-toss { 0% { transform: none; } 45% { transform: translateY(-26px) rotate(-200deg); } 100% { transform: rotate(-360deg); } }

/* vision: the camera scans, the AI boxes what it recognises */
.iq-beam { fill: rgba(56, 214, 245, .07); stroke: rgba(56, 214, 245, .25); stroke-width: 1; opacity: 0; transition: opacity .6s; }
.iq-stage.ready .iq-beam { opacity: 1; }
.iq-scan { stroke: #38d6f5; stroke-width: 1.5; opacity: 0; }
.iq-stage.ready .iq-scan { animation: iq-scan 2.2s ease-in-out infinite; }
@keyframes iq-scan { 0% { opacity: 0; transform: translateY(66px); } 15%, 85% { opacity: .9; } 100% { opacity: 0; transform: translateY(158px); } }
.iq-bb { stroke: #ffb347; stroke-width: 1.6; }
.iq-p.on .iq-bb { stroke-dasharray: .06 .03; transition: none; }
.iq-tag { fill: #ffb347; stroke: none; font: 700 8px ui-monospace, monospace; }
.iq-stage.ready .iq-bb { animation: iq-led 1.4s ease-in-out infinite; }
.iq-stage.go .iq-bb { stroke: #22c55e; animation: none; stroke-dasharray: none; transition: stroke .3s var(--d, 0s); }
.iq-stage.go .iq-tag { fill: #22c55e; }

/* chart: the bars grow, the gear turns */
.iq-bar { fill: #3a434b; transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); transition: transform .7s calc(var(--i) * .08s) cubic-bezier(.3, 1.3, .5, 1), fill .4s; }
.iq-p.on .iq-bar { transform: none; }
.iq-stage.ready .iq-bar { fill: #e5484d; fill-opacity: .8; }
.iq-stage.go .iq-bar { animation: iq-grow .9s calc(var(--i) * .1s) cubic-bezier(.3, 1.4, .5, 1); }
@keyframes iq-grow { 0% { transform: scaleY(.4); } }
.iq-trend { stroke: #22c55e; stroke-width: 3; }
.iq-gear { transform-origin: 100px 64px; }
.iq-stage.ready .iq-gear { animation: iq-spin 6s linear infinite; }
.iq-stage.go .iq-gear { animation-duration: 1.2s; }

/* plc: the LEDs come on and blink */
.iq-wire { stroke: #ffb347; stroke-width: 1.6; }
.iq-stage.ready .iq-led { animation-duration: .9s; }
.iq-stage.go .iq-led { fill: #38d6f5; animation-duration: .25s; }

/* code: the cursor blinks, the build runs */
.iq-code { stroke: #9aa3ab; stroke-width: 3.2; }
.iq-code.k { stroke: #e5484d; }
.iq-code.s { stroke: #38d6f5; }
.iq-cur { stroke: #f2f4f6; stroke-width: 2; opacity: 0; }
.iq-p.on .iq-cur { animation: iq-blink 1s steps(2) infinite; }
@keyframes iq-blink { 50% { opacity: 1; } }
.iq-fill { fill: #22c55e; transform-box: fill-box; transform-origin: left; transform: scaleX(0); }
.iq-stage.go .iq-fill { animation: iq-fill 1.4s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes iq-fill { to { transform: none; } }

/* pallet: the gantry brings the last box and sets it on the stack, then the stack is wrapped */
.iq-car { transform-box: view-box; }
.iq-rod { stroke: #f2f4f6; stroke-width: 3; transform-box: fill-box; transform-origin: top; }
.iq-load { transform-box: view-box; }
.iq-placed { fill: #2a2216; stroke: #ffb347; stroke-width: 1.8; opacity: 0; }
.iq-stage.ready .iq-car { animation: iq-car 4.4s ease-in-out infinite; }
.iq-stage.ready .iq-rod { animation: iq-rod 4.4s ease-in-out infinite; }
.iq-stage.ready .iq-load { animation: iq-load 4.4s ease-in-out infinite; }
.iq-stage.ready .iq-placed { animation: iq-placed 4.4s linear infinite; }
@keyframes iq-car { 0% { transform: none; } 25%, 70% { transform: translateX(-45px); } 90%, 100% { transform: none; } }
@keyframes iq-rod { 0%, 25% { transform: none; } 45%, 55% { transform: scaleY(4.25); } 70%, 100% { transform: none; } }
@keyframes iq-load { 0%, 25% { transform: none; opacity: 1; } 45%, 55% { transform: translateY(52px); opacity: 1; }
  55.5%, 90% { transform: translateY(52px); opacity: 0; } 90.5% { transform: none; opacity: 0; } 96%, 100% { transform: none; opacity: 1; } }
@keyframes iq-placed { 0%, 55% { opacity: 0; } 55.5%, 86% { opacity: 1; } 94%, 100% { opacity: 0; } }
.iq-wrap { stroke: #38d6f5; stroke-width: 1.4; stroke-opacity: .7; stroke-dasharray: 160; stroke-dashoffset: 160; }
.iq-stage.go .iq-wrap { animation: iq-wrapd 1.6s ease-in-out forwards; }
@keyframes iq-wrapd { to { stroke-dashoffset: 0; } }

/* the status under the robot */
.iq-status { position: relative; padding: 18px 26px 24px; border-top: 1px solid #222a31; background: rgba(15, 18, 21, .7); backdrop-filter: blur(4px); }
.iq-status b { display: block; font-size: 16px; line-height: 1.35; min-height: 2.7em; }
.iq-status span { display: block; margin-top: 4px; font: 600 11px ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: #7f8891; }
.iq-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.iq-meter i { height: 4px; border-radius: 4px; background: #262e35; transition: background .4s; }
.iq-meter i.f { background: #e5484d; }
.iq-stage.sent .iq-meter i { background: #22c55e; }
.iq-contact { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: 14px; }
.iq-contact a { color: #cfd4d9; text-decoration: none; }
.iq-contact a:hover { color: #fff; }

@media (max-width: 1023px) {
  /* phones and tablets: the robot sits above the form, smaller */
  .iq-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "stage" "body"; grid-template-rows: auto; row-gap: 22px; }
  .iq-stage { min-height: 0; }
  .iq-bot { height: 250px; flex: none; padding: 44px 12px 0; }
  .iq-label { top: 12px; left: 14px; }
  .iq-status b { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .iq-p, .iq-p [pathLength], .iq-p .iq-o, .iq-p .iq-lk-in { transition: none; }
  .iq-stage .iq-p *, .iq-stage .iq-fxs *, .iq-stage .iq-rot1, .iq-stage .iq-rot2, .iq-stage .iq-sheet, .iq-stage .iq-cap, .iq-stage .iq-car,
  .iq-stage .iq-rod, .iq-stage .iq-load, .iq-stage .iq-placed, .iq-stage .iq-gun, .iq-stage .iq-gear, .iq-stage .iq-item, .iq-stage .iq-scan { animation: none !important; }
  .iq-stage.go .iq-okc, .iq-stage.go .iq-stamp { opacity: 1; transform: none; }
  .iq-stage.go .iq-okp, .iq-stage.go .iq-wrap { stroke-dashoffset: 0; }
  .iq-stage.go .iq-fill { transform: none; }
  .iq-stage.go .iq-spot { opacity: 1; fill: #b0653a; }
}
