/* OpenKNX Design System – nur die für die Homepage benötigten Teile.
   Quelle: OpenKNX Design System (tokens/*, components/okx.css: Button, Card, LED, Label). */


/* ---- fonts ---- */
/* Webfonts — self-hosted (from the openknx.de homepage), no third-party requests.
   Archivo + JetBrains Mono, variable, Latin + Latin Extended, SIL OFL 1.1 (assets/fonts/LIZENZEN.txt). */
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- colors ---- */
:root {
  /* Bus green — sampled from the logo (#449841), named after the green KNX TP cable */
  --bus-50: #eef7ed;
  --bus-100: #d7edd5;
  --bus-200: #b1dbac;
  --bus-300: #84c47e;
  --bus-400: #5fae59;
  --bus-500: #449841;
  --bus-600: #377c35;
  --bus-700: #2c622b;
  --bus-800: #224b21;
  --bus-900: #173317;
  --bus-950: #0c1d0c;

  /* Ink — slightly green-tinted neutrals. 950 = go.openknx.de theme color */
  --ink-0: #ffffff;
  --ink-25: #fafaf7;
  --ink-50: #f3f5f2;
  --ink-100: #e7eae5;
  --ink-200: #d2d6cf;
  --ink-300: #b1b7ad;
  --ink-400: #899084;
  --ink-500: #656c61;
  --ink-600: #4a5047;
  --ink-700: #343832;
  --ink-800: #22251f;
  --ink-900: #161814;
  --ink-925: #10120f;
  --ink-950: #0b0c0a;

  /* Wire colors — KNX cable cores: red (+), black (−), yellow & white (spare pair) */
  --wire-red: #d9412e;
  --wire-red-soft: #fbe5e1;
  --wire-yellow: #e8b20e;
  --wire-yellow-soft: #fbf1d0;
  --wire-white: #f4f4f0;
  --wire-black: #0b0c0a;
  --signal-blue: #3f8fd6; /* info — used sparingly */
  --signal-blue-soft: #e1eefa;

  /* Semantic — light theme (default) */
  --bg-page: var(--ink-25);
  --bg-sunken: var(--ink-50);
  --surface-card: var(--ink-0);
  --surface-raised: var(--ink-0);
  --surface-inverse: var(--ink-950);
  --surface-hover: var(--ink-50);
  --surface-selected: var(--bus-50);

  --text-strong: var(--ink-950);
  --text-body: var(--ink-800);
  --text-muted: var(--ink-500);
  --text-disabled: var(--ink-300);
  --text-inverse: var(--ink-0);
  --text-on-accent: var(--ink-0);
  --text-link: var(--bus-600);
  --text-link-hover: var(--bus-700);

  --border-subtle: var(--ink-100);
  --border-default: var(--ink-200);
  --border-strong: var(--ink-950);
  --border-focus: var(--bus-500);

  --accent: var(--bus-500);
  --accent-hover: var(--bus-600);
  --accent-press: var(--bus-700);
  --accent-soft: var(--bus-50);
  --accent-text: var(--bus-700);
  /* Filled controls with white text: one step darker than the logo green for WCAG AA (white on 500 = 3.6:1, on 600 = 5.1:1) */
  --accent-fill: var(--bus-600);
  --accent-fill-hover: var(--bus-700);
  --accent-fill-press: var(--bus-800);
  --danger-fill: #bf3424;
  --danger-fill-hover: #a82b1b;

  --success: var(--bus-500);
  --success-soft: var(--bus-50);
  --warning: var(--wire-yellow);
  --warning-soft: var(--wire-yellow-soft);
  --danger: var(--wire-red);
  --danger-soft: var(--wire-red-soft);
  --info: var(--signal-blue);
  --info-soft: var(--signal-blue-soft);
  --success-text: var(--bus-700);
  --warning-text: #7a5a00;
  --danger-text: #a82b1b;
  --info-text: #1f5f99;

  --grid-line: rgba(10, 10, 10, 0.06);
  --bg-signal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Crect x='1.5' y='1.5' width='9' height='9' fill='%23449841' fill-opacity='.12'/%3E%3C/svg%3E");
  --overlay-scrim: rgba(10, 10, 10, 0.55);
}

