/* Universal Basic Compute. The system is read off Vadim's X avatar and banner: warm paper, one deep ink, one
   cyan-blue-violet gradient for everything that is live or yours, thin lavender wires, Lato set wide in capitals, a
   centred composition like the banner. Every surface (panel, buttons, sockets) is one of the Codex pieces in /img,
   worn as a nine-slice.

   Layout: one 1160 px column on a 12-track grid, the lockup and the power strip centred on top of every page,
   sections 120 px apart, every page opening with the same head (eyebrow, title, lede). */

@font-face { font-family: "Lato"; font-weight: 300; font-style: normal; font-display: swap; src: url("/fonts/lato-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/lato-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/lato-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 900; font-style: normal; font-display: swap; src: url("/fonts/lato-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/geist-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/geist-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --paper: #fdfcf8;
  --white: #ffffff;
  --ink: #273853;
  --ink-2: #4c5872;
  --ink-3: #7d869b;
  --wire: #d9d6f3;
  --rule: #e9e7f2;
  --blue: #3e6bfd;
  --violet: #a593fc;
  --grad: linear-gradient(115deg, #5acbfd 0%, #3e6bfd 52%, #a593fc 100%);
  --ok: #1f8a5b;
  --bad: #c83c3c;
  --sans: "Lato", "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --wrap: 1160px;
  --gap: 24px;
  --section: clamp(64px, 8vw, 104px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
  position: relative;
}
img { max-width: 100%; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--white); padding: 8px 14px; }
.skip:focus { left: 8px; }
.noscript { max-width: 640px; margin: 40px auto; }
[hidden] { display: none !important; }

/* ---------- the live grid (Today's first screen) ---------- */
.grid { position: absolute; top: 0; left: 0; width: 100%; height: 0; z-index: 0; pointer-events: none; }
.grid-slot { display: none; }
.top, main { position: relative; z-index: 1; }

/* ---------- top: his lockup, then the power strip, centred like his banner ---------- */
.top { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 24px; padding: 34px var(--gutter) 0; }
.lockup { display: inline-flex; align-items: center; gap: 16px; text-decoration: none; }
.lockup__plug { width: 34px; height: auto; }
.lockup__word { width: min(360px, 66vw); height: auto; }

.strip {
  display: flex;
  align-items: stretch;
  padding: 4px 4px 6px;
  /* the outset puts the white edge of the picture on the box edge; the soft shadow falls outside it */
  border-image: url("/img/panel.png") 60 70 80 70 fill / 26px 30px 34px 30px / 13px 16px 20px 17px stretch;
  max-width: 100%;
  min-width: 0;
}
.strip__sockets { list-style: none; margin: 0; padding: 0 4px; display: flex; gap: 2px; }
.strip__sockets a { display: grid; justify-items: center; gap: 4px; min-width: 84px; padding: 6px 8px 4px; color: var(--ink-2); text-decoration: none; border-radius: 12px; }
.strip__sockets a:hover { color: var(--ink); }
.strip__socket { width: 40px; height: 40px; display: block; }
.strip__label { font: 700 11px/1.2 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap; }
.strip__sockets a[aria-current="page"] .strip__label { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.strip__switch { display: flex; align-items: center; gap: 12px; padding-left: 18px; margin-left: 10px; border-left: 1px solid var(--rule); min-width: 196px; }
.strip__switch .who { font-size: 13px; line-height: 1.35; color: var(--ink-3); }
.strip__switch .who b { color: var(--ink); font-weight: 700; }
.strip__switch .who .left { color: var(--ink); }
.strip__switch .btn { min-height: 44px; }

/* ---------- page column ---------- */
.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter) 120px; outline: none; }
.section { margin-top: var(--section); }
.sec-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.sec-head h2 { margin: 0; }
.page-head { padding-top: clamp(40px, 6vw, 72px); margin-bottom: 36px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px 40px; }
.page-head h1 { font-size: clamp(34px, 4vw, 52px); margin: 0 0 12px; }
.page-head .lede { margin: 0; }

/* type */
.eyebrow { font: 700 12px/1.3 var(--sans); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
h1, h2, h3 { font-family: var(--sans); color: var(--ink); text-wrap: balance; }
h1 { font-weight: 300; font-size: clamp(38px, 5vw, 66px); line-height: 1.04; letter-spacing: -0.01em; margin: 0 0 18px; }
h2 { font-weight: 300; font-size: clamp(28px, 3vw, 40px); line-height: 1.12; margin: 0 0 14px; }
h3 { font-weight: 700; font-size: 17px; line-height: 1.35; letter-spacing: 0.01em; margin: 0 0 6px; }
.lede { font-size: clamp(17px, 1.4vw, 19px); line-height: 1.6; color: var(--ink-2); max-width: 40em; margin: 0 0 22px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.num { font-variant-numeric: tabular-nums; }
.label { font: 700 11px/1.3 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- surfaces ---------- */
/* the outset puts the white edge of the picture exactly on the box edge, so panels line up with the text grid */
.panel { border-image: url("/img/panel.png") 60 70 80 70 fill / 30px 35px 40px 35px / 14px 19px 23px 20px stretch; padding: 28px 32px 32px; min-width: 0; }
.panel--tight { padding: 22px 26px 26px; }
.panel > :last-child { margin-bottom: 0; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile .k { display: flex; align-items: center; gap: 10px; }
.tile .k img { width: 26px; height: 26px; object-fit: contain; }
.tile .v { font: 300 clamp(30px, 3vw, 40px)/1.1 var(--sans); font-variant-numeric: tabular-nums; margin: 12px 0 4px; white-space: nowrap; }
.tile .v small { font-size: 15px; color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
.tile .s { font-size: 14px; color: var(--ink-3); }

.split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--gap); margin-top: var(--gap); align-items: start; }
.split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols { display: grid; grid-template-columns: minmax(0, 8fr) minmax(300px, 4fr); gap: var(--gap); align-items: start; }
.cols--7-5 { grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); }
.stick { position: sticky; top: 24px; display: grid; gap: var(--gap); }

/* key / value rows inside a panel */
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); }
.kv li:first-child { border-top: 0; padding-top: 0; }
.kv .v { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); white-space: nowrap; }

