/*
 * Lab Instrumentation — Component Styles
 * BEM-namespaced (.lab-*) to prevent leakage with Bootstrap.
 * Consumes tokens from lab.css (--ink, --amber, --signal, etc.)
 *
 * PR-05 of the marketing-product gap roadmap.
 */

/* ─────────────────────────── STATUS PILL ─────────────────────────── */

.lab-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1;
  border: 1px solid;
  white-space: nowrap;
}
.lab-pill__led {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Variants */
.lab-pill--testing {
  color: var(--status-testing);
  border-color: var(--status-testing);
}
.lab-pill--testing .lab-pill__led {
  background: var(--status-testing);
  box-shadow: 0 0 6px var(--status-testing);
  animation: lab-pulse 1.4s ease-in-out infinite;
}
.lab-pill--paused {
  color: var(--status-paused);
  border-color: var(--status-paused);
}
.lab-pill--paused .lab-pill__led {
  background: var(--status-paused);
}
.lab-pill--winner {
  color: var(--ink);
  background: var(--status-winner);
  border-color: var(--status-winner);
}
.lab-pill--winner .lab-pill__led {
  background: var(--ink);
}
.lab-pill--killed {
  color: var(--status-killed);
  border-color: var(--status-killed);
}
.lab-pill--killed .lab-pill__led {
  background: var(--status-killed);
}
.lab-pill--pending {
  color: var(--status-pending);
  border-color: var(--status-pending);
}
.lab-pill--pending .lab-pill__led {
  background: var(--status-pending);
  opacity: 0.5;
}
.lab-pill--complete {
  color: var(--status-complete);
  border-color: var(--status-complete);
}
.lab-pill--complete .lab-pill__led {
  background: var(--status-complete);
}

@keyframes lab-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* ─────────────────────────── READING ─────────────────────────── */

.lab-reading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lab-reading__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-faint);
  line-height: 1;
}
.lab-reading__value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--paper);
  line-height: 1;
}
.lab-reading__unit {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--paper-dim);
  letter-spacing: 0;
  margin-left: 4px;
}
.lab-reading__delta {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  margin-top: 2px;
}
.lab-reading__delta--pos { color: var(--signal); }
.lab-reading__delta--neg { color: var(--danger); }
.lab-reading__delta--neutral { color: var(--paper-dim); }

/* ─────────────────────────── LAB LOG ENTRY ─────────────────────────── */

.lab-log__entry {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--paper-dim);
  line-height: 1.4;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lab-log__entry:last-child { border-bottom: none; }
.lab-log__ts {
  color: var(--paper);
  font-weight: 700;
  margin-right: 8px;
}
.lab-log__val--pos { color: var(--signal); }
.lab-log__val--neg { color: var(--danger); }
.lab-log__val--accent { color: var(--amber); }
.lab-log__val--neutral { color: var(--paper-dim); }

/* ─────────────────────────── SPECIMEN CARD ─────────────────────────── */

.lab-specimen {
  background: var(--paper);
  color: var(--ink);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 0 0 1px rgba(255,154,31,0.3), 0 0 30px rgba(255,154,31,0.12);
  position: relative;
}
.lab-specimen__meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
.lab-specimen__meta-id { color: var(--ink); font-weight: 700; }
.lab-specimen__image {
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(ellipse at 30% 20%, #ffd089, transparent 55%),
    radial-gradient(ellipse at 80% 80%, #ff9a1f, transparent 60%),
    linear-gradient(135deg, #1c1a16, #2a261f);
  position: relative;
  overflow: hidden;
}
.lab-specimen__image img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.lab-specimen__headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.lab-specimen__body {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--rule-bright);
}
.lab-specimen__cta {
  align-self: flex-start;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 6px 12px;
  border: none;
  cursor: pointer;
}

/* ─────────────────────────── OSCILLOSCOPE ─────────────────────────── */

.lab-osc {
  position: relative;
  height: 70px;
  background: var(--ink);
  overflow: hidden;
  border: 1px solid var(--rule);
}
.lab-osc svg {
  width: 100%; height: 100%;
  display: block;
}
.lab-osc__label {
  position: absolute;
  top: 5px; left: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
  z-index: 2;
}
.lab-osc__value {
  position: absolute;
  top: 5px; right: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--signal);
  z-index: 2;
}
.lab-osc--amber .lab-osc__value { color: var(--amber); }

/* ─────────────────────────── INSTRUMENT PANEL ─────────────────────────── */

.lab-instrument {
  border: 1px solid var(--rule-bright);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-inset-deep);
}
.lab-instrument__header {
  border-bottom: 1px solid var(--rule);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-dim);
}
.lab-instrument__title {
  color: var(--paper);
  font-weight: 700;
  white-space: nowrap;
}
.lab-instrument__id {
  color: var(--paper-faint);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.lab-instrument__status {
  margin-left: auto;
  flex-shrink: 0;
}
.lab-instrument__body {
  padding: 16px;
  flex: 1;
}

/* ─────────────────────────── EYEBROW ─────────────────────────── */

.lab-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-dim);
  flex-wrap: wrap;
  row-gap: 6px;
}
.lab-eyebrow__bracket {
  color: var(--amber);
  font-weight: 700;
}
.lab-eyebrow__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--rule-bright), transparent);
  max-width: 280px;
}
.lab-eyebrow__meta {
  color: var(--paper-faint);
  margin-left: auto;
  white-space: nowrap;
}

