/* Art direction: Industrial pipeline shim tracker → Rugged, utilitarian, field-ready
   Palette: Deep navy/slate (cool industrial), safety-orange accent (#e8651a)
   Typography: Clash Display (headings) + General Sans (body) — bold industrial pairing
   Density: Dense — field tool, data-heavy, mobile-first */

/* ========================================
   FONTS — Fontshare CDN loaded in HTML
   ======================================== */

:root {
  --font-display: 'Clash Display', 'Arial Black', sans-serif;
  --font-body: 'General Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* ========================================
   TYPE SCALE — Fluid clamp()
   ======================================== */

:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
}

/* ========================================
   4px SPACING SYSTEM
   ======================================== */

:root {
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
}

/* ========================================
   CUSTOM INDUSTRIAL COLOR PALETTE
   ======================================== */

/* Dark mode default */
:root, [data-theme="dark"] {
  /* Surfaces — Deep navy/slate */
  --color-bg:               #0f1219;
  --color-surface:          #1a1f2e;
  --color-surface-2:        #222838;
  --color-surface-offset:   #171c28;
  --color-surface-offset-2: #252b3d;
  --color-surface-dynamic:  #2d3448;
  --color-divider:          #2d3448;
  --color-border:           #3a4158;

  /* Text */
  --color-text:           #e2e4ea;
  --color-text-muted:     #8b90a0;
  --color-text-faint:     #555b70;
  --color-text-inverse:   #0f1219;

  /* Primary Accent — Safety Orange */
  --color-primary:         #e8651a;
  --color-primary-hover:   #d45a14;
  --color-primary-active:  #b84d10;
  --color-primary-highlight: color-mix(in oklch, #e8651a 15%, #1a1f2e);

  /* Status: Verified / Complete — Green */
  --color-success:         #2d8f4e;
  --color-success-hover:   #257a42;
  --color-success-active:  #1d6535;
  --color-success-highlight: color-mix(in oklch, #2d8f4e 15%, #1a1f2e);

  /* Status: Staged — Amber */
  --color-warning:         #d4a017;
  --color-warning-hover:   #b8890f;
  --color-warning-active:  #9c7209;
  --color-warning-highlight: color-mix(in oklch, #d4a017 15%, #1a1f2e);

  /* Status: Installed — Blue */
  --color-blue:            #2563eb;
  --color-blue-hover:      #1d55d0;
  --color-blue-active:     #1748b5;
  --color-blue-highlight:  color-mix(in oklch, #2563eb 15%, #1a1f2e);

  /* Status: Welded — Purple/Indigo */
  --color-purple:          #7c3aed;
  --color-purple-hover:    #6b2fd0;
  --color-purple-active:   #5b25b3;
  --color-purple-highlight: color-mix(in oklch, #7c3aed 15%, #1a1f2e);

  /* Flagged / Error — Red */
  --color-error:           #dc2626;
  --color-error-hover:     #c02020;
  --color-error-active:    #a41a1a;
  --color-error-highlight: color-mix(in oklch, #dc2626 15%, #1a1f2e);

  /* Unchecked — Gray */
  --color-gray:            #6b7280;
  --color-gray-hover:      #5b6270;
  --color-gray-highlight:  color-mix(in oklch, #6b7280 15%, #1a1f2e);

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;
}

/* Light mode */
[data-theme="light"] {
  --color-bg:               #f0f2f5;
  --color-surface:          #ffffff;
  --color-surface-2:        #f7f8fa;
  --color-surface-offset:   #e8eaef;
  --color-surface-offset-2: #dde0e6;
  --color-surface-dynamic:  #d4d7df;
  --color-divider:          #d0d3db;
  --color-border:           #bfc3cc;

  --color-text:           #1a1f2e;
  --color-text-muted:     #5b6280;
  --color-text-faint:     #8b90a0;
  --color-text-inverse:   #f0f2f5;

  --color-primary:         #d45a14;
  --color-primary-hover:   #b84d10;
  --color-primary-active:  #9c400c;
  --color-primary-highlight: color-mix(in oklch, #d45a14 10%, #ffffff);

  --color-success:         #237a3e;
  --color-success-hover:   #1b6532;
  --color-success-active:  #155026;
  --color-success-highlight: color-mix(in oklch, #237a3e 10%, #ffffff);

  --color-warning:         #b8890f;
  --color-warning-hover:   #9c7209;
  --color-warning-active:  #805c05;
  --color-warning-highlight: color-mix(in oklch, #b8890f 10%, #ffffff);

  --color-blue:            #1d55d0;
  --color-blue-hover:      #1748b5;
  --color-blue-active:     #123b9a;
  --color-blue-highlight:  color-mix(in oklch, #1d55d0 10%, #ffffff);

  --color-purple:          #6b2fd0;
  --color-purple-hover:    #5b25b3;
  --color-purple-active:   #4b1b96;
  --color-purple-highlight: color-mix(in oklch, #6b2fd0 10%, #ffffff);

  --color-error:           #c02020;
  --color-error-hover:     #a41a1a;
  --color-error-active:    #881414;
  --color-error-highlight: color-mix(in oklch, #c02020 10%, #ffffff);

  --color-gray:            #6b7280;
  --color-gray-hover:      #5b6270;
  --color-gray-highlight:  color-mix(in oklch, #6b7280 10%, #ffffff);

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 250 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 250 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 250 / 0.12);
}

/* System preference fallback */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg:               #f0f2f5;
    --color-surface:          #ffffff;
    --color-surface-2:        #f7f8fa;
    --color-surface-offset:   #e8eaef;
    --color-surface-offset-2: #dde0e6;
    --color-surface-dynamic:  #d4d7df;
    --color-divider:          #d0d3db;
    --color-border:           #bfc3cc;
    --color-text:           #1a1f2e;
    --color-text-muted:     #5b6280;
    --color-text-faint:     #8b90a0;
    --color-text-inverse:   #f0f2f5;
    --color-primary:         #d45a14;
    --color-primary-hover:   #b84d10;
    --color-primary-active:  #9c400c;
    --color-primary-highlight: color-mix(in oklch, #d45a14 10%, #ffffff);
    --color-success:         #237a3e;
    --color-success-hover:   #1b6532;
    --color-success-active:  #155026;
    --color-success-highlight: color-mix(in oklch, #237a3e 10%, #ffffff);
    --color-warning:         #b8890f;
    --color-warning-hover:   #9c7209;
    --color-warning-active:  #805c05;
    --color-warning-highlight: color-mix(in oklch, #b8890f 10%, #ffffff);
    --color-blue:            #1d55d0;
    --color-blue-hover:      #1748b5;
    --color-blue-active:     #123b9a;
    --color-blue-highlight:  color-mix(in oklch, #1d55d0 10%, #ffffff);
    --color-purple:          #6b2fd0;
    --color-purple-hover:    #5b25b3;
    --color-purple-active:   #4b1b96;
    --color-purple-highlight: color-mix(in oklch, #6b2fd0 10%, #ffffff);
    --color-error:           #c02020;
    --color-error-hover:     #a41a1a;
    --color-error-active:    #881414;
    --color-error-highlight: color-mix(in oklch, #c02020 10%, #ffffff);
    --color-gray:            #6b7280;
    --color-gray-hover:      #5b6270;
    --color-gray-highlight:  color-mix(in oklch, #6b7280 10%, #ffffff);
    --shadow-sm: 0 1px 2px oklch(0.2 0.01 250 / 0.06);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 250 / 0.08);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 250 / 0.12);
  }
}
