/* Structure and components, reading only tokens. stockr.css comes after and draws the board itself. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body { margin: 0; min-height: 100svh; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font-text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- type ---------- */
h1, h2, .display { font-family: var(--font-display); font-weight: 900; text-transform: uppercase; letter-spacing: 0.005em; line-height: 0.92; text-wrap: balance; }
h1 { font-size: clamp(44px, 6vw, 84px); }
h2 { font-size: clamp(32px, 3.8vw, 52px); }
h3, .h3 { font: 600 19px/1.3 var(--font-text); letter-spacing: -0.01em; }
.accent { color: var(--accent); }
.lede { font-size: clamp(16.5px, 1.4vw, 18.5px); color: var(--ink-2); max-width: 38em; }
.lede b { color: var(--ink); font-weight: 600; }
.muted { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); }
.mono, .num, .label, .kicker, .chip { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.kicker { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.kicker::before { content: ""; width: 8px; height: 8px; background: var(--accent); }
.up { color: var(--up); }
.down { color: var(--down); }
.burn { color: var(--burn); }

/* ---------- layout ---------- */
.wrap { width: min(var(--wrap), 100% - 2 * var(--gut)); margin-inline: auto; }
.section { padding-top: clamp(64px, 8vw, 112px); }
.page-head { padding-top: clamp(36px, 5vw, 64px); padding-bottom: 28px; display: grid; gap: 16px; justify-items: start; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.section-head > div { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
main { padding-bottom: 120px; min-height: 60vh; }
main.enter { animation: page-in 300ms var(--ease); }
@keyframes page-in { from { opacity: 0; } }

/* ---------- header ---------- */
#top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-bar { height: var(--top-h); display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex: none; }
.brand .lock-word { padding-top: 1px; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--ink-2); font: 500 12.5px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.demo-strip { background: var(--accent); color: var(--on-accent); font: 500 12.5px/1.3 var(--font-mono); text-align: center; padding: 6px var(--gut); }
.demo-strip b { font-weight: 700; letter-spacing: 0.08em; }
.tabbar { display: none; }
.menu-btn { display: none; }

/* ---------- buttons: square keys, like the board's own buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 14px/1 var(--font-text); letter-spacing: 0.01em; cursor: pointer; white-space: nowrap; transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.btn.primary:hover { background: #fff04d; }
.btn.primary:active { box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line-2); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 54px; padding: 0 26px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: var(--surface); }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.link:hover { color: var(--ink); }
.arrow-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font: 500 12.5px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.arrow-link:hover { color: var(--accent); }
.icon { display: inline-flex; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-size: 11.5px; letter-spacing: 0.04em; color: var(--ink-2); white-space: nowrap; text-transform: uppercase; }
.chip.demo { color: var(--on-accent); background: var(--accent); border-color: transparent; font-weight: 600; }
.chip.good { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.chip.grad { color: var(--ink); border-color: var(--line-3); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); flex: none; }
[data-motion="on"] .live-dot.pulse { animation: blink 2.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---------- segmented controls ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--housing); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 32px; padding: 0 12px; border-radius: 3px; border: 0; background: none; color: var(--ink-2); cursor: pointer; font: 500 12px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 18px; }
.controls .search { margin-left: auto; width: min(320px, 100%); }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; margin-top: 16px; }
.field > .label { color: var(--ink-2); }
.input { width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg); font-size: 16px; }
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); }
.input[aria-invalid] { border-color: var(--down); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.prefix { display: flex; align-items: center; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg); padding-left: 14px; font-family: var(--font-mono); color: var(--muted); }
.prefix.suffix { padding-left: 0; padding-right: 14px; }
.prefix .input { border: 0; background: none; padding-left: 4px; color: var(--ink); }
.prefix.suffix .input { padding-left: 14px; }
.prefix:focus-within { border-color: var(--accent); }
.problem { color: var(--down); font-size: 13.5px; }
.problem:empty { display: none; }
.hint { font-size: 13px; color: var(--muted); }
.drop { display: grid; place-items: center; width: 100%; min-height: 150px; border-radius: var(--r); border: 1.5px dashed var(--line-2); background: var(--bg); cursor: pointer; padding: 16px; text-align: center; color: var(--ink-2); }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop img { width: 112px; height: 112px; object-fit: cover; border-radius: var(--r-sm); }
.drop-inner { display: grid; gap: 6px; justify-items: center; }
details.fold { margin-top: 18px; }
details.fold summary { cursor: pointer; color: var(--ink-2); font: 500 12.5px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- panels ---------- */
.panel { border-radius: var(--r); border: 1px solid var(--line); background: var(--housing); padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.bar { height: 6px; border-radius: 1px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar.done span { background: var(--ink-2); }
.sk { border-radius: 4px; background: var(--surface-2); }
[data-motion="on"] .sk { animation: sk 1.4s ease-in-out infinite; }
@keyframes sk { 50% { opacity: 0.45; } }
.sk-line { height: 14px; } .sk-line.short { width: 60%; }

/* ---------- facts and costs ---------- */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 14.5px; }
.facts dt { color: var(--muted); font: 500 11.5px/1.9 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.facts dd { overflow-wrap: anywhere; }
.costs { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; margin-top: 10px; font-size: 14px; }
.costs dt { color: var(--ink-2); }
.costs dd { text-align: right; font-family: var(--font-mono); }
.costs .total { font-weight: 700; color: var(--ink); padding-top: 9px; border-top: 1px solid var(--line-2); }
.notes { display: grid; gap: 9px; font-size: 13.5px; color: var(--ink-2); }
.notes li { display: flex; gap: 9px; align-items: flex-start; }
.notes .icon { color: var(--accent); margin-top: 2px; flex: none; }

/* ---------- CA box ---------- */
.ca { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px dashed var(--line-3); max-width: 100%; }
.ca-addr { font-size: 13px; word-break: break-all; user-select: all; }
.ca-soon { color: var(--accent); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 12.5px; }
.ca-note { font-size: 13px; flex-basis: 100%; }
.ca.small { padding: 0 12px; height: 38px; flex-wrap: nowrap; border-radius: var(--r-sm); }
.ca.small .label { font-size: 10.5px; }

/* ---------- empty states ---------- */
.empty { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 56px 16px; }
.empty h3 { font: 900 28px/1 var(--font-display); text-transform: uppercase; }
.more { display: grid; justify-items: center; margin-top: 22px; }

/* ---------- wallet ---------- */
.wallet-box { position: relative; }
.wallet-btn { font-family: var(--font-mono); font-weight: 500; font-size: 13px; }
.wallet-btn.on { padding: 0 12px; gap: 9px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-2); display: grid; gap: 2px; z-index: 30; }
.menu-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; color: var(--ink-2); }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm); border: 0; background: none; text-align: left; cursor: pointer; font-size: 14px; }
.menu-item:hover { background: var(--surface-3); }
.wallet-list { display: grid; gap: 8px; }
.wallet-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-align: left; }
.wallet-row:hover:not([disabled]) { border-color: var(--accent); }
.wallet-row[disabled] { opacity: 0.6; cursor: default; }
.wallet-row img { border-radius: 6px; }
.wallet-name { flex: 1; font-weight: 600; }
.wallet-tag { font: 12px var(--font-mono); color: var(--muted); }
.wallet-help { display: grid; gap: 10px; margin-top: 14px; }

/* ---------- modal, toasts ---------- */
.modal-veil { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(4, 4, 5, 0.78); animation: fade var(--t) var(--ease); }
.modal-panel { width: min(500px, 100%); max-height: calc(100svh - 32px); overflow: auto; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--housing); padding: 22px; animation: fade var(--t) var(--ease); overflow-wrap: anywhere; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 30px; }
.modal-panel.locked .modal-x { visibility: hidden; }
.modal-body { display: grid; gap: 12px; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; }
.toast { padding: 10px 16px; border-radius: var(--r-sm); background: var(--ink); color: var(--bg); font: 500 13.5px/1.3 var(--font-mono); animation: fade var(--t) var(--ease); }
.toast.bad { background: var(--down); color: #fff; }

/* ---------- footer ---------- */
#foot { border-top: 1px solid var(--line); padding: 56px 0 calc(56px + env(safe-area-inset-bottom)); background: var(--housing); }
.foot { display: grid; grid-template-columns: 1.4fr repeat(3, auto); gap: 32px 56px; }
.foot-brand { display: grid; gap: 14px; align-content: start; justify-items: start; }
.foot-brand p { color: var(--ink-2); font-size: 14.5px; max-width: 34em; }
.foot-col { display: grid; gap: 10px; align-content: start; font-size: 14px; color: var(--ink-2); }
.foot-col a:hover { color: var(--ink); }
.foot-base { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding-top: 22px; border-top: 1px solid var(--line); }
.foot-base p { max-width: 60em; }

/* ---------- motion switch: when off, nothing moves (the visible switch, not the OS setting, decides) ---------- */
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; }

/* ---------- phones ---------- */
@media (max-width: 1080px) {
  .top-actions .ca { display: none; }
}
@media (max-width: 900px) {
  .nav, .top-cta { display: none; }
  .menu-btn { display: inline-grid; }
  .tabbar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 25; display: flex; justify-content: space-between; gap: 2px; padding: 5px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--housing); }
  .tabbar a { flex: 1; text-align: center; padding: 10px 4px; border-radius: var(--r-sm); color: var(--ink-2); font: 500 11.5px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
  .tabbar a[aria-current] { background: var(--surface-3); color: var(--ink); }
  .tabbar a.tab-cta { background: var(--accent); color: var(--on-accent); font-weight: 700; }
  .foot { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .controls .search { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .wallet-btn.on .muted { display: none; }
  .btn.lg { width: 100%; }
  .top-bar { gap: 12px; }
}
