/* Hushel shared shell: tokens, type, rail, ticker, buttons, fields, detail window, legend, wallet picker, menu.
   Lifted from design draft B (picked 2026-11-18). Page-specific rules live in their own file (landing.css, app.css). */
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Libre Franklin"; src: url("/fonts/libre-franklin.woff2") format("woff2"); font-weight: 400 600; 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; }

/* Colour tokens, one meaning each (the map's legend is these three):
   --purple  an amount anyone can read today on a public chain
   --white   a payment a stranger can read as a schedule (the loudest exposure)
   --bg      black: what Hushel hides */
:root {
  --bg: #000;
  --raised: #0c0b0e;
  --raised-2: #16141a;
  --line: rgba(255,255,255,.12);
  --line-2: rgba(255,255,255,.22);
  --ink: #fff;
  --ink-2: rgba(255,255,255,.66);
  --ink-3: rgba(255,255,255,.52);
  --purple: #9945FF;
  --rail: 72px;
  --tick: 36px;
  --corner: 360px;
  --f-head: "Schibsted Grotesk", system-ui, sans-serif;
  --f-body: "Libre Franklin", system-ui, sans-serif;
  --f-mono: "Red Hat Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.22,1,0.36,1);
  --ease-press: cubic-bezier(0.4,0,0.2,1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 16px/1.45 var(--f-body); min-height: 100svh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- rail: the slim left menu ---------- */
.rail { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--rail); display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 14px 0 16px; background: var(--bg); border-right: 1px solid var(--line); }
.mark { width: 44px; height: 44px; border-radius: 9px; background: var(--purple); display: grid; place-items: center; margin-bottom: 14px;
  font: 900 26px/1 var(--f-head); color: #fff; letter-spacing: -.04em; user-select: none; }
.nav { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.nav-btn { width: 60px; min-height: 60px; border: 0; border-radius: 12px; background: transparent; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px; padding: 6px 0; cursor: pointer; text-decoration: none; color: var(--ink-2);
  transition: background-color 160ms var(--ease-press), color 160ms var(--ease-press), transform 150ms var(--ease-press); }
.nav-btn:hover { background: var(--raised-2); color: var(--ink); }
.nav-btn:active { transform: scale(.97); }
.nav-btn[aria-pressed="true"] { color: var(--ink); background: var(--raised-2); }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn span { font: 500 13px/1 var(--f-body); }
.rail .grow { flex: 1; }
.round { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; }
.connect { border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0;
  transition: transform 150ms var(--ease-press); }
.connect:active { transform: scale(.97); }
.connect .round { background: var(--ink); color: #000; transition: background-color 160ms var(--ease-press), box-shadow 160ms var(--ease-press); }
.connect:hover .round { background: #e9e2f7; }
.connect[aria-busy="true"] .round { background: var(--raised-2); color: var(--ink); }
.connect.on .round { background: var(--purple); color: #fff; }
.connect .lbl { font: 500 13px/1 var(--f-body); color: var(--ink-2); max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connect.on .lbl { font-family: var(--f-mono); font-size: 13px; color: var(--ink); }
.connect svg { width: 22px; height: 22px; }

/* ---------- ticker ---------- */
.ticker { position: fixed; z-index: 20; top: 0; left: var(--rail); right: 0; height: var(--tick); display: flex; align-items: center; background: var(--bg);
  border-bottom: 1px solid var(--line); font-size: 13px; overflow: hidden; }
.ticker .fix { flex: none; height: 100%; display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--ink); background: var(--bg); z-index: 1; }
.ticker .fix.l { border-right: 1px solid var(--line); }
.ticker .fix.r { border-left: 1px solid var(--line); color: var(--ink-2); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--purple); flex: none; }
.belt { flex: 1; overflow: hidden; height: 100%; position: relative; mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.belt-in { position: absolute; top: 0; left: 0; height: 100%; display: flex; align-items: center; white-space: nowrap; will-change: transform; }
.t-item { display: inline-flex; align-items: center; gap: 8px; padding: 0 22px; color: var(--ink-2); }
.t-item b { color: var(--ink); font-weight: 600; }
.t-item i { font-style: normal; width: 6px; height: 6px; background: var(--purple); display: inline-block; }
.t-item.in i { background: var(--ink); border-radius: 50%; }


.stamp { flex: none; font: 800 13px/1 var(--f-head); letter-spacing: .04em; color: #fff; background: var(--purple); padding: 6px 8px 5px; border-radius: 4px; margin-top: 1px; }
.field { display: flex; gap: 8px; align-items: center; }
.field input { flex: 1; min-width: 0; height: 56px; border-radius: 28px; border: 1px solid var(--line-2); background: var(--raised); padding: 0 18px; font: 400 16px/1 var(--f-mono);
  transition: border-color 160ms var(--ease-press), background-color 160ms var(--ease-press); }
.field input::placeholder { color: var(--ink-3); font-family: var(--f-body); }
.field input:hover { border-color: rgba(255,255,255,.34); }
.field input:focus-visible { outline: none; border-color: var(--ink); background: #000; }
.field input[aria-invalid="true"] { border-color: var(--purple); }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 55% { transform: translateX(5px); } 80% { transform: translateX(-2px); } }
.go { flex: none; border: 0; cursor: pointer; background: var(--purple); color: #fff; transition: background-color 160ms var(--ease-press), transform 150ms var(--ease-press); }
.go:hover { background: #a75cff; }
.go:active { transform: scale(.97); }
.go[aria-busy="true"] { background: var(--raised-2); }
.go svg { width: 22px; height: 22px; }
.go .spin { display: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 900ms linear infinite; }
.go[aria-busy="true"] svg { display: none; } .go[aria-busy="true"] .spin { display: block; }
@keyframes spin { to { transform: rotate(1turn); } }
.msg { margin: 0; min-height: 20px; font-size: 13px; color: var(--ink-2); }
.msg.err { color: var(--ink); }
.msg.err::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--purple); margin-right: 8px; transform: translateY(-1px); }
.legend { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 13px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 8px; line-height: 1.35; }
.sw { flex: none; width: 14px; height: 14px; }
.sw.p { background: var(--purple); } .sw.w { background: var(--ink); } .sw.b { background: #000; box-shadow: inset 0 0 0 1.5px var(--purple); }
.sw.r { background: var(--purple); box-shadow: inset 0 3px 0 var(--ink); }
.sw.d { width: 8px; height: 8px; margin: 0 3px; border-radius: 50%; background: var(--ink); }
.legend li.wide { grid-column: 1 / -1; color: var(--ink-3); }
.sw.bw { background: #000; box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- detail window, over the chosen cell ---------- */
.detail { position: absolute; z-index: 15; width: 420px; max-height: calc(100% - 24px); overflow: auto; background: var(--raised); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 24px 48px rgba(0,0,0,.55); padding: 18px 18px 16px; transform-origin: var(--ox, 0) var(--oy, 0); }
.detail[hidden] { display: none; }
.detail.open { animation: pop 260ms var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.d-head { display: flex; align-items: center; gap: 10px; }
.d-head .sw { width: 18px; height: 18px; }
.d-addr { font: 500 16px/1.35 var(--f-mono); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; cursor: pointer; display: grid; place-items: center; flex: none;
  transition: background-color 160ms var(--ease-press), transform 150ms var(--ease-press); }
.icon-btn:hover { background: var(--raised-2); } .icon-btn:active { transform: scale(.97); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .ok { display: none; } .icon-btn.done .ok { display: block; } .icon-btn.done .cp { display: none; }
.d-full { margin: 8px 0 0; font: 400 13px/1.4 var(--f-mono); color: var(--ink-2); word-break: break-all; user-select: all; }
.d-dir { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.d-story { margin: 6px 0 14px; font: 600 20px/1.25 var(--f-head); letter-spacing: -.01em; }
.slices { display: flex; gap: 3px; height: 44px; margin-bottom: 14px; }
.slices span { background: var(--purple); min-width: 4px; transition: opacity 160ms var(--ease-press); }
.slices.w span { background: var(--ink); }
.slices.h span { background: #000; box-shadow: inset 0 0 0 1.5px var(--purple); }
.slices span.dim { opacity: .35; }
table.pay { width: 100%; border-collapse: collapse; font-size: 13px; }
.pay th { text-align: left; font: 600 13px/1 var(--f-body); color: var(--ink-3); padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); }
.pay th:last-child, .pay td:last-child { padding-right: 0; }
.pay th.n, .pay td.n { padding-right: 16px; }
.pay th.n, .pay td.n { text-align: right; }
.pay td { height: 44px; border-bottom: 1px solid var(--line); padding: 0 12px 0 0; vertical-align: middle; }
.pay tr:hover td { background: rgba(255,255,255,.03); }
.pay td.n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.pill { display: inline-block; font: 600 13px/1 var(--f-body); padding: 4px 7px; border-radius: 4px; background: #000; box-shadow: inset 0 0 0 1px var(--purple); color: var(--ink); }
.pill.pub { background: var(--ink); color: #000; box-shadow: none; }
.pay a { font-family: var(--f-mono); color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.pay a:hover { color: var(--ink); }
.d-foot { margin: 14px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.d-foot b { color: var(--ink); font-weight: 600; }
.d-act { display: flex; gap: 8px; margin-top: 14px; }
.btn { height: 44px; border-radius: 22px; border: 0; padding: 0 18px; cursor: pointer; font: 600 13px/1 var(--f-body); background: var(--ink); color: #000;
  transition: background-color 160ms var(--ease-press), transform 150ms var(--ease-press); }
.btn:hover { background: #e9e2f7; } .btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost:hover { background: var(--raised-2); }

/* ---------- wallet picker and the connected menu ---------- */
dialog { border: 1px solid var(--line-2); background: var(--raised); color: var(--ink); border-radius: 16px; padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.66); }
dialog[open] { animation: pop 250ms var(--ease-out); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dlg-h h2 { margin: 0; font: 800 24px/1.1 var(--f-head); letter-spacing: -.02em; }
.dlg-p { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }
.wk-label { margin: 14px 0 8px; font: 600 13px/1 var(--f-body); color: var(--ink-3); }
.wk-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--raised-2);
  cursor: pointer; margin-bottom: 8px; transition: background-color 160ms var(--ease-press), transform 150ms var(--ease-press); text-align: left; }
.wk-row:hover { background: #201d26; } .wk-row:active { transform: scale(.98); }
.wk-row[aria-busy="true"] { opacity: .7; }
.wk-row img { border-radius: 8px; }
.wk-name { flex: 1; font-weight: 600; font-size: 16px; }
.wk-tag { font-size: 13px; color: var(--ink-2); }
.wk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wk-tile { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); text-decoration: none;
  transition: background-color 160ms var(--ease-press); }
.wk-tile:hover { background: var(--raised-2); }
.wk-tile img { border-radius: 6px; } .wk-tile .wk-name { font-size: 13px; font-weight: 500; }
.wk-err { margin: 10px 0 0; font-size: 13px; color: var(--ink); min-height: 18px; }
.menu { position: fixed; z-index: 40; left: calc(var(--rail) + 10px); bottom: 16px; width: 260px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 14px; padding: 8px;
  box-shadow: 0 16px 32px rgba(0,0,0,.5); }
.menu[hidden] { display: none; }
.menu.open { animation: pop 200ms var(--ease-out); transform-origin: 0 100%; }
.menu p { margin: 6px 8px 8px; font-size: 13px; color: var(--ink-2); }
.menu p b { font-family: var(--f-mono); color: var(--ink); font-weight: 500; }
.menu button { width: 100%; min-height: 44px; text-align: left; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 16px;
  transition: background-color 160ms var(--ease-press); }
.menu button:hover { background: var(--raised-2); }

.grain { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .015; background-size: 160px 160px; }

/* ---------- phone ---------- */
@media (max-width: 759px) {
  :root { --rail: 0px; --tick: 32px; }
  .rail { position: sticky; top: 0; bottom: auto; width: 100%; height: 64px; flex-direction: row; padding: 0 8px 0 16px; gap: 2px; border-right: 0; border-bottom: 1px solid var(--line); }
  .mark { margin: 0 4px 0 0; width: 44px; height: 44px; font-size: 24px; }
  .nav { flex-direction: row; width: auto; gap: 2px; }
  .nav-btn { width: 56px; min-height: 52px; gap: 3px; }
  .rail .grow { flex: 1; }
  .connect { flex-direction: row; gap: 8px; }
  .connect .round { width: 44px; height: 44px; }
  .connect .lbl { max-width: 84px; }
  .ticker { position: sticky; top: 64px; left: 0; }
  .ticker .fix.r { display: none; }
  .detail { position: fixed; left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-height: 76svh; border-radius: 16px 16px 0 0; }
  .menu { left: 8px; right: 8px; width: auto; bottom: auto; top: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  .detail.open, dialog[open], .menu.open, .read.is-wrong .field input { animation: none; }
  .go .spin { animation-duration: 2.4s; }
  * { transition-duration: 1ms !important; }
}

/* ---------- shell additions (site/ui/shell.mjs) ---------- */
.connect.wrong .round { background: #000; color: var(--ink); box-shadow: inset 0 0 0 2px var(--purple); }
.menu .warn { margin: 0 8px 8px; font-size: 13px; color: var(--ink); }
.toast { position: fixed; z-index: 70; left: 50%; bottom: 20px; transform: translate(-50%, 12px); max-width: min(560px, calc(100vw - 32px)); margin: 0;
  padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #000; font-size: 15px; line-height: 1.4; opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease-press), transform 260ms var(--ease-out); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- site-wide additions for the real site (Builder 1) ---------- */
[hidden] { display: none !important; }
a.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.mark { text-decoration: none; overflow: hidden; background: transparent; transition: transform 150ms var(--ease-press); }
.mark svg { display: block; width: 100%; height: 100%; }
a.mark:active { transform: scale(.96); }
.nav-btn[aria-current="page"] { color: var(--ink); background: var(--raised-2); }
.nav-btn[aria-current="page"]::after { content: ""; position: absolute; left: -6px; top: 18px; bottom: 18px; width: 3px; border-radius: 2px; background: var(--purple); }
.nav-btn { position: relative; }
.rail .sep { width: 32px; height: 1px; background: var(--line); margin: 6px 0; flex: none; }
.menu a { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 10px; border-radius: 8px; text-decoration: none; font-size: 16px;
  transition: background-color 160ms var(--ease-press); }
.menu a:hover { background: var(--raised-2); }
.menu .rule { height: 1px; background: var(--line); margin: 6px 4px; }
/* links at the foot of every page (on a phone the top bar carries only the main ones) */
.site-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; padding: 18px 0 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 22px; text-decoration: none; color: var(--ink-2);
  transition: background-color 160ms var(--ease-press), color 160ms var(--ease-press); }
.site-foot a:hover { background: var(--raised-2); color: var(--ink); }
.site-foot .x { color: var(--ink); }
.site-foot .x svg { width: 15px; height: 15px; margin-right: 6px; }
.site-foot .fine { flex-basis: 100%; margin: 6px 0 0; color: var(--ink-3); }
/* a short window: the rail tightens so Connect stays on screen */
@media (min-width: 760px) and (max-height: 820px) {
  .rail { padding: 10px 0 12px; gap: 2px; }
  .mark { margin-bottom: 8px; }
  .nav { gap: 2px; }
  .nav-btn { min-height: 50px; gap: 4px; }
  .nav-btn svg { width: 20px; height: 20px; }
  .rail .sep { margin: 3px 0; }
  .round { width: 50px; height: 50px; }
}
@media (min-width: 760px) and (max-height: 680px) {
  .nav-btn { min-height: 44px; gap: 3px; }
  .nav-btn svg { width: 18px; height: 18px; }
  .mark { margin-bottom: 6px; }
  .rail .sep { display: none; }
  .round { width: 46px; height: 46px; }
  .connect .lbl { display: none; }
}
@media (max-width: 759px) {
  .rail .sep, .rail .wide-only { display: none !important; }
  .nav-btn[aria-current="page"]::after { left: 14px; right: 14px; top: auto; bottom: -6px; width: auto; height: 3px; }
}
@media (max-width: 380px) {
  .rail { padding-left: 12px; padding-right: 6px; }
  .nav-btn { width: 50px; }
  .connect .lbl { display: none; }
}
