/* fractrade.xyz. One dark look, shared with the app (app.fractrade.xyz): the same ground,
   ink, teal and the up/down pair. Layout: left-aligned text against live instruments
   (the detection tape, the agent console); everything else stays quiet type on the ground. */

:root {
    color-scheme: dark;
    --bg: #0e1a1e;
    --surface: #121920;
    --surface-2: #0a1215;
    --text: #ffffff;
    --text-2: rgba(255, 255, 255, 0.74);
    --text-3: rgba(255, 255, 255, 0.52);
    --line: rgba(255, 255, 255, 0.09);
    --teal: #97fde4;
    --teal-wash: rgba(151, 253, 228, 0.08);
    --up: #55f3d3;
    --down: #ff8177;
    --orange: #f69318;
    --radius: 6px;
    --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --display: "Inter Tight", "Inter", system-ui, sans-serif;
    --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.wrap {
    max-width: 1160px; margin: 0 auto;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px 28px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--teal); font-weight: 700; }
.mark { width: 30px; height: 30px; flex: none; }
.mark rect { fill: rgba(151, 253, 228, 0.16); }
.mark path { fill: none; stroke: var(--teal); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.site-nav { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-left: auto; }
.site-nav a { color: var(--text-2); font-size: 15px; }
.site-nav a:hover, .site-nav a.active { color: var(--text); text-decoration: none; }

.button {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px;
    border-radius: var(--radius); border: 1px solid transparent;
    background: var(--teal); color: #08201b; font-weight: 600; font-size: 15px;
}
.button:hover { text-decoration: none; filter: brightness(1.08); }
.button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.button.ghost:hover { border-color: rgba(255, 255, 255, 0.24); filter: none; }

/* Home: hero */
.hero {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
    gap: 56px; align-items: start; padding-top: 72px; padding-bottom: 72px;
}
.hero h1 {
    font-family: var(--display); font-weight: 600;
    font-size: clamp(2.4rem, 5.2vw, 4.1rem); line-height: 1.02; letter-spacing: -0.035em;
    margin: 0 0 28px; text-wrap: balance;
}
.lead { font-size: 1.15rem; line-height: 1.55; color: var(--text-2); margin: 0 0 32px; max-width: 34em; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }

.install {
    display: flex; align-items: flex-start; gap: 16px; max-width: 100%;
    border-top: 1px solid var(--line); padding-top: 18px;
}
.install code {
    flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7;
    font-family: var(--mono); font-size: 13.5px; color: var(--text-2);
}
.install code::before { content: "$ "; color: var(--text-3); }
.install button {
    flex: none; font: 500 13px var(--sans); color: var(--text-2); background: none;
    border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 10px; cursor: pointer;
}
.install button:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.24); }

