/* Статья «Как одежда держит тепло». Только своё: общие компоненты — в styles.css,
   панель «человек» — в body.css. Ведущий поток — тепло: акценты из --heat*. */

/* ---------- Ведущий поток: перекраска общих компонентов ---------- */

.flow-heat .jump a {
  background: var(--heat-wash);
  color: var(--heat-ink);
}

.flow-heat .jump a:hover {
  background: color-mix(in srgb, var(--heat) 22%, var(--heat-wash));
}

.flow-heat .check li::before {
  border-color: var(--heat);
}

.flow-heat input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--heat) var(--fill, 40%), var(--line) var(--fill, 40%));
}

.flow-heat input[type="range"]::-moz-range-progress {
  background: var(--heat);
}

.flow-heat input[type="range"]::-webkit-slider-thumb {
  border-color: var(--heat);
}

.flow-heat input[type="range"]::-moz-range-thumb {
  border-color: var(--heat);
}

.flow-heat .chart .curve.on {
  stroke: var(--heat);
}

.flow-heat .chart .curve-label.on {
  fill: var(--heat-ink);
}

/* Без JS переключатели ничего не делают: прячем их и показываем подпись к статичному кадру. */
.needs-js {
  display: none !important;
}

.is-live .needs-js {
  display: revert !important;
}

.is-live fieldset.needs-js,
.is-live .stop-controls.needs-js {
  display: flex !important;
}

.is-live .stop-controls.needs-js {
  display: grid !important;
}

.is-live .static-only {
  display: none;
}

.static-only {
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
}

/* ---------- Главный интерактив: сцена на остановке ---------- */

.stop-top {
  padding: clamp(20px, 3vw, 32px) clamp(16px, 3vw, 32px) 0;
}

.stop-top h2 {
  font-size: clamp(24px, 3vw, 32px);
  margin-bottom: 16px;
}

.scenes span {
  padding: 8px 14px;
}

.stop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 24px 40px;
  padding: clamp(20px, 3vw, 28px) clamp(16px, 3vw, 32px) 8px;
  align-items: start;
}

.stop-controls {
  display: grid;
  gap: 18px;
  align-content: start;
}

.stop-controls .control-label {
  margin-bottom: 8px;
}

.stop-controls .segmented span {
  padding: 7px 14px;
}

.stop-foot {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px 40px;
  padding: 16px clamp(16px, 3vw, 32px) clamp(20px, 3vw, 28px);
  border-top: 1px solid var(--line-soft);
}

.stop-foot .sim-say {
  margin: 0;
  min-height: 0;
}

/* ---------- Схема «что греет» ---------- */

.warm-fig,
.thieves-fig {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 28px auto 8px;
}

@media (min-width: 761px) {
  .warm-fig,
  .thieves-fig {
    max-width: min(820px, calc(100% - 2 * var(--gutter)));
  }
}

.warm-layers {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.warm-layers li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 0 20px;
  align-items: stretch;
}

.wl-band {
  display: block;
  position: relative;
}

.wl-band svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wl-text {
  padding: 10px 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
  align-self: center;
}

.wl-text strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}

.wl-out .wl-band { min-height: 64px; }
.wl-shell .wl-band { height: 5px; align-self: center; background: var(--ink); }
.wl-shell .wl-text { padding: 8px 0; }
.wl-fill .wl-band { min-height: 96px; background: var(--heat-wash); }
.wl-body .wl-band { min-height: 64px; background: var(--body); border-radius: 0 0 14px 14px; }

