/* ==========================================================================
   TradeDrill public pages — the course, the glossary, pricing, the fine print.
   Static HTML with no script of their own: fast to load, easy to crawl. The
   app's palette and borderless manner — surfaces separated by elevation and
   space, never lines. Light or dark follows the reader's system.
   ========================================================================== */
:root {
  --bg: #ebebeb; --surface: #fbfbfb; --surface-2: #f1f1f1; --surface-3: #e3e4e6;
  --ink: #121416; --ink-soft: #454b55; --ink-faint: #676b72;
  --accent: #5B47E0; --accent-ink: #4634B8; --accent-soft: #ecebfd; --on-accent: #fff;
  --pos: #1a63bd; --neg: #C61A12; --gold: #9a5c06;
  --glow-a: rgba(91, 71, 224, 0.14); --glow-b: rgba(230, 143, 14, 0.10);
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px -12px rgba(0,0,0,.18);
  --radius: 14px; --radius-sm: 9px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #030404; --surface: #0d0e10; --surface-2: #16181b; --surface-3: #232830;
    --ink: #F1F1F1; --ink-soft: #b4b6ba; --ink-faint: #939393;
    --accent: #8B7BFF; --accent-ink: #BDB3FF; --accent-soft: rgba(139, 123, 255, 0.15); --on-accent: #0e0a2a;
    --pos: #4d97f0; --neg: #ea4035; --gold: #f0a93a;
    --glow-a: rgba(139, 123, 255, 0.22); --glow-b: rgba(230, 143, 14, 0.09);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.65; color: var(--ink);
  background:
    radial-gradient(900px 600px at -10% -10%, var(--glow-a), transparent 70%),
    radial-gradient(800px 600px at 110% 110%, var(--glow-b), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: none; background: var(--accent-soft); border-radius: 6px; }
img, svg { max-width: 100%; }

/* --- chrome ---------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px; padding: 12px max(16px, calc((100vw - 1120px) / 2));
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(12px);
}
.brand { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand b { color: var(--accent); }
.brand svg { width: 26px; height: 26px; }
.top nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.top nav a { white-space: nowrap; padding: 7px 12px; border-radius: 999px; color: var(--ink-soft); text-decoration: none; font-size: 15px; font-weight: 600; }
.top nav a:hover, .top nav a[aria-current] { background: var(--surface-2); color: var(--ink); }
.top nav a.cta { background: var(--accent); color: var(--on-accent); }
.top nav a.cta:hover { background: var(--accent-ink); color: var(--on-accent); }
@media (max-width: 560px) {
  .top { gap: 10px; }
  .top nav { flex-wrap: nowrap; gap: 2px; }
  .top nav a { padding: 6px 9px; font-size: 14px; }
}
@media (max-width: 460px) { .top nav a[href="/pricing/"], .top nav a[href="/glossary/"] { display: none; } }

.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.page { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
.page.single { grid-template-columns: minmax(0, 760px); justify-content: center; }
@media (max-width: 900px) { .page { grid-template-columns: minmax(0, 1fr); } .side { order: 2; } }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 14px; color: var(--ink-faint); }
.crumbs li + li::before { content: '›'; margin-right: 6px; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }

article, .card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
article { padding: clamp(20px, 4vw, 40px); }
.card { padding: 18px 20px; }
.kicker { margin: 0 0 6px; font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); }
h1 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.035em; font-weight: 800; }
h2 { margin: 36px 0 12px; font-size: 23px; line-height: 1.25; letter-spacing: -0.02em; }
h3 { margin: 22px 0 8px; font-size: 18px; }
.lead { margin: 0 0 18px; font-size: 20px; line-height: 1.55; color: var(--ink-soft); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; font-size: 14px; color: var(--ink-faint); }
.meta span { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); }
ul, ol { padding-left: 1.3em; }
li { margin: 5px 0; }
li::marker { color: var(--accent); }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

/* --- lesson parts ------------------------------------------------------------ */
.rules li::marker { content: '✓  '; color: var(--pos); }
.mistakes li::marker { content: '✗  '; color: var(--neg); }
.terms { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.terms dt { font-weight: 700; }
.terms dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 600px) { .terms { grid-template-columns: 1fr; } .terms dd { margin-bottom: 8px; } }
.panel { margin: 18px 0; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); }
.panel h3 { margin-top: 0; }
.panel.found { background: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); }
.panel.drill { background: color-mix(in srgb, var(--pos) 8%, var(--surface-2)); }
.stat { display: inline-block; margin: 2px 6px 2px 0; padding: 2px 9px; border-radius: 999px; background: var(--surface); font-size: 14px; font-variant-numeric: tabular-nums; }
.caveat { font-size: 14px; color: var(--ink-faint); }