/* The tape: detections as they are published */
.tape { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tape-head, .tape-foot {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 14px 18px; font-size: 13px; color: var(--text-3);
}
.tape-head { border-bottom: 1px solid var(--line); }
.tape-head b { color: var(--text); font-weight: 600; font-size: 14px; }
.tape-head .state:empty { display: none; }
.tape-head .state::before {
    content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-3); margin-right: 7px; vertical-align: 1px;
}
.tape-head .state.on::before { background: var(--up); box-shadow: 0 0 0 3px rgba(85, 243, 211, 0.18); }
.tape-foot { border-top: 1px solid var(--line); flex-wrap: wrap; }
.tape-foot strong { color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.tape-rows { list-style: none; margin: 0; padding: 0; height: 432px; overflow: hidden; }
.tape-rows li {
    display: grid; grid-template-columns: 64px 104px minmax(0, 1fr) auto; gap: 12px; align-items: center;
    height: 36px; padding: 0 18px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.tape-rows .t { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tape-rows .k { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-rows .m { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-rows .f { font-family: var(--mono); font-size: 13px; color: var(--text-2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tape-rows .f.up { color: var(--up); }
.tape-rows .f.down { color: var(--down); }
.tape-rows .empty { display: block; height: auto; padding: 18px; color: var(--text-3); border: 0; }
.tape-rows li.new { animation: arrive 1.6s ease-out; }
@keyframes arrive { from { background: rgba(151, 253, 228, 0.12); } to { background: transparent; } }

/* Home: sections */
.band { border-top: 1px solid var(--line); padding-top: 72px; padding-bottom: 72px; }
.band h2 {
    font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem, 3vw, 2.3rem);
    line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 12px; text-wrap: balance;
}
.band-intro { color: var(--text-2); max-width: 40em; margin: 0 0 36px; }

/* The console: a question, the tool call, the live answer */
.ask-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 32px; align-items: start; }
.prompts { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.prompts button {
    text-align: left; font: 400 16px/1.45 var(--sans); color: var(--text-3);
    background: none; border: 0; border-bottom: 1px solid var(--line); padding: 16px 0; cursor: pointer;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: baseline;
}
.prompts button span:last-child { font: 400 12.5px var(--mono); color: var(--text-3); }
.prompts button:hover { color: var(--text-2); }
.prompts button[aria-selected="true"] { color: var(--text); }
.prompts button[aria-selected="true"] span:last-child { color: var(--teal); }

.console { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.console-call {
    font-family: var(--mono); font-size: 13px; padding: 14px 18px; border-bottom: 1px solid var(--line);
    color: var(--text-2); overflow-x: auto; white-space: nowrap;
}
.console-call .srv { color: var(--text-3); }
.console-call .tool { color: var(--teal); }
.console-out {
    margin: 0; padding: 16px 18px; height: 400px; overflow: auto;
    font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--text-2);
}
.console-out .k { color: rgba(255, 255, 255, 0.5); }
.console-out .s { color: var(--text); }
.console-out .n { color: var(--teal); }
.console-out .l { color: var(--orange); }
.console-out .c { color: var(--text-3); }
.console-note { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }

/* Two parts, as spec sheets */
.parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; }
.part h2 { margin-bottom: 8px; }
.part > p { color: var(--text-2); margin: 0 0 24px; max-width: 32em; }
.part dl { margin: 0 0 20px; border-top: 1px solid var(--line); }
.part dl div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.part dt { color: var(--text-3); font-size: 14px; }
.part dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.part dd code { font-family: var(--mono); font-size: 13.5px; color: var(--text-2); }

/* Terms: what it costs, what we are */
.terms p { margin: 0; max-width: 30em; }
.terms .statement {
    font-family: var(--display); font-weight: 500; font-size: clamp(1.4rem, 2.6vw, 2rem);
    line-height: 1.25; letter-spacing: -0.02em; color: var(--text); text-wrap: balance;
}
.terms .statement a { white-space: nowrap; }
.terms .after { margin-top: 20px; color: var(--text-2); max-width: 40em; }

/* Docs */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-top: 40px; padding-bottom: 64px; }
.docs-nav { position: sticky; top: 24px; align-self: start; }
.docs-nav p { margin: 0 0 8px; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav li a { display: block; padding: 6px 10px; border-radius: var(--radius); color: var(--text-2); font-size: 15px; }
.docs-nav li a:hover { color: var(--text); text-decoration: none; }
.docs-nav li a.active { color: var(--text); background: var(--surface); }
.docs-nav .md { display: inline-block; margin-top: 16px; font-size: 13px; padding-left: 10px; }

.prose { max-width: 760px; }
.prose h1 { font-family: var(--display); font-weight: 600; font-size: 2.3rem; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 18px; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 1.45rem; letter-spacing: -0.015em; margin: 44px 0 12px; }
.prose h3 { font-size: 1.05rem; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; color: var(--text-2); }
.prose strong { color: var(--text); }
.prose p, .prose li { overflow-wrap: anywhere; }
.prose td { overflow-wrap: break-word; }
.prose li { margin-bottom: 4px; }
.prose code {
    font-family: var(--mono); font-size: 0.86em; background: var(--surface);
    border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--text);
}
.prose pre {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; overflow-x: auto; margin: 0 0 16px;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: 13.5px; }
.prose blockquote {
    margin: 0 0 16px; padding: 12px 16px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.table { overflow-x: auto; margin: 0 0 16px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.prose td { color: var(--text-2); }
.prose th { color: var(--text-3); font-weight: 500; font-size: 14px; }

/* A page of its own (roadmap, token) */
.page { padding-top: 48px; padding-bottom: 64px; }
.page .prose h3 { color: var(--text); }

/* The token page's live figures (token.js). Chart colors: the validated categorical
   slots 1-3 for a dark surface (dataviz palette), checked against --surface. */
.frac-live { --seg-pool: #3987e5; --seg-top: #d95926; --seg-rest: #199e70; margin: 0 0 16px; }
.frac-note { color: var(--text-3); font-size: 14px; }
.frac-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 24px; }
.frac-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.frac-stats b { display: block; font-family: var(--display); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; color: var(--text); font-variant-numeric: tabular-nums; }
.frac-stats span { color: var(--text-3); font-size: 14px; }
.seg-bar { display: flex; gap: 2px; height: 12px; margin: 0 0 12px; }
.seg { min-width: 2px; flex-basis: 0; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg:focus { outline: 2px solid var(--text); outline-offset: 2px; }
.seg-pool { background: var(--seg-pool); }
.seg-top { background: var(--seg-top); }
.seg-rest { background: var(--seg-rest); }
.seg-legend { list-style: none; padding: 0 !important; margin: 0 0 16px; }
.seg-legend li { display: grid; grid-template-columns: 12px 1fr auto 64px; gap: 10px; align-items: center; padding: 4px 0; color: var(--text); }
.seg-legend .swatch { width: 12px; height: 12px; border-radius: 3px; }
.seg-legend .fig { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.seg-tip {
    position: absolute; z-index: 10; pointer-events: none; max-width: 280px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 6px 10px; font-size: 14px; color: var(--text);
}
.holders .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.holders .addr { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-top: 28px; padding-bottom: 40px; color: var(--text-3); font-size: 14px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer nav a { color: var(--text-2); }
.site-footer nav a:hover { color: var(--text); }
.site-footer .note { margin: 0; max-width: 56ch; }

@media (max-width: 960px) {
    .hero { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 48px; padding-bottom: 56px; }
    .ask-grid, .parts { grid-template-columns: minmax(0, 1fr); }
    .parts { gap: 56px; }
    .band { padding-top: 56px; padding-bottom: 56px; }
}

@media (max-width: 860px) {
    .docs { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 24px; }
    .docs-nav { position: static; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
    .docs-nav ul { display: flex; flex-wrap: wrap; gap: 4px; }
    .docs-nav .md { display: none; }
}

@media (max-width: 640px) {
    /* Phone: the brand and "Open app" on the first line, the menu beneath. */
    .site-header .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 8px; gap: 8px 16px; }
    .brand { order: 1; }
    .open-app { order: 2; margin-left: auto; min-height: 36px; padding: 0 14px; }
    .site-nav { order: 3; flex-basis: 100%; margin-left: 0; gap: 20px; }
    .tape-rows li { grid-template-columns: 58px minmax(0, 1fr) auto; }
    .tape-rows .k { display: none; }
    .tape-rows li { padding: 0 14px; }
    .console-out { height: 340px; }
    .part dl div { grid-template-columns: 88px minmax(0, 1fr); }
}

@media (max-width: 560px) {
    .frac-stats { grid-template-columns: 1fr; }
    .seg-legend li { grid-template-columns: 12px 1fr auto; }
    .seg-legend li .fig:last-child { grid-column: 3; }
    .seg-legend li .fig:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tape-rows li.new { animation: none; }
}
