/* Montra Bot Design System — modeled on montramarkets.xyz:
   Obsidian Dark default (#050505 canvas, #0a0a0a cards, #101010 wells, #1f1f1f hairline rules, sharp 2px radii,
   metallic silver primary buttons, Instrument Serif display + Geist sans + Geist Mono tabular data)
   plus Folio Light archival counterpart. */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Mono", monospace;
  --radius: 2px;
  --wide: 1200px;
  --gutter: clamp(16px, 3.2vw, 28px);
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Obsidian Dark default tokens (silver theme matching montramarkets.xyz) */
  --bg: #050505;
  --bg-1: #0a0a0a;
  --bg-2: #101010;
  --bg-3: #161616;
  --bg-4: #1e1e1e;
  --line: #1f1f1f;
  --line-2: #2c2c2c;
  --fg: #f2f2f2;
  --fg-1: #b0b4ba;
  --fg-2: #8a8f98;
  --fg-3: #5b6069;
  --accent: #e4e6ea;
  --accent-ink: #050505;
  --accent-soft: rgba(255, 255, 255, 0.06);
  --up: #3ddc84;
  --down: #ff5470;
  --warn: #e3d8c3;
  --info: #7aa7ff;
  --metal: linear-gradient(180deg, #ffffff 0%, #ececec 55%, #d4d4d4 100%);
  --metal-ink: #050505;
  --metal-shadow: inset 0 1px #ffffff, inset 0 -1px rgba(0, 0, 0, 0.35);
  --wallet-bg: linear-gradient(135deg, #262626 0%, #141414 100%);
  --sheen: linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.02) 44%, rgba(255, 255, 255, 0.08) 100%);
  --sheen-soft: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.015) 45%, rgba(255, 255, 255, 0.04) 100%);
  --hero-art: url("/img/bg-hero-dark.webp");
  --footer-art: url("/img/bg-footer-dark.webp");
  --hero-dim-top: rgba(5, 5, 5, 0.30);
  --hero-dim-mid: rgba(5, 5, 5, 0.56);
  --footer-scrim: linear-gradient(180deg, rgba(5, 5, 5, 0.88) 0%, rgba(5, 5, 5, 0.62) 48%, rgba(5, 5, 5, 0.44) 100%);
  --hero-wm-opacity: 0.085;
  --hero-sky: rgba(34, 78, 76, 0.34);
  --hero-ridge: rgba(16, 26, 26, 0.86);
  --etch: rgba(255, 255, 255, 0.022);
  --pop-shadow: 0 24px 64px rgba(0, 0, 0, 0.72), 0 2px 8px rgba(0, 0, 0, 0.45);
  --ring: color-mix(in oklab, var(--fg) 18%, transparent);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f6f5f1;
  --bg-1: #ffffff;
  --bg-2: #efede7;
  --bg-3: #e5e2da;
  --bg-4: #d9d5cb;
  --line: #ddd9d0;
  --line-2: #bdb7aa;
  --fg: #0c0c0d;
  --fg-1: #3e4147;
  --fg-2: #585c63;
  --fg-3: #767a83;
  --accent: #141416;
  --accent-ink: #f6f5f1;
  --accent-soft: rgba(12, 12, 13, 0.055);
  --up: #127a43;
  --down: #b81d38;
  --warn: #855200;
  --info: #1d57b8;
  --metal: linear-gradient(180deg, #27292d 0%, #141518 55%, #080809 100%);
  --metal-ink: #f6f5f1;
  --metal-shadow: inset 0 1px rgba(255, 255, 255, 0.24), inset 0 -1px rgba(0, 0, 0, 0.55);
  --wallet-bg: linear-gradient(135deg, #ffffff 0%, #ece9e1 100%);
  --sheen: linear-gradient(135deg, rgba(0, 0, 0, 0.07) 0%, rgba(0, 0, 0, 0.01) 44%, rgba(0, 0, 0, 0.05) 100%);
  --sheen-soft: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0%, transparent 45%, rgba(0, 0, 0, 0.02) 100%);
  --hero-art: url("/img/bg-hero-light.webp");
  --footer-art: url("/img/bg-footer-light.webp");
  --hero-dim-top: rgba(246, 245, 241, 0.24);
  --hero-dim-mid: rgba(246, 245, 241, 0.52);
  --footer-scrim: linear-gradient(180deg, rgba(246, 245, 241, 0.90) 0%, rgba(246, 245, 241, 0.66) 52%, rgba(246, 245, 241, 0.48) 100%);
  --hero-wm-opacity: 0.065;
  --hero-sky: rgba(48, 96, 90, 0.14);
  --hero-ridge: rgba(215, 212, 202, 0.55);
  --etch: rgba(0, 0, 0, 0.024);
  --pop-shadow: 0 24px 64px rgba(15, 16, 18, 0.14), 0 2px 8px rgba(15, 16, 18, 0.08);
  --ring: color-mix(in oklab, var(--fg) 22%, transparent);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
main { flex: 1; }
main:focus { outline: none; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: var(--radius); }
::selection { background: var(--fg); color: var(--bg); }

.skip {
  position: fixed;
  left: 12px;
  top: -64px;
  z-index: 100;
  background: var(--fg);
  color: var(--bg);
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
}
.skip:focus { top: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Typography scale (Bold brand & bold headers matching montramarkets.xyz contrast) */
.t-hero {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.65rem, 1.8rem + 3.4vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
}
.t-hero em, .t-title em { font-style: italic; }
.t-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 1.35rem + 1.4vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.t-figure {
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: lining-nums;
  font-size: clamp(1.65rem, 1.25rem + 1.2vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.t-figure-s {
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: lining-nums;
  font-size: 1.45rem;
  line-height: 1.12;
  letter-spacing: -0.005em;
}
.o-card h2, .o-card h3, .mb-step h3, .mb-prose h3, .mb-footer-col h3 { font-weight: 600; }
.t-numeral {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--fg-2);
  font-size: clamp(2.4rem, 1.9rem + 1.3vw, 3.3rem);
  line-height: 0.95;
  flex: none;
}
.t-lead { font-size: clamp(1rem, 0.95rem + 0.35vw, 1.15rem); line-height: 1.55; color: var(--fg-1); margin: 0; }
.t-body { font-size: 15px; line-height: 1.6; color: var(--fg-1); }
.t-label { font-size: 13px; color: var(--fg-1); }
.t-caption { font-size: 12.5px; color: var(--fg-2); }
.mono, code, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.up-txt { color: var(--up); }
.down-txt { color: var(--down); }
.warn-txt { color: var(--warn); }

.ico { width: 16px; height: 16px; flex: none; }
.o-page { width: min(100%, calc(var(--wide) + 2 * var(--gutter))); min-width: 0; margin: 0 auto; padding-inline: var(--gutter); }

/* Header & Navigation */
.mb-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.mb-top {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mb-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
  min-height: 44px;
}
.mb-mark-svg { width: 28px; height: 28px; flex: none; }
.mb-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.mb-top-actions { display: flex; align-items: center; gap: 6px; }
.o-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-1);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s var(--ease);
}
.o-icon-btn:hover { color: var(--fg); background: transparent; }

/* R05 Icon-Only Original Aperture Theme Button + Directional Octagonal View Transition + Fallback */
.mb-theme-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-1);
  cursor: pointer;
  overflow: visible;
  transition: color 0.15s var(--ease);
}
.mb-theme-btn:hover { color: var(--fg); background: transparent; }
.mb-theme-btn::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--up);
  clip-path: polygon(29% 0%, 71% 0%, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0% 71%, 0% 29%);
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}
.mb-theme-btn.is-switching::after {
  animation: mb-aperture-halo 0.52s cubic-bezier(.22, 1, .36, 1) forwards;
}
.mb-aperture .ap-frame,
.mb-aperture .ap-core,
.mb-aperture .ap-ray,
.mb-aperture .ap-pip {
  transform-box: fill-box;
  transform-origin: center;
}
.mb-aperture .ap-frame { transition: transform 0.52s cubic-bezier(.22, 1, .36, 1); }
.mb-aperture .ap-core { transition: transform 0.52s cubic-bezier(.22, 1, .36, 1); }
.mb-aperture .ap-pip { transition: transform 0.35s var(--ease), opacity 0.25s var(--ease); }
html[data-theme="light"] .mb-aperture .ap-frame { transform: rotate(45deg); }
html[data-theme="light"] .mb-aperture .ap-core { transform: rotate(180deg); }
.mb-theme-btn:hover .ap-pip { transform: scale(1.25); }
.mb-theme-btn.is-switching .ap-pip { animation: mb-pip-flash 0.48s cubic-bezier(.22, 1, .36, 1); }
@keyframes mb-aperture-halo {
  0% { opacity: 0.9; transform: scale(0.62) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.85) rotate(22.5deg); }
}
@keyframes mb-pip-flash {
  0% { transform: scale(1); }
  38% { transform: scale(1.7); }
  100% { transform: scale(1); }
}

