/* ============================================================
   Visual Reality — impact.css
   Impact Simulator: region what-if lab with live before/after
   Requires styles.css (design tokens, nav, footer, buttons)
   ============================================================ */

/* ---------- Hero ---------- */
.im-hero {
  padding: calc(var(--header-h, 76px) + clamp(2.6rem, 6vw, 4.2rem)) 0 clamp(1.4rem, 3vw, 2.2rem);
  text-align: center;
}

.im-hero h1 {
  max-width: 22ch;
  margin-inline: auto;
}

.im-hero .lead {
  max-width: 48rem;
  margin-inline: auto;
}

.im-hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin: 1.5rem auto 0;
  padding: 0;
  list-style: none;
}

.im-hero-chips li {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line, #dcebe2);
  color: var(--ink-soft, #456a58);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------- Lab layout ---------- */
.im-lab {
  padding-bottom: clamp(2.4rem, 5vw, 4rem);
}

.im-lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
}

.im-block {
  padding: 1.4rem 1.5rem 1.5rem;
  border-radius: 22px;
  background: #ffffff;
  border: 1px solid var(--line, #dcebe2);
  box-shadow: var(--shadow-sm, 0 6px 18px rgba(11, 31, 22, 0.06));
}

.im-block + .im-block {
  margin-top: 1.3rem;
}

.im-block-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: #06281d;
}

.im-block-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* ---------- Region picker ---------- */
.im-regions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.im-region {
  position: relative;
  padding: 0.75rem 0.8rem 0.8rem;
  border-radius: 14px;
  border: 1.5px solid var(--line, #dcebe2);
  background: #fbfefc;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body, Inter, sans-serif);
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.im-region:hover {
  transform: translateY(-1px);
  border-color: rgba(13, 148, 136, 0.55);
  box-shadow: 0 8px 16px rgba(6, 40, 29, 0.08);
}

.im-region.active {
  border-color: #0d9488;
  background: linear-gradient(150deg, #f0fbf5, #e8f7f3);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.35);
}

.im-region.active::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.im-region-name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: #06281d;
}

.im-region-meta {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft, #456a58);
}

.im-region-meta i {
  font-style: normal;
  padding: 0.14em 0.5em;
  border-radius: 999px;
  background: #eef4f1;
  margin-left: 0.3em;
}

.im-region-meta i.hot {
  background: #fdeee4;
  color: #b45309;
}

.im-region-meta i.mid {
  background: #fdf6e3;
  color: #a16207;
}

.im-region-meta i.low {
  background: #e7f6ee;
  color: #047857;
}

.im-region-note {
  margin: 0.9rem 0 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--ink-soft, #456a58);
}

/* ---------- Levers ---------- */
.im-lever {
  padding: 0.95rem 0 1.05rem;
  border-bottom: 1px dashed #e3efe8;
}

.im-lever:last-of-type {
  border-bottom: 0;
  padding-bottom: 0.4rem;
}

.im-lever-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.55rem;
}

.im-lever-head label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.94rem;
  color: #06281d;
}

.im-lever-ico {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f2faf5;
  border: 1px solid #dcebe2;
}

.im-lever-val {
  font-family: var(--font-display, Sora, sans-serif);
  font-weight: 800;
  font-size: 1.02rem;
  color: #065f46;
  white-space: nowrap;
}

.im-lever-sub {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft, #456a58);
}

/* range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea672 var(--fill, 0%), #e2ece6 var(--fill, 0%));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #0d9488;
  box-shadow: 0 3px 8px rgba(6, 40, 29, 0.25);
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: #e2ece6;
}

input[type="range"]::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: #0ea672;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #0d9488;
  box-shadow: 0 3px 8px rgba(6, 40, 29, 0.25);
}

input[type="range"]:focus-visible {
  outline: 3px solid rgba(13, 148, 136, 0.5);
  outline-offset: 4px;
  border-radius: 999px;
}

/* ---------- Presets ---------- */
.im-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.1rem;
}

