/* REBOT UI tokens — from design/mockups/tokens.css (ui-proposal.md §7). Light is default; dark via prefers-color-scheme.
   Nunito is self-hosted: @font-face lives in base.css. */
:root {
  color-scheme: light dark;

  /* ---------- Color: neutrals ---------- */
  --bg:            #F5F4FA;  /* page canvas */
  --bg-dots:       #E2DFEF;  /* dot-grid pattern on canvas */
  --surface:       #FFFFFF;  /* cards, bars, sheets */
  --surface-2:     #EDEBF7;  /* sunken areas, segmented tracks, chips */
  --surface-3:     #E3E0F1;  /* pressed / hover on surface-2 */
  --line:          #E1DEEE;  /* hairline dividers, card borders */
  --line-2:        #CFCBE3;  /* secondary button border + lip */
  --line-strong:   #8D88AD;  /* input borders, switch track off (≥3:1) */
  --track:         #C3BED8;  /* slider track (thumb + fill carry the 3:1) */
  --ink:           #1D1A33;  /* primary text (16.8:1 on white) */
  --ink-2:         #4D4A69;  /* secondary text (8.4:1) */
  --ink-3:         #66628A;  /* muted text / placeholder (5.7:1 white, 4.85:1 surface-2) */
  --ink-inverse:   #FFFFFF;
  --inverse:       #1D1A33;  /* toast background */

  /* ---------- Color: brand + semantic ---------- */
  --brand:         #5B3FD6;  /* REBOT violet — primary actions, selection (white text 6.7:1) */
  --brand-hover:   #4C31C2;
  --brand-lip:     #3B2799;
  --brand-tint:    #ECE8FF;
  --brand-ink:     #4527B0;  /* brand text on tint (8.1:1) */
  --on-brand:      #FFFFFF;

  --go:            #087F56;  /* run / connected / success (white text 5.0:1) */
  --go-hover:      #06704B;
  --go-lip:        #05583B;
  --go-tint:       #DCF5EA;
  --go-ink:        #086647;
  --on-go:         #FFFFFF;

  --stop:          #D2333A;  /* stop / danger (white text 4.9:1) */
  --stop-hover:    #B92A31;
  --stop-lip:      #9A2228;
  --stop-tint:     #FDE8E8;
  --stop-ink:      #A8232A;
  --on-stop:       #FFFFFF;

  --led:           #FFC530;  /* LED "on" fill (dark text 8.8:1) */
  --led-glow:      rgba(255, 197, 48, .55);
  --led-ring:      #8A6100;
  --on-led:        #3A2A00;

  --warn-tint:     #FFF1D6;
  --warn-ink:      #8A4B00;
  --focus:         #2563EB;  /* focus ring (5.2:1 on white) */

  /* Data colors (paired with letters/numbers — never color alone) */
  --sensor-a:      #1F6FD1;  /* blue  */
  --sensor-b:      #B54F00;  /* orange */
  --m1:            #2F6FE4;  /* blue   */
  --m2:            #0A8463;  /* green  */
  --m3:            #B85C00;  /* orange */
  --m4:            #B4459B;  /* plum   */
  --btn1:          #2F6FE4;  /* user button 1 */
  --btn2:          #FFC530;  /* user button 2 (dark text) */
  --btn3:          #0A8463;  /* user button 3 */
  --on-btn1: #FFFFFF; --on-btn2: #3A2A00; --on-btn3: #FFFFFF;
  --btn1-lip: #1F4FB0; --btn2-lip: #C28F00; --btn3-lip: #05583B;
  --on-data:       #FFFFFF;  /* text on data-colored badges (all ≥4.5:1) */
  --camera-bg:     #0F0D18;

  /* ---------- Typography ---------- */
  --font: "Nunito", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --fs-xs:   .8125rem;  /* 13px — badges/keycaps only */
  --fs-sm:   .875rem;   /* 14px — meta, helper */
  --fs-md:   1rem;      /* 16px — body, inputs */
  --fs-lg:   1.125rem;  /* 18px — button labels, card titles */
  --fs-xl:   1.375rem;  /* 22px — section titles */
  --fs-2xl:  1.75rem;   /* 28px — screen titles, big values */
  --fs-3xl:  2.25rem;   /* 36px — hero numbers */
  --fw-body: 500; --fw-label: 700; --fw-button: 800; --fw-title: 850; --fw-display: 900;
  --lh-tight: 1.2; --lh-body: 1.45;

  /* ---------- Spacing (4px grid) ---------- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* ---------- Shape ---------- */
  --r-xs: 8px;   /* chips, keycaps */
  --r-sm: 12px;  /* inputs, small buttons */
  --r-md: 16px;  /* buttons, tiles */
  --r-lg: 20px;  /* cards */
  --r-xl: 28px;  /* sheets, dialogs, controller */
  --r-pill: 999px;
  --bw: 2px;     /* default border width */

  /* ---------- Elevation ---------- */
  --sh-1: 0 1px 2px rgba(29, 26, 51, .06), 0 2px 8px rgba(29, 26, 51, .05);
  --sh-2: 0 4px 16px rgba(29, 26, 51, .10);
  --sh-3: 0 18px 48px rgba(29, 26, 51, .24);
  --lip: 4px;      /* tactile "3D" depth for buttons */
  --lip-big: 6px;  /* control pad */

  /* ---------- Sizing ---------- */
  --tap: 48px;         /* minimum touch target */
  --tap-lg: 56px;
  --pad-cell: clamp(84px, 24vw, 112px); /* D-pad cell */
  --face-btn: clamp(76px, 21vw, 104px);
  --topbar-h: 56px;
  --bottomnav-h: 64px;

  /* ---------- Motion ---------- */
  --dur-1: 90ms;   /* press */
  --dur-2: 180ms;  /* toggles, tabs, hover */
  --dur-3: 280ms;  /* sheets, toasts */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}