details.q { margin: 10px 0; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); }
details.q summary { cursor: pointer; font-weight: 700; list-style: none; }
details.q summary::-webkit-details-marker { display: none; }
details.q summary::after { content: ' — show answer'; font-weight: 500; color: var(--accent-ink); font-size: 14px; }
details.q[open] summary::after { content: ''; }
details.q ol { margin: 10px 0 6px; }
details.q .right { color: var(--pos); font-weight: 700; }
details.q .why { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; }

.res { display: grid; gap: 8px; padding: 0; list-style: none; }
.res li { margin: 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.res li span { display: block; font-size: 14px; color: var(--ink-faint); }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.pager a { flex: 1; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); text-decoration: none; color: var(--ink); }
.pager a:hover { background: var(--surface-3); color: var(--ink); }
.pager a span { display: block; font-size: 13px; color: var(--ink-faint); }
.pager a.next { text-align: right; }

/* The one call to action: practise it, free, in the replay. */
.cta-box { margin: 28px 0 0; padding: 20px 22px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.cta-box h2 { margin: 0 0 6px; font-size: 20px; }
.cta-box p { margin: 0 0 14px; color: var(--ink-soft); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; box-shadow: 0 8px 24px -12px var(--accent); }
.btn:hover { background: var(--accent-ink); color: var(--on-accent); }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }

/* --- side rail ---------------------------------------------------------------- */
.side { position: sticky; top: 78px; display: grid; gap: 14px; }
.side h2 { margin: 0 0 8px; font-size: 15px; }
.side ol { margin: 0; padding-left: 1.2em; font-size: 14px; }
.side ol a { color: var(--ink-soft); text-decoration: none; }
.side ol a[aria-current] { color: var(--accent-ink); font-weight: 700; }

