/* ─────────────────────────────────────────────
   Цех с мостовым краном (главная)
   Геометрию крана (--girder-top, --hoist-bottom, --s) выставляет crane.js,
   здесь — значения по умолчанию на случай, если скрипт не загрузился.
   ───────────────────────────────────────────── */
.hall {
  --s: 1;
  --roof-h: 84px;
  --girder-top: 118px;
  --girder-h: 56px;
  --hoist-bottom: 218px;
  --pult-h: 72px;
  --floor-h: clamp(56px, 9svh, 100px);
  --crate-w: clamp(110px, 23svh, 230px);
  --wall: #e3dfd6;
  --wall-2: #d6d1c6;

  position: relative;
  scroll-margin-top: var(--header-h);
  height: clamp(600px, calc(100svh - var(--header-h)), 980px);
  overflow: hidden;
  isolation: isolate;
  background: var(--wall);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Декорации ── */
.hall__scene, .hall__scene > * { position: absolute; left: 0; right: 0; }
.hall__scene { inset: 0; z-index: -1; }

.hall__wall {
  top: var(--roof-h); bottom: 0;
  background:
    /* нижняя окрашенная панель стены */
    linear-gradient(to top, transparent calc(var(--pult-h) + var(--floor-h)), #c9c3b7 calc(var(--pult-h) + var(--floor-h)), #c9c3b7 calc(var(--pult-h) + var(--floor-h) + 13%), rgba(0,0,0,.18) calc(var(--pult-h) + var(--floor-h) + 13%), transparent calc(var(--pult-h) + var(--floor-h) + 13% + 2px)),
    /* швы сэндвич-панелей */
    repeating-linear-gradient(to bottom, transparent 0 58px, rgba(0,0,0,.055) 58px 59px, rgba(255,255,255,.35) 59px 60px),
    linear-gradient(to bottom, #d9d5cc, var(--wall) 30%, #ebe8e1 70%);
}

/* ленточное остекление */
.hall__windows {
  top: calc(var(--roof-h) + 10px);
  height: calc(var(--girder-top) - var(--roof-h) + var(--girder-h) + 34px);
  z-index: 1;
  background:
    repeating-linear-gradient(90deg, #3a3f45 0 6px, transparent 6px 64px),
    linear-gradient(to bottom, #3a3f45 0 5px, transparent 5px calc(50% - 2px), #3a3f45 calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px) calc(100% - 5px), #3a3f45 calc(100% - 5px)),
    linear-gradient(105deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.55) 42%, rgba(255,255,255,0) 52%) 0 0 / 520px 100%,
    linear-gradient(to bottom, #b8c7cf, #e3ebee 60%, #cdd8dd);
  box-shadow: 0 6px 0 -1px rgba(0,0,0,.08);
}

/* кровля и фермы */
.hall__roof {
  top: 0; height: var(--roof-h); z-index: 2;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='100' viewBox='0 0 360 100' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%23464b52' stroke-width='3'%3E%3Cpath d='M0 92h360M0 10h360'/%3E%3Cpath d='M0 92 45 10l45 82 45-82 45 82 45-82 45 82 45-82 45 82' stroke-width='2.5'/%3E%3C/g%3E%3Cpath d='M0 0h360v8H0zM0 90h360v10H0z' fill='%23464b52'/%3E%3C/svg%3E") 0 100% / 360px 100% repeat-x,
    linear-gradient(to bottom, #15171a, #262a2f);
}
.hall__roof::after { /* световой фонарь */
  content: ''; position: absolute; left: 0; right: 0; top: 18%; height: 18%;
  background: linear-gradient(to bottom, rgba(255,255,255,.0), rgba(220,232,236,.22), rgba(255,255,255,0));
}

/* подвесные светильники */
.hall__lamps {
  top: calc(var(--roof-h) - 6px); height: 70%; z-index: 3; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='40' viewBox='0 0 360 40'%3E%3Cpath d='M90 0v14' stroke='%23464b52' stroke-width='2'/%3E%3Cpath d='M78 14h24l8 12H70Z' fill='%232b2f34'/%3E%3Cellipse cx='90' cy='26' rx='19' ry='3' fill='%23fff8e6'/%3E%3C/svg%3E") 0 0 / 360px 40px repeat-x;
}
.hall__lamps::after {
  content: ''; position: absolute; inset: 22px 0 0;
  background: radial-gradient(60px 260px at 90px 0, rgba(255,247,220,.42), transparent 70%) 0 0 / 360px 100% repeat-x;
  mix-blend-mode: screen;
}

/* секционные ворота на задней стене */
.hall__gate {
  left: auto; right: 7%; width: clamp(140px, 17%, 260px);
  bottom: calc(var(--pult-h) + var(--floor-h));
  height: 33%;
  border: 10px solid #2b2f34; border-bottom: 0;
  background:
    repeating-linear-gradient(to bottom, #c5c9cc 0 34px, #a9aeb2 34px 36px, #d7dadc 36px 37px),
    #c5c9cc;
  box-shadow: inset 0 0 0 3px #f2b400;
}
.hall__gate::before { /* жёлто-чёрная рамка */
  content: ''; position: absolute; inset: -10px -22px 0; z-index: -1;
  background: repeating-linear-gradient(-45deg, #f2b400 0 12px, #15171a 12px 24px);
}
.hall__gate span {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font: 600 12px/1 var(--font-display); letter-spacing: .3em; text-transform: uppercase; color: #545a60; white-space: nowrap;
}

/* пол цеха */
.hall__floor {
  bottom: var(--pult-h); height: var(--floor-h); z-index: 1;
  background:
    /* жёлтая разметка проезда */
    linear-gradient(to bottom, transparent 22%, #f2b400 22%, #f2b400 calc(22% + 4px), transparent calc(22% + 4px)),
    linear-gradient(to bottom, transparent 82%, rgba(242,180,0,.85) 82%, rgba(242,180,0,.85) calc(82% + 6px), transparent calc(82% + 6px)),
    /* блики наливного пола */
    radial-gradient(40% 120% at 30% 120%, rgba(255,255,255,.35), transparent 70%),
    radial-gradient(30% 100% at 78% 120%, rgba(255,255,255,.25), transparent 70%),
    linear-gradient(to bottom, #a39d92, #bdb7ad 40%, #c9c4bb);
  box-shadow: inset 0 3px 0 rgba(0,0,0,.18);
}
.hall__floor::before { /* перспективные швы пола */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.07) 0 1px, transparent 1px 180px);
  transform: perspective(240px) rotateX(38deg);
  transform-origin: 50% 0;
}

/* ── Заголовок на стене ── */
.hall__copy {
  position: absolute; z-index: 4;
  left: var(--gutter);
  top: calc(var(--hoist-bottom) + clamp(14px, 3svh, 40px));
  max-width: min(1000px, 62%);
  pointer-events: none;
}
.hall__copy .eyebrow { color: #5d6268; margin-bottom: clamp(8px, 1.6svh, 18px); }
.hall__title {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(36px, min(4.4vw, 6.6svh), 76px); line-height: .94; letter-spacing: -.01em;
  color: var(--ink);
}
.hall__title .is-red { color: var(--red); }
.hall__lead { margin-top: clamp(8px, 1.8svh, 18px); max-width: 600px; font-size: clamp(14px, min(1.25vw, 2.1svh), 18px); color: var(--ink-2); }

/* ── Кран (SVG) ── */
.rig {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 6; pointer-events: none; overflow: visible;
}
.rig .rig__laser { transition: opacity .25s; }

/* ── Склад: ряд ящиков-разделов ── */
.yard {
  list-style: none; margin: 0 auto; padding: 0;
  position: absolute; z-index: 5; left: 0; right: 0;
  bottom: calc(var(--pult-h) + var(--floor-h) * .42);
  width: min(100% - 2 * var(--gutter) - 2 * 28px, 1280px);
  display: grid; grid-template-columns: repeat(5, minmax(0, var(--crate-w)));
  justify-content: space-evenly;
  gap: clamp(8px, 2vw, 40px);
  align-items: end;
}
.slot { position: relative; --lift: 0; }
/* тень ящика на полу */
.slot::before {
  content: ''; position: absolute; left: 2%; right: 2%; bottom: -10px; height: 20px; z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.45), transparent 70%);
  transform: scale(calc(1 - var(--lift) * .55));
  opacity: calc(1 - var(--lift) * .75);
}
/* разметка места на полу */
.slot::after {
  content: ''; position: absolute; left: -6%; right: -6%; bottom: -8px; height: 5px; z-index: -2;
  background: repeating-linear-gradient(90deg, #f2b400 0 14px, transparent 14px 22px);
  opacity: .9;
}
.slot__mark {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: -1;
  font: 700 clamp(28px, 4vw, 56px)/1 var(--font-display); color: rgba(21,23,26,.14);
  opacity: var(--lift);
}

.crate {
  display: block; position: relative; text-decoration: none;
  container-type: inline-size;
  color: var(--crate-ink);
  transform-origin: 50% 0;
  will-change: transform;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.crate__sling {
  position: absolute; left: 4%; right: 4%; bottom: calc(100% - 2px);
  aspect-ratio: 100 / 28;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 28'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M47 9.5 4 26.5M53 9.5 96 26.5' stroke='%2333373c' stroke-width='1.7'/%3E%3Cpath d='M47 9.5 4 26.5M53 9.5 96 26.5' stroke='%23878d93' stroke-width='.6'/%3E%3Cellipse cx='50' cy='6' rx='4.3' ry='5.2' stroke='%2322252a' stroke-width='2.1'/%3E%3Ccircle cx='4' cy='26' r='2' stroke='%2322252a' stroke-width='1.4'/%3E%3Ccircle cx='96' cy='26' r='2' stroke='%2322252a' stroke-width='1.4'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
  pointer-events: none;
}
.crate__body {
  position: relative; display: flex; flex-direction: column;
  aspect-ratio: 1.3;
  overflow: hidden;
  padding: 8% 9% 11%;
  border-radius: 3px;
  background-color: var(--crate);
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,.14), rgba(255,255,255,0) 16%, rgba(0,0,0,0) 80%, rgba(0,0,0,.22)),
    repeating-linear-gradient(90deg, rgba(0,0,0,.14) 0 2px, rgba(255,255,255,.07) 2px 3px, transparent 3px 22px, rgba(0,0,0,.06) 22px 25px, transparent 25px 30px);
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.28),
    inset 0 0 0 5px rgba(255,255,255,.06),
    0 1px 0 rgba(0,0,0,.25);
  transition: box-shadow .2s, filter .3s, opacity .3s;
}
/* угловые фитинги */
.crate__body::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 3px;
  --c: rgba(0,0,0,.42);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / 9% 9% no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / 9% 9% no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / 9% 9% no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / 9% 9% no-repeat;
}
/* полоса разметки по низу */
.crate__body::after {
  content: ''; position: absolute; left: 9%; right: 9%; bottom: 0; height: 6%;
  background: repeating-linear-gradient(-45deg, var(--crate-accent) 0 7px, transparent 7px 14px);
  opacity: .9;
}
.crate__head { display: flex; justify-content: space-between; align-items: flex-start; }
.crate__no { font: 600 clamp(16px, 14cqi, 34px)/1 var(--font-display); letter-spacing: .02em; opacity: .9; }
.crate__icon { width: clamp(18px, 14cqi, 34px); height: auto; opacity: .9; }
.crate__title {
  margin-top: auto;
  font: 600 clamp(11px, 10cqi, 22px)/1.05 var(--font-display); text-transform: uppercase; letter-spacing: .015em;
}
.crate__list { margin-top: 6px; font-size: clamp(9.5px, 5.4cqi, 12px); line-height: 1.35; opacity: .78; }
@container (max-width: 175px) {
  .crate__list { display: none; }
}
.crate__cta {
  position: absolute; right: 9%; top: 9%;
  display: none;
}

/* наведение / выбор */
.slot.is-aimed .crate__body {
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.28),
    inset 0 0 0 5px rgba(255,255,255,.06),
    0 0 0 3px var(--paper),
    0 0 0 6px var(--yellow);
}
.crate:focus-visible .crate__body {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink);
}
.slot.is-aimed .crate__no::after {
  content: ' ↑'; color: var(--crate-accent);
}
.hall.is-busy .slot:not(.is-active) .crate__body { filter: saturate(.6) brightness(.92); opacity: .75; }
.hall.is-busy .crate { cursor: default; }

/* ── Пульт оператора ── */
.pult {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 8;
  height: var(--pult-h);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: clamp(14px, 2.4vw, 40px);
  padding: 0 var(--gutter);
  background: linear-gradient(to bottom, #202328, #15171a);
  color: #e9e6e0;
  border-top: 3px solid #0d0e10;
  box-shadow: 0 -1px 0 rgba(255,255,255,.06) inset;
}
.pult__keys {
  display: flex; gap: 6px; padding: 7px;
  background: linear-gradient(#ffc61a, #e8a900);
  border-radius: 14px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 2px 0 rgba(0,0,0,.5);
}
.pult__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 46px; height: 46px; padding: 0 12px;
  border: 0; border-radius: 9px; cursor: pointer;
  background: linear-gradient(#2c3036, #15171a);
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 3px 0 #0b0c0e;
  transition: transform .08s, box-shadow .08s, background .2s, opacity .2s;
}
.pult__btn svg { width: 16px; height: 16px; }
.pult__btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 #0b0c0e; }
.pult__btn--lift { background: linear-gradient(#e2262c, #a80f14); padding: 0 16px; }
.pult__btn:disabled { cursor: default; background: linear-gradient(#3a3e44, #2a2e33); color: rgba(255,255,255,.4); }
.pult__btn:focus-visible { outline-color: #fff; }

.pult__screen { min-width: 0; display: grid; gap: 2px; }
.pult__tag { font: 500 10px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: #f2b400; }
.pult__title { font: 600 clamp(15px, 1.4vw, 20px)/1.15 var(--font-display); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pult__hint { font-size: 12.5px; color: #a7abb0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pult__telemetry {
  display: flex; gap: 6px;
  font-family: var(--font-mono);
}
.pult__telemetry div {
  min-width: 92px; padding: 7px 10px 6px;
  background: #0b0c0e; border: 1px solid #2c3036; border-radius: 4px;
  box-shadow: inset 0 0 12px rgba(242,180,0,.06);
}
.pult__telemetry dt { font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: #6f747a; }
.pult__telemetry dd { font-size: 15px; color: #ffcf3a; text-shadow: 0 0 8px rgba(255,190,0,.35); font-variant-numeric: tabular-nums; }

/* ── Адаптив ── */
@media (max-width: 1100px) {
  .pult__telemetry div:nth-child(1) { display: none; }
}
@media (max-width: 900px) {
  .crate__body { aspect-ratio: 1; }
  .hall__copy { max-width: calc(100% - 2 * var(--gutter)); }
  .hall__title { font-size: clamp(36px, 7.4vw, 64px); }
}
@media (max-width: 760px) {
  .hall {
    --pult-h: 150px;
    --floor-h: clamp(54px, 9svh, 90px);
    height: clamp(600px, calc(100svh - var(--header-h)), 900px);
  }
  .hall__gate { display: none; }
  .hall__title { font-size: clamp(34px, 10.4vw, 52px); }
  .hall__lead { font-size: 14.5px; max-width: 340px; }
  .yard { gap: 6px; width: calc(100% - 2 * var(--gutter)); grid-template-columns: repeat(5, 1fr); }
  .crate__body { aspect-ratio: .74; padding: 12% 10% 16%; }
  .crate__head { flex-direction: column; align-items: center; gap: 6px; }
  .crate__no { font-size: clamp(16px, 30cqi, 22px); }
  .crate__icon { width: clamp(18px, 36cqi, 26px); }
  .crate__title { font-size: 0; text-align: center; }
  .crate__title::before { content: attr(data-short); font-size: clamp(8.5px, 15cqi, 12px); letter-spacing: 0; }
  .slot__mark { font-size: 26px; }
  .hide-sm { display: none; }
  .pult {
    grid-template-columns: 1fr auto;
    grid-template-areas: "screen screen" "telemetry keys";
    align-content: center; row-gap: 10px; padding-top: 10px; padding-bottom: 10px;
  }
  .pult__screen { grid-area: screen; }
  .pult__keys { grid-area: keys; }
  .pult__telemetry { grid-area: telemetry; }
  .pult__telemetry div { min-width: 0; padding: 5px 8px; }
  .pult__telemetry div:nth-child(2) { display: none; }
  .pult__telemetry dd { font-size: 13px; }
  .pult__btn { height: 40px; min-width: 40px; }
  .pult__hint { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
@media (min-width: 761px) and (max-width: 900px) {
  .hall { height: clamp(600px, calc(100svh - var(--header-h)), 820px); }
  .crate__body { aspect-ratio: .9; }
}
@media (max-width: 760px) and (max-height: 780px) {
  .hall__lead { display: none; }
}
@media (max-width: 370px) {
  .pult__btn--lift span { display: none; }
}
