/* omni documentation site.
   Direction: keycaps and teleprinter tape. Warm keyboard-plastic putty, charcoal legends,
   one signal-orange accent for casting. Navigation keys press down; transcripts and wire
   lines are perforated paper tape. Gabarito (display), Figtree (text), Red Hat Mono.

   Colour roles (shared with scripts/site/figures.py):
     --cast    a keystroke being cast, the omni CLI          --adb     Android (adb, the keyboard app)
     --relay   the relay hub and devices that dial in        --desk    desktops and the replay daemon
     --event   application events                            --ink / --mute  structure and context   */

@font-face { font-family: "Gabarito"; src: url("fonts/gabarito.woff2") format("woff2"); font-weight: 500 900; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree-italic.woff2") format("woff2"); font-weight: 400 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Red Hat Mono"; src: url("fonts/red-hat-mono.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --putty: #ece6d9;
  --putty-2: #e2dac9;
  --cap: #f8f5ee;
  --cap-edge: #c9bfab;
  --cap-shade: #b3a88f;
  --ink: #23201b;
  --ink-2: #4c463d;
  --ink-3: #5f574b;
  --rule: #d2c8b5;
  --tape: #fbf7e9;
  --tape-edge: #e5dcc2;
  --cast: #e8501c;
  --cast-ink: #b33a0f;
  --adb: #2e7d4f;
  --relay: #6b48b8;
  --desk: #2a64b0;
  --event: #b07d00;
  --mute: #8a8172;
  --code-bg: #26221d;
  --code-ink: #f1ead9;
  --display: "Gabarito", "Avenir Next", "Segoe UI", sans-serif;
  --body: "Figtree", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Red Hat Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 45rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; background: var(--putty); color: var(--ink); font: 400 1.06rem/1.62 var(--body); }
a { color: var(--cast-ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--cast); outline-offset: 2px; border-radius: 4px; }
strong, b { font-weight: 700; }
code, kbd, samp { font-family: var(--mono); font-size: 0.86em; }
code, kbd, samp, pre, svg.f .f-m { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
:not(pre) > code { background: var(--cap); border: 1px solid var(--rule); border-radius: 4px; padding: 0.02em 0.3em; overflow-wrap: anywhere; }
code.nb { white-space: nowrap; }
a > code { color: inherit; }
kbd {
  display: inline-block; min-width: 1.7em; padding: 0.05em 0.45em 0.12em; border-radius: 5px; text-align: center;
  background: var(--cap); border: 1px solid var(--cap-edge); box-shadow: 0 2px 0 var(--cap-shade); font-weight: 600; font-size: 0.8em;
}
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--cast); color: #fff; padding: 0.5rem 0.8rem; z-index: 10; font-weight: 700; }
.skip:focus { left: 0.5rem; }

/* ---------------------------------------------------------------- masthead: a row of keys */
.deck { border-bottom: 1px solid var(--rule); background: linear-gradient(var(--putty-2), var(--putty)); }
.deck-in { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; max-width: 76rem; margin: 0 auto; padding: 1rem 2rem 1.1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; }
.brand b {
  display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 9px; background: var(--cast); color: #fff;
  font: 800 1.25rem/1 var(--display); box-shadow: 0 4px 0 var(--cast-ink); transform: translateY(-2px);
}
.brand span { font: 800 1.6rem/1 var(--display); letter-spacing: -0.01em; }
.brand small { font: 500 0.75rem/1 var(--mono); color: var(--ink-3); }
.keys { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }
.keys a {
  display: inline-block; padding: 0.42rem 0.8rem 0.38rem; border-radius: 8px; color: var(--ink); text-decoration: none;
  background: var(--cap); border: 1px solid var(--cap-edge); box-shadow: 0 3px 0 var(--cap-shade);
  font: 700 0.92rem/1.1 var(--display); transition: transform 60ms, box-shadow 60ms;
}
.keys a:hover { transform: translateY(1px); box-shadow: 0 2px 0 var(--cap-shade); }
.keys a[aria-current="page"] { transform: translateY(3px); box-shadow: 0 0 0 var(--cap-shade); background: var(--ink); color: var(--cap); border-color: var(--ink); }

/* ---------------------------------------------------------------- layout */
.page { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 3rem; max-width: 76rem; margin: 0 auto; padding: 0 2rem; }
.rail { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 2.8rem 0 2rem; scrollbar-width: thin; }
.rail p { margin: 0 0 0.7rem; font: 700 0.74rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.rail ol { list-style: none; padding: 0; margin: 0; counter-reset: k; }
.rail li { counter-increment: k; margin: 0 0 0.35rem; }
.rail a { display: grid; grid-template-columns: 1.7rem minmax(0, 1fr); gap: 0.55rem; align-items: baseline; color: var(--ink-2); text-decoration: none; font-size: 0.92rem; line-height: 1.35; }
.rail a::before {
  content: counter(k); display: inline-grid; place-items: center; height: 1.55rem; border-radius: 5px; font: 700 0.78rem/1 var(--mono);
  background: var(--cap); border: 1px solid var(--cap-edge); box-shadow: 0 2px 0 var(--cap-shade); color: var(--ink);
}
.rail a:hover, .rail a.on { color: var(--ink); }
.rail a.on::before { background: var(--cast); color: #fff; border-color: var(--cast-ink); box-shadow: 0 2px 0 var(--cast-ink); }
main { min-width: 0; padding: 2.6rem 0 5rem; }
main > * { max-width: var(--measure); }
main > figure.fig, main > .wide { max-width: 58rem; }

/* ---------------------------------------------------------------- type */
h1, h2, h3 { font-family: var(--display); color: var(--ink); }
h1 { font-weight: 800; font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1; letter-spacing: -0.02em; margin: 0.3rem 0 1.1rem; text-wrap: balance; }
.kicker { margin: 0; font: 600 0.82rem/1 var(--mono); color: var(--cast-ink); letter-spacing: 0.02em; }
.kicker::before { content: "omni › "; color: var(--ink-3); }
h2 { display: flex; align-items: center; gap: 0.75rem; font-weight: 800; font-size: 1.85rem; line-height: 1.1; letter-spacing: -0.01em; margin: 3.8rem 0 1rem; }
h2::before {
  content: ""; flex: none; width: 1.05rem; height: 1.05rem; border-radius: 4px; background: var(--cast);
  box-shadow: 0 3px 0 var(--cast-ink); transform: translateY(-2px);
}
h3 { font-weight: 700; font-size: 1.22rem; margin: 2.2rem 0 0.5rem; }
p, ul, ol, dl { margin: 0 0 1.05rem; }
ul, ol { padding-left: 1.3rem; }
li { margin: 0.25rem 0; }
li::marker { color: var(--ink-3); }
.lede { font-size: 1.27rem; line-height: 1.5; color: var(--ink-2); margin-bottom: 1.7rem; }
.lede strong { color: var(--ink); }
dl.defs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.45rem 1.4rem; }
dl.defs dt { font-weight: 700; }
dl.defs dd { margin: 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- tape (transcripts) */
pre {
  position: relative; margin: 1.2rem 0 1.5rem; padding: 0.95rem 1.1rem 0.95rem 2.4rem; overflow-x: auto;
  background-color: var(--tape); color: var(--ink); border: 1px solid var(--tape-edge); border-radius: 3px;
  background-image: radial-gradient(circle at 0.95rem 50%, var(--putty) 0.26rem, transparent 0.3rem);
  background-size: 1.9rem 0.9rem; background-repeat: repeat-y; background-position: 0 0.45rem;
  font: 400 0.85rem/1.62 var(--mono); scrollbar-width: thin; tab-size: 2;
}
pre::before { content: ""; position: absolute; left: 1.9rem; top: 0; bottom: 0; border-left: 1px dashed var(--tape-edge); }
pre code { font: inherit; background: none; border: 0; padding: 0; color: inherit; white-space: pre-wrap; overflow-wrap: break-word; }
pre .ln { display: block; padding-left: 2ch; text-indent: -2ch; }
pre .p { color: var(--ink); font-weight: 600; }
pre .p::before { content: "$ "; color: var(--cast); font-weight: 700; }
pre .o { color: var(--ink-2); }
pre .c { color: var(--ink-3); font-style: italic; }
pre .k { color: var(--desk); }
pre .s { color: var(--adb); }
pre .y { color: var(--cast-ink); font-weight: 600; }
pre .w { color: var(--relay); }
pre var { font-style: italic; color: var(--cast-ink); }
pre.dark { background: var(--code-bg); background-image: none; color: var(--code-ink); border-color: var(--code-bg); padding-left: 1.1rem; }
pre.dark::before { display: none; }
pre.dark .c { color: #a49a86; }
pre.dark .k { color: #9cc3ff; }
pre.dark .s { color: #9fd9a8; }
pre.dark var { color: #ffb08f; }
pre[data-label] { padding-top: 2rem; }
pre[data-label]::after {
  content: attr(data-label); position: absolute; top: 0.55rem; left: 2.4rem; font: 700 0.7rem/1 var(--mono);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}
pre.dark[data-label]::after { left: 1.1rem; color: #b8ad97; }
pre[data-scroll-more], .table[data-scroll-more], .fig-scroll[data-scroll-more] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 3rem), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 3rem), transparent); }

/* ---------------------------------------------------------------- tables, notes, steps */
.table { overflow-x: auto; margin: 1.2rem 0 1.6rem; scrollbar-width: thin; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; line-height: 1.45; }
th { text-align: left; font: 700 0.74rem/1.2 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2); padding: 0.55rem 0.8rem 0.45rem 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
td { padding: 0.58rem 0.8rem 0.58rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
td:first-child { font-weight: 600; }
td code { white-space: nowrap; }
td.wrap code { white-space: normal; }
td.wrap code.nb { white-space: nowrap; }
th code { background: none; border: 0; padding: 0; font: inherit; text-transform: none; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: 0; }
.note, .warn { margin: 1.6rem 0; padding: 0.9rem 1.1rem; background: var(--cap); border: 1px solid var(--cap-edge); border-radius: 10px; box-shadow: 0 3px 0 var(--cap-shade); }
.warn { border-color: var(--cast); box-shadow: 0 3px 0 var(--cast-ink); }
.note > :last-child, .warn > :last-child { margin-bottom: 0; }
.note b:first-child, .warn b:first-child { font: 800 0.78rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; margin-right: 0.5rem; color: var(--ink-3); }
.warn b:first-child { color: var(--cast-ink); }
ol.steps { list-style: none; counter-reset: st; padding: 0; margin: 1.5rem 0 2rem; }
ol.steps > li { counter-increment: st; position: relative; padding: 0 0 1rem 3rem; margin: 0; }
ol.steps > li::before {
  content: counter(st); position: absolute; left: 0; top: 0.05rem; width: 2rem; height: 2rem; border-radius: 7px; display: grid; place-items: center;
  background: var(--cap); border: 1px solid var(--cap-edge); box-shadow: 0 3px 0 var(--cap-shade); font: 800 1rem/1 var(--display);
}
ol.steps > li > h3 { margin: 0.2rem 0 0.35rem; font-size: 1.08rem; }

/* ---------------------------------------------------------------- figures */
figure.fig { margin: 2rem 0 2.4rem; }
.fig-scroll { overflow-x: auto; background: var(--cap); border: 1px solid var(--cap-edge); border-radius: 12px; box-shadow: 0 4px 0 var(--cap-shade); padding: 1.2rem; scrollbar-width: thin; }
.fig-scroll svg { display: block; width: 100%; height: auto; min-width: 620px; }
figcaption { margin-top: 0.9rem; font-size: 0.93rem; line-height: 1.5; color: var(--ink-2); max-width: var(--measure); }
figcaption b { color: var(--ink); margin-right: 0.35rem; }
figure:has(.fig-scroll[data-scroll-more]) figcaption::before { content: "Scroll sideways · "; font-weight: 700; color: var(--ink); }
.only-narrow { display: none; }

svg.f { font-family: var(--body); }
svg.f .f-t { font: 700 14.5px var(--body); fill: var(--ink); }
svg.f .f-d { font: 800 16px var(--display); fill: var(--ink); }
svg.f .f-s { font: 400 13px var(--body); fill: var(--ink-2); }
svg.f .f-xs { font: 600 11.5px var(--body); fill: var(--ink-3); }
svg.f .f-m { font: 400 12px var(--mono); fill: var(--ink); }
svg.f .f-w { fill: #fff; }
svg.f .key { fill: var(--cap); stroke: var(--cap-edge); stroke-width: 1.2; }
svg.f .key-shade { fill: var(--cap-shade); }
svg.f .tape { fill: var(--tape); stroke: var(--tape-edge); stroke-width: 1.2; }
svg.f .hole { fill: var(--putty); }
svg.f .wire { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
svg.f .dash { stroke-dasharray: 6 5; }
svg.f .labbg { fill: var(--cap); }
svg.f .s-cast { stroke: var(--cast); } svg.f .t-cast { fill: var(--cast-ink); } svg.f .m-cast { fill: var(--cast); } svg.f .b-cast { fill: #fde4d8; stroke: var(--cast); stroke-width: 1.5; }
svg.f .s-adb { stroke: var(--adb); } svg.f .t-adb { fill: var(--adb); } svg.f .m-adb { fill: var(--adb); } svg.f .b-adb { fill: #e1f0e6; stroke: var(--adb); stroke-width: 1.5; }
svg.f .s-relay { stroke: var(--relay); } svg.f .t-relay { fill: var(--relay); } svg.f .m-relay { fill: var(--relay); } svg.f .b-relay { fill: #ece5f8; stroke: var(--relay); stroke-width: 1.5; }
svg.f .s-desk { stroke: var(--desk); } svg.f .t-desk { fill: var(--desk); } svg.f .m-desk { fill: var(--desk); } svg.f .b-desk { fill: #e2ecf8; stroke: var(--desk); stroke-width: 1.5; }
svg.f .s-event { stroke: var(--event); } svg.f .t-event { fill: #8a6100; } svg.f .m-event { fill: var(--event); } svg.f .b-event { fill: #fbf0d0; stroke: var(--event); stroke-width: 1.5; }
svg.f .s-ink { stroke: var(--ink); } svg.f .t-ink { fill: var(--ink); } svg.f .m-ink { fill: var(--ink); } svg.f .b-ink { fill: var(--ink); stroke: var(--ink); }
svg.f .s-mute { stroke: var(--mute); } svg.f .t-mute { fill: var(--ink-3); } svg.f .m-mute { fill: var(--mute); } svg.f .b-mute { fill: var(--putty-2); stroke: var(--mute); stroke-width: 1.3; }
svg.f .b-plain { fill: var(--cap); stroke: var(--ink); stroke-width: 1.3; }

/* ---------------------------------------------------------------- home */
.hero-h1 { font-size: clamp(2.8rem, 6.4vw, 5.2rem); max-width: 13ch; }
.casts { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 1.4rem 0 0.4rem; padding: 0; list-style: none; }
.casts li { margin: 0; }
.casts kbd { font-size: 0.95rem; padding: 0.3em 0.7em 0.36em; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; margin: 2rem 0 1rem; max-width: 58rem; }
.facts p { margin: 0; padding: 0.9rem 1rem; background: var(--cap); border: 1px solid var(--cap-edge); border-radius: 12px; box-shadow: 0 4px 0 var(--cap-shade); }
.facts b { display: block; font: 800 2.3rem/1 var(--display); letter-spacing: -0.02em; }
.facts span { display: block; margin-top: 0.35rem; font-size: 0.88rem; line-height: 1.35; color: var(--ink-2); }
.routes { list-style: none; padding: 0; margin: 1.4rem 0 2rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; max-width: 58rem; }
.routes li { margin: 0; }
.routes a { display: block; height: 100%; padding: 0.9rem 1rem; color: var(--ink); text-decoration: none; background: var(--cap); border: 1px solid var(--cap-edge); border-radius: 12px; box-shadow: 0 4px 0 var(--cap-shade); transition: transform 60ms, box-shadow 60ms; }
.routes a:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--cap-shade); }
.routes b { display: block; font: 800 1.15rem/1.2 var(--display); }
.routes span { display: block; margin-top: 0.25rem; color: var(--ink-2); font-size: 0.95rem; line-height: 1.45; }

/* ---------------------------------------------------------------- footer */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; max-width: 76rem; margin: 0 auto; padding: 1.4rem 2rem 2.2rem; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 0.86rem; }
.foot a { color: var(--ink-2); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .page { display: block; padding: 0 1.25rem; }
  .rail { display: none; }
  .deck-in { padding: 0.9rem 1.25rem; gap: 0.9rem; }
  .keys { margin-left: 0; gap: 0.4rem; }
  .keys a { padding: 0.36rem 0.62rem 0.32rem; font-size: 0.86rem; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding-top: 1.8rem; }
}
@media (max-width: 600px) {
  body { font-size: 1rem; }
  h2 { font-size: 1.55rem; margin-top: 3rem; }
  .lede { font-size: 1.13rem; }
  pre { margin-left: -1.25rem; margin-right: -1.25rem; border-radius: 0; border-left: 0; border-right: 0; font-size: 0.8rem; }
  .fig-scroll { margin: 0 -1.25rem; border-radius: 0; padding: 0.8rem; }
  .routes { grid-template-columns: minmax(0, 1fr); }
  dl.defs { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  dl.defs dd { margin-bottom: 0.9rem; }
  .only-wide { display: none; }
  .only-narrow { display: block; }
  .only-narrow svg { min-width: 0; }
  .table table:has(th:nth-child(3)) { min-width: 34rem; }
  td code, td code.nb { white-space: normal; overflow-wrap: anywhere; }
  .foot { flex-direction: column; padding: 1.2rem 1.25rem 1.6rem; }
}
@media print {
  .deck, .rail, .skip, .foot { display: none !important; }
  .page { display: block; padding: 0; }
  body { background: #fff; font-size: 10.5pt; }
  main { padding: 0; }
  pre { background: #fff !important; background-image: none !important; border: 1px solid #999; padding-left: 1rem; -webkit-mask-image: none !important; mask-image: none !important; }
  pre::before { display: none; }
  pre * { color: #000 !important; }
  .fig-scroll { box-shadow: none; overflow: visible; }
  .fig-scroll svg { min-width: 0; }
  figure, pre, table { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
