/* RANGER -- stark hero interface, visual pass 1 */

/* ============ fonts ============ */
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/rajdhani-400.woff2") format("woff2");
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/rajdhani-600.woff2") format("woff2");
}
@font-face {
  font-family: "Share Tech Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/sharetechmono-400.woff2") format("woff2");
}

/* ============ tokens ============ */
:root {
  --base: #0a0e14;
  --panel: rgba(13, 20, 32, 0.85);
  --cyan: #4fd8ff;
  --cyan-dim: #1a6b8a;
  --text-bright: #d6f4ff;
  --text-dim: #5a7a8a;
  --amber: #ffb454;
  --red: #ff5566;
  --steel: #6a86a0;          /* deep-sleep age readout */
  --hairline: rgba(79, 216, 255, 0.35);
  --font-label: "Rajdhani", "Segoe UI", sans-serif;
  --font-mono: "Share Tech Mono", Consolas, monospace;
  --pulse-dur: 2.4s;
}
body[data-status="sleep"] { --pulse-dur: 4.5s; }

/* ============ base ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  background-color: var(--base);
  background-image:
    linear-gradient(rgba(79, 216, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 216, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--text-bright);
  font-family: var(--font-label);
  overflow-x: hidden;
}

/* soft radial vignette over the grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 42%,
    transparent 0%, rgba(4, 7, 12, 0.55) 78%, rgba(4, 7, 12, 0.85) 100%);
  z-index: 0;
}

.stage { position: relative; z-index: 1; padding: 18px 24px 40px; }

/* ============ top bar ============ */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 1px 0 rgba(79, 216, 255, 0.08), 0 4px 18px rgba(79, 216, 255, 0.06);
  background: rgba(10, 14, 20, 0.6);
}

.topbar-left { display: flex; align-items: baseline; gap: 12px; }

.wordmark {
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.22em;
  color: var(--text-bright);
  text-shadow: 0 0 12px rgba(79, 216, 255, 0.45);
}

.sublabel {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.topbar-center { display: flex; align-items: center; gap: 10px; }

.status-word {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.24em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(79, 216, 255, 0.4);
}
body[data-status="sleep"] .status-word { color: var(--steel); text-shadow: none; }
body[data-status="driving"] .status-word,
body[data-status="active"] .status-word { color: var(--cyan); }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: dotpulse var(--pulse-dur) ease-in-out infinite;
}
body[data-status="sleep"] .status-dot {
  background: var(--steel);
  box-shadow: 0 0 6px rgba(106, 134, 160, 0.6);
}

@keyframes dotpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.age-readout {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.age-readout.age-fresh { color: var(--cyan); }
.age-readout.age-warn  { color: var(--amber); }
.age-readout.age-old   { color: var(--red); }
.age-readout.age-sleep { color: var(--steel); }

.lamp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid rgba(255, 180, 84, 0.5);
  border-radius: 3px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  box-shadow: 0 0 10px rgba(255, 180, 84, 0.18), inset 0 0 8px rgba(255, 180, 84, 0.06);
}

.link-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #37d67a;
  box-shadow: 0 0 8px rgba(55, 214, 122, 0.7);
}
.link-dot.link-warn { background: var(--amber); box-shadow: 0 0 8px rgba(255, 180, 84, 0.7); }
.link-dot.link-down { background: var(--red);   box-shadow: 0 0 8px rgba(255, 85, 102, 0.7); }

/* ============ hero ============ */
.hero { display: flex; justify-content: center; padding: 34px 0 10px; }

.hero-wrap {
  position: relative;
  width: min(1100px, 92vw);
  aspect-ratio: 1439 / 1019;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* derived alpha asset: white background removed offline, so the truck
     floats on the page. Rim glow stands in for the bay scanner light. */
  filter: brightness(0.72) saturate(0.55) contrast(1.05)
          drop-shadow(0 0 22px rgba(79, 216, 255, 0.12));
  user-select: none;
}