@view-transition { navigation: auto; }
.mb-header { view-transition-name: mb-header; }
html.theme-vt .mb-header { view-transition-name: none; }
::view-transition-group(root) { animation-duration: 0.16s; animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
::view-transition-group(mb-header) { animation-duration: 0s; }
html.theme-vt::view-transition-old(root),
html.theme-vt::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
html.theme-vt::view-transition-old(root) { z-index: 1; }
html.theme-vt::view-transition-new(root) { z-index: 99; }
html.theme-swap *, html.theme-swap *::before, html.theme-swap *::after { transition: none !important; }

.mb-theme-fallback {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: none;
  background: #050505;
  opacity: 0;
  will-change: clip-path, opacity;
}
.mb-theme-fallback[data-target="light"] {
  background: radial-gradient(circle at var(--tx, 80%) var(--ty, 30px), color-mix(in oklab, #127a43 12%, #f6f5f1) 0%, #f6f5f1 68%);
}
.mb-theme-fallback[data-target="dark"] {
  background: radial-gradient(circle at var(--tx, 80%) var(--ty, 30px), color-mix(in oklab, #3ddc84 12%, #050505) 0%, #050505 68%);
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .mb-aperture .ap-frame,
  .mb-aperture .ap-core,
  .mb-aperture .ap-pip { transition: none !important; }
  .mb-theme-btn.is-switching::after,
  .mb-theme-btn.is-switching .ap-pip { animation: none !important; }
  .mb-theme-fallback { display: none !important; }
}

.o-wallet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  height: 40px;
  margin-left: 4px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--wallet-bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}
.o-wallet:hover { border-color: var(--fg-2); }
.o-wallet.connected { font-family: var(--font-mono); font-size: 12px; }
.mb-menu-btn { display: none; }

.mb-subnav { border-top: 1px solid var(--line); }
.mb-nav-list {
  display: flex;
  align-items: stretch;
  gap: 20px;
  height: 44px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mb-nav-list::-webkit-scrollbar { display: none; }
.mb-nav-list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-2);
  text-decoration: none;
  white-space: nowrap;
  padding: 0 2px;
  transition: color 0.15s var(--ease);
}
.mb-nav-list a:hover { color: var(--fg); }
.mb-nav-list a[aria-current="page"] { color: var(--fg); font-weight: 600; }
.mb-nav-list a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--fg);
  box-shadow: 0 0 10px color-mix(in oklab, var(--fg) 35%, transparent);
}

@media (max-width: 720px) {
  .mb-menu-btn { display: inline-flex; }
  .mb-subnav { display: none; }
  .mb-subnav.open {
    display: block;
    background: var(--bg-1);
    border-top: 1px solid var(--line);
    padding: 8px 0;
  }
  .mb-subnav.open .mb-nav-list {
    flex-direction: column;
    height: auto;
    gap: 2px;
  }
  .mb-subnav.open .mb-nav-list a {
    min-height: 44px;
    padding: 0 10px;
    border-radius: var(--radius);
  }
  .mb-subnav.open .mb-nav-list a[aria-current="page"] { background: var(--bg-3); }
  .mb-subnav.open .mb-nav-list a[aria-current="page"]::after { display: none; }
  .mb-theme-label { display: none; }
  .o-wallet { min-width: 44px; height: 44px; padding: 0 12px; font-size: 12.5px; margin-left: 2px; }
  .o-icon-btn, .mb-theme-btn { min-width: 44px; min-height: 44px; width: 44px; height: 44px; padding: 0; }
}
@media (max-width: 520px) {
  .mb-top-x { display: none; }
  .mb-brand { gap: 7px; }
  .mb-wordmark { font-size: 20px; }
  .mb-top-actions { gap: 4px; }
  .o-wallet { padding: 0 10px; font-size: 12px; }
  .o-badge { white-space: normal; max-width: 100%; }
}
@media (max-width: 380px) {
  :root { --gutter: 12px; }
  .mb-brand { gap: 5px; }
  .mb-mark-svg { width: 24px; height: 24px; }
  .mb-wordmark { font-size: 17.5px; }
  .mb-top-actions { gap: 2px; }
  .o-icon-btn, .mb-theme-btn { min-width: 36px; min-height: 40px; width: 36px; height: 40px; }
  .o-wallet { min-width: 0; padding: 0 7px; font-size: 11px; margin-left: 2px; }
}

/* Live Montra Ticker & Status Ribbon */
.mb-ticker {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 36px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.mb-ticker-track {
  display: flex;
  align-items: center;
  gap: 28px;
  white-space: nowrap;
  padding-left: 16px;
  animation: mb-marquee 42s linear infinite;
}
.mb-ticker:hover .mb-ticker-track { animation-play-state: paused; }
@keyframes mb-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .mb-ticker { overflow-x: auto; }
  .mb-ticker-track { animation: none; }
}
.mb-tick-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-decoration: none;
  color: var(--fg-1);
}
.mb-tick-item:hover { color: var(--fg); }
.mb-tick-sym { font-weight: 600; color: var(--fg); }

