/* ═══════════════════════════════════════════════════════════
   PREDICTIVE MAINTENANCE — SIGNAL HERO
   Standalone hero for the CAN bus condition monitoring case
   study. Intentionally off-brand: dark instrument console.
   Prefix: .pmx-
═══════════════════════════════════════════════════════════ */

.pmx,
.pmx *,
.pmx *::before,
.pmx *::after {
  box-sizing: border-box;
}

.pmx {
  --pmx-bg: #05070c;
  --pmx-mint: #00f5b5;
  --pmx-cyan: #00e8ff;
  --pmx-violet: #7c6bff;
  --pmx-amber: #ffb020;
  --pmx-red: #ff4d6d;
  --pmx-line: rgba(255, 255, 255, 0.09);
  --pmx-dim: rgba(237, 245, 255, 0.46);
  --pmx-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  position: relative;
  isolation: isolate;
  min-height: 100svh;
  padding: 8.5rem 6vw 4rem;
  display: flex;
  align-items: center;
  color: #edf5ff;
}

.pmx-inner {
  position: relative;
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2.5rem, 5vw, 5rem);
}

/* ── Left column ───────────────────────────────────────── */

.pmx-back {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--pmx-dim);
  margin-bottom: 1.6rem;
  transition: color 0.2s, gap 0.2s;
}
.pmx-back:hover,
.pmx-back:focus-visible { color: var(--pmx-mint); gap: 0.8rem; }

.pmx-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--pmx-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pmx-mint);
  background: rgba(0, 245, 181, 0.07);
  border: 1px solid rgba(0, 245, 181, 0.26);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  margin-bottom: 1.5rem;
}

.pmx-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pmx-mint);
  box-shadow: 0 0 0 0 rgba(0, 245, 181, 0.6);
  animation: pmx-ping 2.2s ease-out infinite;
}

@keyframes pmx-ping {
  0%   { box-shadow: 0 0 0 0 rgba(0, 245, 181, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(0, 245, 181, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 245, 181, 0); }
}

.pmx-headline {
  font-size: clamp(2.3rem, 4.4vw, 4rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0 0 1.5rem;
  text-wrap: balance;
}

.pmx-sub {
  font-size: clamp(0.98rem, 1.1vw, 1.08rem);
  line-height: 1.75;
  color: rgba(237, 245, 255, 0.66);
  max-width: 34rem;
  margin: 0 0 2.2rem;
}

.pmx-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2.4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pmx-line);
}

.pmx-meta-item { display: flex; flex-direction: column; gap: 0.3rem; }

.pmx-meta-label {
  font-family: var(--pmx-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(237, 245, 255, 0.36);
}

.pmx-meta-value { font-size: 0.94rem; font-weight: 500; margin: 0; }

/* ── Console (right column) ────────────────────────────── */

.pmx-console {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(16, 22, 34, 0.82), rgba(8, 11, 18, 0.9));
  box-shadow:
    0 40px 90px -40px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

/* HUD corner brackets */
.pmx-console::before,
.pmx-console::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(0, 232, 255, 0.5);
  pointer-events: none;
}
.pmx-console::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.pmx-console::after  { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }

.pmx-console-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem 0.85rem 1.6rem;
  border-bottom: 1px solid var(--pmx-line);
  font-family: var(--pmx-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--pmx-dim);
  background: rgba(255, 255, 255, 0.02);
}

.pmx-console-title {
  color: rgba(237, 245, 255, 0.82);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pmx-console-spacer { flex: 1; }

.pmx-chip {
  border: 1px solid var(--pmx-line);
  border-radius: 5px;
  padding: 0.16rem 0.45rem;
  white-space: nowrap;
}

.pmx-chip--live { color: var(--pmx-mint); border-color: rgba(0, 245, 181, 0.3); }

/* Scope */
.pmx-scope-wrap { position: relative; }

.pmx-scope {
  display: block;
  width: 100%;
  height: 246px;
}

.pmx-scope-legend {
  position: absolute;
  top: 0.7rem;
  left: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-family: var(--pmx-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--pmx-dim);
  pointer-events: none;
}

.pmx-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }

.pmx-legend-key {
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.pmx-legend-item--temp    { color: var(--pmx-mint); }
.pmx-legend-item--coolant { color: var(--pmx-cyan); }
.pmx-legend-item--load    { color: var(--pmx-violet); }

/* Channel readouts */
.pmx-channels {
  border-top: 1px solid var(--pmx-line);
  padding: 0.55rem 1.1rem 0.7rem;
  display: grid;
  gap: 0.34rem;
}

.pmx-ch {
  display: grid;
  grid-template-columns: 1fr 68px 84px;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--pmx-mono);
  font-size: 0.68rem;
  color: rgba(237, 245, 255, 0.62);
}

.pmx-ch-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmx-ch-val { text-align: right; color: rgba(237, 245, 255, 0.9); font-variant-numeric: tabular-nums; }

.pmx-ch-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.pmx-ch-fill {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--pmx-cyan), var(--pmx-mint));
  transition: width 0.5s ease, background 0.5s ease;
}

.pmx-ch.is-alert { color: var(--pmx-amber); }
.pmx-ch.is-alert .pmx-ch-val { color: var(--pmx-amber); }
.pmx-ch.is-alert .pmx-ch-fill { background: linear-gradient(90deg, var(--pmx-amber), var(--pmx-red)); }

