:root {
  /* semantic aliases */
  --border: var(--color-primary);
  --muted: var(--color-secondary);
  --fg: var(--color-charcoal);
  --bg: var(--color-light);
  --card: var(--color-white);
  --code-bg: var(--color-charcoal);
  --code-fg: var(--color-white);
  --accent: var(--color-primary);
  --accent2: var(--color-accent);
}

.doc {
  font-family: 'Roboto', Rockwell, 'Arial Black', Impact, serif;
  line-height: 1.6;
  margin: 2rem auto 6rem auto;
  padding: 0 1rem;
  font-size: 16px;
}

/* Headings */
.doc h1,
.doc h2,
.doc h3,
.doc h4 {
  line-height: 1.25;
  margin: 2.2rem 0 0.8rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.doc h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: var(--accent);
}

.doc h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  /* border-top: 1px solid var(--border); */
  padding-top: 1rem;
  color: var(--accent2);
}

.doc h3 {
  font-size: 1.2rem;
  color: var(--accent2);

}

.doc h4 {
  font-size: 1.05rem;
  color: var(--color-charcoal);
}

/* Paragraphs & links */
.doc p {
  margin: 0.8rem 0;
}

.doc a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc a:hover {
  text-decoration-thickness: 2px;
}

/* Lists */
.doc ul,
.doc ol {
  padding-left: 1.4rem;
  margin: 0.8rem 0;
}

.doc li {
  margin: 0.3rem 0;
}

.doc li::marker {
  color: var(--muted);
}

.doc input[type="checkbox"] {
  accent-color: var(--accent);
  transform: translateY(1px);
}

/* Images & media */
.doc img,
.doc video {
  max-width: 100%;
  height: auto;
  /* border-radius: 10px; */
  display: block;
  margin: 1rem auto;
  background: #fff0;
  /* fix dark halos on transparent PNGs */
  /* box-shadow: 0 1px 0 rgba(0, 0, 0, .02), 0 8px 30px rgba(0, 0, 0, .06); */
}

.doc figure {
  margin: 1.2rem 0;
  text-align: center;
}

.doc figcaption {
  color: var(--muted);
  font-size: .9rem;
  margin-top: .4rem;
}

/* Optional responsive video wrapper:
   <div class="video"><iframe ...></iframe></div> */
.doc .video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 12px;
}

.doc .video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
  background: #000;
}

/* Blockquotes (useful for callouts like Tip/Warning) */
.doc blockquote {
  margin: 1rem 0;
  padding: .9rem 1rem;
  border-left: 4px solid var(--accent);
  background: color-mix(in oklab, var(--accent) 6%, transparent);
  border-radius: 8px;
}

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

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

/* Inline code & code blocks */
.doc code,
.doc kbd {
  font-family: var(--mono-font);
  font-size: .95em;
  background: color-mix(in oklab, var(--fg) 5%, transparent);
  padding: .15em .35em;
  border-radius: 6px;
  border: 1px solid color-mix(in oklab, var(--fg) 15%, transparent);
}

.doc pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1rem;
  border-radius: 12px;
  overflow: auto;
  border: 1px solid color-mix(in oklab, var(--code-fg) 10%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
}

.doc pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 0.95em;
}

/* Tables */
.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-variant-numeric: tabular-nums;
}

.doc th,
.doc td {
  border: 1px solid var(--border);
  padding: .6rem .7rem;
}

.doc th {
  text-align: left;
  background: color-mix(in oklab, var(--fg) 4%, transparent);
  font-weight: 700;
}

.doc tr:nth-child(even) td {
  background: color-mix(in oklab, var(--fg) 2%, transparent);
}

.doc tr:hover td {
  background: color-mix(in oklab, var(--accent) 7%, transparent);
}

/* Horizontal rule */
.doc hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Footnotes (CommonMark-style) */
.doc .footnotes {
  font-size: .95em;
  color: var(--muted);
}

.doc .footnotes hr {
  display: none;
}

/* Definition lists / details */
.doc details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem 1rem;
  margin: 1rem 0;
}

.doc summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}

/* “Download”/file links */
.doc a[href$=".pdf"],
.doc a[href$=".zip"],
.doc a[href$=".stl"],
.doc a[href$=".hex"] {
  padding: .25rem .5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
}

.doc a[href$=".pdf"]:hover,
.doc a[href$=".zip"]:hover,
.doc a[href$=".stl"]:hover,
.doc a[href$=".hex"]:hover {
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}

/* Inline badges (e.g., “Updated”, “Beta”) */
.doc .badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--fg);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent);
}

/* Small utilities */
.doc .muted {
  color: var(--muted);
}

.doc .center {
  text-align: center;
}

.doc .right {
  text-align: right;
}

/* Make anchors on headings visible if your renderer injects them */
.doc h1:hover a.anchor,
.doc h2:hover a.anchor,
.doc h3:hover a.anchor {
  opacity: 1;
}

.doc a.anchor {
  margin-left: .35rem;
  opacity: 0;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}

/* Spacing fixes around first/last elements */
.doc> :first-child {
  margin-top: 0;
}

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



/* Print-friendly */
@media print {
  .doc {
    max-width: none;
  }

  .doc a {
    color: inherit;
    text-decoration: underline;
  }

  .doc pre {
    white-space: pre-wrap;
    word-break: break-word;
  }
}