/* ==========================================================================
   base.css — reset, design tokens, typography
   ========================================================================== */

:root {
  /* Type scale (fluid, clamp-based) */
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  --text-xl: clamp(1.3rem, 1.15rem + 0.9vw, 1.75rem);

  /* Spacing (4px base) */
  --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;

  --font-display: 'General Sans', 'Segoe UI', sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', sans-serif;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition-interactive: 150ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 40 / 0.08);
  --shadow-md: 0 4px 14px oklch(0.2 0.02 40 / 0.10);
  --shadow-lg: 0 16px 36px oklch(0.2 0.02 40 / 0.16);
}

/* ---- Color system: industrial / logistics palette ---- */
:root,
[data-theme='light'] {
  --color-bg: #f2f3f5;
  --color-surface: #ffffff;
  --color-surface-2: #f8f9fb;
  --color-surface-offset: #ebedf0;
  --color-divider: #e3e6ea;
  --color-border: #d7dbe1;

  --color-text: #171a1f;
  --color-text-muted: #5b6270;
  --color-text-faint: #9aa0aa;
  --color-text-inverse: #ffffff;

  --color-primary: #d9560f;
  --color-primary-hover: #b8480c;
  --color-primary-active: #8f3908;
  --color-primary-highlight: #f6ddc7;

  --color-success: #2e7d46;
  --color-success-highlight: #d7ecdd;

  --color-warning: #a6790a;
  --color-warning-highlight: #f2e3bf;

  --color-error: #c23b3b;
  --color-error-highlight: #f4d9d9;

  --color-blue: #2b6cb0;
  --color-blue-highlight: #d7e6f4;

  --color-grid-line: #d3d8de;
}

[data-theme='dark'] {
  --color-bg: #13151a;
  --color-surface: #1b1e24;
  --color-surface-2: #20232a;
  --color-surface-offset: #262a32;
  --color-divider: #2b2f38;
  --color-border: #383c46;

  --color-text: #e7e9ec;
  --color-text-muted: #9aa0aa;
  --color-text-faint: #656b76;
  --color-text-inverse: #14151a;

  --color-primary: #f0813a;
  --color-primary-hover: #f79a5c;
  --color-primary-active: #ffb37d;
  --color-primary-highlight: #4a3524;

  --color-success: #57b378;
  --color-success-highlight: #21362a;

  --color-warning: #d8ae3f;
  --color-warning-highlight: #3a3121;

  --color-error: #e37070;
  --color-error-highlight: #3a2325;

  --color-blue: #6ba3dd;
  --color-blue-highlight: #23303f;

  --color-grid-line: #33373f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #13151a;
    --color-surface: #1b1e24;
    --color-surface-2: #20232a;
    --color-surface-offset: #262a32;
    --color-divider: #2b2f38;
    --color-border: #383c46;
    --color-text: #e7e9ec;
    --color-text-muted: #9aa0aa;
    --color-text-faint: #656b76;
    --color-text-inverse: #14151a;
    --color-primary: #f0813a;
    --color-primary-hover: #f79a5c;
    --color-primary-active: #ffb37d;
    --color-primary-highlight: #4a3524;
    --color-success: #57b378;
    --color-success-highlight: #21362a;
    --color-warning: #d8ae3f;
    --color-warning-highlight: #3a3121;
    --color-error: #e37070;
    --color-error-highlight: #3a2325;
    --color-blue: #6ba3dd;
    --color-blue-highlight: #23303f;
    --color-grid-line: #33373f;
  }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  line-height: 1.55;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
ul[role='list'], ol[role='list'] { list-style: none; }
ul { list-style: none; }

input, button, textarea, select { font: inherit; color: inherit; }

h1, h2, h3, h4 { text-wrap: balance; line-height: 1.2; font-family: var(--font-display); }
p, li { text-wrap: pretty; }

::selection { background: color-mix(in oklab, var(--color-primary) 30%, transparent); }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }

a, button, [role='button'], input, textarea, select {
  transition: color var(--transition-interactive), background var(--transition-interactive),
    border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}
