/* ============================================================
   XM Trading — Core Design System
   styles.css: reset, variables, typography, layout, header, footer
   ============================================================ */

/* ---------- TRADING DARK TOKENS ---------- */
:root {
  --bg-base: #0B0E11;
  --bg-panel: #181A20;
  --bg-panel-2: #1E2128;
  --bg-elevated: #22252E;
  --border: #2A2E37;
  --border-soft: #21242C;

  --bull: #00C582;
  --bear: #FF4A5A;
  --system: #3B82F6;

  --cta: #F7A600;
  --cta-ink: #0B0E11;
  --cta-hover: #ffba2e;

  --text: #f4f6f9;
  --text-muted: #9aa4b2;
  --text-dim: #6b7480;
  --text-light: #141820;

  --dark-section: #141820;

  --font-display: "Georgia", "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 1200px;
  --gap: 1.5rem;
  --radius: 10px;
  --radius-sm: 6px;
  --header-h: 64px;

  --shadow: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.3);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.05rem; }
p { color: var(--text-muted); }

.numeric, .num, td.num, .tabular { font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cta);
}

/* ---------- LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}
section { padding: 3.5rem 0; }
.section-head { max-width: 720px; margin: 0 0 2rem; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head p { margin-top: 0.75rem; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 780px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
  text-align: center;
  line-height: 1.2;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--cta);
  color: var(--cta-ink);
  box-shadow: 0 4px 16px rgba(247,166,0,0.3);
}
.btn-primary:hover { background: var(--cta-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--cta); background: rgba(255,255,255,0.03); }

.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- SCROLL PROGRESS ---------- */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--cta), var(--bull));
  z-index: 2000;
  transition: width 0.1s linear;
}

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11,14,17,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: padding 0.25s var(--ease);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 1.25rem;
  max-width: var(--maxw);
  margin: 0 auto;
  transition: height 0.25s var(--ease);
}
.site-header.shrink .header-inner { height: 52px; }

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text);
}
.brand-logo .badge-x {
  background: var(--cta);
  color: var(--cta-ink);
  width: 32px; height: 32px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-weight: 800;
}
.session-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bull);
  border: 1px solid rgba(0,197,130,0.4);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.session-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bull);
  box-shadow: 0 0 6px var(--bull);
}

/* ---------- NAV ---------- */
#hamburger-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  z-index: 1100;
}
#hamburger-btn span {
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
#main-nav.is-open ~ #hamburger-btn span:nth-child(1),
#hamburger-btn.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }

#main-nav {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0; right: 0;
  width: min(82vw, 340px);
  height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  padding: calc(var(--header-h) + 1rem) 1.25rem 2rem;
  overflow-y: auto;
  gap: 0.25rem;
  box-shadow: var(--shadow);
}
#main-nav.is-open { display: flex; }

.nav-item { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  border-radius: var(--radius-sm);
  width: 100%;
}
.nav-item.has-dropdown > .nav-link::after {
  content: "\25BE";
  font-size: 0.7rem;
  color: var(--text-dim);
  transition: transform 0.2s var(--ease);
}
.nav-item.has-dropdown.open > .nav-link::after { transform: rotate(180deg); }

ul.dropdown {
  display: none;
  padding: 0.25rem 0 0.5rem 0.75rem;
  margin-left: 0.25rem;
  border-left: 2px solid var(--border);
}
.nav-item.has-dropdown.open ul.dropdown { display: block; }
ul.dropdown > li > a {
  display: block;
  padding: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
ul.dropdown > li > a:hover { color: var(--cta); background: rgba(255,255,255,0.03); }

.nav-cta {
  margin-top: 1rem;
}

@media (min-width: 780px) {
  #hamburger-btn { display: none; }
  #main-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    position: static;
    width: auto;
    height: auto;
    background: none;
    border: none;
    padding: 0;
    overflow: visible;
    box-shadow: none;
    gap: 0.25rem;
  }
  .nav-link { padding: 0.5rem 0.7rem; font-size: 0.85rem; }
  ul.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    margin: 0;
    box-shadow: var(--shadow);
    z-index: 1200;
  }
  .nav-item.has-dropdown:hover ul.dropdown,
  .nav-item.has-dropdown.open ul.dropdown { display: block; }
  .nav-cta { margin-top: 0; margin-left: 0.5rem; }
  .nav-cta .btn { padding: 0.55rem 1.1rem; font-size: 0.85rem; }
}

/* ---------- FOOTER ---------- */
.site-footer {
  background: #07090b;
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
  color: var(--text-muted);
}
.site-footer * { color: inherit; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 780px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-col h4 { color: var(--text); margin-bottom: 0.9rem; font-size: 0.95rem; }
.footer-col a { display: block; padding: 0.3rem 0; font-size: 0.88rem; }
.footer-col a:hover { color: var(--cta); }
.footer-brand p { font-size: 0.85rem; margin-top: 0.75rem; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
}
.footer-risk {
  background: rgba(255,74,90,0.06);
  border: 1px solid rgba(255,74,90,0.25);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 0.78rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}
.footer-risk strong { color: var(--bear); }

/* ---------- SCROLL REVEAL ---------- */
html.js-ready .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
html.js-ready .reveal.in-view { opacity: 1; transform: none; }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  html.js-ready .reveal { opacity: 1; transform: none; }
}


/* agent-nav-patch v1 — #main-nav > .nav-item direct children (no .nav-list) */
.header-logo{font-family:var(--font-display);font-weight:800;font-size:1.35rem;color:var(--brand);text-decoration:none;letter-spacing:-.02em;flex-shrink:0}
.header-logo:hover{text-decoration:none;opacity:.9}
#main-nav .nav-link{white-space:nowrap}
.nav-item.active>.nav-link{color:var(--brand)}
.btn-primary{background:transparent;color:var(--brand);border-color:var(--brand)}
.btn-primary:hover{background:var(--brand);color:var(--brand-ink)}
.btn-sm{padding:.55rem 1rem;font-size:.85rem}
.nav-cta{flex-shrink:0}
@media(min-width:780px){
  #main-nav{display:flex!important;flex:1;align-items:center;justify-content:flex-end;gap:.15rem;min-width:0;margin-left:var(--space-sm)}
  #main-nav .nav-link{font-size:.84rem;padding:.5rem .6rem}
  #main-nav .nav-cta{margin-left:.35rem}
}
@media(min-width:900px){
  #main-nav .nav-link{font-size:.9rem;padding:.55rem .75rem}
}
@media(max-width:779px){
  #main-nav.is-open{display:flex!important;flex-direction:column;align-items:stretch;gap:.2rem}
  #main-nav.is-open .nav-cta{margin-top:var(--space-md);align-self:flex-start}
}