@media (min-width: 1024px) { :root { --topbar-h: 64px; } }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13111D; --bg-dots: #1F1C2E; --surface: #1D1A2C; --surface-2: #272339; --surface-3: #312C47;
    --line: #2F2A45; --line-2: #3D3758; --line-strong: #6F6990; --track: #4A4468;
    --ink: #F1EFFA; --ink-2: #C2BED8; --ink-3: #9C97B8; --ink-inverse: #13111D; --inverse: #F1EFFA;
    --brand: #9F8CFF; --brand-hover: #B1A1FF; --brand-lip: #5B3FD6; --brand-tint: #2C2550; --brand-ink: #C4B8FF; --on-brand: #13111D;
    --go: #2FCB8F; --go-hover: #4BD8A0; --go-lip: #12805A; --go-tint: #123527; --go-ink: #5BE3AE; --on-go: #06140E;
    --stop: #FF6B6F; --stop-hover: #FF8689; --stop-lip: #B3363B; --stop-tint: #3A1A20; --stop-ink: #FF9A9D; --on-stop: #1A0506;
    --led: #FFCB45; --led-glow: rgba(255, 203, 69, .45); --led-ring: #FFCB45; --on-led: #2A1E00;
    --warn-tint: #3A2A10; --warn-ink: #FFC27A; --focus: #7AA7FF;
    --sensor-a: #5AA9FF; --sensor-b: #FF8A3D;
    --m1: #6FA0FF; --m2: #3DD6A6; --m3: #FFA24D; --m4: #F07BD8;
    --btn1: #6FA0FF; --btn2: #FFCB45; --btn3: #3DD6A6; --on-data: #13111D;
    --on-btn1: #0B1530; --on-btn2: #2A1E00; --on-btn3: #06140E;
    --btn1-lip: #2F5FCC; --btn2-lip: #B88A00; --btn3-lip: #12805A;
    --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 6px 18px rgba(0,0,0,.45); --sh-3: 0 18px 48px rgba(0,0,0,.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