/* Notice tab: the network / contract / fee-waiver facts fold into one tappable bar under the header. */
.mb-notice {
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.mb-notice-tab {
  display: block;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mb-notice-tab::-webkit-details-marker { display: none; }
.mb-notice-tab:hover { background: color-mix(in oklab, var(--fg) 3%, var(--bg-1)); }
.mb-notice-tab:focus-visible { outline: 2px solid var(--up); outline-offset: -2px; }
.mb-notice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 12.5px;
  color: var(--fg-1);
}
.mb-notice-pip {
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--up);
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--up) 22%, transparent);
}
.mb-notice-kicker {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
}
.mb-notice-teaser {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--fg-2);
}
.mb-notice-hint::before {
  content: "Open";
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.mb-notice[open] .mb-notice-hint::before { content: "Close"; }
.mb-notice-chev {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--fg-1);
  transition: transform 0.22s cubic-bezier(.22, 1, .36, 1);
}
.mb-notice[open] .mb-notice-chev { transform: rotate(180deg); }
.mb-notice-panel { border-top: 1px dashed var(--line-2); }
.mb-notice[open] .mb-notice-panel { animation: mb-notice-drop 0.24s cubic-bezier(.22, 1, .36, 1); }
.mb-notice-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 0 auto;
  padding-block: 14px 16px;
}
.mb-notice-item { min-width: 0; padding-left: 12px; border-left: 2px solid var(--line-2); }
.mb-notice-item:first-child { border-left-color: var(--up); }
.mb-notice-item dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 4px;
}
.mb-notice-item dd { margin: 0; font-size: 13px; color: var(--fg); line-height: 1.45; }
.mb-notice-ca { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
@keyframes mb-notice-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 760px) {
  .mb-notice-list { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 420px) {
  .mb-notice-hint { display: none; }
  .mb-notice-row { gap: 8px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .mb-notice-chev { transition: none; }
  .mb-notice[open] .mb-notice-panel { animation: none; }
}
.mb-ca-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-1);
  overflow-wrap: anywhere;
}

