/* =====================================================================
   BSA FUTURES - LAYOUT AND COMPONENTS
   Colors, fonts and spacing come from theme.css. To change the look,
   edit theme.css first. This file decides where things sit.
   ===================================================================== */

/* ---------- Fonts (self-hosted, no Google requests) ---------- */
@font-face { font-family: "Sora"; font-weight: 600; font-display: swap; src: url("../fonts/sora-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url("../fonts/sora-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-heading); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: var(--text-h1); font-weight: 700; line-height: 1.05; }
h2 { font-size: var(--text-h2); font-weight: 700; line-height: 1.1; }
h3, .h3 { font-size: var(--text-h3); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--color-vpoc); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--color-accent); color: var(--color-accent-ink); padding: 10px 14px; border-radius: var(--radius-btn); }
.skip-link:focus { top: 12px; }
.noscript-nav { padding: 16px var(--gutter); color: var(--color-text-muted); font-size: var(--text-small); }
.noscript-nav a { margin-right: 14px; text-decoration: underline; }

.eyebrow, .tag {
  font-family: var(--font-mono);
  font-size: var(--text-tiny);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.eyebrow { color: var(--color-accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px;
  border-radius: var(--radius-btn);
  font-family: var(--font-heading); font-weight: 600; font-size: 1rem; letter-spacing: 0;
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); }
.btn--primary:hover { background: var(--color-accent-hover); }
.btn--secondary { border-color: var(--color-border); color: var(--color-text); background: var(--color-surface); }
.btn--secondary:hover { border-color: var(--color-text-muted); }
.btn--ghost { padding-inline: 8px; color: var(--color-text-muted); text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--color-border); }
.btn--ghost:hover { color: var(--color-text); }
.btn--small { min-height: 44px; padding: 0 18px; font-size: 0.9375rem; }
.btn--block { display: flex; width: 100%; }
.btn.is-disabled, .is-disabled { cursor: default; opacity: 0.55; pointer-events: none; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background var(--dur-med) var(--ease), border-color var(--dur-med) var(--ease);
}
.site-header.is-solid, .menu-open .site-header {
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  border-bottom-color: var(--color-border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.site-header__inner { height: 100%; display: flex; align-items: center; gap: var(--space-5); }
.logo { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; letter-spacing: 0.18em; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; gap: 0.45em; }
.logo__mark { color: var(--color-accent); }
.logo__icon { width: 26px; height: 26px; flex: none; margin-right: 0.25em; }
.logo__buy { fill: var(--color-accent); } .logo__sell { fill: var(--color-text); opacity: 0.55; } .logo__line { fill: var(--color-text-faint); }

.nav { display: none; margin-left: auto; }
.nav__list { display: flex; gap: var(--space-1); }
.nav__item { position: relative; }
.nav__link { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; font-size: 0.9375rem; color: var(--color-text-muted); border-radius: 8px; transition: color var(--dur-fast) var(--ease); }
.nav__link:hover, .nav__item:focus-within > .nav__link { color: var(--color-text); }
.nav__caret { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.dropdown {
  position: absolute; top: 100%; left: 0; min-width: 190px; padding: 8px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
}
.nav__item:hover > .dropdown, .nav__item:focus-within > .dropdown { opacity: 1; visibility: visible; transform: none; }
.dropdown a { display: block; padding: 10px 12px; border-radius: 8px; font-size: 0.9375rem; color: var(--color-text-muted); }
.dropdown a:hover, .dropdown a:focus-visible { background: var(--color-surface-2); color: var(--color-text); }
.site-header__cta { display: none; }

.menu-btn { margin-left: auto; width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.menu-btn__bars, .menu-btn__bars::before, .menu-btn__bars::after { display: block; width: 22px; height: 2px; background: var(--color-text); border-radius: 2px; transition: transform var(--dur-fast) var(--ease), background var(--dur-fast); }
.menu-btn__bars { position: relative; }
.menu-btn__bars::before, .menu-btn__bars::after { content: ""; position: absolute; left: 0; }
.menu-btn__bars::before { top: -7px; }
.menu-btn__bars::after { top: 7px; }
.menu-btn[aria-expanded="true"] .menu-btn__bars { background: transparent; }
.menu-btn[aria-expanded="true"] .menu-btn__bars::before { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__bars::after { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu { position: fixed; inset: var(--header-h) 0 0 0; z-index: 49; background: var(--color-bg); overflow-y: auto; padding: var(--space-5) var(--gutter) var(--space-7); }
.mobile-menu__list { margin-bottom: var(--space-6); }
.mobile-menu__list > li { border-bottom: 1px solid var(--color-border); }
.mobile-menu__link { display: flex; align-items: center; min-height: 56px; font-family: var(--font-heading); font-weight: 600; font-size: 1.25rem; }
.mobile-menu__sub { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-bottom: 12px; }
.mobile-menu__sub a { display: inline-flex; align-items: center; min-height: 44px; color: var(--color-text-muted); font-size: 0.9375rem; }
.menu-open, .menu-open body { overflow: hidden; }

@media (min-width: 1180px) {
  .nav { display: block; }
  .site-header__cta { display: inline-flex; }
  .menu-btn, .mobile-menu { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; display: flex; flex-direction: column; min-height: 100svh; background: var(--color-bg); overflow: hidden; }
.hero__chart { position: relative; height: 48svh; min-height: 320px; max-height: 480px; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero__scrim { display: none; }
.hero__badge {
  position: absolute; top: calc(var(--header-h) + 6px); left: var(--gutter);
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 4px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-bg) 80%, transparent);
}
.hero__controls { position: absolute; left: 8px; right: var(--gutter); bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero__dots { display: flex; align-items: center; }
.hero__dot { width: 36px; height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.hero__dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-border); transition: background var(--dur-med) var(--ease), transform var(--dur-med) var(--ease); }
.hero__dot[aria-current="true"]::before { background: var(--color-accent); transform: scale(1.25); }
.hero__toggle { min-height: 44px; padding: 0 10px; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-muted); }
.hero__toggle:hover { color: var(--color-text); }
.hero__caption { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-faint); text-align: right; white-space: nowrap; }

.hero__content { position: relative; z-index: 2; padding-block: var(--space-5) var(--space-7); }
.hero__text .eyebrow { margin-bottom: var(--space-3); }
.hero__sub { margin-top: var(--space-4); color: var(--color-text-muted); max-width: 46ch; }
.hero__actions { margin-top: var(--space-5); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }

/* Desktop hero: chart fills the whole hero, text sits on the left */
@media (min-width: 960px) {
  .hero { justify-content: center; min-height: max(100svh, 680px); }
  .hero__chart { position: absolute; inset: 0; height: auto; max-height: none; }
  .hero__scrim { display: block; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(90deg, var(--color-bg) 0%, var(--color-bg) 34%, transparent 46%),
                radial-gradient(120% 90% at 70% 50%, transparent 55%, var(--color-bg-deep) 130%); }
  .hero__badge { left: auto; right: var(--gutter); top: calc(var(--header-h) + 20px); z-index: 2; }
  .hero__controls { left: 44%; right: var(--gutter); bottom: 24px; z-index: 2; }
  .hero__content { padding-block: var(--header-h) 0; }
  .hero__text { max-width: 40%; }
  .hero__sub { font-size: 1.125rem; margin-top: var(--space-5); }
  .hero__actions { margin-top: var(--space-6); }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-pad); }
.section--deep { background: var(--color-bg-deep); border-block: 1px solid var(--color-border); }
.section-head { max-width: 62ch; margin-bottom: var(--space-7); }
.section-head .eyebrow { margin-bottom: var(--space-3); }
.section-head p:last-child { margin-top: var(--space-4); color: var(--color-text-muted); }

/* ---------- Level picker ---------- */
.levels { display: grid; gap: var(--space-4); }
.level-card {
  display: flex; flex-direction: column; gap: var(--space-3); height: 100%;
  padding: var(--space-5);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  transition: border-color var(--dur-med) var(--ease), background var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
.level-card:hover { border-color: var(--color-accent); background: var(--color-surface-2); transform: translateY(-2px); }
.level-card__num { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-mono); font-size: var(--text-small); color: var(--color-accent); }
.level-card__num::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }
.level-card p { color: var(--color-text-muted); font-size: var(--text-small); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-1); }
.chip { font-size: 0.75rem; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text-muted); }
.level-card:hover .chip { background: var(--color-surface); }
.level-card__go, .link-card__go { margin-top: auto; padding-top: var(--space-3); font-family: var(--font-heading); font-weight: 600; font-size: var(--text-small); color: var(--color-text); }
.level-card__go::after, .link-card__go::after { content: " \2192"; color: var(--color-accent); }
.levels__hint { margin-top: var(--space-5); color: var(--color-text-muted); font-size: var(--text-small); }
@media (min-width: 640px) { .levels { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .levels { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Cards (lessons, links) ---------- */
.cards-3 { display: grid; gap: var(--space-5); }
@media (min-width: 800px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

.lesson-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); overflow: hidden; }
.lesson-card__body { padding: var(--space-5); display: grid; gap: var(--space-2); }
.lesson-card__body p:last-child { color: var(--color-text-muted); font-size: var(--text-small); }

.thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background-color: var(--color-bg);
  background-image:
    linear-gradient(var(--chart-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--chart-grid) 1px, transparent 1px);
  background-size: 100% 25%, 12.5% 100%; border-bottom: 1px solid var(--color-border); }
.thumb::before { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: var(--color-vpoc); opacity: 0.6; }
.thumb--1::before { top: 62%; }
.thumb--2::before { top: 45%; }
.thumb--3::before { top: 70%; }
.thumb__play { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; background: var(--color-accent); transition: transform var(--dur-med) var(--ease), background var(--dur-fast); }
.thumb__play::after { content: ""; position: absolute; left: 23px; top: 18px; border-left: 16px solid var(--color-accent-ink); border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.thumb:hover .thumb__play { background: var(--color-accent-hover); transform: scale(1.05); }
.thumb__soon { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-family: var(--font-mono); font-size: var(--text-tiny); letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-muted); opacity: 0; transition: opacity var(--dur-med) var(--ease); }
.thumb.is-soon .thumb__soon { opacity: 1; }
.video-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }

