/* ==========================================================================
   LiquidTrader Demo — shared styles
   ========================================================================== */

:root {
  --bg: #05070d;
  --bg-2: #0a0e18;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --text-faint: #5f6a80;
  --accent: #2de2c4;
  --accent-2: #4f8cff;
  --accent-3: #9b6bff;
  --up: #22d39b;
  --down: #ff5c7a;
  --grad: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(5, 7, 13, 0.65);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; }
.brand span b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }
.topnav { display: flex; align-items: center; gap: 28px; font-size: 14px; color: var(--text-dim); }
.topnav a:hover { color: var(--text); }
.topnav .pill {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text);
  transition: background .2s, border-color .2s;
}
.topnav .pill:hover { background: var(--surface-2); border-color: var(--accent); }
@media (max-width: 720px) { .topnav a:not(.pill) { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 28px; border-radius: 999px;
  font-weight: 600; font-size: 16px; letter-spacing: 0.01em;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .2s ease, box-shadow .25s ease, background .2s;
}
.btn-primary {
  background: var(--grad); color: #04121a;
  box-shadow: 0 10px 40px -10px rgba(45, 226, 196, 0.55), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 50px -10px rgba(79, 140, 255, 0.7), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-primary .arrow { transition: transform .25s ease; }
.btn-primary:hover .arrow { transform: translateX(5px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }

/* ---------- Home: hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(64px, 10vw, 120px) clamp(16px, 4vw, 48px) 80px;
  text-align: center;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; animation: drift 22s ease-in-out infinite alternate; }
.blob.b1 { width: 520px; height: 520px; background: #0fb9a0; top: -160px; left: -120px; }
.blob.b2 { width: 600px; height: 600px; background: #2f5bff; top: -80px; right: -200px; animation-delay: -6s; opacity: .4; }
.blob.b3 { width: 460px; height: 460px; background: #7b3dff; top: 320px; left: 35%; animation-delay: -12s; opacity: .3; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-40px, 80px) scale(.95); }
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}
.hero-inner { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; color: var(--text-dim); margin-bottom: 28px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 10px var(--up); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 84px); line-height: 1.02; letter-spacing: -0.035em;
  font-weight: 600; margin: 0 0 24px;
}
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(17px, 2vw, 20px); color: var(--text-dim); max-width: 640px; margin: 0 auto 40px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Terminal mock */
.terminal {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 72px auto 0;
  border-radius: 18px; border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(16, 22, 36, .92), rgba(8, 11, 20, .96));
  box-shadow: 0 50px 120px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.02), 0 0 80px -20px rgba(45,226,196,.25);
  overflow: hidden; text-align: left;
  transform: perspective(1800px) rotateX(6deg);
  transform-origin: top center;
}
.term-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-faint); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #2a3142; display: inline-block; }
.term-bar .sym { margin-left: 14px; color: var(--text); font-family: var(--mono); font-weight: 600; }
.term-bar .px { font-family: var(--mono); color: var(--up); }
.term-bar .chg { font-family: var(--mono); color: var(--up); }
.term-body { display: grid; grid-template-columns: 1fr 260px; min-height: 360px; }
.term-chart { position: relative; border-right: 1px solid var(--border); }
.term-chart canvas { width: 100%; height: 100%; display: block; }
.term-side { padding: 14px; font-family: var(--mono); font-size: 12px; }
.term-side h4 { margin: 0 0 10px; font-family: var(--font); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); font-weight: 600; }
.book-row { display: grid; grid-template-columns: 1fr 1fr; padding: 3px 6px; position: relative; }
.book-row span:last-child { text-align: right; color: var(--text-dim); }
.book-row .bar { position: absolute; right: 0; top: 0; bottom: 0; opacity: .14; border-radius: 3px; }
.book-row.ask span:first-child { color: var(--down); }
.book-row.ask .bar { background: var(--down); }
.book-row.bid span:first-child { color: var(--up); }
.book-row.bid .bar { background: var(--up); }
.book-mid { text-align: center; padding: 8px 0; font-size: 15px; color: var(--text); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 6px 0; }
@media (max-width: 760px) {
  .term-body { grid-template-columns: 1fr; }
  .term-side { display: none; }
  .term-chart { border-right: 0; min-height: 280px; }
  .terminal { transform: none; }
}