/* Atmospheric Painted Cloudscape Hero & Compact Subpage Sky (modeled on montramarkets.xyz) */
.mb-hero-band {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mb-hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.mb-hero-bg {
  position: absolute;
  inset: 0;
  background-image: var(--hero-art);
  background-size: cover;
  background-position: 50% 24%;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 32%, rgba(0, 0, 0, 0.92) 42%, rgba(0, 0, 0, 0.74) 55%, rgba(0, 0, 0, 0.46) 70%, rgba(0, 0, 0, 0.18) 85%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 32%, rgba(0, 0, 0, 0.92) 42%, rgba(0, 0, 0, 0.74) 55%, rgba(0, 0, 0, 0.46) 70%, rgba(0, 0, 0, 0.18) 85%, transparent 100%);
}
.mb-hero-watermark {
  position: absolute;
  right: clamp(-10px, 5vw, 96px);
  top: -12px;
  width: clamp(240px, 32vw, 440px);
  height: clamp(240px, 32vw, 440px);
  color: var(--fg);
  opacity: var(--hero-wm-opacity);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 60%, transparent 100%);
}
.mb-hero-wm-svg { width: 100%; height: 100%; }
.mb-hero-etch {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, var(--etch) 0 1px, transparent 1px 4px);
}
.mb-hero-dim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--hero-dim-top) 0%, var(--hero-dim-mid) 56%, var(--bg) 100%);
}
.mb-hero-inner {
  position: relative;
  z-index: 1;
  padding-block: clamp(32px, 5vw, 60px) clamp(24px, 3vw, 36px);
  display: grid;
  gap: 24px;
}
:root:not([data-theme="light"]) .mb-hero-inner :is(.t-hero, .t-lead) {
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.72);
}
main.mb-subpage { position: relative; }
main.mb-subpage > * { position: relative; z-index: 1; }
main.mb-subpage::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 220px;
  pointer-events: none;
  z-index: 0;
  background-image: var(--hero-art);
  background-size: cover;
  background-position: 50% 18%;
  opacity: 0.42;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 48%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 48%, transparent 100%);
}
.mb-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: end;
}
@media (max-width: 860px) { .mb-hero-grid { grid-template-columns: 1fr; } }

.mb-cta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
}
.mb-text-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-1);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--line-2);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.mb-text-link:hover { color: var(--fg); text-decoration-color: var(--fg); }

/* Buttons & Controls */
.o-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background-color: var(--accent);
  background-image: var(--metal);
  color: var(--metal-ink);
  box-shadow: var(--metal-shadow);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s var(--ease), opacity 0.15s var(--ease);
}
.o-btn:hover { filter: brightness(0.95); }
.o-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.o-btn.sm { height: 38px; min-height: 38px; padding: 0 14px; font-size: 13px; }
.o-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-1);
  background-image: var(--sheen-soft);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.o-btn-secondary:hover { border-color: var(--fg-2); background: var(--bg-2); }
.o-btn-secondary.sm { height: 38px; min-height: 38px; padding: 0 12px; font-size: 13px; }
.o-btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }
.full-w { width: 100%; }

/* 4-column Hairline KPI Bar (matching montramarkets.xyz above Trending) */
.mb-kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  padding-top: 20px;
  gap: 16px;
}
@media (max-width: 780px) { .mb-kpi-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mb-kpi { min-width: 0; }
.mb-kpi-label { font-size: 12.5px; color: var(--fg-2); margin-bottom: 4px; }
.mb-kpi-val { color: var(--fg); overflow-wrap: anywhere; }
.mb-kpi-sub { font-size: 12px; color: var(--fg-2); margin-top: 3px; }

/* Cards, Wells, Segments, Inputs */
.mb-section { padding: clamp(24px, 4vw, 44px) 0; }
.mb-section + .mb-section { border-top: 1px solid var(--line); }
.mb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.mb-section-head > *, .mb-swap-layout > *, [data-active-token-banner] { min-width: 0; max-width: 100%; }
.o-card code, [data-active-token-banner] code { overflow-wrap: anywhere; word-break: break-word; }

.o-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  background-image: var(--sheen-soft);
  padding: clamp(16px, 2.4vw, 24px);
  min-width: 0;
}
.o-well {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 12px 14px;
}
.o-input, .o-select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  box-shadow: inset 0 1px rgba(0, 0, 0, 0.25);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.o-input::placeholder { color: var(--fg-2); }
.o-input:focus-visible, .o-select:focus-visible {
  outline: none;
  border-color: var(--fg-1);
  box-shadow: 0 0 0 3px var(--ring);
}
.o-input.mono { font-family: var(--font-mono); font-size: 13px; }

.o-seg {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 2px;
  gap: 2px;
}
.o-seg button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.o-seg button:hover { color: var(--fg); }
.o-seg button[aria-pressed="true"] {
  background: var(--bg-3);
  border-color: var(--line-2);
  color: var(--fg);
}
.o-seg button:disabled { opacity: 0.4; cursor: not-allowed; }

