/* ============================================================
   PowerUp Design System — tokens + base (subset for Boat Track)
   Source: PowerUp Design System handoff (claude.ai/design).
   Flat, data-dense, hairline borders, no shadows, orange accent-only.
   Only the type weights this app uses are self-hosted (lean offline shell).
   ============================================================ */

/* --- Self-hosted fonts (subset) --- */
@font-face { font-family: 'Barlow'; src: url('../fonts/Barlow-Regular.ttf')  format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('../fonts/Barlow-Medium.ttf')   format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('../fonts/Barlow-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('../fonts/Barlow-Bold.ttf')     format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('../fonts/Barlow-ExtraBold.ttf')format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/DMSans-VariableFont_opsz_wght.ttf') format('truetype-variations');
  font-weight: 100 1000; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/JetBrainsMono-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 100 800; font-style: normal; font-display: swap;
}

:root {
  --font-display: 'Barlow', 'Arial Narrow', sans-serif;
  --font-body:    'DM Sans', 'Helvetica Neue', sans-serif;
  --font-mono:    'JetBrains Mono', 'Cascadia Code', 'Fira Mono', monospace;

  /* Neutral ramp (light) */
  --neutral-0: #FFFFFF; --neutral-1: #F4F4F2; --neutral-2: #ECEAE6; --neutral-3: #E0DFDB;
  --neutral-4: #B0AFA9; --neutral-5: #8C8B86; --neutral-6: #4A4A47; --neutral-7: #1A1A1A;

  /* Orange family (light) */
  --orange-tint: #FFF0E5; --orange-light: #FFD4B3; --orange: #FF6B00;
  --orange-hover: #CC5500; --orange-press: #993D00; --orange-deep: #661F00;

  /* Semantic (light) */
  --success: #2E7D32; --success-bg: #EAF3DE; --success-border: #C0DD97;
  --warning: #B45309; --warning-bg: #FFF3CD; --warning-border: #FAC775;
  --danger:  #C0392B; --danger-bg:  #FCEBEB; --danger-border:  #F7C1C1;
  --info:    #185FA5; --info-bg:    #E6F1FB; --info-border:    #B5D4F4;

  /* Semantic aliases */
  --bg-1: var(--neutral-0); --bg-2: var(--neutral-1); --bg-3: var(--neutral-2);
  --bg-selection: var(--orange-tint);
  --border: var(--neutral-3); --border-strong: var(--neutral-4);
  --fg-1: var(--neutral-7); --fg-2: var(--neutral-6); --fg-3: var(--neutral-5); --fg-4: var(--neutral-4);
  --fg-link: var(--orange-hover); --fg-link-hover: var(--orange-press);

  /* Spacing (base-4) + radii */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;
  --radius-xs: 2px; --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px;
  --radius-xl: 16px; --radius-pill: 24px; --radius-full: 9999px;

  /* Focus ring (the system's only "shadow") */
  --focus-ring: 0 0 0 3px rgba(255, 107, 0, 0.18);

  /* Direction-arrow colour: deep ember on light surfaces for contrast (AAA on white);
     overridden to vivid orange in dark theme below. */
  --dial-arrow: var(--orange-press);
}

/* Dark theme — primary surface for low-light helm use. Auto via OS, override with
   [data-theme]. The system's dark ramp brightens the surface and shifts brand orange. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --neutral-0: #0D0D0D; --neutral-1: #1C1C1C; --neutral-2: #252525; --neutral-3: #2E2E2E;
    --neutral-4: #404040; --neutral-5: #6B6A65; --neutral-6: #A8A79F; --neutral-7: #F0EEEA;
    --orange-tint: #261400; --orange-light: #4D2200; --orange: #FF8533;
    --orange-hover: #FFB380; --orange-press: #FFD4B3; --orange-deep: #FFE8CC;
    --dial-arrow: var(--orange); /* vivid orange reads well on dark */
    --success: #4CAF50; --success-bg: #0D2B0F; --success-border: #1A4D1C;
    --warning: #F59E0B; --warning-bg: #2B1A00; --warning-border: #4D3000;
    --danger:  #EF5350; --danger-bg:  #2B0A0A; --danger-border:  #4D1414;
    --info:    #5BA3D9; --info-bg:    #0A1A2B; --info-border:    #143047;
  }
}
[data-theme="dark"] {
  --neutral-0: #0D0D0D; --neutral-1: #1C1C1C; --neutral-2: #252525; --neutral-3: #2E2E2E;
  --neutral-4: #404040; --neutral-5: #6B6A65; --neutral-6: #A8A79F; --neutral-7: #F0EEEA;
  --orange-tint: #261400; --orange-light: #4D2200; --orange: #FF8533;
  --orange-hover: #FFB380; --orange-press: #FFD4B3; --orange-deep: #FFE8CC;
  --dial-arrow: var(--orange);
  --success: #4CAF50; --success-bg: #0D2B0F; --success-border: #1A4D1C;
  --warning: #F59E0B; --warning-bg: #2B1A00; --warning-border: #4D3000;
  --danger:  #EF5350; --danger-bg:  #2B0A0A; --danger-border:  #4D1414;
  --info:    #5BA3D9; --info-bg:    #0A1A2B; --info-border:    #143047;
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* the attribute always wins over display rules */
html { font-size: 16px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--fg-1);
  background: var(--bg-1);
}
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-md); }

/* --- Type roles --- */
.t-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-3);
}
.t-mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

/* ============================================================
   Components (from PowerUp_Components.md)
   ============================================================ */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-body); font-weight: 500; font-size: 14px;
  height: 40px; padding: 0 var(--space-4);
  border: none; border-radius: var(--radius-md);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-lg { height: 48px; padding: 0 var(--space-6); font-size: 15px; border-radius: 10px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-hover); }
.btn-primary:active { background: var(--orange-press); }
.btn-secondary { background: transparent; color: var(--fg-1); border: 0.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg-2); }
.btn-secondary:active { background: var(--bg-3); }
/* Solid danger fill — Stop is the safety-critical control on the water, so it reads
   as a filled state rather than the spec's transparent danger ghost. */
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(0.92); }

/* Status badge: dot + label, never color alone */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-family: var(--font-body); font-size: 11px; font-weight: 500;
  height: 20px; padding: 2px var(--space-2);
  border-radius: var(--radius-sm); white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-ok       { background: var(--success-bg); color: var(--success); }
.badge-ok .badge-dot       { background: var(--success); }
.badge-live     { background: var(--orange-tint); color: var(--orange-press); }
.badge-live .badge-dot     { background: var(--orange-press); }
.badge-idle     { background: var(--bg-2); color: var(--fg-3); }
.badge-idle .badge-dot     { background: var(--fg-4); }
.badge-info     { background: var(--info-bg); color: var(--info); }
.badge-info .badge-dot     { background: var(--info); }

/* KPI / metric card */
.kpi {
  background: var(--bg-1);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-1);
}
.kpi-primary { border-top: 2px solid var(--orange); }
.kpi-value {
  font-family: var(--font-display);
  font-weight: 800; font-size: 2.25rem; line-height: 1; letter-spacing: -0.02em;
  color: var(--fg-1);
}
.kpi-value.mono {
  font-family: var(--font-mono); font-weight: 600; font-size: 1.1rem; letter-spacing: 0;
}