/* Dark theme — the "Schaltschrank" (cabinet) look. Apply class="theme-dark" or data-theme="dark" on any container. */
.theme-dark, [data-theme="dark"] {
  --bg-page: var(--ink-800);
  --bg-sunken: #060606;
  --surface-card: var(--ink-925);
  --surface-raised: var(--ink-900);
  --surface-inverse: var(--ink-0);
  --surface-hover: var(--ink-900);
  --surface-selected: var(--bus-950);

  --text-strong: var(--ink-0);
  --text-body: var(--ink-100);
  --text-muted: var(--ink-400);
  --text-disabled: var(--ink-600);
  --text-inverse: var(--ink-950);
  --text-link: var(--bus-300);
  --text-link-hover: var(--bus-200);

  --border-subtle: var(--ink-800);
  --border-default: var(--ink-700);
  --border-strong: var(--ink-0);
  --border-focus: var(--bus-400);

  --accent-soft: var(--bus-950);
  --accent-text: var(--bus-300);

  --success-soft: var(--bus-950);
  --warning-soft: #2a2107;
  --danger-soft: #2d0f0b;
  --info-soft: #0c1e2e;
  --success-text: var(--bus-300);
  --warning-text: #f2cc55;
  --danger-text: #ff8a78;
  --info-text: #8cc2f0;

  --grid-line: rgba(255, 255, 255, 0.05);
  --overlay-scrim: rgba(0, 0, 0, 0.7);
}

/* ---- typography ---- */
:root {
  --font-display: "Archivo", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Archivo width axis: display runs condensed (85%, as in the videos), body at normal */
  --stretch-display: 85%; /* @kind font */
  --stretch-body: 100%; /* @kind font */
  --stretch-condensed: 80%; /* @kind font */

  --weight-regular: 400; /* @kind font */
  --weight-medium: 500; /* @kind font */
  --weight-semibold: 600; /* @kind font */
  --weight-bold: 700; /* @kind font */
  --weight-black: 900; /* @kind font */

  /* Type scale (1.25, rounded) */
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-4xl: 48px;
  --text-5xl: 64px;
  --text-6xl: 88px;

  --leading-tight: 1.05; /* @kind font */
  --leading-snug: 1.25; /* @kind font */
  --leading-normal: 1.5; /* @kind font */
  --leading-relaxed: 1.65; /* @kind font */

  --tracking-display: -0.02em; /* @kind font */
  --tracking-normal: 0; /* @kind font */
  --tracking-label: 0.08em; /* @kind font */ /* uppercase mono labels */

  /* Semantic roles */
  --type-display: var(--weight-black) var(--text-5xl)/var(--leading-tight) var(--font-display);
  --type-h1: var(--weight-black) var(--text-4xl)/var(--leading-tight) var(--font-display);
  --type-h2: var(--weight-bold) var(--text-2xl)/var(--leading-snug) var(--font-display);
  --type-h3: var(--weight-bold) var(--text-xl)/var(--leading-snug) var(--font-display);
  --type-body: var(--weight-regular) var(--text-md)/var(--leading-normal) var(--font-sans);
  --type-body-sm: var(--weight-regular) var(--text-sm)/var(--leading-normal) var(--font-sans);
  --type-label: var(--weight-medium) var(--text-2xs)/1 var(--font-mono);
  --type-code: var(--weight-regular) var(--text-sm)/var(--leading-normal) var(--font-mono);
}

/* ---- spacing ---- */
:root {
  /* 4px base grid */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 2px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Radii — the logo is all right angles. Corners are square everywhere (videos, deck, UI). */
  --radius-none: 0;
  --radius-xs: 0;
  --radius-sm: 0;
  --radius-md: 0;

  /* Bus stroke — the logo's bus line is ~2.5% of mark width; in UI it's 2px/3px/4px */
  --bus-stroke-sm: 2px;
  --bus-stroke-md: 3px;
  --bus-stroke-lg: 4px;
  --border-width: 1px;

  /* Controls */
  --control-h-sm: 28px;
  --control-h-md: 36px;
  --control-h-lg: 44px;

  /* Layout */
  --container-sm: 640px;
  --container-md: 960px;
  --container-lg: 1200px;
  --header-h: 56px;
  --grid-size: 24px; /* schematic background grid */
}