.o-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-1);
  white-space: nowrap;
}
.o-badge.live { border-color: color-mix(in oklab, var(--up) 45%, transparent); color: var(--up); }
.o-badge.warn { border-color: color-mix(in oklab, var(--warn) 45%, transparent); color: var(--warn); }
.o-badge.official { background: var(--metal); color: var(--metal-ink); border-color: transparent; font-weight: 600; }
/* Phones: long badges wrap inside the page instead of running past the edge (must follow the base rule). */
@media (max-width: 520px) {
  .o-badge { display: inline-block; white-space: normal; max-width: 100%; line-height: 1.5; overflow-wrap: anywhere; }
  .o-badge > .ico { vertical-align: -2px; margin-right: 4px; }
}

/* R04 Precision Signal Loader */
.mb-loader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: 10px 14px;
  position: relative;
  overflow: hidden;
  font-size: 13px;
  color: var(--fg-1);
}
.mb-loader[hidden] { display: none; }
.mb-loader-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.mb-loader-beam {
  position: absolute;
  inset: 0 auto 0 0;
  width: 34%;
  background: linear-gradient(90deg, transparent, var(--up) 55%, var(--fg));
  transform: translateX(-100%);
  animation: mb-scan 1.3s var(--ease) infinite;
}
@keyframes mb-scan {
  from { transform: translateX(-100%); }
  to { transform: translateX(320%); }
}
@keyframes mb-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.4); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .mb-loader-beam { animation: none; transform: translateX(0); width: 45%; opacity: 0.65; }
  .mb-loader-dot { animation: none !important; }
}
.mb-loader.is-error .mb-loader-beam { animation: none; width: 100%; background: var(--down); transform: none; }
.mb-loader.is-error .mb-loader-dot { animation: none; background: var(--down); }
.mb-loader-status { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mb-loader-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); flex: none; animation: mb-dot-pulse 1.4s ease-in-out infinite; }
.mb-loader-actions { display: flex; align-items: center; gap: 8px; }

/* Overview: Numbered Post Builder + X Feed Preview */
.mb-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .mb-builder-grid { grid-template-columns: 1fr; } }

.mb-step-list { display: grid; gap: 16px; }
.mb-step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.mb-step:last-child { border-bottom: 0; padding-bottom: 0; }
@media (max-width: 480px) { .mb-step { grid-template-columns: 1fr; gap: 8px; } }

.mb-form-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .mb-form-2 { grid-template-columns: 1fr; } }
.mb-field { display: grid; gap: 6px; min-width: 0; }
.mb-field.wide { grid-column: 1 / -1; }
.mb-field-label { display: flex; align-items: baseline; justify-content: space-between; font-size: 12.5px; color: var(--fg-1); }

.mb-tweet-preview {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 16px;
}
.mb-hero-band .mb-tweet-preview {
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}
.mb-tweet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mb-tweet-user { display: flex; align-items: center; gap: 10px; }
.mb-tweet-av { width: 30px; height: 30px; border: 0; overflow: hidden; flex: none; background: transparent; display: grid; place-items: center; }
.mb-post-box {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg);
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 82px;
}
.mb-at { color: var(--info); }
.mb-caret { display: inline-block; width: 2px; height: 1em; background: var(--fg); vertical-align: -2px; margin-left: 2px; animation: mb-blink 1s steps(1) infinite; }
@keyframes mb-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mb-caret { animation: none; } }

/* Markets / Launches Grid & List Table */
.mb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.mb-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1 1 320px; justify-content: flex-end; }
.mb-search-wrap { position: relative; flex: 1 1 220px; max-width: 340px; }
.mb-search-wrap .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-2); pointer-events: none; }
.mb-search-wrap .o-input { padding-left: 36px; height: 42px; }

.mb-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1020px) { .mb-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .mb-cards { grid-template-columns: 1fr; } }

.mb-card {
  position: relative;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: 14px;
  transition: border-color 0.15s var(--ease);
}
.mb-card:hover { border-color: var(--line-2); }
.mb-card.hl { border-color: var(--fg); }
.mb-card-media {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
}
.mb-card-media img { width: 100%; height: 100%; object-fit: cover; }
.mb-card-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mb-card-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.mb-card-name::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.mb-card-links { position: relative; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; }
.mb-card-links a { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; padding: 5px 9px; border: 1px solid var(--line-2); border-radius: var(--radius); text-decoration: none; color: var(--fg-1); }
.mb-card-links a .ico { width: 12px; height: 12px; }
.mb-card-links a:hover { border-color: var(--fg); color: var(--fg); }

.mb-prog { height: 3px; background: var(--bg-3); border-radius: 1px; overflow: hidden; }
.mb-prog i { display: block; height: 100%; background: var(--fg); }

.mb-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
}
.mb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}
.mb-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.mb-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.mb-table tr:last-child td { border-bottom: 0; }
.mb-table tbody tr:hover td { background: var(--bg-2); }
/* Phones: two-column reference tables (syntax → meaning, component → address) stack per row
   instead of squeezing the first column to a word per line. Wider data tables keep scrolling. */
