:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-2: #f1f3f5;
  --border: #d1d5db;
  --border-light: #e9ecef;
  --text: #1a1a1a;
  --text-muted: #5a5a5a;
  --text-light: #6c757d;
  --accent: #e30613;
  --accent-dark: #b00510;
  --accent-contrast: #ffffff;
  --success: #137a3a;
  --warning: #c25e00;
  --danger: #c41e3a;
  --info: #005587;
  --sidebar-width: 320px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.print-cover {
  display: none;
}

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.site-title-sep {
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 0.2rem;
}

.site-title-docs {
  font-weight: 400;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.print-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.print-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.print-button::before {
  content: "🖨";
  font-size: 0.9em;
}

.pdf-download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
}

.pdf-download-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.pdf-download-button::before {
  content: "↓";
  font-size: 0.9em;
}

.layout {
  padding: 2.5rem 1.5rem 2.5rem calc(var(--sidebar-width) + 2.5rem);
  transition: padding-left 0.25s ease;
}

.sidebar-collapsed .layout {
  padding-left: 1.5rem;
}

.layout main {
  max-width: 900px;
  margin: 0 auto;
  min-width: 0;
}

.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem 2rem;
  font-size: 0.9rem;
  z-index: 90;
  transition: transform 0.25s ease;
}

.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.mobile-menu-toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  margin-right: 0.5rem;
}

.mobile-menu-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mobile-menu-icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.sidebar-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

body.mobile-nav-open .mobile-nav-backdrop {
  opacity: 1;
  visibility: visible;
}

.sidebar-reveal {
  position: fixed;
  top: 72px;
  left: 1rem;
  z-index: 90;
  display: none;
}

.sidebar-collapsed .sidebar-reveal {
  display: block;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1rem;
}

.sidebar-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.sidebar-reveal .sidebar-toggle {
  margin-bottom: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.sidebar-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li {
  margin: 0;
}

.sidebar a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 0 4px 4px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  line-height: 1.35;
}

.sidebar a:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.sidebar .active {
  background: var(--surface);
  color: var(--accent-dark);
  font-weight: 600;
  border-left-color: var(--accent);
}

.sidebar .group {
  margin-top: 1.25rem;
}

.sidebar .group:first-child {
  margin-top: 0;
}

.sidebar .group-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5rem 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-section > .group-label {
  cursor: pointer;
}

.nav-section {
  position: relative;
  padding-left: 1rem;
}

.nav-section-toggle {
  position: absolute;
  left: -0.15rem;
  top: 0.45rem;
  width: 0.9rem;
  height: 0.9rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}

.nav-section-toggle::before {
  content: "▾";
}

.nav-section-collapsed > .nav-section-toggle::before {
  content: "▸";
}

.nav-section-collapsed > ul {
  display: none;
}

.sidebar a.nav-placeholder {
  color: var(--text-light);
}

.nav-wip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-light);
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  white-space: nowrap;
}

.sidebar ul ul {
  margin: 0.25rem 0 0.5rem 0.5rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border-light);
}

.sidebar ul ul ul {
  margin-left: 0.4rem;
  padding-left: 0.5rem;
}

.sidebar ul ul a {
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}

.sidebar ul ul .active {
  background: transparent;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
}

.breadcrumbs a {
  color: var(--text-light);
}

.breadcrumbs a:hover {
  color: var(--accent-dark);
}

