/* Shared tokens and parts. Direction "Slash" (design/brand/brand-board.html):
   warm near-black, bone ink, ONE accent (vermilion: the slash that replaces the I in T/LT).
   The loss uses the accent on purpose: it is the colour of the slash.
   The buy colour stays on numbers that carry a buy, nowhere else.
   Type: Bricolage Grotesque (display + UI, no italics) and IBM Plex Mono (data). */

@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/Bricolage-var-latin.woff2') format('woff2-variations'), url('../fonts/Bricolage-var-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face { font-family: 'Plex Mono'; src: url('../fonts/IBMPlexMono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/IBMPlexMono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  /* named palette (brand board) */
  --night: #0B0C0E;
  --deep: #111214;
  --graphite: #1D1E21;
  --steel: #A8A49B;
  --salt: #EDEAE3;
  --vermilion: #FF4A1C;
  /* roles */
  --bg: var(--night);
  --panel: var(--deep);
  --raised: #16171A;
  --raised2: var(--graphite);
  --ink: var(--salt);
  --ink2: var(--steel);
  --ink3: #7D7A73;
  --hair: rgba(237, 234, 227, 0.13);
  --hair2: rgba(237, 234, 227, 0.07);
  --accent: var(--vermilion);
  --loss: var(--vermilion);
  --loss-dim: rgba(255, 74, 28, 0.14);
  --gain: #5CC8A0;
  --gain-dim: rgba(92, 200, 160, 0.13);
  --glass1: rgba(14, 14, 16, 0.58);
  --glass2: rgba(14, 14, 16, 0.30);
  --sans: 'Bricolage', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r: 6px;
  /* motion: strong curves, UI ceiling 300 ms, never ease-in */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: rgba(237,234,227,.18) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(237,234,227,.16); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(237,234,227,.28); background-clip: content-box; border: 3px solid transparent; }
:focus { outline: none; }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
a { color: inherit; }
img, canvas, svg { display: block; }
button { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--gain); }
.down { color: var(--loss); }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Labels: mono, small caps feel */
.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink3);
  font-weight: 400;
}

/* Wordmark: T/LT, the I is the vermilion slash (design/brand/logo/v2, vectorised from the
   chosen generated board). The letters stay in the DOM for the name switch in js/brand.js:
   when the name is not the one drawn in the logo, html gets .no-logo and the text shows. */
.wm {
  font-family: var(--sans);
  font-weight: 800;
  font-stretch: 75%;
  font-variation-settings: 'opsz' 96;
  letter-spacing: 0.012em;
  line-height: 0.8;
  display: inline-flex;
  align-items: flex-end;
  white-space: nowrap;
}
html:not(.no-logo) .wm {
  width: 3.72em; height: 1em; overflow: hidden; color: transparent; font-size: 0.82em;
  background: url('../img/wordmark.svg') left center / contain no-repeat;
}
/* Buttons */
.btn {
  --h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--h);
  padding: 0 20px;
  border-radius: var(--r);
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 560;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease), opacity 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: rgba(237,234,227,.32); background: rgba(237,234,227,.04); }
  .btn.primary:hover { background: #fff; }
  .btn:hover .arrow { transform: translateX(3px); }
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--ink); color: var(--night); border-color: var(--ink); }
.btn.sm { --h: 44px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn .arrow { font-family: var(--mono); font-weight: 400; transition: transform 0.2s var(--ease); }

/* Site frame (hairline around the viewport, corner ticks) */
.frame { position: fixed; inset: 12px; border: 1px solid var(--hair); pointer-events: none; z-index: 40; }
.frame::before, .frame::after { content: ''; position: absolute; width: 9px; height: 9px; border: 1px solid rgba(237,234,227,.5); }
.frame::before { left: -5px; top: -5px; border-width: 0 1px 1px 0; }
.frame::after { right: -5px; bottom: -5px; border-width: 1px 0 0 1px; }
@media (max-width: 640px) { .frame { inset: 6px; } }

/* Top bar */
.topbar {
  position: fixed; left: 12px; right: 12px; top: 12px; z-index: 30;
  display: flex; align-items: center; gap: 28px;
  height: 64px; padding: 0 22px;
  transition: background-color 0.3s var(--ease), height 0.3s var(--ease), border-color 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.topbar.compact { height: 54px; background: rgba(11,12,14,.82); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom-color: var(--hair); }
.topbar .brand { text-decoration: none; font-size: 30px; display: inline-flex; align-items: center; gap: 10px; padding: 6px 0; min-height: 44px; }
.topbar nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar nav a { text-decoration: none; color: var(--ink2); font-size: 14.5px; font-weight: 480; padding: 10px 12px; border-radius: var(--r); transition: color 0.18s var(--ease), background-color 0.18s var(--ease); }
.topbar nav a:hover, .topbar nav a[aria-current='page'] { color: var(--ink); }
.topbar nav a:hover { background: rgba(237,234,227,.05); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
@media (max-width: 860px) { .topbar nav { display: none; } }
@media (max-width: 640px) { .topbar { left: 6px; right: 6px; top: 6px; padding: 0 14px; height: 56px; gap: 12px; } .topbar .brand { font-size: 26px; } }

/* Demo banner: discreet, always present in demo mode */
.demo-flag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink2); border: 1px solid rgba(237,234,227,.22); border-radius: var(--r);
  padding: 4px 10px; white-space: nowrap;
}

/* Popover menu (wallet list, etc.) */
.menu {
  position: absolute; z-index: 60; min-width: 240px;
  background: var(--raised); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 6px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.8);
  transform-origin: top right; animation: pop 0.18s var(--ease) both;
}
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; background: transparent; border-radius: 4px; text-align: left; text-decoration: none; cursor: pointer; font-size: 14.5px; }
.menu button:hover, .menu a:hover { background: rgba(237,234,227,.06); }
.menu img { width: 22px; height: 22px; border-radius: 5px; }
.menu .label { padding: 8px 12px 4px; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--raised); border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 16px; font-size: 14px; max-width: 340px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); animation: toastIn 0.32s var(--spring) both; }
.toast.out { animation: toastOut 0.2s var(--ease) both; }
.toast b { font-weight: 600; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@media (max-width: 640px) { .toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; } }

