[data-ob-theme="rustbound"] body {
  background-image:
    linear-gradient(color-mix(in srgb, var(--ob-color-subtle) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ob-color-subtle) 6%, transparent) 1px, transparent 1px);
  background-size: 40px 40px;
}

[data-ob-theme="rustbound"] .ob-header {
  font-family: var(--ob-font-mono);
}

[data-ob-theme="rustbound"] .ob-header-inner {
  margin-bottom: 1.5rem;
}

[data-ob-theme="rustbound"] .ob-title {
  text-transform: uppercase;
  text-wrap: balance;
}

[data-ob-theme="rustbound"] :is(.ob-eyebrow, .rustbound-kicker, .rustbound-article-label) {
  font: 0.75rem / 1.6 var(--ob-font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ob-color-accent-soft);
}

[data-ob-theme="rustbound"] .ob-section > .ob-cover {
  display: none;
}

.rustbound-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding-block: 1.5rem 3rem;
}

.rustbound-hero .ob-heading {
  margin-block: 0.75rem 1rem;
}

.rustbound-hero .ob-title {
  font-size: clamp(2.5rem, 4.5vw, 5rem);
  letter-spacing: -0.065em;
  white-space: nowrap;
}

.rb-title-rust {
  color: var(--ob-color-accent-soft);
}

[data-ob-theme="rustbound"] .ob-prose .rustbound-hero h2 {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
  font: 800 clamp(1.4rem, 2.5vw, 2rem) / 1.2 var(--ob-font-body);
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.rustbound-hero h2 em {
  color: var(--ob-color-accent-soft);
  font-style: normal;
}

.rustbound-hero-copy > p:not(.rustbound-kicker) {
  max-width: 49ch;
  color: var(--ob-color-muted);
}

.rustbound-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 1.75rem;
  font: 0.8rem / 1.6 var(--ob-font-mono);
}

.rustbound-actions a:first-child {
  padding: 0.8rem 1.2rem;
  border: 1px solid var(--ob-color-accent-border);
  border-radius: var(--ob-radius-sm);
  background: var(--ob-color-accent);
  color: var(--ob-color-accent-contrast);
  text-decoration: none;
}

.rustbound-demo {
  min-width: 0;
}

[data-ob-theme="rustbound"] .ob-prose pre {
  padding: 1.1rem;
  border-color: var(--ob-color-border);
  border-radius: var(--ob-radius-sm);
  font-size: 0.85rem;
  line-height: 1.8;
  tab-size: 4;
}

[data-ob-theme="rustbound"] .ob-code-block {
  overflow: hidden;
  border: 1px solid var(--ob-color-border);
  border-radius: var(--ob-radius);
  background: var(--ob-color-code-bg);
  box-shadow: var(--ob-shadow);
}

[data-ob-theme="rustbound"] .ob-code-block pre {
  border: 0;
  border-radius: 0;
}

[data-ob-theme="rustbound"] .ob-numbered .ob-line::before {
  opacity: 1;
}

[data-ob-theme="rustbound"] .ob-code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--ob-color-border);
  border-radius: 0;
  font-size: 0.7rem;
}

[data-ob-theme="rustbound"] .ob-code-title::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 2rem;
  border-radius: 50%;
  background: #f87171;
  box-shadow: 14px 0 #fbbf24, 28px 0 #4ade80;
}

.rustbound-demo .ob-code-block {
  margin: 0;
}

.rustbound-demo code {
  white-space: pre;
}

.rustbound-demo .rustbound-comment {
  color: var(--ob-color-code-comment);
}

.rustbound-demo .rustbound-keyword {
  color: var(--ob-color-code-keyword);
}

.rustbound-demo .rustbound-function {
  color: var(--ob-color-code-function);
}

.rustbound-demo .rustbound-type {
  color: var(--ob-color-code-type);
}

.rb-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin-block: 2rem 1rem;
  list-style: none;
}

