/* Innovistic shared brand tokens + components.
   Used by chat.html and pilot.html. Keep page-specific rules in each page's
   own <style> block; put anything reused across pages here. */

:root {
  --void: #07090e;
  --card: #0d121c;
  --hairline: rgba(255, 255, 255, 0.12);
  --cobalt: #2a5fc7;
  --cyan: #00d2ff;
  --emerald: #10b981;
  --amber: #f59e0b;
  --text-primary: #ffffff;
  --text-secondary: #f3f4f6;
  --steel: #717d93;
  --panel-face: #1117233d;
  --grid-line: rgba(255, 255, 255, 0.028);
  /* Telemetry readout bars stay neutral on purpose: accent means
     "interactive", white means "data". */
  --tg-lit: #ccd7e6;
  --tg-dim: rgba(255, 255, 255, 0.10);
  /* Accent is user-selectable (see chat.html). Each choice carries a
     separate dark and light value, because a hue bright enough to read on
     obsidian is usually illegible on a pale ground, and vice versa. */
  --accent-d: #00d2ff;
  --accent-l: #0b7f9e;
  --accent: var(--accent-d);
  --font-display: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, 'Courier New', monospace;
  /* User-adjustable reading font/size for conversational text (chat.html).
     Pages that don't offer the picker just render these defaults. */
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --body-size: 14.5px;
  --row-gap: 16px;
  --bubble-pad: 11px 14px;
  --line-h: 1.55;
  --composer-h: 84px;
  color-scheme: dark;
}

/* Opt-in light theme -- off by default (this brand runs dark-first).
   Toggled by setting data-theme="light" on <html>. Deliberately not a
   naive invert: pale steel ground and graphite text rather than white and
   black, and each accent swaps to its darker variant. */
:root[data-theme="light"] {
  --void: #f1f3f6;
  --card: #ffffff;
  --hairline: rgba(11, 13, 18, 0.16);
  --text-primary: #0b0d12;
  --text-secondary: #2c313b;
  --steel: #5b6472;
  --panel-face: #0b0d1208;
  --accent: var(--accent-l);
  --grid-line: rgba(11, 13, 18, 0.035);
  --tg-lit: #39414f;
  --tg-dim: rgba(11, 13, 18, 0.13);
  color-scheme: light;
}

:root[data-density="compact"] { --row-gap: 9px; --bubble-pad: 7px 11px; --line-h: 1.4; }
:root[data-config="collapsed"] { --composer-h: 168px; }

/* Customer-facing "Calm" motion setting, and an honest default for anyone
   whose OS already asks for reduced motion. */
:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  animation: none !important;
  transition: none !important;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--void);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ---------- HEADER ---------- */
header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--hairline);
  background: var(--card);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(0, 210, 255, 0.5));
}

.header-text { min-width: 0; flex: 1; }

.agent-name {
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-line {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  display: flex;
  align-items: center;
  gap: 7px;
}

.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 6px var(--emerald);
  animation: pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

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

.wordmark {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  white-space: nowrap;
}
.wordmark b { color: var(--cyan); font-weight: 700; }

/* ---------- HUD FRAME (bordered panel w/ corner crosshairs) ---------- */
.hud-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 14px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--card) 40%, transparent);
  display: flex;
  flex-direction: column;
}

/* Solid "+" marks set inside the corners: the screwheads holding the
   panel. Every measurement is a whole pixel on purpose -- the old build
   used 1.5px arms centered with 50% + translate, which lands on half
   pixels and rasterizes fat on one arm and thin on the other depending
   on where the panel happens to sit. A 12px box with 2px arms at
   integer offsets gives the renderer nothing to round: identical at
   every window size, permanent, unchanging.
   The custom properties are set by brand.js, which sizes everything as a
   whole number of DEVICE pixels (display scaling included) and nudges
   each mark onto the device grid. The fallbacks keep a correct integer
   build if the script ever fails to load. */
.crosshair { position: absolute; width: var(--ch-box, 12px); height: var(--ch-box, 12px); pointer-events: none; z-index: 2; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: var(--accent); }
.crosshair::before { left: 0; top: var(--ch-off, 5px); width: var(--ch-box, 12px); height: var(--ch-arm, 2px); }
.crosshair::after { top: 0; left: var(--ch-off, 5px); width: var(--ch-arm, 2px); height: var(--ch-box, 12px); }
.crosshair.tl { top: 9px; left: 9px; }
.crosshair.tr { top: 9px; right: 9px; }
.crosshair.bl { bottom: 9px; left: 9px; }
.crosshair.br { bottom: 9px; right: 9px; }

/* ---------- FORM CONTROLS ---------- */
.prompt-glyph {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

input, textarea {
  flex: 1;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--hairline);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--steel); }
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

button {
  padding: 12px 20px;
  background: var(--cobalt);
  border: 1px solid var(--cobalt);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
button:hover:not(:disabled) { background: var(--cyan); border-color: var(--cyan); color: var(--void); }
button:disabled { opacity: 0.4; cursor: default; }

/* ---------- FULL-PANEL MESSAGE / ERROR STATE ---------- */
.panel-message {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 40px;
}
.panel-message .tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border: 1px solid currentColor;
}
.panel-message .tag.amber { color: var(--amber); }
.panel-message .tag.cyan { color: var(--cyan); }
.panel-message p { color: var(--steel); font-size: 13.5px; max-width: 380px; }

@media (max-width: 640px) {
  header { padding: 14px 16px; }
  .hud-frame { margin: 8px; }
}

/* ---------- language toggle ----------
   Shared by every client-facing page (intake form, pilot gate, chat) so
   the FR/EN control looks and behaves identically wherever a customer
   meets it. Staff desks do not use it: they run in English. */
.lang-toggle { display: flex; border: 1px solid var(--hairline); margin-left: auto; }
.lang-toggle button { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .08em;
  padding: 6px 12px; background: transparent; border: 0; color: var(--steel); cursor: pointer; }
.lang-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--void); }
.lang-toggle button:hover:not([aria-pressed="true"]) { color: var(--text-primary); }
