/* =============================================================
   base.css — Reset, typography, base styles
   ============================================================= */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  background-color: var(--color-bg-base);
  /* Faint market gridlines baked into background — can never overlap content */
  background-image:
    linear-gradient(var(--color-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  letter-spacing: var(--type-body-ls);
  font-weight: var(--type-body-weight);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Scroll margin for sticky headers */
[id] {
  scroll-margin-top: calc(var(--header-height-desktop) + 8px);
}

@media (max-width: 767px) {
  [id] {
    scroll-margin-top: calc(var(--header-height-mobile) + 8px);
  }
}

.page-strategy [id] {
  scroll-margin-top: calc(var(--header-height-desktop) + 56px);
}

/* Typography */
h1, .h1 {
  font-family: var(--type-h1-family);
  font-weight: var(--type-h1-weight);
  font-size: var(--type-h1-size);
  line-height: var(--type-h1-lh);
  letter-spacing: var(--type-h1-ls);
  color: var(--color-text-primary);
}

h2, .h2 {
  font-family: var(--type-h2-family);
  font-weight: var(--type-h2-weight);
  font-size: var(--type-h2-size);
  line-height: var(--type-h2-lh);
  letter-spacing: var(--type-h2-ls);
  color: var(--color-text-primary);
}

h3, .h3 {
  font-family: var(--type-h3-family);
  font-weight: var(--type-h3-weight);
  font-size: var(--type-h3-size);
  line-height: var(--type-h3-lh);
  letter-spacing: var(--type-h3-ls);
  color: var(--color-text-primary);
}

h4, .h4 {
  font-family: var(--type-h4-family);
  font-weight: var(--type-h4-weight);
  font-size: var(--type-h4-size);
  line-height: var(--type-h4-lh);
  letter-spacing: var(--type-h4-ls);
  color: var(--color-text-primary);
}

h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-text-primary);
}

p {
  color: var(--color-text-secondary);
  line-height: var(--type-body-lh);
}

a {
  color: var(--color-text-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
  color: var(--color-accent-hover);
}

ul, ol {
  list-style: none;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-body);
}

input, textarea, select {
  font-family: var(--font-body);
}

hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: var(--space-8) 0;
}

/* Responsive type */
@media (max-width: 1024px) {
  h1, .h1 { font-size: 3.5rem; }
  h2, .h2 { font-size: 2rem; }
  h3, .h3 { font-size: 1.375rem; }
}

@media (max-width: 767px) {
  h1, .h1 { font-size: 2.75rem; }
  h2, .h2 { font-size: 1.75rem; }
  h3, .h3 { font-size: 1.25rem; }
  h4, .h4 { font-size: 1rem; }
  p { font-size: 0.9375rem; }
}

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Text helpers */
.text-primary   { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-accent    { color: var(--color-text-accent); }
.text-positive  { color: var(--color-positive); }
.text-negative  { color: var(--color-negative); }

/* Eyebrow label */
.eyebrow {
  font-family: var(--type-eyebrow-family);
  font-weight: var(--type-eyebrow-weight);
  font-size: var(--type-eyebrow-size);
  line-height: var(--type-eyebrow-lh);
  letter-spacing: var(--type-eyebrow-ls);
  text-transform: var(--type-eyebrow-transform);
  color: var(--color-text-muted);
  display: block;
  margin-bottom: var(--space-3);
}
.eyebrow--accent {
  color: var(--color-accent-primary);
}

/* Monospace data values */
.mono {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Code blocks */
code, pre {
  font-family: var(--font-mono);
  background: var(--color-bg-code);
  border-radius: var(--radius-sm);
}

code {
  padding: 0.15em 0.4em;
  font-size: 0.875em;
}

/* Legal page content */
.legal-content h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-4);
  margin-top: var(--space-12);
}

.legal-content h3 {
  font-size: 1rem;
  margin-top: var(--space-6);
}

.legal-content p {
  font-size: 0.9375rem;
  line-height: 1.8;
  margin-bottom: var(--space-4);
}

.legal-content ul {
  list-style: disc;
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.legal-content ul li {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  line-height: 1.7;
}

.legal-content a {
  color: var(--color-accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