.content {
  background: var(--bg);
  padding: 0;
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.content h1 {
  font-size: 2.25rem;
  font-weight: 700;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0.75rem;
  margin-top: 0;
  letter-spacing: -0.01em;
}

.content h2 {
  font-size: 1.6rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.content h3 {
  font-size: 1.25rem;
}

.content h4 {
  font-size: 1.1rem;
}

.content p,
.content ul,
.content ol {
  margin-top: 0;
  margin-bottom: 1rem;
}

.content ul,
.content ol {
  padding-left: 1.5rem;
}

.content li {
  margin: 0.35rem 0;
}

.content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  margin: 1.5rem 0 0.5rem;
}

.content figure {
  margin: 1.5rem 0;
}

.content figcaption,
.content img + em {
  display: block;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.content th,
.content td {
  border: none;
  border-bottom: 1px solid var(--border-light);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.content th {
  background: var(--surface);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.content tr:nth-child(even) {
  background: var(--surface);
}

.content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}

.content blockquote > :first-child {
  margin-top: 0;
}

.content blockquote > :last-child {
  margin-bottom: 0;
}

.content blockquote strong:first-child {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.content blockquote.callout-danger {
  border-left-color: var(--danger);
  background: #fff5f6;
}

.content blockquote.callout-danger strong:first-child {
  color: var(--danger);
}

.content blockquote.callout-warning {
  border-left-color: var(--warning);
  background: #fff8f0;
}

.content blockquote.callout-warning strong:first-child {
  color: var(--warning);
}

.content blockquote.callout-note {
  border-left-color: var(--info);
  background: #f2f8fb;
}

.content blockquote.callout-note strong:first-child {
  color: var(--info);
}

.content blockquote.callout-tip {
  border-left-color: var(--success);
  background: #f2faf5;
}

.content blockquote.callout-tip strong:first-child {
  color: var(--success);
}

.content code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.content pre {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.content pre code {
  background: transparent;
  padding: 0;
}

.content hr {
  border: 0;
  border-top: 1px solid var(--border-light);
  margin: 2.5rem 0;
}

.frontmatter {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  font-size: 0.85rem;
}

.frontmatter summary {
  cursor: pointer;
  color: var(--text-light);
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.frontmatter summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 0.9rem;
  transition: transform 0.15s;
}

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

.frontmatter-summary {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.frontmatter table {
  margin: 0.75rem 0 0;
  width: auto;
}

.frontmatter th,
.frontmatter td {
  border: 0;
  padding: 0.25rem 0.75rem 0.25rem 0;
  background: transparent;
}

.frontmatter th {
  color: var(--text-light);
  font-weight: 600;
  text-transform: capitalize;
}

.frontmatter td {
  color: var(--text);
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.status-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-light);
  border: 1px solid var(--border-light);
  vertical-align: middle;
}

.status-badge.status-released {
  background: #e8f5ee;
  color: var(--success);
  border-color: #b8dfc8;
}

.status-badge.status-review {
  background: #fff8e6;
  color: #8a6d0b;
  border-color: #f0e0b0;
}

.status-badge.status-draft,
.status-badge.status-elaborated {
  background: var(--surface-2);
  color: var(--text-light);
  border-color: var(--border-light);
}

.status-badge.status-obsolete {
  background: #f5f5f5;
  color: var(--text-muted);
  border-color: var(--border-light);
  text-decoration: line-through;
}

.placeholder-banner {
  background: #fff8e6;
  border: 1px solid #f0e0b0;
  border-left: 4px solid #c25e00;
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: #5a4a1a;
  font-size: 0.95rem;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer {
  text-align: center;
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 2rem;
  border-top: 1px solid var(--border-light);
  margin-top: 2rem;
}

/* Auto-generated section numbers */
.content {
  counter-reset: h1;
}

.content h1 {
  counter-increment: h1;
  counter-reset: h2;
}

.content h1::before {
  content: counter(h1) ". ";
}

.content h2 {
  counter-increment: h2;
  counter-reset: h3;
}

.content h2::before {
  content: counter(h1) "." counter(h2) ". ";
}

.content h3 {
  counter-increment: h3;
}

.content h3::before {
  content: counter(h1) "." counter(h2) "." counter(h3) ". ";
}

/* Assembly guides number their own headings to match build order */
.content.assembly-guide h1::before,
.content.assembly-guide h2::before,
.content.assembly-guide h3::before {
  content: none;
}

/* Sponsors section on the landing page */
.content .sponsors {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.content .sponsors h2::before,
.content .card h2::before,
.content .card h3::before {
  content: none;
}

.content .sponsor-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.content .sponsor-logos a {
  display: inline-flex;
  align-items: center;
}

.content .sponsor-logos img {
  height: 32px;
  width: auto;
  max-width: 100%;
  border: none;
  border-radius: 0;
  margin: 0;
}

@media (max-width: 900px) {
  html.mobile-nav-open,
  html.mobile-nav-open body {
    overflow: hidden;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .site-header-inner {
    flex-wrap: nowrap;
  }

  .site-title {
    margin-right: auto;
  }

  .site-nav {
    display: none;
  }

  .print-button {
    margin-left: 0;
  }

  .layout {
    padding-left: 1.5rem;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 320px);
    height: 100vh;
    border-right: 1px solid var(--border-light);
    border-bottom: none;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
    transform: translateX(-100%);
    z-index: 200;
    padding-top: 3.5rem;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar-reveal {
    display: none;
  }

  .site-nav-mobile {
    display: block;
    border-bottom: 1px solid var(--border-light);
    margin: 0 -1.25rem 1rem;
    padding: 0 1.25rem 0.75rem;
  }

  .site-nav-mobile ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .site-nav-mobile a {
    display: block;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
  }

  .site-nav-mobile a:hover {
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
  }
}
