/* B1 viewer (figure #b1-3d, assets/b13d.js). Self-contained: the .m3-* rules copied from guides.css come first, so pages
   without guides.css (e.g. /thiamine/) can use it; the B1-only parts follow. */
.m3 { --m: #A78BFA; --b: #FF5C7A; margin: 22px 0 34px; padding: 16px 16px 14px; border: 1px solid var(--x-line); border-radius: 20px;
  background: linear-gradient(180deg, #0A110E 0%, #050505 60%); box-shadow: 0 0 0 1px rgba(110, 231, 183, .04), 0 30px 80px -40px rgba(45, 212, 191, .25); }
.m3-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin: 0 2px 12px; }
.m3-kick { display: block; font-family: "Geist Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #6EE7B7; }
.x-body .m3-title { margin: 4px 0 0; font-family: var(--font-display); font-size: 24px; line-height: 1.15; color: #F3F1EA; }
.x-body .m3-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 12.5px; color: #8E9A94; }
.m3-stats b { color: #F3F1EA; font-weight: 600; margin-right: 3px; }

/* rail: 4 molecules on row 1, the 3 enzymes between them on row 2 */
.m3-rail { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin: 0 0 10px; }
.m3-mol { grid-row: 1; display: grid; justify-items: center; gap: 1px; min-width: 0; padding: 7px 4px 6px; border-radius: 12px; cursor: pointer;
  font: inherit; color: #E9E6DD; background: color-mix(in srgb, var(--c) 9%, #070707); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  transition: background .15s, box-shadow .15s, transform .15s; }
.m3-mol b { font-family: var(--font-display); font-size: 16px; font-weight: 600; line-height: 1.15; color: var(--c); white-space: nowrap; }
.m3-mol small { font-family: "Geist Mono", ui-monospace, monospace; font-size: 10.5px; line-height: 1.3; color: #8E9A94; white-space: nowrap; }
.m3-short { display: none; }
.m3-mol:hover { background: color-mix(in srgb, var(--c) 18%, #070707); }
.m3-mol.is-past { border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.m3-mol[aria-pressed="true"] { background: var(--c); border-color: var(--c); box-shadow: 0 0 22px -4px var(--c); transform: translateY(-1px); }
.m3-mol[aria-pressed="true"] b, .m3-mol[aria-pressed="true"] small { color: #07100C; }
.m3-enz { grid-row: 2; justify-self: center; display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; padding: 4px 11px; border-radius: 999px;
  cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .03em; color: #CFCBC1; background: #0D1210; border: 1px dashed #3A4540;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.m3-enz span { color: #6E7872; font-weight: 600; }
.m3-enz i { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--b); color: #fff; font-size: 10px; font-style: normal; font-weight: 800; }
.m3-enz:hover { border-color: var(--c); color: #F3F1EA; }
.m3-enz.is-past { border-style: solid; border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.m3-enz.is-on { border-style: solid; border-color: var(--c); color: #07100C; background: var(--c); }
.m3-enz.is-on span { color: #07100C; }
.m3-mol:focus-visible, .m3-enz:focus-visible { outline: 2px solid #6EE7B7; outline-offset: 2px; }

.m3-stage { position: relative; aspect-ratio: 16 / 10.5; border-radius: 14px; overflow: hidden; background: #030605;
  border: 1px solid #16211C; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.m3-stage:focus-visible { box-shadow: 0 0 0 3px rgba(110, 231, 183, .45); }
.m3-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.m3-bar { position: absolute; left: 10px; right: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; pointer-events: none; }
.m3-bar > div { pointer-events: auto; }
.m3-bar--top { top: 10px; }
.m3-bar--bottom { bottom: 10px; align-items: center; }
.x-body .m3-name { display: grid; gap: 1px; margin: 0; padding: 6px 11px 7px; border-radius: 12px; min-width: 0; background: rgba(8, 14, 11, .72);
  border: 1px solid rgba(255, 255, 255, .1); border-left: 3px solid var(--m); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.m3-name b { font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.15; color: #F3F1EA; }
.m3-f { font-family: "Geist Mono", ui-monospace, monospace; font-size: 10.5px; line-height: 1.3; color: #8E9A94; }
.m3-made { font-size: 11.5px; font-weight: 600; line-height: 1.3; color: var(--m); }
.m3-made.has-b::after { content: "B"; display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 5px; border-radius: 50%;
  background: var(--b); color: #fff; font-size: 9.5px; font-weight: 800; vertical-align: 1px; }
.m3-stage button { font: inherit; color: #E9E6DD; background: rgba(8, 14, 11, .72); border: 1px solid rgba(255, 255, 255, .12); cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .15s, border-color .15s, color .15s; }
.m3-stage button:hover { border-color: rgba(110, 231, 183, .55); }
.m3-stage button:focus-visible { outline: 2px solid #6EE7B7; outline-offset: 2px; }
.m3-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.m3-stage .m3-ic { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.m3-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m3-ic--h { font-weight: 700; font-size: 14px; }
.m3-stage .m3-ic[aria-pressed="false"] { color: #66706B; border-style: dashed; }
.m3-stage .m3-ic[aria-pressed="true"] { border-color: rgba(110, 231, 183, .45); color: #CFFBE6; }
.x-body .m3-hint { margin: 0; padding: 5px 10px; border-radius: 999px; background: rgba(8, 14, 11, .6); font-size: 11.5px; line-height: 1.3; color: #8E9A94; pointer-events: none; }
.m3-zoom { display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); }
.m3-stage .m3-zoom button { border: 0; border-radius: 0; min-width: 36px; height: 34px; padding: 0 10px; font-size: 18px; line-height: 1; }
.m3-stage .m3-zoom button[data-act="reset"] { font-size: 12px; font-weight: 600; border-left: 1px solid rgba(255, 255, 255, .1); border-right: 1px solid rgba(255, 255, 255, .1); }
.m3-tip { position: absolute; left: 0; top: 0; z-index: 2; display: grid; gap: 1px; max-width: 240px; padding: 7px 11px; border-radius: 10px;
  background: rgba(5, 9, 7, .92); border: 1px solid rgba(255, 255, 255, .14); font-size: 12px; line-height: 1.35; color: #CFCBC1; pointer-events: none; }
.m3-tip[hidden] { display: none; }
.m3-tip b { font-size: 13px; }
.m3-tip__new { font-weight: 600; }
.m3-nojs { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #8E9A94; }
.m3:not(.is-live) .m3-bar, .m3:not(.is-live) .m3-rail, .m3:not(.is-live) .m3-nav, .m3:not(.is-live) .m3-legend { display: none; }

.m3-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 2px 0; font-size: 11.5px; font-weight: 600; color: #9DA8A2; }
.m3-legend span { display: inline-flex; align-items: center; gap: 6px; }
.m3-el::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--c) 45%, #000 120%); }
.m3-gl::before { content: ""; width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle, var(--m) 0 30%, color-mix(in srgb, var(--m) 30%, transparent) 55%, transparent 72%); }
.m3-ring::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1.5px dashed #CFCBC1; }

.m3-info { margin-top: 10px; }
.m3.is-live .m3-card:not(.is-on) { display: none; }
.m3-card { --c: #6EE7B7; margin-top: 10px; padding: 14px 16px 12px; border-radius: 14px; background: #0A0D0B; border: 1px solid #1B2420; border-left: 3px solid var(--c); }
.m3.is-live .m3-card { margin-top: 0; animation: m3in .28s ease-out; }
@keyframes m3in { from { opacity: 0; transform: translateY(4px); } }
.m3-card__top { display: flex; align-items: center; gap: 12px; }
.m3-card__big { display: grid; place-items: center; flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; background: var(--c);
  font-family: var(--font-display); font-size: 26px; font-weight: 600; color: #07100C; box-shadow: 0 0 26px -6px var(--c); }
.x-body .m3-card__kick { margin: 0 0 2px; font-family: "Geist Mono", ui-monospace, monospace; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.x-body .m3-card h4 { margin: 0; font-family: var(--font-display); font-size: 21px; line-height: 1.2; color: #F3F1EA; }
.m3-card h4 span { font-family: "Geist Mono", ui-monospace, monospace; font-size: 12.5px; font-weight: 500; color: #8E9A94; }
.x-body .m3-card__about { margin: 10px 0; font-size: 14.5px; line-height: 1.55; color: #CFCBC1; }
.m3-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 0 0 12px; }
.m3-facts div { min-width: 0; }
.m3-facts dt { font-family: "Geist Mono", ui-monospace, monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #6E7872; }
.m3-facts dd { margin: 1px 0 0; font-size: 13.5px; line-height: 1.4; color: #E9E6DD; overflow-wrap: anywhere; }
.m3-facts .is-b dt, .m3-facts .is-b dd { color: var(--b); font-weight: 600; }
.x-body .m3-bbox { margin: 0 0 4px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; color: #F1D9DE;
  background: color-mix(in srgb, var(--b) 10%, #0A0D0B); border: 1px solid color-mix(in srgb, var(--b) 40%, transparent); }
.m3-bbox b { color: var(--b); }
.m3-nav { display: flex; gap: 6px; margin-top: 10px; }
.m3-btn { --c: var(--m); flex: 1 1 0; min-width: 0; min-height: 36px; padding: 6px 10px; border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 600;
  color: #E9E6DD; background: #111614; border: 1px solid #26302B; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m3-btn:hover:not(:disabled) { border-color: var(--c); }
.m3-btn:disabled { opacity: .35; cursor: default; }
.m3-btn--tour { background: color-mix(in srgb, var(--c) 16%, #0A0D0B); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.m3 figcaption { margin: 12px 2px 0; font-size: 12.5px; line-height: 1.5; color: #7E8883; }

.m3.is-full { display: flex; flex-direction: column; margin: 0; padding: 14px; border-radius: 0; overflow-y: auto; background: #030605; }
.m3.is-full .m3-stage { aspect-ratio: auto; flex: 1 0 60vh; }
.m3.is-full figcaption { display: none; }

@media (max-width: 560px) {
  .m3 { margin-left: -6px; margin-right: -6px; padding: 12px 10px; border-radius: 16px; }
  .m3-stage { aspect-ratio: 1 / 1.08; }
  .x-body .m3-title { font-size: 21px; }
  .x-body .m3-stats { gap: 2px 10px; font-size: 11.5px; }
  .m3-rail { gap: 5px 4px; }
  .m3-long { display: none; }
  .m3-short { display: inline; }
  .m3-mol b { font-size: 14.5px; }
  .m3-mol small { font-size: 9.5px; }
  .m3-enz { padding: 3px 8px; font-size: 11px; gap: 4px; }
  .m3-stage .m3-ic { width: 32px; height: 32px; }
  .m3-tools { gap: 5px; }
  .x-body .m3-hint { display: none; }
  .m3-bar--bottom { justify-content: flex-end; }
  .m3-name b { font-size: 15.5px; }
  .m3-facts { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 380px) { .m3-stage .m3-ic[data-act="full"] { display: none; } .m3-mol small { display: none; } .m3-enz span { display: none; } }
@media (prefers-reduced-motion: reduce) { .m3.is-live .m3-card { animation: none; } .m3-mol, .m3-enz { transition: none; } }

/* ---- B1 only ---- */
.m3.b1 { --m: #FFC24B; }
.b1 .m3-rail { grid-template-columns: repeat(8, minmax(0, 1fr)); }
/* stage 30% shorter than the guides.css default (16/10.5 desktop, 1/1.08 mobile) */
.b1 .m3-stage { aspect-ratio: 16 / 7.35; }

/* Parts / Atoms switch (bottom-left of the stage, like the BPC-157 model) */
.b1-mode { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(8, 14, 11, .72); border: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.m3-stage .b1-mode button { border: 0; border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; color: #9DA8A2; background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none; }
.m3-stage .b1-mode button[aria-pressed="true"] { background: #F3F1EA; color: #07100C; }
.m3-stage .m3-ic--360 { width: auto; min-width: 34px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }

/* the parts strip under the stage (like the BPC-157 amino-acid chain) */
.b1-parts { display: flex; align-items: stretch; gap: 0; margin: 10px 0 0; overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 6px; }
.b1-part { flex: 1 0 auto; display: grid; justify-items: center; gap: 1px; min-width: 76px; padding: 8px 10px 7px; border-radius: 12px; cursor: pointer;
  font: inherit; color: #E9E6DD; background: color-mix(in srgb, var(--c) 9%, #070707); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  transition: background .15s, box-shadow .15s, transform .15s, opacity .15s; }
.b1-part b { font-family: var(--font-display); font-size: 15px; font-weight: 600; line-height: 1.15; color: var(--c); white-space: nowrap; }
.b1-part small { font-family: "Geist Mono", ui-monospace, monospace; font-size: 10px; line-height: 1.3; color: #8E9A94; white-space: nowrap; }
.b1-part:hover { background: color-mix(in srgb, var(--c) 18%, #070707); }
.b1-part[aria-pressed="true"] { background: var(--c); border-color: var(--c); box-shadow: 0 0 22px -4px var(--c); transform: translateY(-1px); }
.b1-part[aria-pressed="true"] b, .b1-part[aria-pressed="true"] small { color: #07100C; }
.b1-part.is-off { opacity: .38; border-style: dashed; }
.b1-part:focus-visible { outline: 2px solid #6EE7B7; outline-offset: 2px; }
.b1-link { flex: 0 0 14px; align-self: center; height: 2px; background: #3A4540; }
.b1-link.is-off { background: repeating-linear-gradient(90deg, #3A4540 0 3px, transparent 3px 6px); opacity: .5; }
.x-body .b1-hint { margin: 6px 2px 0; font-size: 12px; color: #7E8883; }
.m3:not(.is-live) .b1-parts, .m3:not(.is-live) .b1-hint { display: none; }

@media (max-width: 560px) {
  .b1 .m3-stage { aspect-ratio: 1 / .756; }
  .b1-part { min-width: 64px; padding: 7px 7px 6px; }
  .b1-part b { font-size: 13.5px; }
  .b1-link { flex-basis: 8px; }
  .m3-stage .b1-mode button { padding: 6px 10px; font-size: 12px; }
}
