.doc-layout {
  display: grid;
  gap: 16px;
}

.doc-layout .page-card h2 {
  margin-top: 0;
}

.section-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 4px;
}

/* ── Kompatibilitäts-Gantt (Zeitachse vertikal, oben = alt) ── */
.gantt-wrap {
  margin-top: 12px;
}

/* Nur auf schmalen Screens horizontal scrollen — sonst würden die Tooltips
   am Rand des Scroll-Containers abgeschnitten */
@media (max-width: 680px) {
  .gantt-wrap {
    overflow-x: auto;
  }
}

.gantt {
  display: grid;
  grid-template-columns: max-content 130px minmax(140px, 1fr) minmax(140px, 1fr);
  gap: 5px 14px;
  min-width: 540px;
  align-items: stretch;
}

.gantt-head {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  font-weight: 700;
  padding-bottom: 4px;
  align-self: end;
}

.gantt-date {
  font-size: 0.78rem;
  color: var(--text-soft);
  align-self: center;
  white-space: nowrap;
  text-align: right;
}

/* Firmware-Blöcke: ein kurzer Eintrag je Release */
.fw-block {
  position: relative;
  border-radius: 8px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  cursor: help;
  border: 1px solid transparent;
  white-space: nowrap;
}

.fw-none {
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.45);
  color: #0d9488;
}

.fw-ota3 {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--primary);
}

.fw-ota4 {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.45);
  color: #7e22ce;
}

.fw-mig {
  background: rgba(234, 179, 8, 0.13);
  border-color: rgba(234, 179, 8, 0.45);
  color: #a16207;
}

/* Untertitel im Firmware-Block (z. B. „Bootloader-Updater") */
.fw-block small {
  display: block;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  opacity: 0.8;
  margin-top: 1px;
}

/* Tooltip mit Key-Features (Hover / Tastatur-Fokus) */
.fw-tip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 20;
  min-width: 230px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  padding: 10px 12px;
  text-align: left;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text);
  white-space: normal;
  line-height: 1.45;
  cursor: auto;
}

.fw-tip ul {
  margin: 0;
  padding-left: 16px;
}

.fw-tip li {
  margin: 2px 0;
}

.fw-block:hover .fw-tip,
.fw-block:focus-within .fw-tip,
.fw-block:focus .fw-tip,
.gantt-bar:hover .fw-tip,
.gantt-bar:focus-within .fw-tip,
.gantt-bar:focus .fw-tip {
  display: block;
}

/* Tooltip unterhalb statt oberhalb (für Einträge am oberen Diagrammrand) */
.tip-below .fw-tip {
  bottom: auto;
  top: calc(100% + 8px);
}

/* Kompatibilitäts-Balken (Bootloader / Groundstation) */
.gantt-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  padding: 5px 8px;
  cursor: help;
}

.gantt-bar small {
  font-weight: 400;
  opacity: 0.75;
}

.bar-bl {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.35);
  color: var(--primary);
}

.bar-gs {
  background: rgba(34, 197, 94, 0.09);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #15803d;
}

.bar-none {
  background: rgba(13, 148, 136, 0.1);
  border: 1px solid rgba(13, 148, 136, 0.45);
  color: #0d9488;
}

/* Bootloader-Wechsel per OTA — gestreift, um den Übergang zu zeigen */
.bar-mig {
  border: 1px solid rgba(234, 179, 8, 0.55);
  color: #a16207;
  background: repeating-linear-gradient(
    -45deg,
    rgba(234, 179, 8, 0.16) 0 7px,
    rgba(234, 179, 8, 0.06) 7px 14px
  );
  font-size: 0.8rem;
}

/* Legende + Fußnoten */
.gantt-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.gantt-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}

.dot-none { background: rgba(13, 148, 136, 0.45); }
.dot-ota3 { background: rgba(37, 99, 235, 0.45); }
.dot-ota4 { background: rgba(168, 85, 247, 0.45); }
.dot-mig  { background: rgba(234, 179, 8, 0.5); }

.compat-notes {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.compat-notes a {
  color: var(--primary);
}

/* ── Hardware-Version Foldables ── */
.hw-version {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.hw-version summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-weight: 700;
  font-size: 1.02rem;
}

.hw-version summary::-webkit-details-marker {
  display: none;
}

.hw-version summary::before {
  content: "›";
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-soft);
  transition: transform 160ms ease;
  flex: 0 0 auto;
}

.hw-version[open] summary::before {
  transform: rotate(90deg);
}

.hw-version summary:hover {
  background: rgba(37, 99, 235, 0.05);
}

.hw-date {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-left: auto;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
}

.badge-ok {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.hw-body {
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
}

.hw-body ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text-soft);
}

.hw-body li {
  margin: 4px 0;
}

.hw-note {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.08);
  font-size: 0.88rem;
}

/* ── KiCad viewer embed ── */
.kicad-embed {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #001023;
}

.kicad-embed iframe {
  display: block;
  width: 100%;
  height: min(62vh, 560px);
  min-height: 380px;
  border: 0;
}

.kicad-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.kicad-foot a {
  color: var(--primary);
  font-weight: 600;
}

/* ── Repo-Links ── */
.repo-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