/* --- index pages -------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { display: block; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.tile:hover { background: var(--surface-2); color: var(--ink); }
.tile strong { display: block; font-size: 18px; letter-spacing: -0.01em; }
.tile span { display: block; margin-top: 4px; font-size: 15px; color: var(--ink-soft); }
.tile em { display: block; margin-top: 8px; font-style: normal; font-size: 13px; color: var(--ink-faint); }
.lessons { padding: 0; list-style: none; counter-reset: l; }
.lessons li { counter-increment: l; margin: 0; }
.lessons a { display: flex; gap: 12px; padding: 11px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.lessons a::before { content: counter(l); min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 800; }
.lessons a:hover { background: var(--surface-2); color: var(--ink); }
.lessons a span { display: block; font-size: 14px; color: var(--ink-soft); }
.az { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.az a { min-width: 34px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); text-align: center; text-decoration: none; font-weight: 700; color: var(--ink-soft); }
.az a:hover { background: var(--surface-3); color: var(--ink); }
.terms-list { columns: 2 280px; column-gap: 28px; padding: 0; list-style: none; }
.terms-list li { break-inside: avoid; margin: 0 0 10px; }
.terms-list a { font-weight: 700; }
.terms-list span { display: block; font-size: 14px; color: var(--ink-soft); }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 20px 0; }
.plan { padding: 22px 24px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.plan.best { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.plan h2 { margin: 0; font-size: 20px; }
.plan .price { margin: 8px 0 2px; font-size: 38px; font-weight: 800; letter-spacing: -0.03em; }
.plan .price small { font-size: 16px; font-weight: 600; color: var(--ink-soft); }
.plan ul { margin: 14px 0 18px; padding-left: 1.2em; }
.plan li::marker { content: '✓  '; color: var(--accent); }
.plan li.no::marker { content: '–  '; color: var(--ink-faint); }

/* The lesson diagram, as in the app. */
.ld { margin: 22px 0; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.ld svg { width: 100%; max-height: 280px; }
.ld figcaption { font-size: 14px; color: var(--ink-soft); }
.ld-wick { stroke-width: 1.4; }
.ld-up .ld-wick { stroke: var(--pos); } .ld-up .ld-body { fill: var(--pos); }
.ld-down .ld-wick { stroke: var(--neg); } .ld-down .ld-body { fill: var(--neg); }
.ld text { font-size: 10px; font-weight: 700; fill: var(--ink-soft); font-family: var(--font); }
.ld-text { fill: var(--ink) !important; }
.ld-zone rect { fill-opacity: .16; }
.ld-zone.t-bull rect { fill: var(--pos); } .ld-zone.t-bull text { fill: var(--pos); }
.ld-zone.t-bear rect { fill: var(--neg); } .ld-zone.t-bear text { fill: var(--neg); }
.ld-zone.t-liq rect { fill: var(--gold); } .ld-zone.t-liq text { fill: var(--gold); }
.ld-zone.t-neutral rect { fill: var(--ink-faint); }
.ld-level line { stroke-width: 1.4; stroke: var(--ink-faint); }
.ld-level.t-liq line { stroke: var(--gold); } .ld-level.t-liq text { fill: var(--gold); }
.ld-level.t-bull line { stroke: var(--pos); } .ld-level.t-bear line { stroke: var(--neg); }
.ld-arrow line, .ld-arrow path { stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ld-arrow.t-bull line, .ld-arrow.t-bull path { stroke: var(--pos); }
.ld-arrow.t-bear line, .ld-arrow.t-bear path { stroke: var(--neg); }
.ld-arrow.t-liq line, .ld-arrow.t-liq path { stroke: var(--gold); } .ld-arrow.t-liq text { fill: var(--gold); }
.ld-arrow.t-neutral line, .ld-arrow.t-neutral path { stroke: var(--ink-soft); }

/* An ad, when there is one: set apart by space, labelled, never between a question and its answer. */
.ad { margin: 28px 0; min-height: 120px; }
.ad::before { content: 'Advertisement'; display: block; margin-bottom: 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }

/* --- footer ------------------------------------------------------------------- */
footer { padding: 32px 16px 48px; }
footer .in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 24px; font-size: 14px; color: var(--ink-soft); }
footer h2 { margin: 0 0 8px; font-size: 14px; color: var(--ink); }
footer ul { margin: 0; padding: 0; list-style: none; }
footer li { margin: 4px 0; }
footer a { color: var(--ink-soft); text-decoration: none; }
footer a:hover { color: var(--ink); }
footer .fine { grid-column: 1 / -1; font-size: 13px; color: var(--ink-faint); }
@media (max-width: 760px) { footer .in { grid-template-columns: 1fr 1fr; } }

/* Landing fallback, shown until the app starts (and to anything without script). */
.pre { max-width: 900px; margin: 0 auto; padding: 72px 16px; }
.pre h1 { font-size: clamp(36px, 6vw, 60px); }
.pre .row { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 36px; }

/* Guides */
.guide-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 18px; }
.guide-list li p { margin: 4px 0 0; }
.guide-list a { text-decoration: none; }
.guide-cta { display: inline-block; margin: 8px 0; padding: 10px 18px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; }
