/* ==========================================================================
   base.css — Reset, Design Tokens, Typography, Layout Primitives
   ========================================================================== */

/* --- 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-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--color-primary-dark);
}

ul,
ol {
  list-style: none;
}

/* --- Design Tokens --- */
:root {
  /* Brand Colors – derived from Zacks logo greens */
  --color-primary: #124734;        /* deep forest green from wordmark */
  --color-primary-dark: #0c3325;
  --color-primary-light: #1a5e46;
  --color-accent: #2f8a0a;         /* deepened brand green, used sparingly */
  --color-accent-dark: #256e08;
  --color-accent-light: #5bb524;
  --color-success: #15803d;

  /* Neutrals — cool, paper-like */
  --color-bg: #ffffff;
  --color-bg-alt: #f4f7f4;          /* faint green-grey panel */
  --color-bg-dark: #0a221a;         /* deep ink-green for dark sections */
  --color-bg-darker: #07180f;
  --color-surface: #ffffff;
  --color-text: #14201b;            /* near-black with a slight green cast */
  --color-text-light: #ffffff;
  --color-muted: #566a61;
  --color-border: #e3eae5;          /* hairline */
  --color-border-strong: #cdd9d2;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.6;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Borders & Shadows — sharper, quieter "paper" feel */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(10, 34, 26, 0.04);
  --shadow-md: 0 6px 20px rgba(10, 34, 26, 0.06);
  --shadow-lg: 0 20px 50px rgba(10, 34, 26, 0.09);

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 800px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  color: var(--color-text);
}

/* Editorial serif for display headings — institutional gravitas */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
}

h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
}

h1 { font-size: var(--text-5xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-4xl); letter-spacing: -0.018em; }
h3 { font-size: var(--text-2xl); letter-spacing: -0.012em; }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-4);
}

.text-muted { color: var(--color-muted); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }

/* Serif numerals for headline statistics */
.num-serif {
  font-family: var(--font-serif);
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--color-accent-dark);
  margin-bottom: var(--space-3);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

/* --- Layout Primitives --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--space-24);
}

.section--compact {
  padding-block: var(--space-12);
}

.section {
  position: relative;
}

/* Alt panel: faint dot-grid texture for a "research-terminal" surface */
.section--alt {
  background-color: var(--color-bg-alt);
  background-image: radial-gradient(circle, rgba(18, 71, 52, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* Dark section: deep ink-green with a faint engineering grid + glow */
.section--dark {
  color: var(--color-text-light);
  background-color: var(--color-bg-dark);
  background-image:
    radial-gradient(circle at 50% -20%, rgba(91, 181, 36, 0.12) 0%, transparent 55%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-text-light);
}

.section--dark p {
  color: rgba(255, 255, 255, 0.7);
}

.section__header {
  text-align: center;
  max-width: 720px;
  margin-inline: auto;
  margin-bottom: var(--space-16);
}

/* Center the eyebrow's leading rule within centered headers */
.section__header .eyebrow {
  margin-bottom: var(--space-5);
}

.section__header h2 {
  font-size: var(--text-4xl);
}

.section__header p {
  font-size: var(--text-lg);
  color: var(--color-muted);
  line-height: var(--leading-normal);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-xl); }

  .section {
    padding-block: var(--space-16);
  }

  .container {
    padding-inline: var(--space-4);
  }
}

@media (max-width: 480px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}