.link-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); min-height: 100%; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); transition: border-color var(--dur-med) var(--ease), background var(--dur-med) var(--ease); }
.link-card:hover { border-color: var(--color-text-muted); background: var(--color-surface-2); }
.link-card p:not(.tag) { color: var(--color-text-muted); font-size: var(--text-small); }
.link-card.is-disabled { opacity: 1; }
.link-card.is-disabled .link-card__go { opacity: 0.5; }

/* ---------- Inner pages (Community, Journal) ---------- */
.page-hero { padding-block: calc(var(--header-h) + var(--space-8)) var(--space-8); border-bottom: 1px solid var(--color-border); }
.page-hero h1 { font-size: clamp(2.25rem, 1.2rem + 3.4vw, 3.75rem); max-width: 16ch; }
.page-hero .eyebrow { margin-bottom: var(--space-3); }
.page-hero__sub { margin-top: var(--space-5); color: var(--color-text-muted); max-width: 56ch; font-size: 1.125rem; }
.page-hero__actions { margin-top: var(--space-6); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.grid-4 { display: grid; gap: var(--space-4); }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); }
.card p:not(.tag) { color: var(--color-text-muted); font-size: var(--text-small); }
.card__num { font-family: var(--font-mono); font-size: var(--text-small); color: var(--color-accent); }
.callout { padding: var(--space-6); border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent); border-radius: var(--radius-card); background: var(--color-surface); display: grid; gap: var(--space-3); max-width: 760px; }
.callout p { color: var(--color-text-muted); }
.fineprint { margin-top: var(--space-5); color: var(--color-text-faint); font-size: 0.8125rem; max-width: 70ch; }