@media (max-width: 600px) {
  .mb-table:not(:has(th:nth-child(3))) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .mb-table:not(:has(th:nth-child(3))),
  .mb-table:not(:has(th:nth-child(3))) tbody,
  .mb-table:not(:has(th:nth-child(3))) tr,
  .mb-table:not(:has(th:nth-child(3))) td { display: block; width: 100%; }
  .mb-table:not(:has(th:nth-child(3))) tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .mb-table:not(:has(th:nth-child(3))) tr:last-child { border-bottom: 0; }
  .mb-table:not(:has(th:nth-child(3))) td { padding: 0; border: 0; overflow-wrap: anywhere; }
  .mb-table:not(:has(th:nth-child(3))) td:first-child { font-weight: 600; color: var(--fg); margin-bottom: 4px; }
  .mb-table:not(:has(th:nth-child(3))) tbody tr:hover td { background: none; }
}
.mb-tok-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.mb-tok-cell img { width: 38px; height: 38px; border: 1px solid var(--line-2); border-radius: var(--radius); object-fit: cover; flex: none; background: var(--bg-2); }

/* Dashboard & Token Detail */
.mb-dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .mb-dash-grid { grid-template-columns: 1fr; } }
.mb-dash-wide { grid-column: 1 / -1; }
.mb-connect-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  align-items: center;
}
@media (max-width: 760px) { .mb-connect-card { grid-template-columns: 1fr; } }

.mb-kv-list { list-style: none; margin: 0; padding: 0; display: grid; }
.mb-kv-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.mb-kv-list li:last-child { border-bottom: 0; }
.mb-kv-list li span { color: var(--fg-2); font-size: 13px; }
.mb-kv-list li code { font-size: 12.5px; color: var(--fg); overflow-wrap: anywhere; }

/* Swap & Market Terminal */
.mb-swap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) { .mb-swap-layout { grid-template-columns: 1fr; } }

.mb-trade-well {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 14px;
  display: grid;
  gap: 10px;
}
.mb-trade-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mb-amount-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 2rem;
  font-variant-numeric: lining-nums;
  line-height: 1.1;
  min-width: 0;
  padding: 4px 0;
}
.mb-amount-input:focus { outline: none; }
.mb-unit-pill {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--fg);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  flex: none;
  cursor: pointer;
}
.mb-flip-row { display: flex; justify-content: center; margin: -6px 0; position: relative; z-index: 2; }
.mb-flip-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--fg-1);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.mb-flip-btn:hover { color: var(--fg); background: var(--bg-3); }

.mb-amt-chips { display: flex; gap: 6px; }
.mb-amt-chips button {
  padding: 4px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.mb-amt-chips button:hover { color: var(--fg); border-color: var(--fg-2); }

.mb-chart-box { min-height: 320px; display: grid; place-items: center; color: var(--fg-2); }
.mb-chart-box svg { width: 100%; height: auto; touch-action: pan-y; user-select: none; }
.mb-chart-box line.grid { stroke: var(--line); stroke-width: 1; }
.mb-chart-box text.axis { fill: var(--fg-2); font-family: var(--font-mono); }
.mb-chart-box .up-stroke { stroke: var(--up); fill: none; }
.mb-chart-box .down-stroke { stroke: var(--down); fill: none; }
.mb-chart-box .up-fill { fill: var(--up); }
.mb-chart-box .down-fill { fill: var(--down); }
.mb-chart-box .vol-up { fill: color-mix(in oklab, var(--up) 26%, transparent); }
.mb-chart-box .vol-down { fill: color-mix(in oklab, var(--down) 26%, transparent); }
.mb-chart-box .crosshair { stroke: var(--fg-2); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.mb-chart-box .last-line { stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.72; }
.mb-chart-box .last-pill-txt { fill: #050505; font-family: var(--font-mono); font-weight: 600; font-size: 10.5px; }

.mb-three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}
@media (max-width: 960px) { .mb-three-col { grid-template-columns: 1fr; } }

.mb-chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mb-chip {
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
}
.mb-chip[aria-pressed="true"] { background: var(--bg-3); border-color: var(--fg); color: var(--fg); }

/* Montra-style 3-column Multi-Page Docs UI */
.mb-docs-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 196px;
  gap: 36px;
  align-items: start;
}
@media (max-width: 1199px) {
  .mb-docs-layout { grid-template-columns: 212px minmax(0, 1fr); gap: 28px; }
  .docs-toc-col { display: none; }
}
.docs-sidebar {
  position: sticky;
  top: 114px;
  max-height: calc(100dvh - 128px);
  overflow-y: auto;
  display: grid;
  gap: 22px;
}
/* Below 960px the sidebar gives way to the .mb-docs-picker menu. This must come after the .docs-sidebar rule:
   when it came first, display:grid won and the sticky sidebar sat on top of the article text. */
@media (max-width: 959px) {
  .mb-docs-layout { grid-template-columns: 1fr; gap: 18px; }
  .docs-sidebar { display: none; }
}
.docs-group-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  padding: 0 12px;
  margin: 0 0 6px;
}
.docs-nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.docs-nav-link {
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 20px;
  color: var(--fg-1);
  text-decoration: none;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.docs-nav-link:hover { color: var(--fg); background-image: var(--sheen-soft); }
.docs-nav-link[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  background-color: var(--bg-3);
  background-image: var(--sheen);
  box-shadow: inset 2px 0 0 var(--fg);
}

.mb-docs-picker { display: none; }
@media (max-width: 959px) {
  .mb-docs-picker { display: block; margin-bottom: 16px; }
}
.mb-docs-picker summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-1);
  background-image: var(--sheen-soft);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.mb-docs-picker summary::-webkit-details-marker { display: none; }