/* Frame stream */
.pmx-stream {
  border-top: 1px solid var(--pmx-line);
  padding: 0.6rem 1.1rem 0.75rem;
  height: 142px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.18rem;
  mask-image: linear-gradient(180deg, transparent, #000 34%);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 34%);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

/* The finding takes the stage: the raw stream recedes behind it */
.pmx-console.is-verdict .pmx-stream {
  opacity: 0.16;
  filter: blur(1.5px);
}

.pmx-frame {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--pmx-mono);
  font-size: 0.66rem;
  white-space: nowrap;
  color: rgba(237, 245, 255, 0.5);
  animation: pmx-frame-in 0.32s ease-out both;
}

@keyframes pmx-frame-in {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

.pmx-f-id { color: var(--pmx-cyan); }
.pmx-f-dlc { color: rgba(237, 245, 255, 0.3); }
.pmx-f-bytes { letter-spacing: 0.04em; }
.pmx-f-decoded { color: var(--pmx-mint); margin-left: auto; }
.pmx-frame.is-hot .pmx-f-decoded { color: var(--pmx-amber); }

/* Pipeline */
.pmx-pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--pmx-line);
}

.pmx-stage {
  position: relative;
  padding: 0.7rem 0.5rem 0.75rem;
  text-align: center;
  font-family: var(--pmx-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(237, 245, 255, 0.3);
  border-right: 1px solid var(--pmx-line);
  transition: color 0.35s ease, background 0.35s ease;
}
.pmx-stage:last-child { border-right: 0; }

.pmx-stage::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--pmx-cyan), var(--pmx-mint));
  transition: width 0.4s ease;
}

.pmx-stage.is-done { color: rgba(237, 245, 255, 0.55); }
.pmx-stage.is-done::after { width: 100%; opacity: 0.45; }

.pmx-stage.is-active {
  color: #edf5ff;
  background: rgba(0, 232, 255, 0.06);
}
.pmx-stage.is-active::after { width: 100%; }

.pmx-stage--predict.is-active { background: rgba(255, 176, 32, 0.08); }
.pmx-stage--predict.is-active::after { background: linear-gradient(90deg, var(--pmx-amber), var(--pmx-red)); }

/* Verdict card */
.pmx-verdict {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 3.2rem;
  display: flex;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 176, 32, 0.4);
  border-radius: 12px;
  background: linear-gradient(180deg, #2a1d07 0%, #14100a 100%);
  box-shadow: 0 24px 50px -22px rgba(0, 0, 0, 0.9), 0 0 32px -14px rgba(255, 176, 32, 0.55);
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
  pointer-events: none;
}

.pmx-verdict.is-on { opacity: 1; transform: none; }

.pmx-verdict-icon {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 176, 32, 0.14);
  color: var(--pmx-amber);
  font-size: 1.1rem;
}

.pmx-verdict-label {
  font-family: var(--pmx-mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pmx-amber);
  margin: 0 0 0.2rem;
}

.pmx-verdict-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 245, 230, 0.92);
}

.pmx-verdict-text strong { color: #fff; font-weight: 600; }

.pmx-verdict-eta {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--pmx-mono);
  font-size: 0.66rem;
  color: rgba(255, 176, 32, 0.85);
}

/* Scroll cue */
.pmx-cue {
  position: absolute;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--pmx-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(237, 245, 255, 0.32);
}

.pmx-cue-rail {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, rgba(0, 232, 255, 0.7), transparent);
  animation: pmx-cue 2.4s ease-in-out infinite;
  transform-origin: top;
}

@keyframes pmx-cue {
  0%, 100% { transform: scaleY(0.35); opacity: 0.35; }
  50%      { transform: scaleY(1); opacity: 1; }
}

/* Screen-reader summary of the animated instrument panel */
.pmx-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 1080px) {
  .pmx {
    padding: 7.5rem 6vw 5rem;
    align-items: flex-start;
  }
  .pmx-inner {
    grid-template-columns: 1fr;
    gap: 2.75rem;
  }
  .pmx-scope { height: 210px; }
  .pmx-cue { display: none; }
}

@media (max-width: 620px) {
  .pmx { padding: 6.5rem 5vw 4rem; }
  .pmx-meta { gap: 1.2rem 1.8rem; }
  .pmx-scope { height: 178px; }
  .pmx-stream { height: 108px; }
  .pmx-ch { grid-template-columns: 1fr 60px 56px; font-size: 0.62rem; }
  .pmx-frame { font-size: 0.6rem; gap: 0.45rem; }
  .pmx-f-decoded { display: none; }
  .pmx-verdict { bottom: 3rem; }
  .pmx-console-bar { gap: 0.5rem; padding: 0.75rem 0.8rem 0.75rem 1.5rem; }
  .pmx-chip:not(.pmx-chip--live) { display: none; }
  .pmx-scope-legend { font-size: 0.56rem; gap: 0.25rem 0.6rem; }
  .pmx-stage { font-size: 0.53rem; letter-spacing: 0.08em; }
}

/* ── Reduced motion: static instrument, no sweeps ──────── */

@media (prefers-reduced-motion: reduce) {
  .pmx-badge-dot,
  .pmx-cue-rail {
    animation: none;
  }
  .pmx-frame { animation: none; }
  .pmx-verdict { transition: none; }
}