/* ---------- Newsletter + Discord ---------- */
.cta-pair { display: grid; gap: var(--space-8); }
.cta-block { display: grid; gap: var(--space-4); justify-items: start; align-content: start; }
.cta-block h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); }
.cta-block p:not(.eyebrow) { color: var(--color-text-muted); max-width: 44ch; }
.cta-block .btn { margin-top: var(--space-2); }
@media (min-width: 800px) { .cta-pair { grid-template-columns: 1fr 1fr; gap: var(--space-9); } }

/* ---------- Footer ---------- */
.site-footer { padding-block: var(--space-8) var(--space-6); font-size: var(--text-small); color: var(--color-text-muted); }
.footer__top { display: grid; gap: var(--space-6); grid-template-columns: 1fr 1fr; }
.footer__brand { grid-column: 1 / -1; display: grid; gap: var(--space-2); }
.footer__brand .logo { color: var(--color-text); }
.footer__title { font-family: var(--font-mono); font-size: var(--text-tiny); font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-text-faint); margin-bottom: var(--space-2); }
.footer__col a { display: inline-flex; align-items: center; min-height: 40px; }
.footer__col a:hover { color: var(--color-text); }
.footer__risk { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--color-border); max-width: 90ch; font-size: 0.8125rem; line-height: 1.6; }
.footer__copy { margin-top: var(--space-4); font-size: 0.8125rem; color: var(--color-text-faint); }
@media (min-width: 900px) {
  .footer__top { grid-template-columns: 1.6fr repeat(4, 1fr); }
  .footer__brand { grid-column: auto; max-width: 30ch; }
}

/* ---------- Scroll reveal (only when JavaScript is running) ---------- */
.js-ready .reveal { opacity: 0; transform: translateY(8px); transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.js-ready .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .js-ready .reveal { opacity: 1; transform: none; }
}
