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

/* ---------- Без JS: прячем переключатели, показываем статичные кадры ---------- */

.needs-js {
  display: none !important;
}

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

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

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

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

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

.stage-static {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sim.is-live .stage-static,
.sim.is-live .st-only {
  display: none;
}

.sim:not(.is-live) canvas {
  display: none;
}

.stage-static .st-ins {
  fill: var(--heat);
  opacity: 0.12;
}

.stage-static .st-body {
  fill: var(--body);
}

.stage-static .st-fabric rect,
.stage-static .st-yarn ellipse {
  fill: var(--ink);
}

.stage-static .st-wind path {
  fill: none;
  stroke: var(--wind);
  stroke-width: 3;
  stroke-linecap: round;
}

.stage-static .st-wind .st-in {
  opacity: 0.7;
}

.stage-static .st-heat circle {
  fill: var(--heat);
}

/* ---------- Главный интерактив ---------- */

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

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

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

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

.wind-side {
  display: grid;
  gap: 24px;
  align-content: start;
}

.wind-controls {
  display: grid;
  gap: 18px;
}

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

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

/* Куртка на фигуре: пунктир — вязка, сквозь которую дует; сплошной контур — плотный верх. */
.wind-body[data-layer="sweater"] .bf-jacket,
.wind-body[data-layer="fleece"] .bf-jacket,
.wind-body[data-layer="sweater"] .bf-collar,
.wind-body[data-layer="fleece"] .bf-collar {
  stroke-dasharray: 5 4;
}

.wind-body[data-layer="membrane"] .bf-jacket {
  stroke-width: 3.5;
}

/* ---------- Сравнение слоёв ---------- */

.cmp-title {
  margin: 0 0 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-2);
}

.cmp-lead {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cmp-rows {
  display: grid;
  gap: 4px;
}

.cmp-row {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr) 5.6em;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 4px 8px;
  margin: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out);
}

.cmp-row:hover {
  background: var(--line-soft);
}

.cmp-row:focus-visible {
  outline: 2px solid var(--water);
  outline-offset: 1px;
}

.cmp-row.on {
  color: var(--ink);
  font-weight: 600;
}

.cmp-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.cmp-bar i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--heat) 40%, transparent);
  transform-origin: left center;
  transform: scaleX(var(--w, 1));
  transition: transform 0.35s var(--ease-out);
}

.cmp-row.on .cmp-bar i {
  background: var(--heat);
}

.cmp-val {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Частицы и подвал карточки ---------- */

.wind-stage {
  height: clamp(220px, 26vw, 300px);
  margin-top: 20px;
  border-top: 1px solid var(--line-soft);
}

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

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

/* ---------- Схема: три пути ---------- */

.wind-figure {
  max-width: var(--wide);
  margin: 28px auto 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: 24px 40px;
  align-items: center;
}

.wind-ways-card svg {
  max-width: 460px;
  margin: 0 auto;
}

.wind-ways-card svg text {
  font-family: var(--font-body);
  font-size: 15px;
}

.ww-bl { fill: var(--wind-wash); }
.ww-fab { fill: var(--ink); }
.ww-ins { fill: var(--heat-wash); }
.ww-body { fill: var(--body); }
.ww-heat circle { fill: var(--heat); }

.ww-wind,
.ww-heat-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 2 9;
  animation: ww-run 1.6s linear infinite;
}

.ww-heat-line {
  animation-duration: 2.8s;
}

@keyframes ww-run {
  to { stroke-dashoffset: -22; }
}

.ww-wind { stroke: var(--wind); }
.ww-heat-line { stroke: var(--heat); }

.ww-head-w,
.ww-head-h {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ww-head-w { stroke: var(--wind); }
.ww-head-h { stroke: var(--heat); }
.ww-lbl { fill: var(--ink-3); }

.ww-n {
  font-family: var(--font-display);
  font-weight: 700;
  fill: var(--wind-ink);
}

.wind-figure figcaption {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}

.ww-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: ww;
  max-width: 46ch;
}

.ww-steps li {
  counter-increment: ww;
  display: grid;
  grid-template-columns: 1.6em 1fr;
  gap: 0 8px;
  margin-bottom: 0.9em;
}

.ww-steps li::before {
  content: counter(ww);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.2;
  color: var(--wind-ink);
}

.ww-steps strong {
  color: var(--ink);
  font-weight: 600;
}

.ww-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin: 0;
  max-width: 46ch;
  color: var(--ink-3);
}

.ww-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}

.ww-legend span::before {
  content: "";
  width: 18px;
  height: 4px;
  border-radius: 2px;
}

.ww-legend .lg-wind::before { background: var(--wind); }
.ww-legend .lg-heat::before { background: var(--heat); }

/* ---------- Интерактив «Ткань на просвет» ---------- */

.see-sim .readout .big {
  color: var(--wind-ink);
  font-size: clamp(32px, 4.6vw, 48px);
  line-height: 1;
}

.see-sim .readout .label {
  max-width: none;
}

.see-stage {
  height: clamp(240px, 28vw, 320px);
}

.see-note {
  grid-column: 1 / -1;
  max-width: 76ch;
}

.see-note .data {
  font-size: 15px;
}

.see-note .num {
  color: var(--ink-2);
}

.see-sim .sim-say {
  margin-top: 4px;
}

.perm-scale {
  margin: 6px 0 16px;
}

.ps-track {
  position: relative;
  height: 14px;
}

.ps-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--line);
  border-right: 2px solid var(--surface);
  transition: background-color 0.3s var(--ease-out);
}

.ps-zone:first-child {
  border-radius: 3px 0 0 3px;
}

.ps-zone:nth-child(3) {
  border-right: 0;
  border-radius: 0 3px 3px 0;
}

.ps-zone.is-on {
  background: color-mix(in srgb, var(--wind) 26%, var(--surface));
}

.ps-mark {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink-3);
  transform: translate(-50%, -50%) scale(0.5);
  transition: transform 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}

.ps-mark.is-on {
  z-index: 1;
  background: var(--wind);
  box-shadow: 0 0 0 3px var(--surface);
  transform: translate(-50%, -50%);
}

.ps-classes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-3);
}

.ps-classes span {
  overflow-wrap: anywhere;
}

.ps-classes span[data-c="2"] { text-align: center; }
.ps-classes span[data-c="1"] { text-align: right; }

.ps-classes span.is-on {
  color: var(--wind-ink);
  font-weight: 600;
}

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

.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 {
  font-size: 16px;
}

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

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

  .wind-figure {
    grid-template-columns: 1fr;
  }

  .wind-ways-card svg {
    max-width: none;
  }

  .see-stage {
    height: 250px;
  }

  .cmp-row {
    grid-template-columns: 9.2em minmax(0, 1fr) 5.4em;
    gap: 8px;
    padding: 4px 4px;
  }

  .cmp-name {
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ww-wind,
  .ww-heat-line {
    animation: none;
  }

  .ps-zone,
  .ps-mark,
  .cmp-bar i,
  .cmp-row {
    transition: none;
  }
}

@media (max-width: 480px) {
  .cmp-row { grid-template-columns: minmax(0, 1fr) minmax(32px, 0.65fr) minmax(0, 5.4em); }
  .cmp-name, .cmp-val { white-space: normal; overflow-wrap: anywhere; }
}
