/* ==========================================================================
   problem.css — "La noche del compresor": historia con medidor sticky
   El color del medidor y de los puntos de la historia cambia según data-state (ok/warn/crit)
   ========================================================================== */
.problem { background: var(--bg); }
.problem__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); margin-top: clamp(36px, 5vw, 64px); }
.problem__head { max-width: 820px; }
.problem__sticky { position: sticky; top: 110px; align-self: start; }

.gauge {
  --c: var(--ok); padding: 28px; border-radius: var(--r-l);
  background: var(--navy); color: var(--white); box-shadow: 0 40px 80px -40px rgba(15, 27, 51, .7);
  position: relative; overflow: hidden;
}
.gauge[data-state="warn"] { --c: var(--warn); }
.gauge[data-state="crit"] { --c: var(--crit); }
.gauge::before { content: ""; position: absolute; inset: auto -20% -60% -20%; height: 100%; background: radial-gradient(closest-side, var(--c), transparent); opacity: .28; transition: background .5s; }
.gauge__top { position: relative; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--on-dark); }
.gauge__time { font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: 8px; background: rgba(255, 255, 255, .1); color: var(--white); }
.gauge__main { position: relative; margin-top: 12px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.gauge__num { font-size: clamp(76px, 9vw, 128px); font-weight: 800; letter-spacing: -.06em; line-height: .95; font-variant-numeric: tabular-nums; }
.gauge__num sup { font-size: .34em; letter-spacing: 0; margin-left: 6px; vertical-align: top; color: var(--c); transition: color .4s; }
/* Consumo del compresor: es lo que se ve venir antes que la temperatura */
.gauge__amp { flex: none; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .08); text-align: right; }
.gauge__amp > span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-dark); }
.gauge__amp b { display: block; margin-top: 2px; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gauge__bar { position: relative; margin-top: 18px; height: 10px; border-radius: 10px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.gauge__bar i { position: absolute; inset: 0; width: 100%; transform-origin: left; transform: scaleX(var(--p, .2)); background: var(--c); border-radius: 10px; transition: background .4s; }
.gauge__bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: rgba(255, 255, 255, .55); }
.gauge__scale { position: relative; display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--on-dark); font-weight: 600; }
.gauge__state { position: relative; margin-top: 18px; font-size: 15px; font-weight: 700; color: var(--c); transition: color .4s; }
.gauge__chart { position: relative; margin-top: 12px; width: 100%; height: auto; aspect-ratio: 300 / 90; overflow: visible; }
.gauge__chart path { fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; transition: stroke .4s; }
.gauge__chart .ghost { stroke: rgba(255, 255, 255, .14); }

.story { position: relative; padding-left: 44px; padding-top: 12px; }
.story::before { content: ""; position: absolute; left: 11px; top: 20px; bottom: 20px; width: 2px; background: var(--line-light); }
/* Línea de progreso: antes era un <div> dentro del <ol> (HTML inválido); js/problem-story.js mueve --p en .story */
.story::after { content: ""; position: absolute; left: 11px; top: 20px; width: 2px; height: calc((100% - 40px) * var(--p, 0)); background: var(--navy); transition: height .5s var(--ease); }
.story__step { position: relative; z-index: 1; min-height: 46vh; display: flex; flex-direction: column; justify-content: center; opacity: .3; transition: opacity .5s; }
.story__step[data-p="0"] { min-height: 40vh; }
.story__step.is-active { opacity: 1; }
.story__step::before {
  content: ""; position: absolute; left: -44px; top: calc(50% - 60px); width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--slate); transition: all .4s var(--ease);
}
.story__step.is-active::before { background: var(--navy); border-color: var(--navy); box-shadow: 0 0 0 8px rgba(15, 27, 51, .1); }
/* Solo el paso "Todo en orden" va en verde; el primero ("Una señal que nadie vio") conserva el punto navy */
.story__step[data-state="ok"]:not(:first-child).is-active::before { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 8px rgba(16, 185, 129, .2); }
.story__step[data-state="warn"].is-active::before { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 0 8px rgba(245, 158, 11, .2); }
.story__step[data-state="crit"].is-active::before { background: var(--crit); border-color: var(--crit); box-shadow: 0 0 0 8px rgba(220, 38, 38, .18); }
.story__time { font-size: 14px; font-weight: 800; letter-spacing: .08em; color: var(--slate); font-variant-numeric: tabular-nums; }
.story__step h3 { margin-top: 10px; font-size: clamp(26px, 3vw, 40px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; color: var(--navy); }
.story__step p { margin-top: 14px; max-width: 440px; color: var(--slate); font-size: 18px; }

.pains__bridge { margin: clamp(48px, 6vw, 88px) auto 0; max-width: 22em; font-size: clamp(28px, 3.8vw, 52px); font-weight: 800; line-height: 1.05; letter-spacing: -.04em; color: var(--navy); text-align: center; text-wrap: balance; }
.pains__bridge::before { content: ""; display: block; width: 28px; height: 2px; margin: 0 auto 28px; border-radius: 2px; background: var(--blue); }
.pains__bridge em { display: block; font-style: normal; color: var(--blue); }
.pains { margin-top: clamp(40px, 5vw, 64px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.pain { padding: 32px; border-radius: var(--r-l); background: var(--white); border: 1px solid var(--line-light); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.pain:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -30px rgba(15, 27, 51, .3); }
.pain__ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--navy); color: var(--ice); }
.pain__ico svg { width: 26px; height: 26px; }
.pain h3 { margin-top: 24px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--navy); }
.pain p { margin-top: 10px; font-size: 16px; color: var(--slate); }

@media (max-width: 900px) {
  .problem__grid { grid-template-columns: 1fr; }
  .problem__sticky { top: 76px; z-index: 5; padding-bottom: 12px; background: linear-gradient(var(--bg) 85%, transparent); }
  .gauge { padding: 18px 20px; }
  .gauge__num { font-size: 64px; }
  .gauge__amp b { font-size: 17px; }
  .gauge__chart, .gauge__scale { display: none; }
  .story { padding-left: 34px; }
  .story__step { min-height: 34vh; }
  .story__step::before { left: -34px; }
  .pains { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .gauge__num { font-size: 52px; } /* en 320–380 px "14.8 °C" + el bloque de consumo no entraban en un renglón */
}
