/* =========================================================
   Інтерактивні блоки лендінга
   1) Калькулятор економії та окупності  (.calc)
   2) Схема потоків енергії              (.flow)

   Кожен блок самодостатній: щоб прибрати його, досить
   видалити відповідний <section> з index.html
   і його <script> у кінці сторінки.
   ========================================================= */

/* ---------------------------------------------------------
   Спільні елементи керування
   --------------------------------------------------------- */
.control { margin-bottom: 26px; }

.control__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.control__label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.control__hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 6px;
  line-height: 1.5;
}

.control__value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Слайдер */
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 6px;
  background: rgba(26, 29, 38, 0.10);
  box-shadow: inset 0 1px 2px rgba(26, 29, 38, 0.06);
  outline: none;
  margin: 10px 0;
  cursor: pointer;
}

input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(26, 29, 38, 0.05);
  box-shadow: 0 1px 1px rgba(26, 29, 38, 0.08),
              0 3px 8px rgba(26, 29, 38, 0.16),
              0 0 0 0 var(--accent-shadow);
  cursor: grab;
  transition: box-shadow 0.22s var(--ease-out), transform 0.15s ease;
}
input[type="range"].slider:hover::-webkit-slider-thumb {
  box-shadow: 0 1px 1px rgba(26, 29, 38, 0.08),
              0 4px 12px rgba(26, 29, 38, 0.2),
              0 0 0 8px var(--accent-soft);
}
input[type="range"].slider::-webkit-slider-thumb:active { transform: scale(1.12); cursor: grabbing; }

input[type="range"].slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: grab;
}

input[type="range"].slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }

/* Сегментований перемикач */
.segmented {
  display: inline-flex;
  background: rgba(26, 29, 38, 0.05);
  border-radius: 980px;
  padding: 4px;
  gap: 3px;
  box-shadow: inset 0 1px 2px rgba(26, 29, 38, 0.05);
}

.segmented button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--text-secondary);
  min-height: 44px;
  padding: 9px 20px;
  border-radius: 980px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s var(--ease);
}
.segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 1px rgba(26, 29, 38, 0.06),
              0 2px 6px rgba(26, 29, 38, 0.10);
}
.segmented--full { display: flex; width: 100%; }
.segmented--full button { flex: 1; }

/* Перемикач-тумблер */
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.switch:last-of-type { border-bottom: 0; }
.switch__text { font-size: 0.95rem; font-weight: 500; }
.switch__text small {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 3px;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 28px;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.14);
  transition: background 0.25s var(--ease);
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s var(--ease);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------------------------------------------------------
   1) Калькулятор
   --------------------------------------------------------- */
.calc {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 30px;
  align-items: start;
}

.calc__panel {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  padding: clamp(26px, 3vw, 40px);
  box-shadow: var(--shadow-2);
}

.calc__mode { margin-bottom: 28px; }

/* Темна панель результату: градієнт + акцентне світло згори —
   дає глибину, якої не дає плоска заливка */
.calc__result {
  position: sticky;
  top: 80px;
  background:
    radial-gradient(120% 80% at 85% -10%, rgba(244, 118, 41, 0.16), transparent 60%),
    linear-gradient(165deg, var(--brand-dark-2), var(--brand-dark) 55%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: clamp(26px, 3vw, 40px);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow-4);
}

.calc__result-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 600;
  margin-bottom: 10px;
}

.calc__big {
  font-size: clamp(2.2rem, 5vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.calc__big span { font-size: 0.5em; font-weight: 500; color: rgba(255, 255, 255, 0.6); margin-left: 6px; }

.calc__rows {
  margin-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.calc__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.95rem;
}
.calc__row dt { color: rgba(255, 255, 255, 0.66); }
.calc__row dd {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.calc__row--accent dd { color: var(--accent); font-size: 1.15rem; }

.calc__bar {
  margin-top: 26px;
}
.calc__bar-track {
  height: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.calc__bar-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent), #ffb457);
  width: 0;
  transition: width 0.6s var(--ease);
}
.calc__bar-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 10px;
}

.calc__pick {
  margin-top: 26px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: #fff;
  display: block;
  transition: background 0.25s ease;
}
.calc__pick:hover { background: rgba(255, 255, 255, 0.14); }
.calc__pick-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 7px;
}
.calc__pick-name { font-size: 1.1rem; font-weight: 600; }
.calc__pick-spec { font-size: 0.85rem; color: var(--accent); margin-top: 2px; }
.calc__pick-more {
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.66);
  margin-top: 9px;
}

.calc__note {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  margin-top: 20px;
}

.calc__cta { margin-top: 22px; }

/* ---------------------------------------------------------
   3) Схема потоків енергії (.flow)
   --------------------------------------------------------- */
/* Темна поверхня — у пару до панелі результату калькулятора.
   На чорному фірмовий #F47629 дає 6:1, тому тут працює чистий акцент. */
.flow {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(244, 118, 41, 0.10), transparent 62%),
    linear-gradient(168deg, #23262f, #14161c 62%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), var(--shadow-4);
  padding: clamp(20px, 2.4vw, 32px);
  overflow: hidden;
  color: #fff;
}

