/* ====================================================================
   Soiling Insights — Kipp & Zonen brand tokens
   Brand reference: red #AF2227, gold #D89B2B
   Type stack: Overpass / IBM Plex Sans / Arial fallback
   ==================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Overpass:wght@400;500;600;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Brand — Kipp & Zonen 2026 */
  --kz-red:       #AF2227;   /* cranberry — primary */
  --kz-red-deep:  #8E1A1F;
  --kz-red-tint:  #FBECEC;
  --kz-yellow:    #FFCC00;   /* pyranometer yellow — sparing accent */
  --kz-yellow-tint:#FFF6D6;
  --kz-gold:      #FFCC00;   /* legacy alias → true brand yellow */
  --kz-gold-tint: #FFF6D6;
  --kz-navy:      #1C252D;   /* brand navy — chrome + ink */
  --kz-navy-700:  #243038;
  --kz-charcoal:  #1C252D;
  --kz-graphite:  #384959;

  /* Data-viz accent — brand-derived steel/azure (cool, calm; cranberry stays for alerts) */
  --accent:       #5B79C4;
  --accent-bright:#8AA2E6;
  --accent-deep:  #3F569B;
  --accent-tint:  #E8EDF8;
  --accent-glow:  rgba(91,121,196,.35);

  /* Neutrals (light mode default) — cooler, calmer ramp */
  --bg:           #F4F6F8;
  --bg-elev:     #FFFFFF;
  --bg-soft:     #EDF0F3;
  --border:       #E4E8EE;
  --border-soft:  #EEF1F5;
  --text:         #19222B;
  --text-muted:   #586471;
  --text-faint:   #8A95A3;

  /* Semantic / status */
  --ok:           #1E8A4C;
  --ok-tint:      #E3F4EB;
  --warn:         #C97A0C;
  --warn-tint:    #FCEFD7;
  --alert:        #B7271D;
  --alert-tint:   #FCE4E1;
  --info:         #1E5FA8;
  --info-tint:    #E3EDFA;

  /* Chart palette (colorblind-aware accent set, K&Z-toned) */
  --c-raw:        #B9BFCD;
  --c-filtered:   #AF2227;
  --c-trend:      #1F2230;
  --c-threshold:  #D89B2B;
  --c-stretch:    #C97A0C;
  --c-wind:       #2E7CC2;
  --c-rain:       #1B8B8B;
  --c-irr:        #E08B2B;
  --c-rh:         #6E5BB1;
  --c-dew:        #3C8E60;
  --c-temp:       #B7271D;

  /* Spacing scale (4px base) */
  --s-0: 0;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;

  /* Radius — sharp, squared-off (modern, not bubbly) */
  --r-1: 0;
  --r-2: 2px;
  --r-3: 3px;
  --r-4: 4px;
  --r-pill: 2px;   /* pills/badges squared for consistency */

  /* Elevation — soft, layered, premium */
  --shadow-1: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.05);
  --shadow-2: 0 2px 4px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.08);
  --shadow-3: 0 4px 8px rgba(16,24,40,.06), 0 24px 48px rgba(16,24,40,.14);
  --ring:     0 0 0 1px rgba(16,24,40,.04);

  /* Chrome — sidebar + topbar shell. Driven per data-chrome variant below. */
  --chrome-bg:        var(--kz-navy);
  --chrome-bg-elev:   var(--kz-navy-700);
  --chrome-text:      #EAF0F4;
  --chrome-muted:     #93A1AD;
  --chrome-faint:     #6B7A86;
  --chrome-border:    rgba(255,255,255,.08);
  --chrome-hover:     rgba(255,255,255,.06);
  --chrome-active-bg: rgba(255,255,255,.10);
  --chrome-active-tx: #FFFFFF;
  --chrome-accent:    var(--kz-yellow);

  /* Type */
  --font-display: 'Overpass', 'IBM Plex Sans', 'Arial', system-ui, sans-serif;
  --font-body:    'IBM Plex Sans', 'Overpass', 'Arial', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --fs-1: 11px;
  --fs-2: 12px;
  --fs-3: 13px;
  --fs-4: 14px;
  --fs-5: 16px;
  --fs-6: 18px;
  --fs-7: 22px;
  --fs-8: 28px;
  --fs-9: 36px;
  --fs-10: 48px;

  /* Layout */
  --topbar-h: 64px;
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
}

