/* Изнанка — общий модуль «тело»: фигура человека, тепловой баланс, лента времени, «Показать цифры».
   Подключается вместе с body.js. Цвета — только токены из styles.css.
   Тепло на ленте — основной тон тепла: чем холоднее ступень, тем меньше в полосе тепла.
   Куртка и шапка — подложка тепла с контуром чернилами, как утеплитель на схемах. */

/* ---------- Раскладка панели ---------- */

.bp {
  display: grid;
  grid-template-columns: minmax(120px, 210px) minmax(0, 1fr);
  grid-template-areas:
    "fig state"
    "time time"
    "nums nums";
  gap: 8px 24px;
  align-items: center;
}

.bp-fig {
  grid-area: fig;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.is-live .bp-fig {
  cursor: ew-resize;
}

.bp-state {
  grid-area: state;
  min-width: 0;
}

.bp-time {
  grid-area: time;
  margin-top: 12px;
}

.bp-numbers {
  grid-area: nums;
}

/* ---------- Фигура ---------- */

.bf {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.bp-fig .bf {
  animation: bf-in 0.3s var(--ease-out);
}

@keyframes bf-in {
  from { opacity: 0.35; }
}

.bf-ground {
  stroke: var(--line);
  stroke-width: 2;
  stroke-linecap: round;
}

.bf-bench {
  fill: var(--ink-3);
}

.bf-leg {
  fill: none;
  stroke: var(--body);
  stroke-width: 17;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bf-shoe {
  fill: var(--ink);
}

.bf-head,
.bf-hand {
  fill: var(--body);
}

.bf-hat,
.bf-jacket,
.bf-collar {
  fill: var(--heat-wash);
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.bf-inner {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}

.bf-zip {
  stroke: var(--ink-3);
  stroke-width: 1.5;
}

.bf-pocket {
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.bf-sleeve-o,
.bf-sleeve {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bf-sleeve-o {
  stroke: var(--ink);
  stroke-width: 20;
}

.bf-sleeve {
  stroke: var(--heat-wash);
  stroke-width: 15;
}

.bf-shiver {
  stroke: var(--ink-2);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.bf-vapor {
  fill: none;
  stroke: var(--vapor);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.85;
}

/* Дрожь: мелкое быстрое смещение. При «уменьшить движение» остаются только штрихи. */
.bf-shake {
  animation: bf-shake 0.14s steps(2, jump-none) infinite alternate;
}

@keyframes bf-shake {
  from { transform: translateX(-1.5px); }
  to { transform: translateX(1.5px); }
}

.bf-alarm .bf-shake {
  animation-duration: 0.1s;
}

/* ---------- Ступень ---------- */

.bp-state p {
  margin: 0;
}

.bs-when {
  font-size: 14px;
  color: var(--ink-3);
}

.bs-word {
  margin-top: 2px !important;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.bs-feel {
  margin-top: 10px !important;
  font-size: 17px;
  line-height: 1.45;
  max-width: 34ch;
}

.bs-next {
  margin-top: 8px !important;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
}

.bs-face {
  margin-top: 10px !important;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

/* ---------- Лента времени ---------- */

.bt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.bt-head .control-label {
  margin: 0;
}

.bt-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--heat-ink);
}

.bt-track {
  position: relative;
  height: 40px;
  margin-top: 4px;
}

.bt-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 13px;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--line-soft);
}

.bt-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  box-shadow: inset -2px 0 0 var(--surface);
}

.bt-seg.s-warm { background: var(--heat); }
.bt-seg.s-comfort { background: color-mix(in srgb, var(--heat) 72%, transparent); }
.bt-seg.s-cool { background: color-mix(in srgb, var(--heat) 48%, transparent); }
.bt-seg.s-chilly { background: color-mix(in srgb, var(--heat) 30%, transparent); }
.bt-seg.s-cold { background: color-mix(in srgb, var(--heat) 16%, transparent); }
.bt-seg.s-freezing { background: color-mix(in srgb, var(--heat) 7%, transparent); }
.bt-seg.s-danger {
  background: repeating-linear-gradient(-45deg, var(--ink-3) 0 2px, transparent 2px 7px);
}

/* Ползунок лежит поверх полосы: тянуть можно прямо ленту. */
.bp input.bt-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 40px;
  margin: 0;
  background: transparent;
  display: none;
}

.is-live .bp input.bt-input {
  display: block;
}

.bp input.bt-input[type="range"]::-webkit-slider-runnable-track {
  height: 40px;
  background: transparent !important;
}

.bp input.bt-input[type="range"]::-moz-range-track {
  background: transparent !important;
}

.bp input.bt-input[type="range"]::-moz-range-progress {
  background: transparent !important;
}

.bp input.bt-input[type="range"]::-webkit-slider-thumb {
  width: 8px;
  height: 34px;
  margin-top: 3px;
  border-radius: 4px;
  background: var(--ink);
  border: 2px solid var(--surface) !important;
  box-shadow: 0 2px 6px rgb(18 19 24 / 0.25);
}

.bp input.bt-input[type="range"]::-moz-range-thumb {
  width: 6px;
  height: 30px;
  border-radius: 4px;
  background: var(--ink);
  border: 2px solid var(--surface) !important;
  box-shadow: 0 2px 6px rgb(18 19 24 / 0.25);
}

.bt-ticks {
  position: relative;
  height: 20px;
  font-size: 13px;
  color: var(--ink-3);
}

.bt-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.bt-ticks span:first-child {
  transform: none;
}

.bt-ticks span:last-child {
  transform: translateX(-100%);
}

.bt-events {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.bt-ev {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
}

.bt-at {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.bt-w {
  color: var(--ink-2);
}

.bt-ev.late .bt-at,
.bt-ev.late .bt-w {
  color: var(--ink-3);
}

.bp-note {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* ---------- Показать цифры ---------- */

.bp-numbers {
  margin-top: 4px;
  border-top: 1px solid var(--line-soft);
}

.bp-numbers > summary {
  padding: 14px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.bp-numbers > summary:hover {
  color: var(--ink);
}

.bn-lead {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-3);
}

.bn-list {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

.bn-list div {
  display: grid;
  grid-template-columns: minmax(0, 13em) minmax(0, 1fr);
  gap: 2px 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.bn-list dt {
  color: var(--ink-3);
}

.bn-list dd {
  margin: 0;
  color: var(--ink);
}

/* ---------- Телефон ---------- */

@media (max-width: 760px) {
  .bp {
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 4px 16px;
    align-items: start;
  }

  .bs-feel {
    font-size: 16px;
  }

  .bn-list div {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bf-shake,
  .bp-fig .bf {
    animation: none;
  }
}

@media (max-width: 480px) {
  .bp {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "fig" "state" "time" "nums";
    gap: 16px;
  }
  .bp-fig { width: 112px; justify-self: center; }
  .bt-head { flex-wrap: wrap; gap: 4px 12px; }
}
