/* ========================================
   HEIZKRAFT Dashboard — base.css
   Design Tokens + Reset + Foundation
   ======================================== */

:root {
  /* Type Scale */
  --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.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);

  /* 4px Spacing System */
  --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;

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

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

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

  /* Fonts */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;

  /* Sidebar width */
  --sidebar-width: 220px;
  --sidebar-collapsed: 56px;
}

/* ---- DARK MODE (DEFAULT) ---- */
:root, [data-theme="dark"] {
  --color-bg:             #111110;
  --color-surface:        #191918;
  --color-surface-2:      #1e1e1d;
  --color-surface-offset: #1a1a19;
  --color-surface-offset-2: #222221;
  --color-surface-dynamic: #2a2a29;
  --color-divider:        #2a2a28;
  --color-border:         #353533;
  --color-text:           #cdccca;
  --color-text-muted:     #87867f;
  --color-text-faint:     #5a5957;
  --color-text-inverse:   #111110;

  /* Primary (Teal) */
  --color-primary:        #4f98a3;
  --color-primary-hover:  #3ab0be;
  --color-primary-active: #1a626b;
  --color-primary-highlight: rgba(79, 152, 163, 0.12);
  --color-primary-bg:     rgba(79, 152, 163, 0.08);

  /* Semantic */
  --color-error:          #e05c5c;
  --color-error-bg:       rgba(224, 92, 92, 0.1);
  --color-warning:        #e0a040;
  --color-warning-bg:     rgba(224, 160, 64, 0.1);
  --color-success:        #5cb870;
  --color-success-bg:     rgba(92, 184, 112, 0.1);
  --color-blue:           #5591c7;
  --color-blue-bg:        rgba(85, 145, 199, 0.1);
  --color-orange:         #e08850;
  --color-orange-bg:      rgba(224, 136, 80, 0.1);
  --color-purple:         #a86fdf;
  --color-purple-bg:      rgba(168, 111, 223, 0.1);
  --color-gold:           #d4a640;
  --color-gold-bg:        rgba(212, 166, 64, 0.1);

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

/* ---- LIGHT MODE ---- */
[data-theme="light"] {
  --color-bg:             #f5f5f3;
  --color-surface:        #ffffff;
  --color-surface-2:      #fafaf9;
  --color-surface-offset: #eeede9;
  --color-surface-offset-2: #e8e7e3;
  --color-surface-dynamic: #e0dfd9;
  --color-divider:        #dcd9d5;
  --color-border:         #d0cdc7;
  --color-text:           #1a1a18;
  --color-text-muted:     #6b6a65;
  --color-text-faint:     #a8a7a2;
  --color-text-inverse:   #ffffff;

  --color-primary:        #0e7c83;
  --color-primary-hover:  #096268;
  --color-primary-active: #054b50;
  --color-primary-highlight: rgba(14, 124, 131, 0.1);
  --color-primary-bg:     rgba(14, 124, 131, 0.05);

  --color-error:          #c23c3c;
  --color-error-bg:       rgba(194, 60, 60, 0.08);
  --color-warning:        #b07a00;
  --color-warning-bg:     rgba(176, 122, 0, 0.08);
  --color-success:        #2e7d32;
  --color-success-bg:     rgba(46, 125, 50, 0.08);
  --color-blue:           #1565c0;
  --color-blue-bg:        rgba(21, 101, 192, 0.08);
  --color-orange:         #c55700;
  --color-orange-bg:      rgba(197, 87, 0, 0.08);
  --color-purple:         #7a39bb;
  --color-purple-bg:      rgba(122, 57, 187, 0.08);
  --color-gold:           #b07a00;
  --color-gold-bg:        rgba(176, 122, 0, 0.08);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:             #111110;
    --color-surface:        #191918;
    --color-surface-2:      #1e1e1d;
    --color-surface-offset: #1a1a19;
    --color-surface-offset-2: #222221;
    --color-surface-dynamic: #2a2a29;
    --color-divider:        #2a2a28;
    --color-border:         #353533;
    --color-text:           #cdccca;
    --color-text-muted:     #87867f;
    --color-text-faint:     #5a5957;
    --color-text-inverse:   #111110;
    --color-primary:        #4f98a3;
    --color-primary-hover:  #3ab0be;
    --color-primary-active: #1a626b;
    --color-primary-highlight: rgba(79, 152, 163, 0.12);
    --color-primary-bg:     rgba(79, 152, 163, 0.08);
    --color-error:          #e05c5c;
    --color-error-bg:       rgba(224, 92, 92, 0.1);
    --color-warning:        #e0a040;
    --color-warning-bg:     rgba(224, 160, 64, 0.1);
    --color-success:        #5cb870;
    --color-success-bg:     rgba(92, 184, 112, 0.1);
    --color-blue:           #5591c7;
    --color-blue-bg:        rgba(85, 145, 199, 0.1);
    --color-orange:         #e08850;
    --color-orange-bg:      rgba(224, 136, 80, 0.1);
    --color-purple:         #a86fdf;
    --color-purple-bg:      rgba(168, 111, 223, 0.1);
    --color-gold:           #d4a640;
    --color-gold-bg:        rgba(212, 166, 64, 0.1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  }
}

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

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  hanging-punctuation: first last;
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  overflow: hidden;
  line-height: 1.5;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-bg);
  font-variant-numeric: tabular-nums lining-nums;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }

h1, h2, h3, h4, h5, h6 { text-wrap: balance; line-height: 1.2; }
p, li, figcaption { text-wrap: pretty; max-width: 72ch; }

::selection {
  background: rgba(79, 152, 163, 0.25);
  color: var(--color-text);
}

: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%; }

.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;
}
