/* ubiomes.com shared design. Layout: sticky menu, one centered column, an axon running down the left of each page header, experiment panel, readable content, next-page link */
:root {
  --bg: #f3f9fd;
  --bg-2: #fff6ee;
  --card: #ffffff;
  --soft: #e1f1fb;
  --ink: #132e46;
  --muted: #587087;
  --line: #d3e4ef;
  --axon: #ef7aa0;        /* membrane pink */
  --myelin: #ffe2a8;      /* myelin, sunny */
  --myelin-edge: #f2c766;
  --spike: #2b9fe0;       /* signal, sky */
  --spike-glow: rgba(43,159,224,.45);
  --orange: #ff9b54;
  --lilac: #8f73c9;
  --sea: #3fb6a8;
  --accent: #1d72a6;
  --screen: #0b1d2e;      /* instrument screens, same in both themes */
  --f-display: "Unbounded", "Arial Black", Arial, sans-serif;
  --f-body: "Outfit", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "Fragment Mono", ui-monospace, Menlo, monospace;
  --axon-x: 2.5rem;
  --pad: 1.9rem;
}
@media (min-width: 760px) { :root { --axon-x: 6rem; --pad: 2.5rem; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1b2b; --bg-2: #131c30; --card: #11253a; --soft: #183552; --ink: #eef6fb; --muted: #9db3c5; --line: #22405b;
    --axon: #ff9bbb; --myelin: #5b4a2a; --myelin-edge: #b8923f; --spike: #8fd3f4; --spike-glow: rgba(143,211,244,.5);
    --orange: #ffad70; --lilac: #b79be8; --sea: #6fe0d0; --accent: #8fd3f4; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1b2b; --bg-2: #131c30; --card: #11253a; --soft: #183552; --ink: #eef6fb; --muted: #9db3c5; --line: #22405b;
  --axon: #ff9bbb; --myelin: #5b4a2a; --myelin-edge: #b8923f; --spike: #8fd3f4; --spike-glow: rgba(143,211,244,.5);
  --orange: #ffad70; --lilac: #b79be8; --sea: #6fe0d0; --accent: #8fd3f4; color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.08rem/1.65 var(--f-body); min-height: 100vh; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 41; background: var(--bg); }
main { flex: 1; }
a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: 68rem; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); position: relative; }
.mono { font: 400 .78rem/1.4 var(--f-mono); color: var(--muted); }

/* Menu */
.topnav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topnav .wrap { display: flex; align-items: center; gap: 1rem; padding-block: .65rem; }
.brand { font: 700 .95rem/1 var(--f-display); letter-spacing: -.01em; color: var(--ink); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .5rem; }
.brand i { width: .7rem; height: .7rem; border-radius: 50%; background: var(--axon); }
.brand img { width: 1.75rem; height: 1.75rem; display: block; }
.topnav nav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.topnav nav a { flex: none; font: 500 .92rem/1 var(--f-body); color: var(--muted); text-decoration: none; padding: .5rem .72rem; border-radius: 999px; }
.topnav nav a:hover { color: var(--ink); }
.topnav nav a[aria-current="page"], .topnav nav a.on { color: var(--ink); background: color-mix(in srgb, var(--spike) 18%, transparent); }
.topnav nav a.cta { color: var(--bg); background: var(--ink); }
@media (max-width: 700px) { .brand span { display: none; } .topnav nav { margin-left: 0; } }

/* Inner page header: a short stretch of axon with this page's node */
.page-head { padding-block: 3rem 1.5rem; }
.page-head .wrap { padding-left: calc(max(16px, env(safe-area-inset-left, 0px)) + var(--axon-x) + var(--pad)); }
.page-head .wrap::before { content: ""; position: absolute; left: calc(max(16px, env(safe-area-inset-left, 0px)) + var(--axon-x) - 3px); top: -3rem; bottom: -1.5rem; width: 6px; border-radius: 3px; background: var(--axon); }
.page-head .node { position: absolute; left: calc(max(16px, env(safe-area-inset-left, 0px)) + var(--axon-x) - .85rem); top: .2rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--spike); border: 3px solid var(--spike); box-shadow: 0 0 0 10px var(--spike-glow); }
.page-head .kicker { margin-bottom: .6rem; }
.page-head h1 { font: 800 clamp(2.2rem, 6.5vw, 4.2rem)/1 var(--f-display); letter-spacing: -.03em; }
.page-head .lede { font-size: 1.15rem; color: var(--muted); max-width: 38em; margin-top: 1rem; }

