/* ============================================================
   ezpztrader.com — base styles + components
   Depends on custom properties from tokens.css so both themes
   stay in sync automatically.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--on-accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: clamp(2.6rem, 6.5vw, 5rem); font-weight: 800; }
h2 { font-size: clamp(1.9rem, 4vw, 3.1rem); }
h3 { font-size: 1.3rem; letter-spacing: -0.02em; }
h4 { font-size: 1.05rem; letter-spacing: -0.01em; }

p { margin: 0 0 1em; max-width: var(--measure); }

a { color: var(--accent-ink); text-decoration: none; transition: color .2s var(--ease-out); }
a:hover { color: var(--accent-strong); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

code, pre, .mono { font-family: var(--font-mono); }
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.7;
}

img, svg { max-width: 100%; display: block; }
ul, ol { padding-left: 1.2rem; }

/* ============ layout ============ */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1rem, 2vw, 1.5rem);
  position: relative;
}
.stack { display: flex; flex-direction: column; }
.row { display: flex; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 1.5rem; }
.section { padding: clamp(4rem, 9vw, 8rem) 0; position: relative; }
.section-tight { padding: clamp(2.5rem, 5vw, 4rem) 0; }

/* ============ eyebrow / pill ============ */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 1.25rem;
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .34rem .8rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.pill-gold   { background: var(--gold-soft);   color: var(--gold-ink);   border-color: transparent; }
.pill-buy    { background: var(--buy-soft);    color: var(--buy);        border-color: transparent; }
.pill-sell   { background: var(--sell-soft);   color: var(--sell);       border-color: transparent; }

/* ============ buttons ============ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -0.01em;
  padding: .85rem 1.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out),
              background-color .25s var(--ease-out), border-color .25s var(--ease-out), color .25s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 24px -8px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
  box-shadow: 0 14px 36px -8px var(--accent-glow);
}

.btn-gold {
  background: var(--gold);
  color: var(--on-gold);
  box-shadow: 0 8px 24px -8px var(--gold-soft);
}
.btn-gold:hover { background: var(--gold-ink); color: var(--on-gold); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }

.btn-sm { padding: .55rem 1.1rem; font-size: .85rem; }

/* ============ card ============ */

.card {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform .35s var(--ease-out), border-color .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.card-hover:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.card h3 { margin-bottom: .4rem; }
.card p:last-child { margin-bottom: 0; }

/* ============ table ============ */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table { border-collapse: collapse; width: 100%; min-width: 460px; font-size: .92rem; }
th, td { text-align: left; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line-soft); }
thead th {
  background: var(--bg-sunken);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  font-weight: 600;
}
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ============ header ============ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease-out), background-color .3s var(--ease-out);
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-top: 1rem; padding-bottom: 1rem; }

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.brand:hover { color: var(--ink); }
.logo-mark {
  flex-shrink: 0;
  display: block;
  height: 74px;
  width: auto;
}
.site-footer .logo-mark { height: 96px; }
/* Theme swap: same transparent artwork, recolored per theme so the
   logo never needs a background chip. Dark theme keeps the artwork's
   original white ink; light theme uses a variant with the white/gray
   strokes recolored to --ink (the colored candlestick + accent strokes
   are untouched in both). Server always renders an explicit data-theme,
   so these two rules are exhaustive. */
.logo-mark-on-light { display: none; }
[data-theme="light"] .logo-mark-on-dark { display: none; }
[data-theme="light"] .logo-mark-on-light { display: block; }
.brand em { font-style: normal; color: var(--accent); }

.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
  position: relative;
  color: var(--ink-soft);
  font-size: .93rem;
  font-weight: 600;
  padding: .25rem 0;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .3s var(--ease-out);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

.nav-actions { display: flex; gap: .7rem; align-items: center; }

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  width: 2.4rem; height: 2.4rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .25s var(--ease-out), border-color .25s var(--ease-out), transform .25s var(--ease-out);
}
.theme-toggle:hover { color: var(--accent-ink); border-color: var(--accent); transform: rotate(-20deg); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
/* Server always renders an explicit data-theme, so these are exhaustive. */
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ============ footer ============ */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
  padding: 4rem 0 2rem;
  color: var(--ink-soft);
  font-size: .92rem;
}
.site-footer h4 {
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-faint);
  margin-bottom: 1rem;
  font-weight: 500;
}
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent-ink); }
.footer-grid { display: grid; grid-template-columns: 1.8fr repeat(5, 1fr); gap: 2rem; }
.footer-bottom {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .8rem;
  color: var(--ink-faint);
}

/* ============ skip link (a11y) ============ */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--on-accent);
  padding: .75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; color: var(--on-accent); }

/* ============ mobile nav ============ */

.nav-burger {
  display: none;
  width: 2.75rem; height: 2.75rem;   /* 44px touch target */
  align-items: center; justify-content: center;
  flex-direction: column; gap: 5px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-burger span {
  display: block;
  width: 17px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
.nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(6, 4, 17, .6);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .3s var(--ease-out);
}
.nav-open .nav-scrim { opacity: 1; }

.mobile-nav {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 80;
  width: min(88vw, 340px);
  background: var(--bg-raised);
  border-left: 1px solid var(--line);
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform .32s var(--ease-out);
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}
.nav-open .mobile-nav { transform: translateX(0); }
.nav-open { overflow: hidden; }

.mobile-nav-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav-close {
  width: 2.75rem; height: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
}
.nav-close:hover { color: var(--accent-ink); border-color: var(--accent); }
.nav-close svg { width: 1.1rem; height: 1.1rem; }

.mobile-nav-links { display: flex; flex-direction: column; }
.mobile-nav-links a {
  display: block;
  padding: .9rem 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
}
.mobile-nav-links a:hover { color: var(--accent-ink); }

.mobile-nav-cta { display: flex; flex-direction: column; gap: .65rem; margin-top: auto; }
.mobile-nav-cta .btn { width: 100%; padding-block: 1rem; }

/* ============ responsive ============ */

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
  .nav-login { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

@media (min-width: 901px) {
  /* Drawer must never be reachable at desktop widths, even if a
     stale `hidden` removal or resize left it in the DOM. */
  .mobile-nav, .nav-scrim { display: none !important; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .section { padding: clamp(3rem, 11vw, 4.5rem) 0; }
  .card { padding: 1.35rem; }
  .btn { padding: .8rem 1.35rem; }        /* keeps ~44px tap height */
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .footer-bottom { flex-direction: column; gap: .5rem; }
  .site-footer { padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .nav-actions .btn-primary { padding: .55rem .9rem; font-size: .8rem; }
  .logo-mark { height: 56px; }
}