/* ─────────────────────────── CORNER BRACKETS ─────────────────────────── */

.lab-corners { position: relative; }
.lab-corner {
  position: absolute;
  width: 14px; height: 14px;
  color: var(--amber);
  opacity: 0.6;
  pointer-events: none;
}
.lab-corner--tl { top: 8px; left: 8px; border-top: 1px solid currentColor; border-left: 1px solid currentColor; }
.lab-corner--tr { top: 8px; right: 8px; border-top: 1px solid currentColor; border-right: 1px solid currentColor; }
.lab-corner--bl { bottom: 8px; left: 8px; border-bottom: 1px solid currentColor; border-left: 1px solid currentColor; }
.lab-corner--br { bottom: 8px; right: 8px; border-bottom: 1px solid currentColor; border-right: 1px solid currentColor; }

/* ─────────────────────────── EMPTY STATE ─────────────────────────── */

.lab-empty {
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--amber);
  position: relative;
}
.lab-empty__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 20px;
  color: var(--paper);
  margin-bottom: 8px;
}
.lab-empty__body {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-dim);
  line-height: 1.6;
  max-width: 40ch;
  margin: 0 auto;
}
.lab-empty__cta {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
  background: var(--amber);
  padding: 10px 18px;
  text-decoration: none;
  transition: background 0.15s;
}
.lab-empty__cta:hover { background: var(--amber-hot); color: var(--ink); }

/* ─────────────────────────── SCANLINE LOADER ─────────────────────────── */

.lab-loader {
  position: relative;
  overflow: hidden;
  background: var(--ink-2);
  border: 1px solid var(--rule);
}
.lab-loader--sm { width: 32px; height: 32px; }
.lab-loader--md { width: 48px; height: 48px; }
.lab-loader--lg { width: 80px; height: 80px; }
.lab-loader::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 0; height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255,154,31,0.2) 49%,
    rgba(255,154,31,0.6) 50%,
    rgba(255,154,31,0.2) 51%,
    transparent 100%
  );
  background-size: 100% 8px;
  background-repeat: no-repeat;
  animation: lab-scan 1.8s linear infinite;
  mix-blend-mode: screen;
}
@keyframes lab-scan {
  0%   { background-position: 0 -20%; }
  100% { background-position: 0 120%; }
}

/* ─────────────────────────── BUTTONS ─────────────────────────── */

.lab-btn {
  background: var(--ink-3);
  color: var(--paper-dim);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.lab-btn:hover,
.lab-btn-hover {
  background: var(--rule);
  color: var(--paper);
  border-color: var(--rule-bright);
}
.lab-btn-primary {
  background: var(--amber);
  color: var(--ink);
  border: 1px solid var(--amber-dark);
  font-family: var(--font-mono);
  font-weight: 700;
}
.lab-btn-primary:hover {
  background: var(--amber-hot);
}

/* ─────────────────────────── BEZEL (input border) ─────────────── */

.lab-bezel {
  border: 1px solid var(--rule);
  background: var(--ink-2);
  color: var(--paper);
}
.lab-bezel:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(255, 154, 31, 0.2);
  outline: none;
}

/* ─────────────────────────── STATUS BADGES ─────────────────────── */

.lab-status-success {
  background: rgba(184, 255, 90, 0.1);
  color: var(--signal);
}
.lab-status-error {
  background: rgba(255, 77, 58, 0.1);
  color: var(--danger);
}
.lab-status-warning {
  background: rgba(255, 154, 31, 0.1);
  color: var(--amber);
}