.hero-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 55% at 50% 52%,
    rgba(79, 216, 255, 0.08) 0%,
    rgba(79, 216, 255, 0.03) 55%,
    transparent 75%);
}

/* corner brackets just outside the image */
.bracket {
  position: absolute;
  width: 26px; height: 26px;
  border-color: var(--cyan);
  border-style: solid;
  border-width: 0;
  opacity: 0.8;
  filter: drop-shadow(0 0 6px rgba(79, 216, 255, 0.5));
  pointer-events: none;
}
.bracket-tl { top: -14px; left: -14px;  border-top-width: 1px; border-left-width: 1px; }
.bracket-tr { top: -14px; right: -14px; border-top-width: 1px; border-right-width: 1px; }
.bracket-bl { bottom: -14px; left: -14px;  border-bottom-width: 1px; border-left-width: 1px; }
.bracket-br { bottom: -14px; right: -14px; border-bottom-width: 1px; border-right-width: 1px; }

/* leader lines */
.leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.leader {
  fill: none;
  stroke: var(--cyan-dim);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
}

/* zones */
.zone {
  position: absolute;
  background: transparent;
  border: 1px solid var(--cyan-dim);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 8px rgba(79, 216, 255, 0.15), inset 0 0 8px rgba(79, 216, 255, 0.06);
  animation: zonepulse var(--pulse-dur) ease-in-out infinite;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.zone.rect { border-radius: 4px; }
.zone.circle { aspect-ratio: 1 / 1; border-radius: 50%; }

@keyframes zonepulse {
  0%, 100% { box-shadow: 0 0 8px rgba(79, 216, 255, 0.15), inset 0 0 8px rgba(79, 216, 255, 0.06); }
  50%      { box-shadow: 0 0 14px rgba(79, 216, 255, 0.28), inset 0 0 12px rgba(79, 216, 255, 0.10); }
}

.zone:hover, .zone.active {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(79, 216, 255, 0.5), inset 0 0 14px rgba(79, 216, 255, 0.12);
  animation: none;
}
.zone:focus-visible { outline: 1px dashed var(--cyan); outline-offset: 3px; }

/* chips */
.chip {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 10px 6px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(79, 216, 255, 0.12);
  cursor: pointer;
  z-index: 3;
  white-space: nowrap;
}
.chip:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(79, 216, 255, 0.3); }

.chip-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.chip-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(79, 216, 255, 0.35);
}
.chip-value.warn { color: var(--amber); text-shadow: 0 0 8px rgba(255, 180, 84, 0.35); }

/* value-change glow pulse */
.pulse { animation: valuepulse 0.6s ease-out 1; }
@keyframes valuepulse {
  0%   { text-shadow: 0 0 14px rgba(79, 216, 255, 0.9); }
  100% { text-shadow: 0 0 8px rgba(79, 216, 255, 0.35); }
}

/* ============ gauge strip ============ */
.gauges {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 34px;
  flex-wrap: wrap;
  margin: 26px auto 0;
  max-width: 1100px;
  padding: 18px 12px;
  border-top: 1px solid rgba(79, 216, 255, 0.12);
}

.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 100px;
}

.gauge-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.gauge-ring { position: relative; }
.gauge-ring svg { transform: rotate(-90deg); }

.ring-track {
  fill: none;
  stroke: rgba(79, 216, 255, 0.12);
  stroke-width: 3;
}
.ring-fill {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 213.6;
  stroke-dashoffset: 213.6;
  filter: drop-shadow(0 0 4px rgba(79, 216, 255, 0.6));
}

