/* ========================================================
   BASE STYLES — Reset, typography, core layout primitives
   Components are in /components/*.css
   ======================================================== */

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

html { font-size: var(--text-body); scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  background-color: var(--bg);
  color: var(--primary); /* Now uses the theme-adaptive primary brand color */
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  text-rendering: optimizeLegibility;
}

/* ─── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--fg);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-h1); margin-bottom: 1rem; }
h2 { font-size: var(--text-h2); margin-bottom: 0.875rem; }
h3 { font-size: var(--text-h3); margin-bottom: 0.75rem; }
h4 { font-size: var(--text-h4); margin-bottom: 0.5rem; }
h5 { font-size: var(--text-body); margin-bottom: 0.5rem; }
h6 { font-size: var(--text-small); margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; line-height: var(--leading-relaxed); }
a { color: var(--primary); text-decoration: none; transition: var(--t-fast); }
a:hover { color: var(--primary-hover); }

/* ─── Keyboard focus ring ───────────────────────────────────
   WCAG 2.4.7: keyboard users get a visible ring on every
   interactive element; mouse clicks stay ring-free. */
:focus-visible {
  outline: 3px solid var(--border-focus, #2563eb);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

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

/* ─── Layout primitives ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section        { padding: 4rem 0; }
.section-sm     { padding: 3rem 0; }
.section-lg     { padding: 7rem 0; }
.section-alt    { background-color: var(--bg-alt); }
.section-surface{ background-color: var(--surface); }

/* ─── Section headers ────────────────────────────────────── */
.section-eyebrow {
  display: inline-block;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.75rem;
}
[data-theme="dark"] .section-eyebrow {
  color: var(--accent);
}
.section-title {
  font-size: var(--text-section);
  margin-bottom: 1rem;
}
.section-desc {
  font-size: var(--text-lead);
  color: var(--muted);
  max-width: 640px;
  line-height: 1.75;
}
.section-header         { margin-bottom: 3.5rem; }
.section-header.center  { text-align: center; }
.section-header.center .section-desc { margin: 0 auto; }

/* Badges inside section headers always stick to the left */
.section-header .badge,
.section-header.text-center .badge,
.section-header.center .badge {
  display: block;
  width: fit-content;
  text-align: left;
  margin-left: 0;
  margin-right: auto;
  margin-bottom: 0.75rem;
}
.section-subtitle { font-size: var(--text-lead); color: var(--muted); max-width: 640px; }

/* ─── Grid helpers ────────────────────────────────────────── */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Spacing utilities ───────────────────────────────────── */
.mt-5 { margin-top: 1.5rem; }
.mt-6 { margin-top: 2rem; }
.mt-7 { margin-top: 2.5rem; }
.mt-8 { margin-top: 4rem; }
.mb-5 { margin-bottom: 1.5rem; }

/* ─── Divider ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ─── Keyframe Animations ─────────────────────────────────── */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-down {
  from { opacity: 0; transform: translateY(-1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .section, .section-lg { padding: 3.5rem 0; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section, .section-lg { padding: 3rem 0; }
  .container { padding: 0 1.125rem; }
}