.rb-materials li {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--ob-color-border);
  border-radius: 4px;
  color: var(--ob-color-muted);
  font: 0.65rem / 1.8 var(--ob-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rb-assembly {
  position: relative;
  margin: 0 0 1rem;
  overflow: hidden;
  border: 1px solid #41434a;
  border-radius: 12px;
  background: radial-gradient(ellipse at 55% 40%, #60302145, transparent 65%), #11151b;
  color: #d0b8a4;
  box-shadow: 0 24px 70px #00000030, inset 0 1px #ffffff0a;
}

.rb-assembly-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0.75rem 1.1rem;
  font: 0.6rem / 1.8 var(--ob-font-mono);
  letter-spacing: 0.08em;
}

.rb-motion-toggle {
  padding: 0.3rem 0.5rem;
  border: 1px solid #615249;
  border-radius: 4px;
  color: #f0c9aa;
  background: #201d1c;
  font: inherit;
  cursor: pointer;
}

.rb-motion-toggle[hidden] { display: none; }

.rb-mechanism {
  position: relative;
  aspect-ratio: 1.2;
  margin-inline: 0.75rem;
  container-type: inline-size;
  background:
    linear-gradient(#a5b2c00c 1px, transparent 1px),
    linear-gradient(90deg, #a5b2c00c 1px, transparent 1px);
  background-size: 28px 28px;
}

.rb-orbit {
  position: absolute;
  width: 70%;
  aspect-ratio: 1;
  top: 0;
  left: 25%;
  border: 1px solid #c29a7930;
  border-radius: 50%;
}

.rb-orbit-inner { inset: 5% auto auto 29%; width: 62%; border-style: dashed; }

.rb-gear-position {
  position: absolute;
  aspect-ratio: 1;
  filter: drop-shadow(0 12px 8px #00000080);
}

.rb-drive { width: 60%; top: 4%; left: 31%; }
.rb-driven { width: 40%; top: 47%; left: 2%; }

.rb-machined-gear {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 2deg, #c07548 0deg 9deg, transparent 9deg 15deg);
}

.rb-machined-gear::before {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background: conic-gradient(#e5a275, #6e3928 23%, #ffbe83 43%, #82442b 61%, #e8a77a 83%, #e5a275);
  box-shadow: inset 0 0 0 1px #f7b789, inset 0 0 0 5px #6e422c;
}

.rb-gear-face {
  position: absolute;
  inset: 14%;
  border: 1px solid #dfa678;
  border-radius: 50%;
  background: repeating-conic-gradient(#131820 0deg 37deg, #ad6840 37deg 60deg);
  box-shadow: 0 0 0 4px #81492f, inset 0 0 12px #000000;
}

.rb-gear-face span {
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: conic-gradient(#c8956c, #764e37, #e7b487, #805036, #c8956c);
  border: 2px solid #e2ad7d;
}

.rb-axle {
  position: absolute;
  inset: 39%;
  display: grid;
  place-items: center;
  border: 1px solid #e0ac7d;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #353336, #11151b);
  color: #f3be91;
  font: 900 clamp(1rem, 5cqw, 1.8rem) / 1 var(--ob-font-heading);
  box-shadow: 0 3px 6px #000000a0;
}

.rb-driven .rb-machined-gear {
  background: repeating-conic-gradient(from 4deg, #8895a0 0deg 13.5deg, transparent 13.5deg 22.5deg);
}

.rb-driven .rb-machined-gear::before {
  background: conic-gradient(#c6cdd2, #4d5965, #b5bec7, #525e68, #c6cdd2);
  box-shadow: inset 0 0 0 1px #b7c2c9, inset 0 0 0 4px #4e5c68;
}

.rb-driven .rb-gear-face { background: repeating-conic-gradient(#131820 0deg 37deg, #7d8b98 37deg 60deg); border-color: #9daab3; box-shadow: 0 0 0 3px #52606e; }
.rb-driven .rb-gear-face span { background: conic-gradient(#afbac3, #52606e, #c1cbd3, #657583, #afbac3); border-color: #b7c2c9; }
.rb-driven .rb-axle { inset: 42%; border-color: #a0aeb9; }

.rb-mechanism-label,
.rb-mechanism-coordinate {
  position: absolute;
  font: 0.6rem / 1.8 var(--ob-font-mono);
  letter-spacing: 0.08em;
  color: #c6b7ad;
}

.rb-label-core { top: 4%; left: 2%; border-bottom: 1px solid #8e6245; padding-bottom: 0.5rem; }
.rb-label-state { right: 3%; bottom: 8%; border-top: 1px solid #71818c; padding-top: 0.5rem; }
.rb-mechanism-coordinate { left: 2%; bottom: 0; font-size: 0.5rem; color: #a0abb6; }

.rb-assembly figcaption {
  padding: 1rem 1.1rem;
  color: #c5b7ac;
  font: 0.65rem / 1.8 var(--ob-font-mono);
}

.rb-machined-gear { animation: rb-turn 48s linear infinite paused; }
.rb-driven .rb-machined-gear { animation-duration: 32s; animation-direction: reverse; }
@keyframes rb-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) {
  .rb-motion-running .rb-machined-gear { animation-play-state: running; }
}

.rb-motion-toggle:focus-visible,
.rb-roadmap-grid a:focus-visible,
.rustbound-actions a:focus-visible {
  outline: 2px solid var(--ob-color-accent-soft);
  outline-offset: 4px;
}

.rb-roadmap {
  margin-block: 3rem;
}

.rb-roadmap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
}

.rb-roadmap-grid a {
  position: relative;
  box-sizing: border-box;
  display: block;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--ob-color-border);
  border-top: 1px solid var(--ob-color-accent-border);
  border-radius: 4px;
  color: var(--ob-color-text);
  background: var(--ob-color-surface);
  text-decoration: none;
}

.rb-roadmap-grid li { position: relative; padding-top: 1.5rem; }
/* The series page renders inside .ob-prose, whose `li + li` spacing would drop every card after the first. */
.rb-roadmap-grid li + li { margin-top: 0; }
.rb-roadmap-grid li::before { content: ""; position: absolute; top: 0; left: 0; right: -1rem; height: 1px; background: var(--ob-color-border); }
.rb-roadmap-grid li::after { content: ""; position: absolute; top: -4px; left: 1.25rem; width: 9px; height: 9px; border-radius: 50%; background: var(--ob-color-accent-soft); box-shadow: 0 0 0 5px var(--ob-color-page); }
.rb-roadmap-grid li:last-child::before { right: 0; }

.rb-roadmap-grid a:hover {
  background: var(--ob-color-surface-raised);
}

.rb-roadmap-grid span {
  display: block;
  color: var(--ob-color-subtle);
  font: 0.7rem / 1.8 var(--ob-font-mono);
}

.rb-roadmap-grid strong {
  display: block;
  margin-block: 0.5rem;
  font-size: 1.2rem;
}

.rb-roadmap-grid p,
.rb-next-horizon {
  color: var(--ob-color-muted);
  font-size: 0.9rem;
}

.rb-chapter-label {
  margin-block: 2rem 1rem;
  color: var(--ob-color-accent-soft);
  font: 0.9rem / 1.8 var(--ob-font-mono);
}

[id^="rb-chapter-"] {
  scroll-margin-top: 2rem;
}

.rb-next-horizon {
  padding: 1rem 1.25rem;
  border: 1px dashed var(--ob-color-border);
  border-radius: var(--ob-radius-sm);
}

.rustbound-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 3rem;
  padding: 0;
  list-style: none;
}

.rustbound-flow li {
  position: relative;
  padding: 1.2rem;
  border: 1px solid var(--ob-color-border);
  border-radius: var(--ob-radius-sm);
  background: var(--ob-color-surface);
}

.rustbound-flow li:not(:last-child)::after {
  content: "\2192";
  position: absolute;
  z-index: 1;
  right: -0.85rem;
  top: calc(50% - 0.8rem);
  color: var(--ob-color-accent-soft);
  font-size: 1.2rem;
}

.rustbound-flow span {
  display: block;
  color: var(--ob-color-subtle);
  font: 0.65rem / 1.6 var(--ob-font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rustbound-flow strong {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.1rem;
}

[data-ob-theme="rustbound"] #mission-log {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  text-transform: uppercase;
}

[data-ob-theme="rustbound"] .ob-series-parts-full {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

[data-ob-theme="rustbound"] .ob-part {
  height: 100%;
  padding: 1.4rem;
  border: 1px solid var(--ob-color-border);
  border-radius: var(--ob-radius);
  background: var(--ob-color-surface);
}

/* A chapter label shares the first row of each group; the card fills only what is left. */
[data-ob-theme="rustbound"] .rb-chapter-label + .ob-part {
  height: auto;
}

[data-ob-theme="rustbound"] .ob-part:is(:hover, :focus-visible) {
  border-color: var(--ob-color-accent-border);
  background: var(--ob-color-surface-raised);
}

[data-ob-theme="rustbound"] .ob-part-number {
  color: var(--ob-color-accent-soft);
  font: 700 1.2rem / 1.8 var(--ob-font-mono);
}

[data-ob-theme="rustbound"] .ob-part-title {
  font-family: var(--ob-font-body);
  font-weight: 750;
}

[data-ob-theme="rustbound"] .ob-post-header {
  position: relative;
  padding-block: 1.5rem;
  border-top: 1px solid var(--ob-color-accent-border);
  border-bottom: 1px solid var(--ob-color-border);
}

[data-ob-theme="rustbound"] .ob-post-header .ob-eyebrow {
  max-width: 60ch;
}

.rustbound-article-label {
  margin-block: 0 0.75rem;
}

[data-ob-theme="rustbound"] .ob-tags a {
  border-radius: 4px;
  font: 0.7rem / 1.8 var(--ob-font-mono);
}

[data-ob-theme="rustbound"] .ob-prose :is(h2, h3) {
  margin-top: 2em;
  font-family: var(--ob-font-body);
  letter-spacing: -0.025em;
}

[data-ob-theme="rustbound"] .ob-prose h2 {
  padding-top: 0.8rem;
  border-top: 1px solid var(--ob-color-border);
  font-weight: 800;
}

[data-ob-theme="rustbound"] .ob-prose blockquote {
  border-left-color: var(--ob-color-accent);
  background: var(--ob-color-surface);
  color: var(--ob-color-muted);
}

[data-ob-theme="rustbound"] .ob-prose :not(pre) > code {
  color: var(--ob-color-accent-soft);
}

[data-ob-theme="rustbound"] .ob-series-box {
  border-top: 3px solid var(--ob-color-accent);
}

[data-ob-theme="rustbound"] .ob-footer::before {
  content: "> Small function. Bigger game.";
  display: block;
  width: min(var(--ob-reading-width), 100% - 2 * var(--ob-gutter));
  margin: 0 auto 2rem;
  color: var(--ob-color-accent-soft);
  font: 0.8rem / 1.8 var(--ob-font-mono);
}

@media (max-width: 900px) {
  .rb-roadmap-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rustbound-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .rustbound-hero .ob-title {
    font-size: clamp(2.8rem, 10vw, 6rem);
  }

  .rustbound-demo {
    max-width: 36rem;
    width: 100%;
  }
}

@media (max-width: 540px) {
  .rustbound-flow {
    grid-template-columns: minmax(0, 1fr);
  }

  .rustbound-flow li:not(:last-child)::after {
    content: "\2193";
    top: auto;
    right: 1rem;
    bottom: -1.2rem;
  }

  [data-ob-theme="rustbound"] .ob-part {
    padding: 1rem;
    gap: 0.75rem;
  }
}

@media print {
  [data-ob-theme="rustbound"] body {
    background-image: none;
  }

  .rb-machined-gear { animation: none; }
  .rb-motion-toggle { display: none; }
}

.rb-core-status {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid #41434a;
  font-size: 0.85rem;
}
.rb-core-status[hidden],
.rb-core-hint[hidden],
.rb-core-readout[hidden] { display: none; }
.rb-core-hint { margin: 0; color: #b4bdca; }
.rb-core-level { margin: 0 0 0.5rem; }
.rb-core-level strong { color: #ffd2b0; }
.rb-core-meter { display: block; width: 100%; height: 0.8rem; accent-color: #e0743a; }
.rb-core-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 0; padding: 0; list-style: none; }
.rb-badge { padding: 0.25rem 0.6rem; border: 1px dashed #41434a; border-radius: 4px; color: #99a3b3; }
.rb-badge-earned { border-style: solid; border-color: #c9622a; color: #ffd2b0; }
.rb-core-announce { margin: 0.5rem 0 0; min-height: 1.2em; color: #ffd2b0; }
.rb-assembly[data-level] { border-color: #8a4a2e; box-shadow: 0 24px 70px #00000030, inset 0 1px #ffffff0a, 0 0 calc(var(--rb-level) * 9px) #c9622a66; }
.rb-assembly[data-level="1"] { --rb-level: 1; }
.rb-assembly[data-level="2"] { --rb-level: 2; }
.rb-assembly[data-level="3"] { --rb-level: 3; }
.rb-assembly[data-level="4"] { --rb-level: 4; }
.rb-assembly[data-level="5"] { --rb-level: 5; }
.rb-assembly[data-level="5"] .rb-mechanism-coordinate { color: #ffd2b0; }