/* ---- effects ---- */
:root {
  /* Shadows — restrained. Light: soft ambient. Hard offset only for "lifted modules". */
  --shadow-none: none;
  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.06);
  --shadow-md: 0 2px 4px rgba(10, 10, 10, 0.05), 0 8px 24px rgba(10, 10, 10, 0.08);
  --shadow-lg: 0 4px 8px rgba(10, 10, 10, 0.06), 0 24px 48px rgba(10, 10, 10, 0.14);
  --shadow-module: 6px 6px 0 0 var(--bus-500); /* hard green offset as in the videos (8px on windows, 12px on large frames) */
  --focus-ring: 0 0 0 2px var(--bg-page), 0 0 0 4px var(--border-focus);

  /* Motion — "signal" easing: fast start, precise stop. No bounces. */
  --ease-signal: cubic-bezier(0.2, 0, 0, 1); /* @kind other */
  --ease-in: cubic-bezier(0.4, 0, 1, 1); /* @kind other */
  --ease-out: cubic-bezier(0, 0, 0.2, 1); /* @kind other */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* @kind other */
  --ease-linear: linear; /* @kind other */
  --ease-step: steps(4, end); /* @kind other */ /* LED blink / terminal cursor */

  --dur-instant: 80ms; /* @kind other */
  --dur-fast: 140ms; /* @kind other */
  --dur-base: 220ms; /* @kind other */
  --dur-slow: 360ms; /* @kind other */

  --blur-header: saturate(140%) blur(12px); /* @kind other */
  --z-sticky: 40; /* @kind other */
  --z-header: 50; /* @kind other */
  --z-overlay: 100; /* @kind other */
  --z-toast: 200; /* @kind other */
  --z-tooltip: 300; /* @kind other */
}

.theme-dark, [data-theme="dark"] {
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 24px 64px rgba(0, 0, 0, 0.75);
  --shadow-module: 6px 6px 0 0 var(--bus-500);
}