/* ---------- Ticker strip ---------- */
.ticker { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; background: var(--bg-2); }
.ticker-track { display: flex; gap: 48px; padding: 14px 0; width: max-content; animation: scroll 50s linear infinite; font-family: var(--mono); font-size: 13px; }
.ticker-track span b { color: var(--text); margin-right: 8px; font-weight: 600; }
.ticker-track .up { color: var(--up); }
.ticker-track .down { color: var(--down); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 110px) clamp(16px, 4vw, 48px); max-width: 1200px; margin: 0 auto; }
.section-head { max-width: 640px; margin-bottom: 52px; }
.section-head .kicker { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.section-head h2 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.025em; line-height: 1.1; margin: 12px 0 14px; font-weight: 600; }
.section-head p { color: var(--text-dim); margin: 0; font-size: 18px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.feature {
  position: relative; padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .25s, transform .25s, background .25s;
  overflow: hidden;
}
.feature::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: var(--grad); opacity: 0; transition: opacity .3s;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.feature:hover { transform: translateY(-4px); background: var(--surface-2); }
.feature:hover::before { opacity: 1; }
.feature .icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(45,226,196,.15), rgba(79,140,255,.15));
  border: 1px solid var(--border-strong); margin-bottom: 20px; color: var(--accent);
}
.feature h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.feature p { margin: 0; color: var(--text-dim); font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--bg); padding: 34px 28px; }
.stat .num { font-family: var(--font-display); font-size: 42px; font-weight: 600; letter-spacing: -0.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--text-dim); font-size: 14px; }

.cta-band {
  margin: 0 clamp(16px, 4vw, 48px) 90px; padding: clamp(40px, 6vw, 72px);
  border-radius: 24px; text-align: center; position: relative; overflow: hidden;
  border: 1px solid var(--border-strong);
  background: radial-gradient(ellipse at 20% 0%, rgba(45,226,196,.22), transparent 55%),
              radial-gradient(ellipse at 90% 100%, rgba(155,107,255,.22), transparent 55%),
              var(--bg-2);
}
.cta-band h2 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.025em; margin: 0 0 14px; font-weight: 600; }
.cta-band p { color: var(--text-dim); margin: 0 0 32px; font-size: 18px; }

.footer { border-top: 1px solid var(--border); padding: 28px clamp(16px, 4vw, 48px); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--text-faint); font-size: 13px; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .blob, .ticker-track, .eyebrow .dot { animation: none; }
}

/* ==========================================================================
   Demo page
   ========================================================================== */
body.demo { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.demo-shell { flex: 1; display: grid; grid-template-columns: var(--sidebar-w, 300px) 1fr; min-height: 0; }

.sidebar {
  position: relative; z-index: 2; border-right: 1px solid var(--border); background: var(--bg-2);
  display: flex; flex-direction: column; min-height: 0;
}
/* Drag handle on the menu's right edge (width is set by demo.js through --sidebar-w). */
.sidebar-resizer { position: absolute; top: 0; bottom: 0; right: -5px; width: 10px; cursor: col-resize; touch-action: none; }
.sidebar-resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px;
  background: var(--accent); opacity: 0; transition: opacity .15s;
}
.sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, body.resizing .sidebar-resizer::after { opacity: 1; }
.sidebar-resizer:focus { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing .content { pointer-events: none; }
/* Wide screens: no top bar, so the video gets the full window height. Logo and Home sit at the top of the menu. */
body.demo .topbar { display: none; }
.sidebar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; padding: 16px 16px 0; }
.sidebar-head .brand { font-size: 18px; }
.sidebar-head .brand-mark { width: 28px; height: 28px; }
.home-link {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text);
  font-size: 13px; white-space: nowrap; transition: background .2s, border-color .2s;
}
.home-link:hover { background: var(--surface-2); border-color: var(--accent); }
.sidebar-search { padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-search input {
  width: 100%; padding: 10px 12px 10px 36px; border-radius: 10px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235f6a80' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
  border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.sidebar-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,226,196,.15); }
