/* ============================================
   IC Markets — Trading Design System
   styles.css : reset, tokens, typography,
   layout, header, footer
   ============================================ */

/* ---------- TOKENS (trading dark) ---------- */
:root {
  --bg-base: #0B0E11;
  --bg-panel: #181A20;
  --bg-panel-2: #1F222A;
  --bg-elevated: #141820;
  --border: #2A2E37;
  --border-soft: #23262F;

  --text: #EAEDF2;
  --text-muted: #9AA3B2;
  --text-light: #141820;

  --bull: #00C582;
  --bear: #FF4A5A;
  --system: #3B82F6;
  --cta: #F0B90B;
  --cta-ink: #0B0E11;
  --cta-hover: #FFC92E;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --maxw: 1200px;
  --header-h: 64px;

  --font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', ui-monospace, 'Roboto Mono', Menlo, Consolas, monospace;

  --shadow-1: 0 1px 3px rgba(0,0,0,.4);
  --shadow-2: 0 8px 28px rgba(0,0,0,.5);
  --ease: cubic-bezier(.4,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, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--system); outline-offset: 2px; }

/* numeric cells */
.num, td.num, .ticker-item, .clock-time, .stat-num {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
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.2vw, 1.6rem); }
h4 { font-size: 1.1rem; }
p { color: var(--text-muted); }
strong { color: var(--text); }
small { font-size: .8125rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .75rem;
  font-weight: 600;
  color: var(--system);
  font-family: var(--font-mono);
}

/* ---------- LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.section { padding-block: var(--space-7); }
.section-tight { padding-block: var(--space-6); }
.section-head {
  max-width: 720px;
  margin-bottom: var(--space-6);
}
.section-head.center { margin-inline: auto; text-align: center; }
.section-head p { margin-top: var(--space-3); }

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

.dark-section {
  background: var(--bg-elevated);
  color: #f4f6f9;
}
.dark-section * { color: inherit; }
.dark-section p, .dark-section .text-muted { color: #b9c1ce; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-family: var(--font-display);
  font-size: .95rem;
  transition: transform .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--cta);
  color: var(--cta-ink);
}
.btn-primary:hover { background: var(--cta-hover); }
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--system); background: rgba(59,130,246,.08); }
.btn-ghost {
  background: var(--bg-panel-2);
  color: var(--text);
}
.btn-ghost:hover { background: var(--border); }
.btn-lg { padding: 15px 30px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- SCROLL PROGRESS ---------- */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--cta);
  z-index: 1000;
  transition: width .1s linear;
}

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(11,14,17,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  transition: padding .2s var(--ease), background .2s var(--ease);
}
.site-header.shrink { background: rgba(11,14,17,.96); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-4);
  transition: min-height .2s var(--ease);
}
.site-header.shrink .header-inner { min-height: 54px; }
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.02em;
  color: var(--text);
  flex-shrink: 0;
}
.brand .brand-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--system), var(--bull));
  display: inline-block;
}

/* hamburger */
#hamburger-btn {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 950;
}
#hamburger-btn span {
  width: 24px; height: 2px;
  background: var(--text);
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}

/* nav */
#main-nav {
  display: none;
  position: fixed;
  top: 0; right: 0;
  width: min(320px, 85vw);
  height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  flex-direction: column;
  align-items: stretch;
  padding: calc(var(--header-h) + var(--space-4)) var(--space-4) var(--space-5);
  overflow-y: auto;
  gap: var(--space-1);
  box-shadow: var(--shadow-2);
}
#main-nav.is-open { display: flex; }

.nav-item { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 12px 10px;
  font-weight: 600;
  font-size: .95rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 100%;
}
.nav-link:hover { background: var(--bg-panel-2); color: var(--system); }
.has-dropdown > .nav-link::after {
  content: '+';
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.has-dropdown.open > .nav-link::after { content: '\2212'; }
.dropdown {
  display: none;
  flex-direction: column;
  padding: var(--space-1) 0 var(--space-2) var(--space-4);
}
.has-dropdown.open > .dropdown { display: flex; }
.dropdown > li > a {
  display: block;
  padding: 9px 10px;
  font-size: .9rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.dropdown > li > a:hover { color: var(--text); background: var(--bg-panel-2); }
.nav-cta {
  margin-top: var(--space-3);
}

/* ---------- FOOTER ---------- */
.site-footer {
  background: #07090C;
  border-top: 1px solid var(--border-soft);
  padding-block: var(--space-7) var(--space-5);
  color: #b9c1ce;
}
.site-footer * { color: inherit; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}
.footer-col h4 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #fff;
  margin-bottom: var(--space-3);
}
.footer-col a {
  display: block;
  padding: 5px 0;
  font-size: .9rem;
  color: #8c95a4;
}
.footer-col a:hover { color: #fff; }
.footer-brand p { font-size: .9rem; margin-top: var(--space-3); }
.footer-bottom {
  border-top: 1px solid var(--border-soft);
  padding-top: var(--space-5);
  font-size: .8rem;
  color: #707a8a;
}
.footer-risk {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  font-size: .8rem;
  margin-bottom: var(--space-5);
  color: #8c95a4;
}

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

/* ---------- UTILITIES ---------- */
.text-muted { color: var(--text-muted); }
.text-bull { color: var(--bull); }
.text-bear { color: var(--bear); }
.text-system { color: var(--system); }
.center { text-align: center; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-4 { margin-bottom: var(--space-4); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.hidden { display: none !important; }

/* ---------- RESPONSIVE ---------- */
@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); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 780px) {
  #hamburger-btn { display: none; }
  #main-nav {
    display: flex;
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    background: none;
    border: none;
    overflow: visible;
    box-shadow: none;
    gap: var(--space-1);
  }
  .nav-link { padding: 8px 12px; }
  .has-dropdown > .nav-link::after { content: '\25BE'; font-size: .7rem; }
  .has-dropdown.open > .nav-link::after { content: '\25BE'; }
  .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-2);
    box-shadow: var(--shadow-2);
    z-index: 920;
  }
  .nav-item.has-dropdown:hover > .dropdown,
  .has-dropdown.open > .dropdown { display: flex; }
  .nav-cta { margin-top: 0; margin-left: var(--space-3); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr repeat(4, 1fr); }
  .section { padding-block: var(--space-8); }
}

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

@media print {
  .site-header, .site-footer, #scroll-progress, .nav-cta, .cta-band, .sticky-cta, .back-top { display: none !important; }
  body { background: #fff; color: #000; }
  * { color: #000 !important; }
}

/* 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}
}
