/* ========================================
   Base — reset, typography, section wrappers,
   accessibility helpers, Gutenberg compat.
   Depends on tokens.css.
   ======================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* overflow-x: clip (NOT hidden) lets sticky nav keep working while
     stopping a wider-than-viewport child from causing page-level
     horizontal scroll on mobile. */
  overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

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

ul, ol { padding-left: 1.2em; }
p, ul, ol, blockquote, pre {
  margin-top: 0;
  margin-bottom: 1rem;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-family: var(--font-heading);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 700; }
h3 { font-size: clamp(1.35rem, 2.8vw, 2rem); font-weight: 700; }
h4, h5, h6 { font-size: 1.1rem; font-weight: 700; }

a {
  color: var(--color-primary);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
}
a:hover { text-decoration-thickness: 0.12em; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

input, textarea, select, button { font: inherit; }

code, pre { font-family: var(--font-mono); }
code {
  padding: 0.15rem 0.4rem;
  font-size: 0.95em;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 6px;
}
pre {
  overflow-x: auto;
  padding: 1rem;
  color: var(--color-dark-text);
  background: var(--color-primary-dark);
  border-radius: 12px;
}

blockquote {
  padding-left: 1rem;
  color: var(--color-muted);
  border-left: 4px solid var(--color-accent);
}

[id] { scroll-margin-top: calc(var(--nav-height) + 1rem); }

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

.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--color-primary);
  color: var(--color-white);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.site-main { display: block; }

/* Section wrappers — generic containers. Project-specific section
   visuals go in production-ready/<page>/sections/*.html inline
   <style> blocks per Phase 10 of the playbook. */
.section {
  width: 100%;
  padding: var(--section-padding) 0;
}
.section-inner {
  width: min(100%, var(--content-width));
  margin-inline: auto;
  padding-inline: var(--side-padding);
}
.section-white { background: var(--color-white); }
.section-light { background: var(--color-light); }
.section-dark {
  background: var(--color-primary);
  color: var(--color-dark-text);
}
.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark h5,
.section-dark h6,
.section-dark a,
.section-dark .kicker {
  color: var(--color-white);
}

/* WP archive templates (blog index, category, tag). */
.archive-wrap { display: grid; gap: 1rem; }
.archive-card {
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.archive-card h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}
.archive-nav { margin-top: 2rem; }

/* Gutenberg compatibility — let shortcode/HTML blocks render
   without the editor's default width constraint. */
.site-main > .wp-block-html,
.site-main > .wp-block-shortcode,
.site-main > .wp-block-group {
  max-width: none;
}
.wp-block-html,
.wp-block-shortcode {
  margin-top: 0;
  margin-bottom: 0;
}