.tree { flex: 1; overflow-y: auto; padding: 10px 10px 30px; font-size: 14px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { margin-left: 14px; padding-left: 10px; border-left: 1px solid var(--border); }
.tree-branch > button, .tree-leaf > a {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  color: var(--text-dim); font: inherit; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.tree-branch > button:hover, .tree-leaf > a:hover { background: var(--surface-2); color: var(--text); }
.tree > ul > .tree-branch > button { color: var(--text); font-weight: 600; margin-top: 4px; }
.tree-branch > button .chev { width: 14px; height: 14px; flex: none; transition: transform .2s; color: var(--text-faint); }
.tree-branch.open > button .chev { transform: rotate(90deg); }
.tree-branch > ul { display: none; }
.tree-branch.open > ul { display: block; }
.tree .cat-icon { width: 18px; height: 18px; flex: none; color: var(--accent); }
.tree-leaf > a .play { width: 14px; height: 14px; flex: none; opacity: .5; }
.tree-leaf > a.active { background: linear-gradient(90deg, rgba(45,226,196,.16), rgba(79,140,255,.06)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.tree-leaf > a.active .play { opacity: 1; color: var(--accent); }
.tree-branch > button .play { width: 14px; height: 14px; flex: none; opacity: .5; }
.tree-branch > button.current { background: rgba(45,226,196,.09); color: var(--text); }
.tree-branch > button.current .play { opacity: 1; color: var(--accent); }
.tree-chapter .ch-time { margin-left: auto; padding-left: 8px; font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.tree-leaf > a.tree-chapter.active, .tree-chapter.active .ch-time { color: var(--accent); }
.tree .count { margin-left: auto; font-size: 11px; color: var(--text-faint); font-weight: 500; }
.tree-empty { padding: 20px 12px; color: var(--text-faint); font-size: 14px; }
mark { background: rgba(45,226,196,.25); color: var(--text); border-radius: 3px; }

/* Right-hand frame: the video fills it completely (letterboxed, never cropped). */
.content { position: relative; min-height: 0; overflow: hidden; background: #000; }
.view, .player { position: absolute; inset: 0; }
.player { background: #000; }
.player video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at 30% 20%, rgba(45,226,196,.18), transparent 60%),
              radial-gradient(ellipse at 80% 90%, rgba(155,107,255,.18), transparent 60%), #070a12;
}
.placeholder .ring {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center;
  background: var(--grad); color: #04121a; box-shadow: 0 0 50px rgba(45,226,196,.45);
}
.placeholder h3 { margin: 0 0 6px; font-size: 20px; }
.placeholder p { margin: 0; color: var(--text-dim); font-size: 14px; }
.placeholder code { font-family: var(--mono); font-size: 12px; color: var(--accent); background: rgba(255,255,255,.05); padding: 2px 6px; border-radius: 5px; }

.menu-toggle { display: none; background: none; border: 1px solid var(--border-strong); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 14px; }
@media (max-width: 860px) {
  .demo-shell { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; }
  .sidebar-resizer { display: none; }
  body.demo .topbar { display: flex; } /* phones keep the top bar: it holds the Menu button */
  .sidebar-head { display: none; }
  .sidebar {
    position: fixed; top: 63px; bottom: 0; left: 0; width: min(320px, 86vw); z-index: 40;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 60px rgba(0,0,0,.6);
  }
  body.nav-open .sidebar { transform: none; }
}
