/* ──────────────────────────────────────────────────────────────
   OpenSpeed – site styles
   ──────────────────────────────────────────────────────────── */

:root {
  --bg:           #f4f5f7;
  --surface:      #ffffff;
  --nav-bg:       #1c2333;
  --primary:      #2563eb;
  --primary-dim:  #dbeafe;
  --green:        #16a34a;
  --text:         #1f2937;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --code-bg:      #1c2333;
  --radius:       5px;
  --shadow:       0 1px 6px rgba(0,0,0,.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navigation ───────────────────────────────────────────── */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 54px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 2px 8px rgba(0,0,0,.3);
  gap: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #f3f4f6;
  font-size: 1.05rem;
  font-weight: 700;
  flex-shrink: 0;
}
.nav-logo svg { width: 24px; height: 24px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  flex: 1;
}

.nav-links a {
  color: #9ca3af;
  font-size: .82rem;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav-links a:hover { background: rgba(255,255,255,.08); color: #f3f4f6; text-decoration: none; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lang-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  color: #9ca3af;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .12s, color .12s;
  letter-spacing: .3px;
}
.lang-btn:hover { border-color: rgba(255,255,255,.4); color: #f3f4f6; }

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #9ca3af;
  border-radius: 2px;
  transition: background .12s;
}
.nav-hamburger:hover span { background: #f3f4f6; }

/* Mobile nav drawer */
.nav-drawer {
  display: none;
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 12px 16px 16px;
  z-index: 99;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.nav-drawer.open { display: block; }
.nav-drawer ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-drawer a {
  color: #9ca3af;
  font-size: .9rem;
  padding: 8px 12px;
  border-radius: 4px;
  display: block;
  transition: background .12s, color .12s;
}
.nav-drawer a:hover { background: rgba(255,255,255,.08); color: #f3f4f6; text-decoration: none; }

/* ── Hero ─────────────────────────────────────────────────── */

.hero {
  background: linear-gradient(150deg, #1c2333 0%, #1e3a5f 100%);
  color: #f3f4f6;
  padding: 72px 28px 64px;
}

.hero-inner {
  max-width: 700px;
}

.hero-eyebrow {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #60a5fa;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.9rem);
  font-weight: 800;
  line-height: 1.18;
  margin-bottom: 18px;
  color: #f9fafb;
}

.hero h1 em {
  font-style: normal;
  color: #60a5fa;
}

.hero-lead {
  font-size: 1.05rem;
  color: #9ca3af;
  max-width: 580px;
  margin-bottom: 28px;
  line-height: 1.7;
}

.hero-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.35);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 28px;
  font-size: .875rem;
  color: #fca5a5;
  max-width: 580px;
}
.hero-warning strong { color: #f87171; }

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .12s, transform .08s;
  border: none;
  text-decoration: none;
}
.btn:hover { opacity: .85; transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; color: #d1d5db; border: 1px solid rgba(255,255,255,.25); }

/* ── Layout ───────────────────────────────────────────────── */

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

section { padding: 60px 0; }
section + section { border-top: 1px solid var(--border); }

/* Responsive grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 8px;
}

/* ── Section headers ──────────────────────────────────────── */

.section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}

h2 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.section-lead {
  color: var(--text-muted);
  font-size: .975rem;
  max-width: 580px;
  margin-bottom: 36px;
  line-height: 1.7;
}

/* ── Feature cards ────────────────────────────────────────── */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.feature-card-icon {
  font-size: 1.25rem;
  margin-bottom: 10px;
  line-height: 1;
}

.feature-card h3 {
  font-size: .975rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.feature-card p { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }

/* ── Steps ────────────────────────────────────────────────── */

.steps { display: flex; flex-direction: column; }

.step {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: none; }

.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  margin-top: 3px;
}

.step h3 { font-size: .975rem; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.step p, .step li { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }
.step ul { padding-left: 16px; margin-top: 6px; }
.step li { margin-bottom: 2px; }

/* ── How-it-works cards ───────────────────────────────────── */

.how-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border-top: 2px solid var(--primary);
}

.how-card-num {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}

.how-card h3 { font-size: .975rem; font-weight: 600; margin-bottom: 6px; }
.how-card p { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }

/* ── Cards / boxes ────────────────────────────────────────── */

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.info-card-header {
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card-body { padding: 16px; }

/* ── Tables ───────────────────────────────────────────────── */

.pin-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.pin-table th {
  background: var(--bg);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.pin-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.pin-table td:first-child { white-space: nowrap; }
.pin-table tr:last-child td { border-bottom: none; }
.pin-table tr:hover td { background: var(--bg); }

.spec-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.spec-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.spec-table td:first-child { font-weight: 600; color: var(--text-muted); width: 180px; white-space: nowrap; }
.spec-table tr:last-child td { border-bottom: none; }
.spec-table tr:hover td { background: var(--bg); }

.pin-chip {
  display: inline-block;
  background: #1c2333;
  color: #93c5fd;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .75rem;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 600;
}
.pin-chip.gnd { color: #f87171; }
.pin-chip.vcc { color: #86efac; }
.pin-chip.data { color: #fcd34d; }

/* ── Compat box ───────────────────────────────────────────── */

.compat-box {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 20px 0;
}
.compat-box-title {
  font-size: .875rem;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.compat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.compat-col h4 {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}
.compat-col.yes h4 { color: #15803d; }
.compat-col.no  h4 { color: #b91c1c; }
.compat-col ul { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.compat-col li { padding: 2px 0; color: var(--text-muted); }
.compat-col.yes li::before { content: "✓ "; color: #16a34a; font-weight: 600; }
.compat-col.no  li::before { content: "✗ "; color: #dc2626; font-weight: 600; }

/* ── Sensor distance box ──────────────────────────────────── */

.sensor-dist-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 20px 0;
}
.sensor-dist-box-title {
  font-size: .875rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sensor-dist-box p, .sensor-dist-box li { font-size: .875rem; color: #78350f; line-height: 1.6; }
.sensor-dist-box ul { padding-left: 16px; margin-top: 6px; }
.sensor-dist-box li { margin-bottom: 2px; }

/* ── Wiring diagram ───────────────────────────────────────── */

.diagram-wrap {
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 24px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.diagram-wrap pre {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .78rem;
  color: #9ca3af;
  line-height: 1.6;
  white-space: pre;
  min-width: max-content;
}

.diagram-wrap .hl   { color: #60a5fa; }
.diagram-wrap .hl-g { color: #86efac; }
.diagram-wrap .hl-y { color: #fcd34d; }
.diagram-wrap .hl-r { color: #f87171; }

/* ── Code blocks ──────────────────────────────────────────── */

pre, code {
  font-family: "Cascadia Code", Consolas, monospace;
}

.code-block {
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 12px 0;
}
.code-block code {
  font-size: .82rem;
  color: #9ca3af;
  line-height: 1.7;
}
.code-block .kw  { color: #60a5fa; }
.code-block .str { color: #86efac; }
.code-block .num { color: #fcd34d; }

/* ── Alerts ───────────────────────────────────────────────── */

.alert {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0;
  font-size: .875rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.6;
}
.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.alert-danger  { background: #fef2f2; border: 1px solid #fca5a5; color: #7f1d1d; }

/* ── API endpoints ────────────────────────────────────────── */

.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  margin: 8px 0;
  font-size: .875rem;
}
.method {
  background: #dcfce7;
  color: #15803d;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.endpoint-path { font-family: monospace; color: var(--text); font-weight: 600; }
.endpoint-desc { color: var(--text-muted); margin-left: auto; font-size: .82rem; }

/* ── Footer ───────────────────────────────────────────────── */

footer {
  background: var(--code-bg);
  color: #4b5563;
  text-align: center;
  padding: 28px 24px;
  font-size: .84rem;
  border-top: 1px solid rgba(255,255,255,.05);
}
footer a { color: #6b7280; }
footer a:hover { color: #9ca3af; }

/* ── Localization ─────────────────────────────────────────── */

[data-lang] { display: none; }
.lang-de [data-lang="de"],
.lang-en [data-lang="en"] { display: block; }

.lang-de [data-lang-inline="de"],
.lang-en [data-lang-inline="en"] { display: inline; }

[data-lang-inline] { display: none; }

[id] { scroll-margin-top: 64px; }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  nav { padding: 0 16px; }
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }

  .hero { padding: 48px 16px 44px; }
  .container { padding: 0 16px; }
  section { padding: 44px 0; }

  .grid-2 { grid-template-columns: 1fr; gap: 20px; }
  .grid-3 { grid-template-columns: 1fr; gap: 16px; }

  .compat-grid { grid-template-columns: 1fr; }

  .endpoint { flex-wrap: wrap; }
  .endpoint-desc { margin-left: 0; width: 100%; }

  h2 { font-size: 1.4rem; }
  .hero h1 { font-size: 1.75rem; }
}