/* Experiment panel */
.lab { padding-block: 1rem 3rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: clamp(12px, 2.4vw, 24px); display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 20px 50px rgba(19,46,70,.08); }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; }
.panel-title h2 { font: 700 1.1rem/1.2 var(--f-display); }
.controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn, .act { font: 500 .85rem/1 var(--f-mono); color: var(--ink); background: transparent; border: 1.5px solid var(--line); border-radius: 999px; padding: .6rem .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; }
.btn.dark, .act.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.act[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); }
.btn:hover, .act:hover { border-color: var(--ink); }
.big { font: 600 1rem/1 var(--f-body); padding: .9rem 1.3rem; }
.readouts { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font: 400 .8rem/1.4 var(--f-mono); color: var(--muted); }
.readouts b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
label.slider { font: 400 .8rem/1 var(--f-mono); color: var(--muted); display: inline-flex; align-items: center; gap: .55rem; }
label.slider input { width: 8rem; accent-color: var(--spike); }
.model { font-size: .93rem; color: var(--muted); border-left: 3px solid var(--myelin-edge); padding-left: .9rem; max-width: 60rem; }
.model b { color: var(--ink); }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--c); vertical-align: -.05em; }
.rod { display: inline-block; width: 1rem; height: .45rem; border-radius: .3rem; background: var(--c); vertical-align: .05em; }

/* Content */
.content { padding-block: 3rem 4rem; border-top: 1px solid var(--line); }
.content .wrap { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2.5rem; }
@media (max-width: 760px) { .content .wrap { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; } }
.content h2 { font: 700 clamp(1.5rem, 3.4vw, 2.1rem)/1.1 var(--f-display); letter-spacing: -.02em; }
.body { display: flex; flex-direction: column; gap: 1rem; max-width: 42rem; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 1rem; padding-block: .8rem; border-top: 1px solid var(--line); }
.timeline .when { font: 400 .8rem/1.7 var(--f-mono); color: var(--muted); }
.timeline strong { display: block; font-weight: 600; }
.timeline span { color: var(--muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .45rem .9rem; font-size: .95rem; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
@media (max-width: 640px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem 1.35rem; display: flex; flex-direction: column; gap: .4rem; scroll-margin-top: 5rem; transition: box-shadow .3s; }
.card h3 { font: 600 1.12rem/1.3 var(--f-body); }
.card p:not(.mono) { color: var(--muted); font-size: .98rem; }
.card .mono { color: var(--accent); }
.card.flash { box-shadow: 0 0 0 3px var(--spike); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
@media (max-width: 560px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.gallery canvas, .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; display: block; max-width: 100%; }
.gallery figcaption { font-size: .9rem; }

/* Next node */
.next { border-top: 1px solid var(--line); background: linear-gradient(180deg, var(--bg), var(--bg-2)); }
.next .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-block: 2.2rem; }
.next a.go { display: inline-flex; flex-direction: column; gap: .3rem; text-decoration: none; color: var(--ink); }
.next a.go b { font: 700 clamp(1.3rem, 3vw, 1.8rem)/1.1 var(--f-display); letter-spacing: -.02em; }
footer { padding-block: 1.4rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); }
footer .wrap { display: flex; gap: 1.2rem; flex-wrap: wrap; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); transform: translate(-50%, calc(100% + 40px)); visibility: hidden; z-index: 60; display: flex; align-items: center; gap: .9rem; background: var(--ink); color: var(--bg); border-radius: 999px; padding: .6rem .65rem .6rem 1.1rem; font: 500 .92rem/1.2 var(--f-body); box-shadow: 0 12px 30px rgba(0,0,0,.2); transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility .35s; max-width: calc(100vw - 32px); }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast a { flex: none; color: var(--ink); background: var(--bg); text-decoration: none; border-radius: 999px; padding: .45rem .8rem; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .toast, .card { transition: none; } }
