/* Page layout for the Solos dashboard. Components come from terminal.css (the Solos Terminal design system). */

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); }
body { min-height: 100vh; }
.sheet { padding-inline: var(--space-8); padding-block: var(--space-6) var(--space-4); max-width: 1440px; margin: 0 auto; }
@media (max-width: 700px) { .sheet { padding-inline: var(--space-4); } }
.dim { color: var(--ink-muted); }
a { color: inherit; }

/* Header: the test sheet's top strip. */
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-6); flex-wrap: wrap; }
.head-left { display: flex; flex-direction: column; gap: var(--space-4); }
.meta { font-size: 22px; line-height: 1.1; text-transform: uppercase; }
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); text-align: right; }
.credit { text-transform: uppercase; }
.readouts { display: grid; grid-template-columns: repeat(2, auto); column-gap: var(--space-6); row-gap: var(--space-2); justify-items: end; }
.readouts .st-stat { align-items: flex-end; }
.readouts .st-stat-value { font-size: 28px; }
@media (max-width: 700px) { .head-right { align-items: flex-start; text-align: left; } .readouts { justify-items: start; } .readouts .st-stat { align-items: flex-start; } }

/* Hero: one scanlined word flanked by readouts, like "(ERR0R 404)". */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-4); padding-block: var(--space-12); }
.hero-word { font-size: min(88px, calc((100vw - 2 * var(--space-8)) / var(--chars, 10))); text-align: center; }
.hero-side { display: flex; flex-direction: column; gap: var(--space-1); text-transform: uppercase; font-variant-numeric: tabular-nums; min-width: 0; }
.hero-r { align-items: flex-end; text-align: right; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-block: var(--space-6); }
  .hero-word { order: -1; text-align: left; font-size: min(88px, calc((100vw - 2 * var(--space-4)) / var(--chars, 10))); }
  .hero-r { align-items: flex-start; text-align: left; }
}

/* Body: content + sidebar. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-8); align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.tab { display: none; flex-direction: column; gap: var(--space-4); }
.tab.on { display: flex; }
.side { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.side .st-feed { max-height: 560px; overflow-y: auto; }
.lede { margin: 0; max-width: 70ch; }
.sub { margin: var(--space-4) 0 0; font-weight: 400; font-size: 28px; line-height: 1; text-transform: uppercase; }
.sub::before { content: '// '; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; text-transform: uppercase; }
.toolbar .st-btn { font-size: 20px; }
.ledger { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-row { display: flex; flex-wrap: wrap; gap: var(--space-6) var(--space-8); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); align-items: start; }
.two .st-feed { max-height: 420px; overflow-y: auto; }
@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.cards .st-window { cursor: pointer; }
.cards .st-window:hover { outline: var(--rule-weight) solid var(--ink); outline-offset: 2px; }
.cards .st-window:has(.st-row-btn:focus-visible) { outline: var(--focus-weight) dashed var(--focus); outline-offset: 2px; }
.cards .st-window .st-row-btn:focus-visible { outline: none; } /* the whole card carries the focus ring */
#modal-body p { overflow-wrap: anywhere; } /* the 42-character wallet address must not push the window sideways */
.card-note { color: var(--ink-muted); font-size: 18px; line-height: 1.15; }
.pager { display: flex; gap: var(--space-4); align-items: baseline; justify-content: center; }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.how { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-3); max-width: 80ch; counter-reset: step; }
.how li { counter-increment: step; display: grid; grid-template-columns: 8ch 1fr; }
.how li::before { content: '. ' counter(step, decimal-leading-zero) ' >'; }
.mod { display: flex; flex-direction: column; gap: var(--space-1); padding-block: var(--space-2); border-bottom: 1px dashed var(--ink-faint); }
.mod-head { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; text-transform: uppercase; }
.mod p { margin: 0; max-width: 90ch; }
.mod .params { color: var(--ink-muted); font-size: 18px; }

/* Footer: "// END OF TEST PAGE". */
.foot { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-4); margin-top: var(--space-12); text-transform: uppercase; align-items: end; }
.foot-mid { white-space: nowrap; }
.foot-r { text-align: right; }
@media (max-width: 700px) { .foot { grid-template-columns: 1fr; } .foot-r { text-align: left; } .foot-mid { display: none; } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 10; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto;
  padding: calc(var(--space-8) + env(safe-area-inset-top, 0px)) var(--space-4) var(--space-8);
  background-image: radial-gradient(circle, var(--ink) 1px, transparent 1.4px); background-size: 4px 4px; background-color: color-mix(in srgb, var(--ground) 70%, transparent); }
.modal[hidden] { display: none; }
.modal-window { width: min(960px, 100%); }

/* Live tab: error text and endpoint lists wrap inside their ledger instead of widening the page. */
.live-on { display: flex; flex-direction: column; gap: var(--space-4); }
.live-on[hidden] { display: none; }
#tab-live .st-leader { flex-wrap: wrap; }
#tab-live .st-leader-value { white-space: normal; overflow-wrap: anywhere; min-width: 0; }

/* Long module names wrap inside the Solo window instead of overflowing it. */
.modal-window .st-leader { flex-wrap: wrap; }
.modal-window .st-leader-value { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
.st-btn:disabled::before, .st-btn:disabled::after { opacity: .5; }

/* FEE_SOURCE=claims (html.claims, set from /api/state): the treasury is real, everything else is paper.
   .if-claims shows only then; without it the page is exactly the paper / dry-run page. */
html:not(.claims) .if-claims { display: none; }
.sim-tag { margin-left: 0.5ch; vertical-align: baseline; }
.st-stat-value .sim-tag { font-size: 18px; }
/* A badge must not push a narrow ledger sideways: its value wraps instead (claims mode only). */
html.claims #treasury-ledger .st-leader { flex-wrap: wrap; }
html.claims #treasury-ledger .st-leader-value { white-space: normal; min-width: 0; }

/* The REAL · ON-CHAIN panel: explorer links, and ledger values that wrap instead of widening the page. */
.chain-link { text-decoration: underline; text-underline-offset: 3px; }
.chain-link:hover { background: var(--invert-ground); color: var(--invert-ink); }
.chain-link:focus-visible { outline: var(--focus-weight) dashed var(--focus); outline-offset: 2px; }
.real .st-leader { flex-wrap: wrap; }
.real .st-leader-value { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
.real .sub { margin-top: 0; }

/* Pre-launch (html.prelaunch, from /api/state launch: 'pending'): one banner above every tab. */
.launch { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-4); margin-bottom: var(--space-8);
  padding: var(--space-2) var(--space-3); border: var(--rule-weight) solid var(--ink); background: var(--ground-sunk); }
.launch[hidden] { display: none; }
.launch-head { text-transform: uppercase; }
.launch .st-loader { flex-wrap: wrap; } /* each part stays on one line; the parts wrap on a phone */
.launch-note { min-width: 0; }
