/* ==========================================================================
   Roof ventilation (whirlybirds): warm counterpart to the cold subfloor story
   ========================================================================== */

.roof {
  position: relative;
  padding-block: var(--space-section);
  background:
    radial-gradient(55% 45% at 85% 0%, rgb(242 137 74 / 0.22), transparent 70%),
    linear-gradient(180deg, var(--white), var(--sand-100));
  overflow: hidden;
}
.roof__grid { display: grid; gap: clamp(2.5rem, 5vw, 5rem); align-items: center; }

.roof__copy .eyebrow { color: var(--sand-700); }
.roof__copy h2 {
  margin-top: 1rem;
  font-size: var(--step-4);
  text-transform: uppercase;
  color: var(--teal-700);
  line-height: 0.98;
}

.roof__points { margin-top: 1.75rem; border-top: 1px dashed rgb(9 84 115 / 0.3); }
.roof__points li {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 0.25rem;
  border-bottom: 1px dashed rgb(9 84 115 / 0.3);
  transition: padding-left 0.5s var(--ease-out-expo), background 0.4s;
}
.roof__points strong { font-family: var(--font-body); font-weight: 700; font-size: var(--step-0); text-transform: uppercase; color: var(--teal-700); letter-spacing: 0.04em; }
.roof__points span { color: var(--text-muted-on-light); }
@media (hover: hover) { .roof__points li:hover { padding-left: 1rem; background: rgb(211 171 125 / 0.18); } }

.roof__note { margin-block: 1.5rem 2rem; max-width: 34rem; color: var(--text-muted-on-light); }

/* ---------- Interactive demo card ---------- */
.roof__demo {
  position: relative;
  padding: clamp(1rem, 2.5vw, 1.75rem);
  border-radius: var(--radius-l);
}
.roof__svg { width: 100%; height: auto; overflow: visible; }

/* Attic colour: hot (no vent) ⇄ cooled (vent installed). stop-color transitions in CSS. */
.roof__svg [data-attic-a], .roof__svg [data-attic-b] { transition: stop-color 1.4s var(--ease-out-expo); }
.roof__demo[data-vent="off"] [data-attic-a] { stop-color: #ff6b3d; }
.roof__demo[data-vent="off"] [data-attic-b] { stop-color: #f2894a; }
.roof__demo[data-vent="on"]  [data-attic-a] { stop-color: #2ec4f1; }
.roof__demo[data-vent="on"]  [data-attic-b] { stop-color: #c8eaf6; }

.roof__svg [data-roof-label] { transition: fill 0.8s; }
.roof__demo[data-vent="on"] [data-roof-label] { fill: #04202d; }

.roof__svg [data-whirly-roof], .roof__svg [data-cap], .roof__svg [data-heat-rings] { transition: opacity 0.7s var(--ease-out-expo); }
.roof__demo[data-vent="on"]  [data-cap], .roof__demo[data-vent="on"] [data-heat-rings] { opacity: 0; }
.roof__demo[data-vent="off"] [data-whirly-roof] { opacity: 0; }
.roof__demo[data-vent="off"] [data-heat-rings] { animation: shimmer 2.2s var(--ease-in-out) infinite; }
@keyframes shimmer { 50% { transform: translateY(-8px); opacity: 0.4; } }

/* No-JS: the demo still reads (vent installed, cooled attic) */

/* ---------- Controls ---------- */
.roof__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; margin-top: 1rem; }

.switch {
  display: inline-flex; align-items: center; gap: 0.75rem;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  border: 0; border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  color: var(--text-on-light);
  font-weight: 500;
}
.switch__track {
  position: relative;
  width: 3.5rem; height: 2rem;
  border-radius: var(--radius-pill);
  background: var(--heat-500);
  transition: background 0.5s var(--ease-out-expo);
}
.switch__track i {
  position: absolute; top: 0.25rem; left: 0.25rem;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgb(2 18 25 / 0.35);
  transition: transform 0.5s var(--ease-out-expo);
}
.switch[aria-checked="true"] .switch__track { background: var(--teal-700); }
.switch[aria-checked="true"] .switch__track i { transform: translateX(1.5rem); }
.switch__label b { color: var(--teal-700); font-weight: 700; }

.breeze { display: inline-flex; align-items: center; gap: 0.75rem; font-weight: 500; }
.breeze input {
  -webkit-appearance: none; appearance: none;
  width: clamp(8rem, 18vw, 12rem); height: 2rem;
  background: transparent;
  cursor: pointer;
}
.breeze input::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--cyan-200), var(--cyan-500)); }
.breeze input::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--cyan-200), var(--cyan-500)); }
.breeze input::-webkit-slider-thumb { -webkit-appearance: none; width: 1.75rem; height: 1.75rem; margin-top: -0.75rem; border-radius: 50%; background: var(--sand-400); border: 3px solid var(--teal-700); }
.breeze input::-moz-range-thumb { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--sand-400); border: 3px solid var(--teal-700); }
.breeze input:disabled { opacity: 0.35; cursor: not-allowed; }

.roof__caption {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted-on-light);
}

@media (min-width: 64em) {
  .roof__grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .roof__demo[data-vent="off"] [data-heat-rings] { animation: none; }
}

/* No vent installed: nothing leaves the roof, so the exhaust arrows hide */
.roof__demo[data-vent="off"] [data-exhaust] { opacity: 0 !important; }
.roof__svg [data-exhaust] { transition: opacity 0.5s; }

/* Magnifier turbine: spun by CSS so it always pivots on its own hub.
   Speed follows the breeze slider (--wind is set by roof.js); it holds still when no vent is installed. */
.roof__svg [data-turbine] {
  transform-box: fill-box;
  transform-origin: center;
  animation: turbine-spin calc(2s / (0.12 + var(--wind, 0.55) * 3.6)) linear infinite;
}
.roof__demo[data-vent="off"] [data-turbine] { animation-play-state: paused; }
@keyframes turbine-spin { to { rotate: 360deg; } }