.wl-wind {
  stroke: var(--wind);
  stroke-width: 2.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.wl-fibers path {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* Тепло идёт от тела наружу: одна линия поверх полосы слоёв. */
.warm-layers::before {
  content: "";
  position: absolute;
  left: 58px;
  top: 30px;
  bottom: 18px;
  width: 4px;
  border-radius: 2px;
  background: var(--heat);
  z-index: 1;
}

.warm-layers::after {
  content: "";
  position: absolute;
  left: 52px;
  top: 18px;
  border: 8px solid transparent;
  border-bottom: 12px solid var(--heat);
  border-top: 0;
  z-index: 1;
}

.warm-fig figcaption,
.thieves-fig figcaption {
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* ---------- Схема «три вора» ---------- */

.thieves {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 24px;
}

.thief svg {
  display: block;
  width: 100%;
  height: auto;
}

.thief p {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
}

.thief p strong {
  color: var(--ink);
}

.t-body { fill: var(--body); }
.t-fill { fill: var(--heat-wash); }
.t-fill.t-thin { fill: color-mix(in srgb, var(--heat-wash) 45%, var(--surface)); }
.t-shell { fill: var(--ink); }
.t-strap { fill: var(--ink-3); }

.t-fibers path {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.t-wind {
  stroke: var(--wind);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 2 10;
  animation: flow 1.6s linear infinite;
}

.t-drops circle {
  fill: var(--water);
}

/* ---------- Второй интерактив: разрез утеплителя ---------- */

.layer-stage {
  margin-top: 16px;
  padding: 0 clamp(16px, 3vw, 32px);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.is-live .layer-stage {
  cursor: ew-resize;
}

.layer-stage svg {
  display: block;
  width: 100%;
  height: auto;
}

.layer-stage .air {
  fill: var(--heat-wash);
}

.layer-stage .fibers path {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.8;
}

.layer-stage .shell {
  fill: var(--ink);
}

.layer-stage .core {
  fill: var(--body);
}

.layer-stage .lbl {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  fill: var(--ink-3);
}

.p-heat {
  fill: none;
  stroke: var(--heat);
  stroke-linecap: round;
}

.h-heat {
  fill: var(--heat);
}

.flow-dash {
  fill: none;
  stroke: var(--surface);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 2 14;
  opacity: 0.6;
  animation: heat-run 2.8s linear infinite;
}

@keyframes heat-run {
  to { stroke-dashoffset: 32; }
}

.layer-stage .wind-line {
  stroke: var(--wind);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.75;
  animation: heat-gust 1.6s linear infinite;
}

@keyframes heat-gust {
  0% { transform: translateX(-16px); opacity: 0; }
  25% { opacity: 0.75; }
  75% { opacity: 0.75; }
  100% { transform: translateX(16px); opacity: 0; }
}

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

.ctl-row .control-label {
  margin-bottom: 0;
}

.ctl-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--heat-ink);
  text-align: right;
}

.ctl-gap {
  margin-top: 22px;
}

.chart text {
  font-size: 13px;
}

/* ---------- «Как это устроено» и источники ---------- */

.how,
.sources-box {
  border-top: 1px solid var(--line);
}

.how {
  margin-top: clamp(56px, 8vw, 88px);
}

.how > summary,
.sources-box > summary {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 22px 0;
  cursor: pointer;
  list-style: none;
}

.how > summary::-webkit-details-marker,
.sources-box > summary::-webkit-details-marker {
  display: none;
}

.how > summary h2,
.sources-box > summary h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 30px);
}

.sources-box > summary .count {
  font-size: 15px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.how > summary::after,
.sources-box > summary::after {
  content: "";
  width: 10px;
  height: 10px;
  margin-left: auto;
  align-self: center;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.25s var(--ease-out);
}

.how[open] > summary::after,
.sources-box[open] > summary::after {
  transform: translateY(2px) rotate(225deg);
}

.how > summary:hover h2,
.sources-box > summary:hover h2 {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.how-body {
  padding-bottom: 12px;
}

.how-body h3:first-child {
  margin-top: 4px;
}

.how-body p,
.how-body td {
  font-size: 16px;
}

table.steps td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

.cond-fig {
  margin: 12px 0 20px;
}

.cond {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cond li {
  display: grid;
  grid-template-columns: 11em 1fr 6.5em;
  align-items: center;
  gap: 4px 14px;
  padding: 7px 0;
  font-size: 16px;
}

.cond .air .cn {
  font-weight: 600;
}

.cond .cb {
  position: relative;
  height: 12px;
}

.cond .cb i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  min-width: 4px;
  border-radius: 3px;
  background: var(--heat);
}

.cond .cb i.range {
  opacity: 0.4;
  border-radius: 0 3px 3px 0;
}

.cond .water .cb i {
  background: var(--water);
}

.cond .cv {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.cond-fig figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-3);
}

.sources-box {
  margin-top: 0;
}

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

@media (max-width: 760px) {
  .stop-grid,
  .stop-foot {
    grid-template-columns: minmax(0, 1fr);
  }

  .thieves {
    grid-template-columns: minmax(0, 1fr);
  }

  .thief {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 0 14px;
    align-items: center;
  }

  .thief p {
    margin: 0;
  }

  .warm-layers li {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 0 14px;
  }

  .warm-layers::before {
    left: 36px;
  }

  .warm-layers::after {
    left: 30px;
  }

  .cond li {
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 6px 0;
  }

  .cond .cb {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 10px;
  }

  .cond .cv {
    grid-row: 1;
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-dash,
  .t-wind,
  .layer-stage .wind-line {
    animation: none;
  }

  .layer-stage .wind-line {
    opacity: 0.75;
  }
}

.sim-controls .sim-say {
  margin-top: 18px;
}
