/* kabelschweiz redesign — shared design tokens
   Theme (light / dark) via [data-theme] on <html>.
   The absolute --ink-* palette stays fixed; only --bg, --surface, --text… swap.
*/

:root {
  /* === Absolute palette (NEVER swapped) === */
  --ks-red: #db0000;
  --ks-red-600: #b80000;
  --ks-red-50: #fff1f1;

  --ink-0: #ffffff;
  --ink-50: #f7f7f5;
  --ink-100: #efefea;
  --ink-150: #e6e6df;
  --ink-200: #d6d6cd;
  --ink-300: #b8b8ad;
  --ink-400: #8c8c80;
  --ink-500: #5e5e54;
  --ink-700: #2c2c26;
  --ink-900: #131310;

  --ok: #1f8a5b;
  --warn: #c2890c;
  --info: #1652c9;

  /* Wire colors (Cat 6 T568-B) */
  --w-orange: #f08b1d;
  --w-orange-w: #ffd9ad;
  --w-blue: #1a5fbb;
  --w-blue-w: #b9d2f0;
  --w-green: #1f8f4d;
  --w-green-w: #bce7c8;
  --w-brown: #8c5a35;
  --w-brown-w: #e3cdbc;

  /* Cable accent palette (NetzwerkBOX brights) */
  --cable-yellow: #F9E63B;
  --cable-magenta: #BC4193;
  --cable-cyan: #3BC0F9;
  --cable-orange: #FF8A3B;
  --cable-green: #6DDB5B;

  /* Radii */
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 22px;

  /* Type */
  --font-sans: "Geist", "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-display: "Geist", sans-serif;

  /* === Semantic tokens — LIGHT theme === */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0eb;
  --surface-elev: #ffffff;
  --rail: #131310;            /* always-dark rail — same in both themes */
  --rail-text: #d6d6cd;
  --rail-text-strong: #ffffff;
  --border: #e6e6df;
  --border-strong: #b8b8ad;
  --text: #131310;
  --text-muted: #5e5e54;
  --text-faint: #8c8c80;
  --shadow-sm: 0 1px 2px rgba(19,19,16,0.06);
  --shadow-md: 0 2px 8px rgba(19,19,16,0.08), 0 1px 2px rgba(19,19,16,0.04);
  --shadow-lg: 0 12px 32px rgba(19,19,16,0.12), 0 2px 6px rgba(19,19,16,0.05);

  /* Tabular num for prices */
  font-feature-settings: "ss01", "cv11";
}

/* === DARK theme === */
[data-theme="dark"] {
  --bg: #0d0d0b;
  --surface: #16161310;      /* will sit on top of subtle gradient on body */
  --surface-2: #1d1d1a;
  --surface-elev: #1d1d1a;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.2);
  --text: #f3f3ec;
  --text-muted: rgba(243,243,236,0.62);
  --text-faint: rgba(243,243,236,0.38);
  --ks-red-50: rgba(219,0,0,0.16);
  --ks-red-600: #ff3838;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.6);
  --shadow-md: 0 4px 18px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.7), 0 2px 6px rgba(0,0,0,0.3);
}

[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(219,0,0,0.05), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(59,192,249,0.04), transparent 60%),
    var(--bg);
}

/* === Base === */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* === Utilities === */
.mono { font-family: var(--font-mono); font-feature-settings: "zero", "ss01"; letter-spacing: -0.01em; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.divider-h { height: 1px; background: var(--border); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-mono);
}
.chip-red { background: var(--ks-red-50); color: var(--ks-red-600); }
.chip-ok { background: rgba(31,138,91,0.14); color: var(--ok); }
.chip-warn { background: rgba(194,137,12,0.14); color: var(--warn); }

[data-theme="dark"] .chip-ok { color: #46d18a; }
[data-theme="dark"] .chip-warn { color: #ffc94a; }

.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-elev);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .12s ease, border-color .12s ease, transform .04s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ks-red);
  border-color: var(--ks-red);
  color: white;
}
.btn-primary:hover { background: var(--ks-red-600); border-color: var(--ks-red-600); color: white; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn-icon { width: 40px; padding: 0; justify-content: center; }
.btn-inverse { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-inverse:hover { background: var(--text); color: var(--bg); opacity: 0.88; }

.input, .select, textarea.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  background: var(--surface-elev);
  color: var(--text);
  border-color: var(--border-strong);
}
.input, .select, textarea.input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  width: 100%;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
textarea, textarea.input {
  height: auto;
  padding: 10px 12px;
  background: var(--surface-elev);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font: inherit;
  resize: vertical;
}
.input:focus, .select:focus, textarea:focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="search"]:focus {
  outline: 2px solid var(--ks-red);
  outline-offset: -1px;
  border-color: var(--ks-red);
}
.input::placeholder, textarea::placeholder, input::placeholder { color: var(--text-faint); }

/* Forms inside intentionally-dark blocks (konfigurator, modal, hero) inherit white text/transparent bg via more-specific rules in their own stylesheets — these globals just establish a sane theme-aware default. */

[data-theme="dark"] select option { background: var(--surface-elev); color: var(--text); }
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] { accent-color: var(--ks-red); filter: invert(0); }
[data-theme="dark"] input[type="range"] { accent-color: var(--ks-red); }

/* === Global motion baseline === */
html { color-scheme: light dark; }
@media (prefers-reduced-motion: no-preference) {
  a, button, .card, .btn, .chip, .filtbar__btn, .filtbar__pop, .pdp__tab,
  .ks-action, .cat, .pc, .stripe, .b2b__navitem, .b2b__perspective,
  .crm-row, .checkout__addr, .checkout__opt, .checkout__step,
  .lex-cms__tab, .lex__entry, .nbx__slot, .nbx__len, .nbx__color, .nbx__finished {
    transition: background-color .18s ease, color .18s ease, border-color .18s ease,
                transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  }
  .pc:hover, .cat:hover, .nbx__finished:hover, .crm-row:hover { transform: translateY(-2px); }
}

/* fade in for route changes (apply via .route-fade) */
.route-fade { animation: routeFade .28s ease both; }
@keyframes routeFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
}

.container { width: min(1440px, 100% - 48px); margin: 0 auto; }
.container-wide { width: min(1640px, 100% - 32px); margin: 0 auto; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

:focus-visible { outline: 2px solid var(--ks-red); outline-offset: 2px; }

.price, .num, td.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