/* ---------- shared brand parts (landing, docs, stats; the app can opt in) ---------- */

/* Capsule header: one glass capsule, logo + links + CTA inside. The only rounded shape. */
.topbar.capsule {
  left: 50%; right: auto; top: 14px; transform: translateX(-50%);
  /* aligned on the page gutter: the logo sits on the same left edge as the content */
  width: calc(100% - 2 * (clamp(28px, 5vw, 84px) - 8px)); max-width: 1440px; height: 58px; padding: 0 8px 0 20px;
  border-radius: 99px; border: 1px solid rgba(237,234,227,.12);
  background: linear-gradient(160deg, rgba(14,14,16,.42), rgba(14,14,16,.22));
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 40px -24px rgba(0,0,0,.7);
  transition: background-color 0.3s var(--ease), height 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.topbar.capsule.compact { height: 52px; background: linear-gradient(160deg, rgba(11,12,14,.86), rgba(11,12,14,.72)); border-bottom-color: rgba(237,234,227,.12); }
.topbar.capsule .brand { font-size: 25px; min-height: 44px; }
.topbar.capsule .btn { border-radius: 99px; }
@media (max-width: 640px) {
  .topbar.capsule { top: 8px; width: calc(100% - 16px); height: 54px; padding: 0 6px 0 14px; left: 50%; right: auto; }
  .topbar.capsule .brand { font-size: 23px; }
}

/* Layered glass (design 05 step 2, night version) */
.glass {
  position: relative; isolation: isolate;
  background: linear-gradient(160deg, var(--glass1), var(--glass2));
  backdrop-filter: blur(26px) saturate(160%) brightness(1.03); -webkit-backdrop-filter: blur(26px) saturate(160%) brightness(1.03);
  border-radius: var(--r);
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.75);
}
.glass::before { /* conic rim: the light turns around the edge */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.2px; pointer-events: none;
  background: conic-gradient(from 210deg, rgba(255,255,255,.34), rgba(255,255,255,.06) 25%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.05) 75%, rgba(255,255,255,.34));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass::after { /* top highlight + edge lens */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), inset 0 0 22px rgba(255,255,255,.05);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: rgba(14,14,16,.92); } }

/* Mono chips: square corners, never pills */
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em; color: var(--ink2);
  border: 1px solid rgba(237,234,227,.14); border-radius: 4px; background: rgba(237,234,227,.04);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 500; }
.accent { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; }
}

/* Inner pages: the horizon of the hero scene as a quiet band under the capsule */
.page-scene {
  position: absolute; left: 0; right: 0; top: 0; height: 320px; z-index: -1; pointer-events: none;
  /* the left of the scene only: sky and the vermilion horizon, never the beam behind text */
  background: url('../img/hero-1280.webp') 0% 47% / max(240%, 2400px) auto no-repeat;
  -webkit-mask: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.12) 45%, transparent 88%);
          mask: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.12) 45%, transparent 88%);
}
body:has(.page-scene) { position: relative; isolation: isolate; }
.topbar.capsule .brand .wm::before { width: 1.2em; height: 1.2em; margin-right: 0.22em; }