.mb-docs-picker-panel {
  margin-top: 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: 10px 8px;
  display: grid;
  gap: 14px;
}

.docs-article { max-width: 70ch; min-width: 0; }
.docs-h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 1.25rem + 0.8vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 34px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 120px;
}
.docs-h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.docs-h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--fg);
  margin: 22px 0 8px;
  scroll-margin-top: 120px;
}
.docs-prose p, .docs-prose li { font-size: 15px; line-height: 1.65; color: var(--fg-1); margin: 0 0 14px; }
.docs-prose ul, .docs-prose ol { margin: 0 0 18px; padding-left: 20px; }
.docs-prose li { margin-bottom: 6px; }
.docs-prose b, .docs-prose strong { color: var(--fg); font-weight: 600; }

.docs-code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  margin: 14px 0 20px;
  overflow: hidden;
}
.docs-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  background-image: var(--sheen-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-2);
}
.docs-code pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--fg-1);
}

.docs-toc-col { position: sticky; top: 114px; }
.docs-toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  margin: 0 0 10px;
}
.mb-toc { display: grid; gap: 2px; box-shadow: inset 1px 0 0 var(--line-2); }
.mb-toc a {
  display: block;
  font-size: 13px;
  line-height: 20px;
  color: var(--fg-2);
  text-decoration: none;
  padding: 4px 0 4px 12px;
  transition: color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.mb-toc a:hover { color: var(--fg); box-shadow: inset 2px 0 0 var(--fg); }

.docs-pager {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 560px) { .docs-pager { grid-template-columns: 1fr; } }
.docs-pager a {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  text-decoration: none;
  transition: border-color 0.15s var(--ease);
}
.docs-pager a:hover { border-color: var(--fg-2); }
.docs-pager a.next { text-align: right; }

.mb-prose h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.85rem; margin: 28px 0 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.mb-prose h2:first-child { margin-top: 0; }
.mb-prose h3 { font-size: 15px; margin: 20px 0 8px; color: var(--fg); font-weight: 600; }
.mb-prose p, .mb-prose li { color: var(--fg-1); line-height: 1.65; }
.mb-prose pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; font-size: 12.5px; }

/* Post Builder optional metadata + /how/ Live Pipeline Simulator */
.mb-opt-meta { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; }
.mb-opt-meta summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-1);
  list-style: none;
}
.mb-opt-meta summary::-webkit-details-marker { display: none; }
.mb-opt-meta summary:hover { color: var(--fg); }

.mb-sim-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 20px;
  align-items: start;
}
.mb-sim-grid > * { min-width: 0; }
@media (max-width: 920px) { .mb-sim-grid { grid-template-columns: 1fr; } }
.mb-sim-textarea {
  width: 100%;
  min-height: 92px;
  height: auto;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}
.mb-sim-checks {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: var(--fg-1);
}
.mb-sim-checks input { accent-color: var(--fg); width: 15px; height: 15px; }
.mb-sim-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mb-sim-step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  transition: border-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.mb-sim-num {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
}
.mb-sim-step[data-state="running"] { border-color: var(--fg); }
.mb-sim-step[data-state="running"] .mb-sim-num { color: var(--fg); border-color: var(--fg); }
.mb-sim-step[data-state="done"] { border-color: color-mix(in oklab, var(--up) 45%, var(--line)); }
.mb-sim-step[data-state="done"] .mb-sim-num { background: var(--up); border-color: var(--up); color: #050505; }
.mb-sim-step[data-state="done"] [data-stage-badge] { border-color: color-mix(in oklab, var(--up) 45%, transparent); color: var(--up); }
.mb-sim-step[data-state="error"] { border-color: color-mix(in oklab, var(--down) 55%, var(--line)); }
.mb-sim-step[data-state="error"] .mb-sim-num { background: var(--down); border-color: var(--down); color: #050505; }
.mb-sim-step[data-state="error"] [data-stage-badge] { border-color: color-mix(in oklab, var(--down) 55%, transparent); color: var(--down); }
.mb-sim-reply .mb-post-box { white-space: pre-wrap; word-break: break-word; }

/* Footer (classical viaduct valley horizon fade matching montramarkets.xyz) */
.mb-footer {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: clamp(32px, 5vw, 52px) 0 calc(28px + env(safe-area-inset-bottom));
}
.mb-footer-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.mb-footer-bg {
  position: absolute;
  inset: 0;
  background-image: var(--footer-art);
  background-size: cover;
  background-position: 50% 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.03) 10%, rgba(0, 0, 0, 0.12) 22%, rgba(0, 0, 0, 0.32) 36%, rgba(0, 0, 0, 0.62) 52%, rgba(0, 0, 0, 0.88) 68%, #000 80%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.03) 10%, rgba(0, 0, 0, 0.12) 22%, rgba(0, 0, 0, 0.32) 36%, rgba(0, 0, 0, 0.62) 52%, rgba(0, 0, 0, 0.88) 68%, #000 80%);
}
.mb-footer-scrim {
  position: absolute;
  inset: 0;
  background: var(--footer-scrim);
}
.mb-footer > .o-page {
  position: relative;
  z-index: 1;
}
:root:not([data-theme="light"]) .mb-footer > .o-page {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
}
.mb-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: 28px;
}
@media (max-width: 780px) { .mb-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .mb-footer-grid { grid-template-columns: 1fr; } }
.mb-footer-col h3 { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-2); margin: 0 0 10px; }
.mb-footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.mb-footer-col a { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; color: var(--fg-1); text-decoration: none; }
.mb-footer-col a .ico { width: 13px; height: 13px; }
.mb-footer-col a:hover { color: var(--fg); text-decoration: underline; }
.mb-footer-bottom {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in oklab, var(--fg) 15%, transparent);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--fg-2);
}