.flow__modes {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 980px;
  padding: 5px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.flow__mode {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: rgba(255, 255, 255, 0.62);
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 980px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.3s var(--ease);
}
.flow__mode:hover { color: #fff; }
.flow__mode[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(26, 29, 38, 0.1), 0 5px 16px var(--accent-shadow);
}
.flow__mode svg { flex-shrink: 0; }

/* Сцена зі схемою */
.flow__stage {
  position: relative;
  aspect-ratio: 900 / 420;
  background:
    radial-gradient(circle at 50% 48%, rgba(244, 118, 41, 0.08), transparent 58%),
    rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.flow__links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.flow__link {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 2;
  stroke-dasharray: 5 7;
  stroke-linecap: round;
  transition: stroke 0.4s ease, opacity 0.4s ease;
  opacity: 0.75;
}
.flow__link.is-active {
  stroke: var(--flow-color, var(--accent));
  stroke-width: 2.5;
  stroke-dasharray: 13 9;
  opacity: 1;
  animation: flowDash 0.9s linear infinite;
}
.flow__link.is-reverse { animation-direction: reverse; }
.flow__link.is-slow { animation-duration: 2.2s; }

@keyframes flowDash { to { stroke-dashoffset: -22; } }

.flow__glow {
  fill: none;
  stroke: var(--flow-color, var(--accent));
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0;
  filter: blur(6px);
  transition: opacity 0.45s ease;
}
.flow__glow.is-active { opacity: 0.4; }

/* Вузли схеми */
.flow__node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 122px;
  padding: 14px 10px 12px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-md);
  text-align: center;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.45s var(--ease);
}

.flow__node.is-dim {
  opacity: 0.42;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.flow__node.is-live {
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--flow-color, #F47629) 18%, transparent),
    color-mix(in srgb, var(--flow-color, #F47629) 5%, transparent));
  border-color: color-mix(in srgb, var(--flow-color, #F47629) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--flow-color, #F47629) 16%, transparent),
              0 10px 30px color-mix(in srgb, var(--flow-color, #F47629) 26%, transparent);
}
.flow__node.is-live .flow__node-icon { color: var(--flow-color, var(--accent)); }

.flow__node-icon {
  width: 34px; height: 34px;
  margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.4s ease;
}
.flow__node.is-live .flow__node-icon { color: var(--accent); }

.flow__node-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.25;
}

.flow__node-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 4px;
  min-height: 1em;
}

/* Індикатор заряду батареї */
.flow__soc {
  height: 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.14);
  margin-top: 9px;
  overflow: hidden;
}
.flow__soc-fill {
  height: 100%;
  width: 50%;
  border-radius: 5px;
  background: linear-gradient(90deg,
    var(--flow-color, #F47629),
    color-mix(in srgb, var(--flow-color, #F47629) 55%, #fff));
  box-shadow: 0 0 12px color-mix(in srgb, var(--flow-color, #F47629) 60%, transparent);
  transition: width 1.1s var(--ease);
}

/* Підпис під схемою */
.flow__caption {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 20px;
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
}
.flow__caption-dot {
  flex-shrink: 0;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--flow-color, var(--accent));
  margin-top: 7px;
  transition: background 0.45s var(--ease);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--flow-color, #F47629) 20%, transparent),
              0 0 14px color-mix(in srgb, var(--flow-color, #F47629) 65%, transparent);
}
.flow__caption-title { font-size: 1rem; font-weight: 600; margin-bottom: 5px; color: #fff; }
.flow__caption-text { font-size: 0.92rem; color: rgba(255, 255, 255, 0.62); line-height: 1.6; margin: 0; }
.flow__price {
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
  padding-left: 20px;
}
.flow__price-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 600;
  margin-bottom: 4px;
}
.flow__price-val {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.024em;
  color: var(--flow-color, var(--accent));
  transition: color 0.45s var(--ease);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.flow__node-short { display: none; }

@media (max-width: 900px) {
  .flow { padding: 18px; }
  .flow__stage { aspect-ratio: 620 / 540; }
  .flow__node { width: 82px; padding: 9px 4px 8px; border-radius: 11px; }
  .flow__node-icon { width: 24px; height: 24px; margin-bottom: 4px; }
  .flow__node-icon svg { width: 21px; height: 21px; }
  .flow__node-label { font-size: 0.55rem; letter-spacing: 0.02em; }
  .flow__node-full { display: none; }
  .flow__node-short { display: inline; }
  .flow__node-sub { font-size: 0.53rem; margin-top: 2px; }
  .flow__soc { height: 4px; margin-top: 6px; }
  .flow__mode { font-size: 0.8rem; padding: 9px 12px; }
  .flow__mode span { display: none; }
  .flow__caption { flex-wrap: wrap; }
  .flow__price { margin-left: 0; padding-left: 0; text-align: left; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .flow__link.is-active { animation: none; }
}

.calc__row dt small {
  display: block;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.52);
  margin-top: 4px;
}


/* Легенда кольорів потоків */
.flow__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.62);
}
.flow__legend-item { display: inline-flex; align-items: center; gap: 8px; }
.flow__legend-swatch {
  width: 16px;
  height: 3px;
  border-radius: 3px;
  background: var(--swatch);
  box-shadow: 0 0 8px color-mix(in srgb, var(--swatch) 70%, transparent);
}