/* ---------- buttons: his gradient pill and the white pill ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 26px;
  font: 700 15px/1 var(--sans);
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  background: transparent;
  white-space: nowrap;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
/* outsets put the visible pill on the box edge, so both pills are exactly the button's height */
/* slices leave a middle row to stretch, so a pill of any height has no seam */
.btn--go { color: #fff; border-image: url("/img/btn-primary.webp") 80 120 80 120 fill / 20px 30px / 4px 4px 4px 4px stretch; }
.btn--go:hover { filter: brightness(1.06) saturate(1.05); color: #fff; }
.btn--plain { color: var(--ink); border-image: url("/img/btn-secondary.png") 90 120 95 120 fill / 20px 30px / 4px 8px 10px 8px stretch; }
.btn--plain:hover { color: var(--blue); }
.btn--link { min-height: 40px; padding: 0 2px; color: var(--blue); text-decoration: underline; letter-spacing: 0; font-weight: 400; }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; filter: grayscale(1) opacity(0.42); transform: none; }
.btn img.mark { width: 18px; height: 18px; object-fit: contain; }
.btn--wide { width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row--center { justify-content: center; }

/* forms */
.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field label { font: 700 11px/1.3 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }
.input, textarea.input, select.input {
  width: 100%;
  font: 400 16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--wire);
  border-radius: 14px;
  padding: 11px 14px;
  outline: none;
}
select.input { padding-right: 36px; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(62, 107, 253, 0.14); }
textarea.input { resize: vertical; min-height: 88px; }
.hint { font-size: 14px; color: var(--ink-3); margin: 0; }
.err { color: var(--bad); font-size: 15px; margin: 10px 0 0; }
.okay { color: var(--ok); font-size: 15px; margin: 8px 0 0; }

/* ---------- Today ---------- */
.hero { display: grid; justify-items: center; text-align: center; padding-top: clamp(32px, 5vh, 64px); }
.hero h1 { max-width: 13em; }
.hero .lede { max-width: 36em; margin-bottom: 22px; }
.share__n { font: 900 clamp(96px, 12vw, 172px)/0.86 var(--sans); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; padding: 0 0.06em; }
.share__unit { display: block; font: 700 13px/1.3 var(--sans); letter-spacing: 0.26em; text-transform: uppercase; color: var(--ink-2); margin-top: 18px; }
.facts { list-style: none; margin: 12px 0 24px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; color: var(--ink-3); font-size: 16px; }
.facts li + li::before { content: "·"; margin: 0 12px; color: var(--wire); }
.facts b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.hero__note { max-width: 34em; color: var(--ink-3); font-size: 16px; margin: 14px 0 24px; }

/* the outlet: the $UBC plate the wires run into */
.outlet { width: min(100%, 1000px); margin-top: clamp(36px, 5vh, 56px); display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 36px; align-items: center; text-align: left; }
.outlet__id { display: flex; align-items: center; gap: 14px; }
.outlet__id img { width: 52px; height: 52px; }
.outlet__name { font: 900 30px/1 var(--sans); letter-spacing: 0.01em; }
.outlet__sub { font-size: 13px; color: var(--ink-3); margin-top: 6px; line-height: 1.35; }
.outlet__body { display: grid; gap: 14px; }
.ca { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; }
.ca .label { grid-column: 1 / -1; }
.ca__well { font: 500 15px/1.45 var(--mono); color: var(--ink); padding: 10px 0; border-top: 1px dashed var(--wire); border-bottom: 1px dashed var(--wire); overflow-wrap: anywhere; user-select: all; min-width: 0; }
.ca__well.is-empty { color: var(--ink-3); font-family: var(--sans); font-size: 15px; user-select: none; }
.links { display: flex; flex-wrap: wrap; gap: 12px; }
.links .btn--go { flex: 1 1 260px; }

/* the steps */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); position: relative; counter-reset: st; }
.steps::before { content: ""; position: absolute; left: 12%; right: 12%; top: 32px; border-top: 1px dashed var(--wire); }
.step { position: relative; text-align: center; padding: 0 6px; counter-increment: st; }
.step img { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto 16px; background: var(--paper); padding: 0 6px; box-sizing: content-box; }
.step .k { font: 700 12px/1.3 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.step .k::before { content: counter(st, decimal-leading-zero) "  "; color: var(--blue); }
.step p { color: var(--ink-2); font-size: 16px; margin: 0; }

.ticker { list-style: none; margin: 0; padding: 0; font: 400 14px/1.45 var(--mono); color: var(--ink-2); }
.ticker li { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 14px; padding: 9px 0; border-top: 1px solid var(--rule); }
.ticker li:first-child { border-top: 0; padding-top: 0; }
.ticker .c { color: var(--ink); }
.ticker .m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.teaser { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: center; }
.teaser img { width: 88px; height: auto; }
.teaser__main { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 28px; align-items: center; }

/* ---------- Terminal ---------- */
.term { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.app { display: flex; flex-direction: column; height: clamp(520px, calc(100svh - 330px), 880px); padding: 22px 28px 26px; }
.page-head--compact { padding-top: clamp(28px, 4vw, 44px); margin-bottom: 28px; }
.page-head--compact h1 { font-size: clamp(30px, 3vw, 40px); margin-bottom: 0; }
.app__bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.modes { display: flex; gap: 8px; flex-wrap: wrap; }
.modes .btn { min-height: 44px; padding: 0 20px 0 14px; font-size: 14px; }
.modes .btn { color: var(--ink-3); }
.modes .btn img { width: 22px; height: 22px; object-fit: contain; filter: grayscale(1) opacity(0.5); }
.modes .btn[aria-pressed="true"] { color: var(--ink); }
.modes .btn[aria-pressed="true"] img { filter: none; }
.modes .btn[aria-pressed="true"] span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.model { display: flex; align-items: center; gap: 10px; flex: 1 1 300px; max-width: 460px; }
.model select { min-height: 44px; }
.log { flex: 1 1 auto; overflow-y: auto; padding: 22px 4px 8px; scroll-behavior: smooth; }
.empty { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; gap: 10px; color: var(--ink-3); padding: 20px; }
.empty img { width: 64px; height: 64px; object-fit: contain; opacity: 0.9; }
.composer { border-top: 1px solid var(--rule); padding-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; align-items: end; }
.composer textarea { min-height: 56px; max-height: 220px; resize: none; }
.composer__meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 13px; color: var(--ink-3); }
.composer__send { display: flex; gap: 10px; align-items: center; }
.gate { border-top: 1px solid var(--rule); padding-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; }
.gate h3 { margin: 0 0 4px; }
.gate p { margin: 0; color: var(--ink-3); font-size: 15px; }
.msg { margin: 0 0 24px; }
.msg__who { font: 700 11px/1.3 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.msg__who .cost { letter-spacing: 0.04em; text-transform: none; font-weight: 400; }
.msg--you .msg__body { border-left: 3px solid var(--violet); padding: 2px 0 2px 14px; white-space: pre-wrap; }
.msg__body { overflow-wrap: anywhere; }
.msg__body p { margin: 0 0 10px; }
.msg__body pre { position: relative; background: #f5f4fb; border-left: 3px solid var(--wire); border-radius: 6px; padding: 14px 16px; overflow-x: auto; font: 400 14px/1.55 var(--mono); }
.msg__body code { font-family: var(--mono); font-size: 0.92em; }
.msg__body :not(pre) > code { background: #f1f0f8; padding: 1px 5px; border-radius: 5px; }
.msg__body table { border-collapse: collapse; font-size: 15px; }
.msg__body td, .msg__body th { border: 1px solid var(--rule); padding: 4px 8px; }
.msg img.pic { border-radius: 14px; display: block; max-height: 480px; max-width: 100%; width: auto; margin: 8px 0; }
.copycode { position: absolute; top: 8px; right: 8px; font: 700 11px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); background: var(--white); border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.meter__n { font: 900 52px/1 var(--sans); font-variant-numeric: tabular-nums; margin: 12px 0 2px; }
.meter__bar { height: 8px; border-radius: 99px; background: var(--rule); overflow: hidden; margin: 14px 0 10px; }
.meter__fill { height: 100%; background: var(--grad); border-radius: 99px; width: 0%; transition: width 0.4s ease; }

/* ---------- Passport ---------- */
.steps-v { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; }
.steps-v > li { counter-increment: s; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; padding: 22px 0; border-top: 1px solid var(--rule); }
.steps-v > li:first-child { border-top: 0; padding-top: 0; }
.steps-v > li:last-child { padding-bottom: 0; }
.steps-v > li::before { content: counter(s); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 900 17px/1 var(--sans); color: #fff; background: var(--grad); }
.steps-v > li.is-done::before { content: "\2713"; }
.steps-v > li.is-later { opacity: 0.45; }
.steps-v h3 { margin-top: 8px; }
.post { font: 400 15px/1.5 var(--mono); padding: 12px 0 12px 14px; border-left: 3px solid var(--violet); white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 0; }
.idcard { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 22px; align-items: center; }
.idcard img { width: 80px; height: auto; }
.idcard .outlet__name { font-size: 34px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; color: var(--ink-2); font-size: 15.5px; }
.checks li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--grad); margin-top: 8px; }

table.list { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
table.list th { font: 700 11px/1.3 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 0 12px 12px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.list td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.list tr:last-child td { border-bottom: 0; }
table.list .r, table.list th.r { text-align: right; padding-right: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- Works ---------- */
.props { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--gap); }
.prop { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 24px; align-items: start; }
.prop h3 { margin: 6px 0 6px; font-size: 19px; }
.prop p { margin: 0 0 6px; color: var(--ink-2); font-size: 15px; }
.votes { display: grid; justify-items: center; gap: 4px; text-align: center; }
.votes b { font: 900 34px/1 var(--sans); font-variant-numeric: tabular-nums; }
.votes span { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.votes .btn { margin-top: 8px; min-height: 40px; padding: 0 20px; }
.tag { display: inline-block; font: 700 11px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); }
.tag--done { color: var(--ok); }
.tag--fail { color: var(--bad); }
.progress { height: 6px; border-radius: 99px; background: var(--rule); overflow: hidden; margin: 12px 0; }
.progress > i { display: block; height: 100%; background: var(--grad); }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary { margin-bottom: 18px; }
.side-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.side-head img { width: 44px; height: 44px; object-fit: contain; }
.side-head h3 { margin: 0; }

/* ---------- Readings ---------- */
.events { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.events li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 14px; padding: 11px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.events li:first-child { border-top: 0; padding-top: 0; }

/* ---------- Rules ---------- */
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; align-items: start; }
.toc { position: sticky; top: 24px; display: grid; gap: 2px; }
.toc a { display: block; padding: 8px 0 8px 14px; border-left: 2px solid var(--rule); color: var(--ink-2); text-decoration: none; font-size: 15px; }
.toc a:hover, .toc a.is-on { border-left-color: var(--blue); color: var(--ink); }
.prose { max-width: 720px; }
.prose h2 { margin-top: 64px; scroll-margin-top: 24px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); }
.prose .panel { margin: 28px 0; }
.schema { font: 400 13.5px/1.55 var(--mono); color: var(--ink); overflow-x: auto; white-space: pre; margin: 0; }
.risk { font-size: 13px; color: var(--ink-3); margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--rule); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 60; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; transition: 0.2s ease; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
dialog.wallets { border: 0; padding: 0; background: transparent; max-width: min(420px, calc(100vw - 32px)); width: 100%; }
dialog.wallets::backdrop { background: rgba(39, 56, 83, 0.28); backdrop-filter: blur(3px); }
dialog.wallets .panel { display: grid; gap: 10px; }

/* ---------- narrower screens ---------- */
@media (max-width: 1120px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .term { grid-template-columns: minmax(0, 1fr); }
  /* narrow: the share first, then the app, then the notes */
  .term__side { display: contents; }
  .term__side > :first-child { order: -1; }
  .term__side > :last-child { order: 1; }
  .cols, .cols--7-5 { grid-template-columns: minmax(0, 1fr); }
  .stick { position: static; }
  .doc { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .strip { flex-direction: column; width: min(100%, 560px); padding: 2px 4px 8px; }
  .strip__sockets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; }
  .strip__sockets a { min-width: 0; padding: 6px 4px 4px; gap: 2px; }
  .strip__socket { width: 32px; height: 32px; }
  .strip__switch { border-left: 0; border-top: 1px solid var(--rule); margin: 4px 8px 0; padding: 10px 0 0; min-width: 0; justify-content: center; }
  .strip__switch .who { text-align: center; }
  .split, .split--even { grid-template-columns: minmax(0, 1fr); }
  .outlet { grid-template-columns: minmax(0, 1fr); text-align: left; }
  .ca { grid-template-columns: minmax(0, 1fr); }
  .ca .btn { justify-self: start; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; }
  .steps::before { display: none; }
  .teaser, .teaser__main { grid-template-columns: minmax(0, 1fr); }
  .teaser img { display: none; }
  .page-head { grid-template-columns: minmax(0, 1fr); }
  .grid-slot { display: block; width: calc(100% + 2 * var(--gutter)); height: 150px; margin: 0 calc(var(--gutter) * -1) 6px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top { padding-top: 22px; gap: 16px; }
  .lockup__plug { width: 26px; }
  .panel { border-image-width: 24px 26px 30px 26px; border-image-outset: 12px 14px 18px 15px; padding: 22px 20px 24px; }
  .panel--tight { padding: 18px 18px 20px; }
  .tiles, .tiles--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .tile .v { font-size: 26px; }
  .tile .k img { display: none; }
  .app { height: auto; padding: 18px 18px 20px; }
  .log { min-height: 46vh; max-height: 62vh; }
  .composer { grid-template-columns: minmax(0, 1fr); }
  .composer__send .btn { flex: 1; }
  .gate { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .prop { grid-template-columns: minmax(0, 1fr); }
  .votes { justify-items: start; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 8px; }
  .votes .btn { margin-top: 0; justify-self: end; }
  .events li { grid-template-columns: minmax(0, 1fr) auto; }
  .events li > :first-child { grid-column: 1 / -1; }
  .ticker li { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; }
  .facts { flex-direction: column; }
  .facts li + li::before { display: none; }
  .modes .btn { padding: 0 14px 0 10px; }
}

@media (max-width: 360px) {
  .tiles, .tiles--3 { grid-template-columns: minmax(0, 1fr); }
  .strip__label { font-size: 10px; letter-spacing: 0.1em; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
