/* FILE: css/gauges.css — SVG gauge styles, bargraph, power circle diagram */

/* ── Arc Gauge (SVG) ─────────────────────────────────────────────────────── */
.gauge-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.gauge-svg {
  overflow: visible;
}

/* Background track arc */
.gauge-track {
  fill: none;
  stroke: #1a1d22;
  stroke-linecap: butt;
}

/* Value arc */
.gauge-arc {
  fill: none;
  stroke-linecap: butt;
  transition: stroke-dasharray 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              stroke 0.3s ease;
}
.gauge-arc.nominal  { stroke: var(--c-green);  }
.gauge-arc.caution  { stroke: var(--c-amber);  }
.gauge-arc.alarm    { stroke: var(--c-red);    filter: drop-shadow(0 0 4px var(--c-red));    }
.gauge-arc.electric { stroke: var(--c-orange); }
.gauge-arc.coolant  { stroke: var(--c-blue);   }
.gauge-arc.steam    { stroke: #bdd9f2; }
.gauge-arc.power    { stroke: var(--c-green); filter: drop-shadow(0 0 3px var(--c-green-glow)); }

/* Tick marks */
.gauge-tick       { stroke: var(--c-trim-bright); stroke-width: 1; }
.gauge-tick.major { stroke: var(--c-aluminum);    stroke-width: 1.5; }
.gauge-tick.alarm { stroke: var(--c-red-dim);     }

/* Labels */
.gauge-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--c-text-muted);
  text-anchor: middle;
  dominant-baseline: middle;
}
.gauge-label.alarm-label { fill: var(--c-red-dim); }

/* Center value display */
.gauge-value-text {
  font-family: var(--font-mono);
  font-size: 16px;
  fill: var(--c-white);
  text-anchor: middle;
  dominant-baseline: middle;
  transition: fill 0.3s;
}
.gauge-value-text.alarm   { fill: var(--c-red);   }
.gauge-value-text.caution { fill: var(--c-amber); }
.gauge-value-text.ok      { fill: var(--c-green); }

.gauge-unit-text {
  font-family: var(--font-label);
  font-size: 8px;
  fill: var(--c-text-dim);
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: 0.05em;
}
.gauge-title-text {
  font-family: var(--font-label);
  font-size: 8px;
  fill: var(--c-text-muted);
  text-anchor: middle;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Tachometer (large RPM gauge) ────────────────────────────────────────── */
.tachometer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tachometer-svg { overflow: visible; }

.tacho-arc-bg   { fill: none; stroke: #0d1015; stroke-width: 16; }
.tacho-arc-run  { fill: none; stroke: var(--c-green); stroke-width: 12; stroke-linecap: butt;
                  transition: stroke-dasharray 0.6s cubic-bezier(0.4,0,0.2,1); }
.tacho-arc-warn { fill: none; stroke: var(--c-amber); stroke-width: 12; stroke-linecap: butt;
                  opacity: 0.3; }
.tacho-arc-trip { fill: none; stroke: var(--c-red);   stroke-width: 12; stroke-linecap: butt;
                  opacity: 0.4; }

.tacho-zone-label {
  font-size: 8px;
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tacho-zone-label.critical { fill: var(--c-amber); }
.tacho-zone-label.trip     { fill: var(--c-red-dim); }

/* Critical speed bands (resonance avoidance) */
.tacho-critical-band { fill: rgba(255,171,0,0.15); }
.tacho-trip-zone     { fill: rgba(255,23,68,0.12); }

/* RPM readout under tachometer */
.tacho-rpm-readout {
  font-family: var(--font-mono);
  font-size: var(--fs-3xl);
  color: var(--c-white);
  text-align: center;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 20px rgba(255,255,255,0.1);
  transition: color 0.3s;
}
.tacho-rpm-readout.at-sync   { color: var(--c-green); text-shadow: var(--shadow-glow-green); }
.tacho-rpm-readout.overspeed { color: var(--c-red);   text-shadow: var(--shadow-glow-red); }
.tacho-rpm-readout.critical  { color: var(--c-amber); text-shadow: var(--shadow-glow-amber); }

/* ── Vertical Bargraph (log scale for flux, linear for others) ───────────── */
.vbargraph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.vbargraph-track {
  width: 20px;
  flex: 1;
  background: #0a0c0a;
  border: 1px solid #1a2a1a;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  min-height: 80px;
}
.vbargraph-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  transition: height 0.4s ease;
  border-radius: 2px 2px 0 0;
  background: var(--c-green);
}
.vbargraph-fill.alarm   { background: var(--c-red);   }
.vbargraph-fill.caution { background: var(--c-amber); }
.vbargraph-fill.electric{ background: var(--c-orange); }

.vbargraph-label {
  font-size: 8px;
  font-family: var(--font-label);
  text-transform: uppercase;
  color: var(--c-text-muted);
  letter-spacing: 0.05em;
  text-align: center;
  writing-mode: horizontal-tb;
}

/* Setpoint line on bargraph */
.vbargraph-setpoint {
  position: absolute;
  left: -2px;
  right: -2px;
  height: 2px;
  background: var(--c-amber);
  z-index: 2;
}

/* NI flux channel panel (4 channels side by side) */
.ni-panel {
  display: flex;
  gap: var(--sp-2);
  height: 120px;
  align-items: flex-end;
}
.ni-channel {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  gap: 2px;
}
.ni-channel-id {
  font-size: 8px;
  font-family: var(--font-mono);
  color: var(--c-text-muted);
}

/* ── Power Circle (P-Q capability diagram) ────────────────────────────────── */
.pq-diagram {
  background: #08090c;
  border: 1px solid var(--c-trim);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.pq-diagram svg {
  width: 100%;
  display: block;
}
.pq-axis    { stroke: var(--c-trim-bright); stroke-width: 1; }
.pq-label   { font-family: var(--font-mono); font-size: 9px; fill: var(--c-text-muted); }
.pq-limit   { fill: none; stroke: var(--c-trim); stroke-width: 1; stroke-dasharray: 3,3; }
.pq-stator  { fill: none; stroke: var(--c-blue); stroke-width: 1.5; }
.pq-field   { fill: none; stroke: var(--c-orange); stroke-width: 1.5; }
.pq-uel     { fill: none; stroke: var(--c-green-dim); stroke-width: 1; stroke-dasharray: 4,2; }
.pq-point   { fill: var(--c-white); stroke: var(--c-green); stroke-width: 1.5; r: 5; }
.pq-point.alarm { fill: var(--c-red); stroke: var(--c-red); }

/* ── Subcooling margin bar ────────────────────────────────────────────────── */
.subcooling-bar {
  background: #0a0c0a;
  border: 1px solid #1a2a1a;
  border-radius: 2px;
  height: 14px;
  overflow: hidden;
  position: relative;
}
.subcooling-fill {
  height: 100%;
  transition: width 0.5s ease;
  border-radius: 2px;
}
.subcooling-fill.adequate { background: linear-gradient(90deg, var(--c-blue-dim), var(--c-blue)); }
.subcooling-fill.caution  { background: linear-gradient(90deg, var(--c-amber-dim), var(--c-amber)); }
.subcooling-fill.critical { background: linear-gradient(90deg, var(--c-red-dim), var(--c-red)); }

/* ── Load meter (switchboard analog style) ───────────────────────────────── */
.load-meter {
  background: #06080b;
  border: 2px solid var(--c-trim);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
}
.load-meter canvas {
  width: 100%;
  height: 100%;
}