/* Toast */
.mb-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--fg);
  box-shadow: var(--pop-shadow);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.mb-toast.show { opacity: 1; transform: translateY(0); }

/* Shield disclosure */
.mb-shield summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-weight: 500;
}
.mb-shield.empty summary { color: var(--fg-2); }
.mb-banner {
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--up);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: 12px 14px;
  font-size: 13.5px;
}
.mb-banner.warn { border-left-color: var(--warn); }

/* ---------------- R04 Raster Lock Boot (logo only) ----------------
   The mark arrives as seven mis-registered signal bands that snap into
   alignment, the visor and beacon fire, then the mark punches through to the page.
   Invisible skip: any tap, click or key during the intro (wired in theme-init.js). */
.mb-boot { display: none; }
html.mb-booting .mb-boot {
  --logo: clamp(92px, 26vmin, 188px);
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background-color: var(--bg);
  background-image: repeating-linear-gradient(180deg, var(--etch) 0 1px, transparent 1px 4px);
  color: var(--fg);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  animation: mb-boot-out 0.30s ease-in 1.16s forwards;
}
html.mb-booting.mb-boot-skip .mb-boot {
  pointer-events: none;
  animation: mb-boot-out 0.16s ease-out forwards;
}
.mb-boot-sym { position: absolute; width: 0; height: 0; overflow: hidden; }
.mb-boot-logo {
  position: relative;
  width: var(--logo);
  height: var(--logo);
  animation: mb-logo-punch 0.34s cubic-bezier(.55, 0, .8, .2) 1.12s forwards;
}
.mb-boot-logo svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.mb-boot-band {
  clip-path: inset(calc(var(--i) * 100% / 7) 0 calc((6 - var(--i)) * 100% / 7) 0);
  opacity: 0;
  will-change: transform, opacity;
  animation:
    mb-band-lock 0.46s cubic-bezier(.2, .9, .25, 1) var(--d) forwards,
    mb-band-hide 0.01s linear 0.74s forwards;
}
.mb-boot-band:nth-child(1) { --i: 0; --dx: -38%; --d: 0.06s; }
.mb-boot-band:nth-child(2) { --i: 1; --dx: 26%;  --d: 0.18s; }
.mb-boot-band:nth-child(3) { --i: 2; --dx: -18%; --d: 0.02s; }
.mb-boot-band:nth-child(4) { --i: 3; --dx: 44%;  --d: 0.24s; }
.mb-boot-band:nth-child(5) { --i: 4; --dx: -28%; --d: 0.12s; }
.mb-boot-band:nth-child(6) { --i: 5; --dx: 16%;  --d: 0.21s; }
.mb-boot-band:nth-child(7) { --i: 6; --dx: -34%; --d: 0.09s; }
/* Solid copy takes over at lock so fractional band edges never leave hairline seams. */
.mb-boot-whole {
  opacity: 0;
  animation: mb-whole-in 0.01s linear 0.72s forwards;
}
.mb-boot-visor {
  opacity: 0;
  animation: mb-visor-fire 0.40s ease-out 0.72s forwards;
}
.mb-boot-beacon {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  animation: mb-beacon-pop 0.30s cubic-bezier(.22, 1, .36, 1) 0.76s forwards;
}
.mb-boot-ring {
  position: absolute;
  top: 11.25%;
  left: 50%;
  width: 34%;
  aspect-ratio: 1;
  border: 1.5px solid var(--up);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
  pointer-events: none;
  animation: mb-ring-out 0.56s cubic-bezier(.18, .85, .32, 1) 0.80s forwards;
}

@keyframes mb-band-lock {
  0%   { opacity: 0; transform: translateX(var(--dx)); }
  30%  { opacity: 1; transform: translateX(calc(var(--dx) * -0.28)); }
  62%  { opacity: 1; transform: translateX(calc(var(--dx) * 0.1)); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes mb-band-hide { to { visibility: hidden; } }
@keyframes mb-whole-in { to { opacity: 1; } }
@keyframes mb-visor-fire {
  0%   { opacity: 0; }
  35%  { opacity: 1; }
  100% { opacity: 0.18; }
}
@keyframes mb-beacon-pop {
  0%   { transform: scale(0); }
  65%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
@keyframes mb-ring-out {
  0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); }
}
@keyframes mb-logo-punch {
  to { opacity: 0; transform: scale(1.9); }
}
@keyframes mb-boot-out {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  html.mb-booting .mb-boot { display: none !important; }
}