/* ---- base ---- */
/* Minimal base + motion keyframes shared by components */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg-page); color: var(--text-body); font: var(--type-body); font-stretch: var(--stretch-body); -webkit-font-smoothing: antialiased; }
a { color: var(--text-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--dur-fast) var(--ease-signal); }
a:hover { color: var(--text-link-hover); text-decoration-thickness: 2px; }
code, kbd, samp, pre { font-family: var(--font-mono); }
::selection { background: var(--bus-500); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Signal-Hintergrund: Modul-Quadrate (12px-Raster), Deckkraft als Wellenfeld. Statisch; animiert via <okx-waves> (assets/js/okx-waves.js). */
.okx-grid-bg, .okx-bg-signal { background-image: var(--bg-signal); background-size: 12px 12px; background-repeat: repeat; background-position: center; }

@keyframes okx-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

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

/* ---- Komponenten ---- */
.okx-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:var(--control-h-md);padding:0 16px;border:1px solid transparent;border-radius:var(--radius-xs);font:600 14px/1 var(--font-sans);font-stretch:var(--stretch-body);letter-spacing:.005em;cursor:pointer;white-space:nowrap;user-select:none;position:relative;text-decoration:none;transition:background-color var(--dur-fast) var(--ease-signal),border-color var(--dur-fast) var(--ease-signal),color var(--dur-fast) var(--ease-signal),transform var(--dur-instant) var(--ease-signal),box-shadow var(--dur-fast) var(--ease-signal)}
.okx-btn:active:not(:disabled){transform:translateY(1px)}
.okx-btn:disabled{cursor:not-allowed;opacity:.45}
.okx-btn i{font-size:16px;line-height:1}
.okx-btn--sm{height:var(--control-h-sm);padding:0 10px;font-size:13px;gap:6px}
.okx-btn--sm i{font-size:14px}
.okx-btn--lg{height:var(--control-h-lg);padding:0 20px;font-size:15px}
.okx-btn--lg i{font-size:18px}
.okx-btn--full{width:100%}
.okx-btn--primary{background:var(--accent-fill);color:var(--text-on-accent)}
.okx-btn--primary:hover:not(:disabled){background:var(--accent-fill-hover)}
.okx-btn--primary:active:not(:disabled){background:var(--accent-fill-press)}
.okx-btn--secondary{background:transparent;border-color:var(--border-strong);color:var(--text-strong)}
.okx-btn--secondary:hover:not(:disabled){background:var(--text-strong);color:var(--bg-page)}
.okx-btn--ghost{background:transparent;color:var(--text-body)}
.okx-btn--ghost:hover:not(:disabled){background:var(--surface-hover);color:var(--text-strong)}
.okx-btn--danger{background:var(--danger-fill);color:#fff}
.okx-btn--danger:hover:not(:disabled){background:var(--danger-fill-hover)}
.okx-btn--icon{padding:0;width:var(--control-h-md)}
.okx-btn--icon.okx-btn--sm{width:var(--control-h-sm)}
.okx-btn--icon.okx-btn--lg{width:var(--control-h-lg)}
.okx-led{display:inline-flex;align-items:center;gap:8px;font:500 12px/1 var(--font-mono);color:var(--text-muted)}
.okx-led__dot{width:8px;height:8px;background:var(--ink-300);flex:none;transition:background-color var(--dur-base) var(--ease-signal),box-shadow var(--dur-base) var(--ease-signal)}
.okx-led--on .okx-led__dot,.okx-led--blink .okx-led__dot{background:var(--bus-500);box-shadow:0 0 0 2px rgba(68,152,65,.18)}
.okx-led--blink .okx-led__dot{animation:okx-blink 1s linear infinite}
.okx-led--warn .okx-led__dot{background:var(--wire-yellow);box-shadow:0 0 0 2px rgba(232,178,14,.18)}
.okx-led--error .okx-led__dot{background:var(--wire-red);box-shadow:0 0 0 2px rgba(217,65,46,.18);animation:okx-blink .5s linear infinite}
.okx-label{font:var(--type-label);letter-spacing:var(--tracking-label);text-transform:uppercase;color:var(--text-muted)}
.okx-card{position:relative;background:var(--surface-card);border:1px solid var(--border-default);border-radius:var(--radius-xs);display:flex;flex-direction:column;min-width:0;transition:transform var(--dur-base) var(--ease-signal),box-shadow var(--dur-base) var(--ease-signal),border-color var(--dur-base) var(--ease-signal)}
.okx-card__head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 20px 0}
.okx-card__eyebrow{font:var(--type-label);letter-spacing:var(--tracking-label);text-transform:uppercase;color:var(--text-muted);margin-bottom:8px}
.okx-card__title{font:700 18px/1.25 var(--font-display);font-stretch:var(--stretch-display);color:var(--text-strong);margin:0}
.okx-card__body{padding:14px 20px 20px;color:var(--text-body);font-size:14px;line-height:1.55;flex:1}
.okx-card__foot{border-top:1px solid var(--border-subtle);padding:12px 20px;display:flex;gap:8px;justify-content:flex-end;align-items:center}
.okx-card--bus{border-top-color:transparent}
.okx-card--bus::before{content:"";position:absolute;top:-1px;left:-1px;right:-1px;height:3px;background:var(--accent)}
.okx-card--bus::after{content:"";position:absolute;top:2px;left:20px;width:3px;height:7px;background:var(--accent)}
.okx-card--module{border:1.5px solid var(--border-strong);box-shadow:var(--shadow-module)}
.okx-card--inverse{background:var(--ink-950);border-color:var(--ink-800);color:var(--ink-200)}
.okx-card--inverse .okx-card__title{color:#fff}
.okx-card--inverse .okx-card__body{color:var(--ink-300)}
.okx-card--inverse .okx-card__foot{border-color:var(--ink-800)}
.okx-card--interactive{cursor:pointer}
.okx-card--interactive:hover{border-color:var(--border-strong);transform:translate(-3px,-3px);box-shadow:3px 3px 0 0 var(--accent)}
