:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --text: #1c1e21;
  --text-muted: #55595f;
  --border: #e3e5e8;
  --accent: #2b6cb0;
  --accent-bg: #eaf2fb;
  --code-bg: #f0f1f3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-alt: #1b1e23;
    --text: #ecedee;
    --text-muted: #a3a9b0;
    --border: #2b2f36;
    --accent: #6fa8dc;
    --accent-bg: #17293a;
    --code-bg: #1f2228;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 0 1.5rem; }

/* Nav */
nav.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
nav.topnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  max-width: 860px;
}
nav.topnav .brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 0.98rem;
}
nav.topnav .links { display: flex; gap: 1.4rem; align-items: center; }
nav.topnav .links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
nav.topnav .links a:hover { color: var(--accent); }
nav.topnav .links a.current { color: var(--accent); }

/* Hero */
header.hero { padding: 3.5rem 0 2.5rem; border-bottom: 1px solid var(--border); }
header.hero .eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
header.hero h1 { font-size: 2.6rem; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
header.hero p.tagline { font-size: 1.15rem; color: var(--text-muted); max-width: 640px; margin: 0 0 1.5rem; }

.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.75rem; }
.badges img { display: block; height: 20px; }

.cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-secondary { background: transparent; color: var(--text); }

section { padding: 3rem 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }
h2 { font-size: 1.5rem; margin: 0 0 1.5rem; }
h3.subhead { font-size: 1.05rem; margin: 2rem 0 0.75rem; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; }
.feature h3 { font-size: 1rem; margin: 0 0 0.35rem; }
.feature p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.88rem;
}
code { font-family: "SFMono-Regular", Consolas, Menlo, monospace; }
p code, li code { background: var(--code-bg); padding: 0.1rem 0.35rem; border-radius: 4px; }

.download-links { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.25rem; }
.download-links a { color: var(--accent); font-weight: 600; text-decoration: none; }
.download-links a:hover { text-decoration: underline; }

.lineage {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.lineage ol { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.lineage a { color: var(--accent); }
.credits p { color: var(--text-muted); }

table.status { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.status th, table.status td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
table.status th { color: var(--text-muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-bug { background: #fbdada; color: #8a1f1f; }
.tag-planned { background: var(--accent-bg); color: var(--accent); }
.tag-pending { background: #fdeecb; color: #8a5a1f; }
.tag-untested { background: var(--bg-alt); color: var(--text-muted); }
@media (prefers-color-scheme: dark) {
  .tag-bug { background: #3a1c1c; color: #f2a3a3; }
  .tag-pending { background: #3a2f1c; color: #f2c98b; }
}
.verified {
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.sample-video video {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
  display: block;
}
.sample-video .caption {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.empty-gallery {
  text-align: center;
  padding: 3.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
}
.empty-gallery .icon { font-size: 2.2rem; margin-bottom: 0.75rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-top: 2rem; }
.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.part-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-alt);
}
.part-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  display: block;
}
.stl-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 40%, #fdfdfe, #eef0f3);
  cursor: grab;
  touch-action: none;
  overflow: hidden;
}
.stl-viewer:active { cursor: grabbing; }
.stl-viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.stl-viewer::before {
  content: "loading model…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: inherit;
}
.stl-viewer.loaded::before { content: none; }
.stl-viewer::after {
  content: "drag to rotate · scroll to zoom · shift+drag to pan";
  position: absolute;
  left: 0.5rem;
  bottom: 0.4rem;
  font-size: 0.65rem;
  color: rgba(0,0,0,0.45);
  background: rgba(255,255,255,0.65);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.stl-viewer.loaded:hover::after,
.stl-viewer.loaded:focus-within::after { opacity: 1; }
.stl-viewer-large {
  max-width: 500px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 1.25rem 0;
}

.part-viewer { margin: 1.5rem 0; }
.stl-viewer-stage {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 0.9rem;
}
.part-tabs {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}
.part-tab {
  flex: 0 0 auto;
  width: 84px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--bg-alt);
  padding: 0.3rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-family: inherit;
}
.part-tab img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  border-radius: 5px;
  display: block;
}
.part-tab span {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}
.part-tab:hover { background: var(--accent-bg); }
.part-tab.active { border-color: var(--accent); background: var(--accent-bg); }
.part-tab.active span { color: var(--accent); font-weight: 600; }
.part-active-info { margin-top: 0.9rem; }
.part-active-download {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}
.part-active-download:hover { text-decoration: underline; }
.part-active-desc { font-size: 0.85rem; color: var(--text-muted); margin: 0.3rem 0 0; }
.part-card .part-info {
  padding: 0.75rem 0.9rem 1rem;
}
.part-card .part-info a {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}
.part-card .part-info a:hover { text-decoration: underline; }
.part-card .part-info p {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.gallery-photo {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.gallery-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
}
.gallery-photo span {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.gallery-placeholder {
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  background: var(--bg-alt);
}

footer { padding: 2.5rem 0 4rem; color: var(--text-muted); font-size: 0.85rem; }
footer a { color: var(--accent); }

/* Docs sub-navigation (tab pages + workflow guide) */
.docs-subnav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: -1.25rem 0 2.5rem; }
.docs-subnav a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  white-space: nowrap;
}
.docs-subnav a:hover { color: var(--accent); border-color: var(--accent); }
.docs-subnav a.current { color: #fff; background: var(--accent); border-color: var(--accent); }

/* Prev/next pager at the bottom of a docs page */
.pager { display: flex; justify-content: space-between; gap: 1rem; }
.pager a {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-alt);
}
.pager a:hover { border-color: var(--accent); }
.pager .pager-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.pager .pager-next { text-align: right; }

/* Numbered step flow (workflow guide) */
.step-flow { display: flex; flex-direction: column; }
.step { display: flex; gap: 1.1rem; position: relative; padding-bottom: 2.25rem; }
.step:last-child { padding-bottom: 0; }
.step-num {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  position: relative;
  z-index: 1;
}
.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 34px;
  bottom: -2px;
  width: 2px;
  background: var(--border);
}
.step-body { padding-top: 0.15rem; }
.step-body h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.step-body p { margin: 0 0 0.6rem; color: var(--text-muted); font-size: 0.92rem; }
.step-body .step-link { font-size: 0.85rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.step-body .step-link:hover { text-decoration: underline; }
.step-note {
  background: var(--accent-bg);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.5rem;
}