.ring-center {
  position: absolute;
  top: 0; left: 0;
  width: 84px; height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.ring-value {
  font-family: var(--font-mono);
  font-size: 19px;
  color: var(--text-bright);
}
.ring-unit { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

.gauge-coolant { min-width: 170px; justify-content: flex-end; }
.coolant-top { display: flex; align-items: baseline; gap: 6px; }
.coolant-value {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--text-bright);
}
.coolant-value.warn  { color: var(--amber); }
.coolant-value.alarm { color: var(--red); }
.coolant-unit { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

.coolant-bar {
  position: relative;
  width: 160px;
  height: 4px;
  background: rgba(79, 216, 255, 0.12);
  border-radius: 2px;
  margin: 8px 0 4px;
}
.coolant-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--cyan);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(79, 216, 255, 0.6);
  transition: width 0.5s ease, background-color 0.3s ease;
}
.coolant-fill.warn  { background: var(--amber); box-shadow: 0 0 6px rgba(255, 180, 84, 0.6); }
.coolant-fill.alarm { background: var(--red);   box-shadow: 0 0 6px rgba(255, 85, 102, 0.6); }
.coolant-tick {
  position: absolute;
  left: 56.25%;              /* 190 deg F on a 100-260 scale */
  top: -4px; bottom: -4px;
  width: 1px;
  background: var(--text-dim);
}

.gauge-plain { justify-content: flex-end; }
.plain-top { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.plain-value {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--text-bright);
}
.plain-unit { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

/* ============ dynamics row ============ */
.dynamics {
  max-width: 1100px;
  margin: 6px auto 0;
  padding: 12px;
  border-top: 1px solid rgba(79, 216, 255, 0.12);
  text-align: center;
}

.dynamics-standby {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  opacity: 0.7;
}

.dynamics-live {
  display: flex;
  justify-content: center;
  gap: 48px;
}
.dyn { display: flex; flex-direction: column; gap: 2px; }
.dyn-value {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(79, 216, 255, 0.35);
}
.dyn-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

/* ============ drawer ============ */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(4, 7, 12, 0.35);
}

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100%;
  z-index: 9;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border-left: 1px solid var(--hairline);
  box-shadow: -6px 0 30px rgba(0, 0, 0, 0.5), -1px 0 12px rgba(79, 216, 255, 0.15);
  transform: translateX(105%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(79, 216, 255, 0.18);
}
.drawer-title {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(79, 216, 255, 0.4);
}
.drawer-close {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  display: flex;
}
.drawer-close:hover { color: var(--cyan); border-color: var(--hairline); }

.drawer-body { overflow-y: auto; padding: 8px 0 24px; flex: 1; }

.drow { border-bottom: 1px solid rgba(79, 216, 255, 0.08); }
.drow-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 20px;
}
.drow.expandable .drow-main { cursor: pointer; }
.drow.expandable .drow-main:hover { background: rgba(79, 216, 255, 0.05); }

.drow-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.drow-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.drow-value {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-bright);
}
.drow-value.warn { color: var(--amber); }
.drow-age {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.8;
}

.drow-note {
  padding: 0 20px 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.drow-spark { padding: 4px 20px 14px; }
.spark-ranges { display: flex; gap: 8px; margin-bottom: 6px; }
.spark-range {
  background: none;
  border: 1px solid rgba(79, 216, 255, 0.25);
  border-radius: 3px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  cursor: pointer;
}
.spark-range.sel { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 6px rgba(79, 216, 255, 0.3); }

.spark-svg-wrap { position: relative; }
.spark-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(79, 216, 255, 0.5));
}
.spark-dot { fill: var(--cyan); filter: drop-shadow(0 0 4px rgba(79, 216, 255, 0.8)); }
.spark-minmax {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-dim);
}
.spark-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  padding: 14px 0;
  text-align: center;
  opacity: 0.7;
}

.drawer-placeholder {
  padding: 40px 24px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  opacity: 0.8;
  line-height: 2;
}

/* ============ narrow desktop ============ */
@media (max-width: 1180px) {
  .gauges { gap: 22px; }
  .dynamics-live { gap: 30px; }
  .chip-value { font-size: 12px; }
  .chip-label { font-size: 9px; }
}

/* ============ reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  .zone, .status-dot { animation: none !important; }
  .pulse { animation: none !important; }
  .drawer, .coolant-fill, .zone, .chip { transition: none !important; }
}
