/* Structure and components, reading only tokens. ptf.css comes after this one and draws the market: fund cards and
   their allocation bars, charts, the heatmap, the screener and each page's layout. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100svh; background: var(--bg); color: var(--ink); font: 400 16px/1.55 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(--act); outline-offset: 2px; }
::selection { background: var(--act); color: var(--on-act); }

/* ---------- the raised card (the hero's quote card, the closing band): the same tokens, one step lighter ---------- */
.night {
  --bg-rgb: 22, 22, 24; --bg-2-rgb: 12, 12, 14; --surface-rgb: 30, 30, 34; --surface-2-rgb: 36, 36, 40;
  --bg: rgb(22, 22, 24); --bg-2: rgb(12, 12, 14); --surface: rgb(30, 30, 34); --surface-2: rgb(36, 36, 40); --surface-3: #34343a;
  color: var(--ink);
}

/* ---------- type ---------- */
h1, h2, .display { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.04; text-wrap: balance; }
h1 { font-size: clamp(38px, 5vw, 66px); }
h2 { font-size: clamp(28px, 3.3vw, 44px); }
h3, .h3 { font: 700 18px/1.3 var(--font-text); letter-spacing: -0.01em; }
/* the second beat of a headline: the same serif, in italic and mint */
.grad { font-style: italic; color: var(--act-ink); }
.accent { color: var(--act-ink); }
.lede { font-size: clamp(16px, 1.35vw, 19px); color: var(--ink-2); max-width: 36em; }
.lede b { color: var(--ink); font-weight: 650; }
.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); }
/* a kicker is a printed section label: a short rule, then the words */
.kicker { display: inline-flex; align-items: center; gap: 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 14px; }
.kicker::before { content: ""; width: 22px; height: 2px; background: var(--ink); }
.kicker-dot { display: none; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- 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(32px, 4.4vw, 60px); padding-bottom: 24px; display: grid; gap: 14px; justify-items: start; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head p { max-width: 34em; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
main { padding-bottom: 120px; min-height: 60vh; overflow-x: clip; }
main.enter { animation: page-in var(--t) var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------- header ---------- */
#top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line-2); }
.top-bar { height: var(--top-h); display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.lockup { display: inline-flex; align-items: center; gap: 11px; }
.lockup > svg { height: 32px; width: auto; }
.lockup .brand-word { display: inline-flex; flex-direction: column; line-height: 1; }
.lockup .brand-word svg { height: 20px; width: auto; color: var(--ink); }
.lockup .brand-sub { font: 600 8.5px/1 var(--font-mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
.nav { display: flex; align-items: center; gap: 2px; height: 100%; }
.nav .ca.small { margin-left: 12px; }
.nav a { position: relative; display: inline-flex; align-items: center; height: 100%; padding: 0 12px; color: var(--ink-2); font-size: 14.5px; font-weight: 600; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--ink); }
.nav a[aria-current]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--act); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.market-status { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 2px; color: var(--ink-2); font: 600 11px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.demo-strip { background: var(--gold); color: var(--on-light); font: 12.5px/1.4 var(--font-mono); text-align: center; padding: 6px var(--gut); }
.demo-strip b { font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.tabbar { display: none; }

/* ---------- 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-3); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 0 rgba(var(--line-rgb), 0.08); transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
/* the main action: a mint key with a darker green edge under it, pressed down on click */
.btn.primary { background: var(--act); color: var(--on-act); border-color: var(--act-2); box-shadow: var(--key); }
.btn.primary:hover { background: var(--act-2); border-color: var(--act-3); box-shadow: var(--key-hover); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(2px); box-shadow: var(--key-down); }
.btn.buy { background: var(--up-fill); color: #fff; border-color: var(--up); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 0 #0b4d24, 0 8px 20px -8px rgba(var(--up-rgb), 0.6); }
.btn.sell { background: var(--down-fill); color: #fff; border-color: var(--down); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 0 #7f1d1d, 0 8px 20px -8px rgba(var(--down-rgb), 0.55); }
.btn.sell:hover { background: var(--down); }
.btn.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.lg { height: 52px; padding: 0 24px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: var(--surface-3); }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--act-ink); font-weight: 700; }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; }
.icon { display: inline-flex; }

/* ---------- chips, banners ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.chip.done { color: var(--up); border-color: rgba(var(--up-rgb), 0.3); background: var(--up-soft); }
.chip.demo, .chip.ipo { color: var(--on-light); border-color: transparent; background: var(--gold); }
.chip.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.banner { margin-top: 20px; padding: 14px 18px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); }
.banner.good { border-color: rgba(var(--up-rgb), 0.35); background: var(--up-soft); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); flex: none; box-shadow: 0 0 0 0 rgba(var(--up-rgb), 0.5); animation: live 2.4s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 6px rgba(var(--up-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--up-rgb), 0); } }

/* ---------- segmented controls ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 30px; padding: 0 12px; border-radius: 5px; border: 0; background: none; color: var(--ink-2); cursor: pointer; font: 600 12.5px var(--font-mono); letter-spacing: 0.02em; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(var(--line-rgb), 0.12), 0 0 0 1px var(--line-2); }
.night .seg button[aria-pressed="true"] { background: var(--surface-3); box-shadow: none; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.controls .search { margin-left: auto; width: min(320px, 100%); }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; margin-top: 18px; }
.field > .label { color: var(--ink-2); }
.input { width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-3); background: var(--surface); font-size: 16px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.input[aria-invalid] { border-color: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.prefix { display: flex; align-items: center; border-radius: var(--r-sm); border: 1px solid var(--line-3); background: var(--surface); padding-left: 14px; }
.prefix > span { 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; box-shadow: none; }
.prefix.suffix .input { padding-left: 14px; }
.prefix:focus-within { border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.problem { justify-self: start; font-size: 13.5px; color: var(--down); background: var(--down-soft); border: 1px solid rgba(var(--down-rgb), 0.3); border-radius: 6px; padding: 4px 9px; }
.problem:empty { display: none; }
.hint { font-size: 13px; }
.drop { display: grid; place-items: center; width: 100%; min-height: 128px; border-radius: var(--r); border: 1.5px dashed var(--line-3); background: var(--surface-2); cursor: pointer; padding: 16px; text-align: center; color: var(--ink-2); }
.drop.over, .drop:hover { border-color: var(--act); background: var(--act-soft); }
.drop img { width: 104px; height: 104px; object-fit: cover; border-radius: var(--r-sm); }
.drop-inner { display: grid; gap: 6px; justify-items: center; }
details.links { margin-top: 18px; }
details.links summary { cursor: pointer; color: var(--ink-2); }

/* ---------- panels ---------- */
.card { border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--surface); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.skeleton .sk { border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--bg-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.sk-head { height: 40px; } .sk-line { height: 14px; } .sk-line.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- stats, CA box ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.stat { display: grid; gap: 4px; }
.stat-value { font: 700 22px/1.1 var(--font-mono); letter-spacing: -0.02em; }
.stat-hint { font-size: 12px; }
.ca { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px dashed var(--line-3); max-width: 100%; background: var(--surface); }
.ca-addr { font-size: 13px; word-break: break-all; user-select: all; }
.ca-soon { color: var(--on-light); background: var(--gold); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.ca-note { font-size: 13px; flex-basis: 100%; color: var(--muted); }
/* the header's CA pill: a light pill with a gold "soon" */
.ca.small { margin: 0; padding: 0 5px 0 11px; height: 32px; flex-wrap: nowrap; gap: 8px; border: 0; border-radius: 6px; background: var(--ink); }
.ca.small .label { font-size: 10.5px; font-weight: 700; color: var(--on-light); white-space: nowrap; }
.ca.small .ca-soon { padding: 3px 8px; font-size: 10.5px; }
.ca.small .ca-addr { color: var(--on-light); font-size: 12px; }
/* the header pill never shrinks: its short address stays on one line; on mid-size screens the market status gives way */
.ca.small { flex: none; }
.ca.small .ca-addr { white-space: nowrap; word-break: normal; }
@media (max-width: 1200px) { .market-status { display: none; } }
@media (max-width: 1100px) { .nav a { padding: 0 9px; } .nav a[aria-current]::after { left: 9px; right: 9px; } }

/* ---------- the trade feed ---------- */
.feed { display: grid; }
.feed-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto 80px; gap: 14px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--line); font: 13.5px/1.35 var(--font-mono); }
.feed-row:last-child { border-bottom: 0; }
.feed-side { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; border-radius: 4px; padding: 3px 0; }
.feed-side.buy { background: var(--up-soft); color: var(--up); }
.feed-side.sell { background: var(--down-soft); color: var(--down); }
.feed-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.feed-text a { color: var(--ink); font-weight: 700; }
.tx { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--ink-2); }
.tx:hover { color: var(--act-ink); }
.feed-time { font-size: 12px; text-align: right; color: var(--muted); }

/* ---------- empty states ---------- */
.empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 52px 16px; }
.empty h3 { font: 600 24px/1.15 var(--font-display); letter-spacing: -0.015em; }
.more { display: grid; justify-items: center; margin-top: 24px; }

/* ---------- wallet ---------- */
.wallet-box { position: relative; }
.wallet-btn { background: var(--act); color: var(--on-act); border-color: var(--act-2); box-shadow: var(--key); }
.wallet-btn:hover { background: var(--act-2); border-color: var(--act-3); box-shadow: var(--key-hover); }
.wallet-btn:active { transform: translateY(2px); box-shadow: var(--key-down); }
.wallet-btn.on { padding: 0 12px; gap: 9px; background: var(--surface); color: var(--ink); border-color: var(--line-3); box-shadow: 0 1px 0 rgba(var(--line-rgb), 0.08); }
.wallet-btn.on:hover { border-color: var(--ink); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 8px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); box-shadow: var(--shadow-lift); 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: 15px; }
.menu-item:hover { background: var(--surface-2); }
.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-2); background: var(--surface); cursor: pointer; text-align: left; }
.wallet-row:hover:not([disabled]) { border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.wallet-row[disabled] { opacity: 0.6; cursor: default; }
.wallet-row img { border-radius: 6px; }
.wallet-name { flex: 1; font-weight: 700; }
.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(0, 0, 0, 0.6); backdrop-filter: blur(3px); animation: fade var(--t) var(--ease); }
.modal-panel { width: min(480px, 100%); max-height: calc(100svh - 32px); overflow: auto; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.8); padding: 22px; animation: pop 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: 24px; }
.modal-panel.locked .modal-x { visibility: hidden; }
.modal-body { display: grid; gap: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; }
.toast { padding: 9px 16px; border-radius: 8px; background: var(--ink); color: var(--on-light); font: 13.5px var(--font-mono); box-shadow: var(--shadow-lift); animation: pop var(--t) var(--ease); }
.toast.bad { background: var(--down); color: var(--on-light); }