.im-preset {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1.5px solid var(--line, #dcebe2);
  background: #ffffff;
  color: #06281d;
  font: 700 0.83rem/1 var(--font-body, Inter, sans-serif);
  cursor: pointer;
  transition: all 0.2s ease;
}

.im-preset:hover {
  border-color: #0d9488;
  color: #0d9488;
  transform: translateY(-1px);
}

.im-preset-reset {
  color: #b45309;
  border-color: #f3ddb8;
  background: #fffaf0;
}

/* ---------- Scene ---------- */
.im-viz {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 92px;
}

.im-scene {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line, #dcebe2);
  box-shadow: var(--shadow-lg, 0 30px 60px rgba(11, 31, 22, 0.14));
  aspect-ratio: 720 / 420;
  background: #eafaf1;
}

.im-scene svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#im-smogrect {
  transition: opacity 0.7s ease;
}

.im-sun-halo {
  animation: im-halo 5s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes im-halo {
  from { opacity: 0.18; transform: scale(0.94); }
  to { opacity: 0.32; transform: scale(1.06); }
}

.im-cloud {
  animation: im-cloud-drift 26s linear infinite;
}

.im-cloud-b {
  animation-duration: 34s;
  animation-delay: -12s;
}

@keyframes im-cloud-drift {
  from { transform: translateX(-90px); }
  to { transform: translateX(760px); }
}

/* turbines */
.im-turbine .im-rotor {
  transform-box: fill-box;
  transform-origin: center;
  animation: im-rotor-spin 7s linear infinite;
}

@keyframes im-rotor-spin {
  to { transform: rotate(360deg); }
}

/* cars */
.im-car {
  animation: im-drive 13s linear infinite;
}

.im-car.rev {
  animation-name: im-drive-rev;
  animation-duration: 15s;
}

@keyframes im-drive {
  from { transform: translateX(-120px); }
  to { transform: translateX(820px); }
}

@keyframes im-drive-rev {
  from { transform: translateX(820px); }
  to { transform: translateX(-120px); }
}

/* scene badges */
.im-scene-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.im-badge {
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  font-size: 0.78rem;
  color: var(--ink-soft, #456a58);
  box-shadow: 0 8px 18px rgba(6, 40, 29, 0.14);
}

.im-badge b {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #94a3b8;
}

.im-badge-after {
  background: rgba(240, 253, 244, 0.92);
  border-color: #bbe7d0;
}

.im-badge-after b {
  color: #059669;
}

/* ---------- Result dashboard ---------- */
.im-result {
  padding: 1.5rem 1.6rem 1.6rem;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid var(--line, #dcebe2);
  box-shadow: var(--shadow-sm, 0 6px 18px rgba(11, 31, 22, 0.06));
}

.im-hero-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.4rem;
  align-items: center;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid #eef4f0;
}

.im-saved-label {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft, #456a58);
}

.im-saved-val {
  margin: 0;
  font-family: var(--font-display, Sora, sans-serif);
  font-size: clamp(2.5rem, 5.4vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  color: #065f46;
}

.im-saved-unit {
  font-size: 0.42em;
  font-weight: 700;
  color: #0d9488;
  margin-left: 0.22em;
}

.im-saved-sub {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft, #456a58);
}

/* before/after emission bars */
.im-bar-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.im-bar-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft, #456a58);
}

.im-bar-track {
  height: 20px;
  border-radius: 999px;
  background: #eef4f0;
  overflow: hidden;
}

.im-bar {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.55s cubic-bezier(0.3, 0.9, 0.3, 1);
}

.im-bar-before {
  background: linear-gradient(90deg, #94a3b8, #64748b);
}

.im-bar-after {
  background: linear-gradient(90deg, #34d399, #0d9488);
}

.im-bar-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: #06281d;
  white-space: nowrap;
}

.im-bar-note {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft, #456a58);
}

/* ---------- Grid mix bars ---------- */
.im-mix {
  padding: 1.25rem 0 1.1rem;
  border-bottom: 1px solid #eef4f0;
}

.im-mix-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.im-mix-head h3 {
  margin: 0;
  font-size: 1.02rem;
  color: #06281d;
}

.im-mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-size: 0.74rem;
  color: var(--ink-soft, #456a58);
}

.im-mix-legend .lg {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 0.32em;
}

.lg-solar { background: #f59e0b; }
.lg-wind { background: #38bdf8; }
.lg-clean { background: #10b981; }
.lg-fossil { background: #64748b; }

.im-mix-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.im-mix-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft, #456a58);
}

.im-mix-bar {
  display: flex;
  height: 26px;
  border-radius: 9px;
  overflow: hidden;
  background: #eef4f0;
}

.im-mix-bar span {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width 0.55s cubic-bezier(0.3, 0.9, 0.3, 1);
}

.im-mix-bar .seg-solar { background: #f59e0b; }
.im-mix-bar .seg-wind { background: #38bdf8; }
.im-mix-bar .seg-clean { background: #10b981; }
.im-mix-bar .seg-fossil { background: #64748b; }

/* ---------- Equivalents ---------- */
.im-equiv {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.im-equiv li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem 0.9rem;
  border-radius: 16px;
  background: #f6fbf8;
  border: 1px solid #e2efe8;
}

.im-eq-ico {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2efe8;
  margin-bottom: 0.35rem;
}

.im-equiv b {
  font-family: var(--font-display, Sora, sans-serif);
  font-size: 1.15rem;
  color: #06281d;
}

.im-equiv li > span:last-child {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--ink-soft, #456a58);
}

/* ---------- Methodology ---------- */
.im-method {
  padding-bottom: clamp(2rem, 5vw, 3.4rem);
}

.im-details {
  border-radius: 18px;
  border: 1px solid var(--line, #dcebe2);
  background: #ffffff;
  overflow: hidden;
}

.im-details summary {
  padding: 1.1rem 1.4rem;
  font-weight: 700;
  color: #06281d;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.im-details summary::-webkit-details-marker {
  display: none;
}

.im-details summary::after {
  content: "+";
  font-size: 1.4rem;
  line-height: 1;
  color: #0d9488;
  transition: transform 0.25s ease;
}

.im-details[open] summary::after {
  transform: rotate(45deg);
}

.im-method-body {
  padding: 0 1.4rem 1.4rem;
  color: #3c5a4c;
  line-height: 1.7;
}

.im-method-body ul {
  padding-left: 1.2rem;
  margin: 0.8rem 0;
}

.im-method-body li {
  margin-bottom: 0.5rem;
}

/* ---------- Outro ---------- */
.im-outro {
  padding: 0 0 clamp(3rem, 6vw, 4.5rem);
}

.im-outro-panel {
  padding: clamp(2.2rem, 5.5vw, 3.6rem);
  border-radius: 28px;
  background:
    radial-gradient(130% 120% at 85% -10%, rgba(45, 212, 191, 0.25), transparent 55%),
    linear-gradient(135deg, #06281d 0%, #0b3b2c 55%, #0f4a37 100%);
  color: #ffffff;
}

.im-outro-panel h2 {
  color: #ffffff;
  max-width: 26ch;
}

.im-outro-copy {
  max-width: 44rem;
  color: #c9e8d8;
  line-height: 1.7;
}

.im-outro-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4rem;
  margin: 1.8rem 0;
  max-width: 46rem;
}

.im-outro .outro-stat {
  border-left: 2px solid rgba(94, 234, 212, 0.4);
  padding-left: 1.1rem;
}

.im-outro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

/* ---------- Toast ---------- */
.im-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  z-index: 80;
  padding: 0.8rem 1.3rem;
  border-radius: 12px;
  background: #06281d;
  color: #d1fae5;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 16px 34px rgba(4, 31, 22, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.im-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  .im-lab-grid {
    grid-template-columns: 1fr;
  }

  .im-viz {
    position: static;
    order: -1;
  }
}

@media (max-width: 720px) {
  .im-hero-result {
    grid-template-columns: 1fr;
  }

  .im-equiv {
    grid-template-columns: 1fr 1fr;
  }

  .im-regions {
    grid-template-columns: 1fr 1fr;
  }

  .im-badge {
    font-size: 0.68rem;
    padding: 0.4rem 0.6rem;
  }
}

@media (max-width: 560px) {
  .im-regions {
    grid-template-columns: 1fr;
  }

  .im-outro-stats {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .im-block {
    padding: 1.15rem 1.1rem 1.2rem;
  }

  .im-result {
    padding: 1.2rem 1.1rem 1.3rem;
  }

  .im-mix-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .im-bar-row {
    grid-template-columns: 58px minmax(0, 1fr) auto;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .im-cloud,
  .im-sun-halo,
  .im-turbine .im-rotor,
  .im-car {
    animation: none !important;
  }

  .im-cloud {
    transform: translateX(120px);
  }

  .im-bar,
  .im-mix-bar span,
  #im-smogrect {
    transition: none !important;
  }

  .im-toast {
    transition: none;
  }
}