/* ---- Chrome variant: light & airy (white shell, navy ink) ---------- */
:root[data-chrome="light"] {
  --chrome-bg:        #FFFFFF;
  --chrome-bg-elev:   #FFFFFF;
  --chrome-text:      #19222B;
  --chrome-muted:     #586471;
  --chrome-faint:     #8A95A3;
  --chrome-border:    #E4E8EE;
  --chrome-hover:     #F1F4F7;
  --chrome-active-bg: var(--kz-red-tint);
  --chrome-active-tx: var(--kz-red-deep);
  --chrome-accent:    var(--kz-red);
}

/* ---- Icon system --------------------------------------------------- */
.ico {
  width: 20px; height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
}
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 28px; height: 28px; }

/* ====================================================================
   Dark theme — premium indigo-navy canvas (reference look).
   This is the default. Surfaces are elevated + subtly translucent;
   the steel accent drives data-viz, cranberry stays for alerts.
   ==================================================================== */
:root[data-theme="dark"] {
  /* Canvas + surfaces */
  --bg:           #161B27;
  --bg-grad:      radial-gradient(1200px 600px at 78% -8%, #20283C 0%, #161B27 55%);
  --bg-elev:      #1E2536;
  --bg-elev-2:    #232B3F;
  --bg-soft:      #283044;
  --border:       rgba(255,255,255,.08);
  --border-soft:  rgba(255,255,255,.05);
  --text:         #EAEEF6;
  --text-muted:   #9AA6C0;
  --text-faint:   #6B7691;

  /* Accent (steel/azure) tuned brighter for dark */
  --accent:       #7E97E8;
  --accent-bright:#9DB2F2;
  --accent-deep:  #4F69C0;
  --accent-tint:  rgba(126,151,232,.16);
  --accent-glow:  rgba(126,151,232,.45);

  /* Status tints re-tuned for dark surfaces */
  --kz-red-tint:  rgba(224,86,90,.16);
  --ok:           #34D08A;  --ok-tint:    rgba(52,208,138,.15);
  --warn:         #F0B24A;  --warn-tint:  rgba(240,178,74,.15);
  --alert:        #F26D6D;  --alert-tint: rgba(242,109,109,.16);
  --info:         #6FA8FF;  --info-tint:  rgba(111,168,255,.15);
  --kz-yellow-tint: rgba(255,204,0,.16);

  /* Chart palette */
  --c-raw:        #49526B;
  --c-filtered:   #8AA2E6;
  --c-trend:      #EAEEF6;
  --c-threshold:  #F0B24A;
  --c-stretch:    #F08A4A;

  /* Chrome (sidebar/topbar) = canvas family in full-dark */
  --chrome-bg:        #141925;
  --chrome-bg-elev:   #1E2536;
  --chrome-text:      #EAEEF6;
  --chrome-muted:     #8C97B2;
  --chrome-faint:     #5E6884;
  --chrome-border:    rgba(255,255,255,.07);
  --chrome-hover:     rgba(255,255,255,.05);
  --chrome-active-bg: var(--accent-tint);
  --chrome-active-tx: #FFFFFF;
  --chrome-accent:    var(--accent);

  --shadow-1: 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 2px 6px rgba(0,0,0,.30), 0 12px 28px rgba(0,0,0,.40);
  --shadow-3: 0 8px 16px rgba(0,0,0,.40), 0 30px 60px rgba(0,0,0,.55);
  --ring: 0 0 0 1px rgba(255,255,255,.04);
}

/* Dark canvas: soft radial gradient on the body; shell panels stay solid */
:root[data-theme="dark"] body { background: var(--bg-grad); background-attachment: fixed; }
:root[data-theme="dark"] .main { background: transparent; }

/* Base typography */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-4);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-9); line-height: 1.15; }
h2 { font-size: var(--fs-8); line-height: 1.2; }
h3 { font-size: var(--fs-7); line-height: 1.25; }
h4 { font-size: var(--fs-6); line-height: 1.3; }
h5 { font-size: var(--fs-5); line-height: 1.4; }
h6 { font-size: var(--fs-4); line-height: 1.4; font-weight: 600; }
p, ul, ol { margin: 0; padding: 0; }
a { color: var(--kz-red); text-decoration: none; }
a:hover { color: var(--kz-red-deep); text-decoration: underline; }
code, .mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-mono  { font-family: var(--font-mono); }
.t-up      { text-transform: uppercase; letter-spacing: 0.06em; }
.t-tight   { letter-spacing: -0.02em; }
.weight-500{ font-weight: 500; }
.weight-600{ font-weight: 600; }
.weight-700{ font-weight: 700; }