/* ---------- footer ---------- */
#foot { border-top: 1px solid var(--line-2); background: var(--surface); padding: 56px 0 calc(48px + env(safe-area-inset-bottom)); }
.foot { display: grid; grid-template-columns: 1fr auto; gap: 28px; }
.foot-brand .lockup > svg { height: 38px; }
.foot-brand .lockup .brand-word svg { height: 24px; }
.foot-brand p { margin-top: 14px; color: var(--muted); max-width: 30em; }
.foot-links { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 36px; align-content: start; font-size: 15px; color: var(--ink-2); }
.foot-links a:hover { color: var(--act-ink); }
.foot-base { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font: 12px/1.5 var(--font-mono); padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); }

/* ---------- 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: 960px) {
  .nav, .top-actions .ca, .market-status { display: none; }
  .tabbar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 25; display: flex; justify-content: space-around; padding: 5px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.8); }
  .tabbar a { padding: 9px 10px; border-radius: 8px; color: var(--ink-2); font: 600 12.5px var(--font-mono); }
  .tabbar a[aria-current] { background: var(--act); color: var(--on-act); }
  .controls .search { margin-left: 0; width: 100%; }
  .feed-row { grid-template-columns: 50px minmax(0, 1fr) 54px; }
  .feed-row .tx { display: none; }
  #foot { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  .two { grid-template-columns: 1fr; }
  .foot { grid-template-columns: 1fr; }
  .wallet-btn.on .muted { display: none; }
  .top-bar { gap: 12px; }
  .lockup .brand-sub { display: none; }
}
