/*
 * nonprofittechsupport.ca — Phase 3 stylesheet
 *
 * Design goals: render fast on mobile (Phase 5 E.2 mobile-Perf gap is 100% caused by GoDaddy's runtime JS — this stylesheet ships none),
 * meet WCAG 2.2 AA contrast + spacing (Phase 5 E.1 target), system font stack so no remote font fetches block first paint.
 */

/* --- reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote { margin: 0; padding: 0; }
ul[role="list"] { list-style: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }

/* --- design tokens --- */
:root {
  --brand: #1B3A5C;
  --brand-fg: #ffffff;
  --accent: #B57F1B;
  --accent-on-dark: #dca73f; /* lighter amber: 5.34:1 on --brand navy -> passes WCAG AA for nav links on the dark header (the base #B57F1B is only 3.33:1) */
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --fg: #1a1a1a;
  --fg-muted: #555;
  --border: #d8dde3;
  --link: #1B3A5C;
  --link-hover: #B57F1B;
  --focus: #4A90E2;
  --warn: #b54a1b;

  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 65ch;

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;

  --shadow-md: 0 2px 8px rgba(0,0,0,.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131720;
    --bg-alt: #1c2330;
    --fg: #f0f3f8;
    --fg-muted: #b8c0cc;
    --border: #2a3142;
    --link: #c8d8ee;
    --link-hover: #f0c97f;
  }
}

/* --- base --- */
html { color-scheme: light dark; }
body {
  font-family: var(--font-stack);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: underline; text-underline-offset: .2em; }
a:hover, a:focus { color: var(--link-hover); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; color: var(--fg); }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-block: var(--space-3); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-block: var(--space-5) var(--space-3); }
h3 { font-size: 1.25rem; margin-block: var(--space-4) var(--space-2); }
h4 { font-size: 1.05rem; margin-block: var(--space-3) var(--space-2); }
p { max-width: var(--measure); margin-block: var(--space-3); }

/* --- skip link (accessibility) --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-3);
  background: var(--brand);
  color: var(--brand-fg);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  border-radius: 4px;
  z-index: 100;
}
.skip-link:focus { top: var(--space-3); }

/* --- header / nav --- */
.site-header {
  background: var(--brand);
  color: var(--brand-fg);
  padding-block: var(--space-3);
  border-bottom: 4px solid var(--accent);
}
.site-header__inner {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
}
.site-header__brand {
  color: var(--brand-fg);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.site-header__brand:hover, .site-header__brand:focus { color: var(--accent); }

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
}
.site-nav a {
  color: var(--brand-fg);
  text-decoration: none;
  font-weight: 500;
  padding-block: var(--space-1);
  min-height: 44px; /* WCAG 2.2 AA target-size */
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover, .site-nav a:focus, .site-nav a[aria-current="page"] { color: var(--accent-on-dark); text-decoration: underline; }

/* --- main / sections --- */
main { display: block; }
section { padding-block: var(--space-5); }
section.alt { background: var(--bg-alt); }
.section__inner {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-3);
}
.prose { max-width: 70ch; margin-inline: auto; }
.lede { font-size: 1.15rem; color: var(--fg-muted); max-width: 60ch; }

/* --- hero --- */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, #2c5a8c 100%);
  color: var(--brand-fg);
  padding-block: var(--space-6);
}
.hero h1 { color: var(--brand-fg); }
.hero p { color: var(--brand-fg); }
.hero .cta-row { margin-top: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* --- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-2) var(--space-4);
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
}
.btn--primary { background: var(--accent); color: #1a1a1a; }
.btn--primary:hover, .btn--primary:focus { background: #d49a2e; color: #1a1a1a; }
.btn--secondary { background: transparent; color: var(--brand-fg); border-color: var(--brand-fg); }
.btn--secondary:hover, .btn--secondary:focus { background: var(--brand-fg); color: var(--brand); }

/* --- cards / grid --- */
.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-4);
  box-shadow: var(--shadow-md);
}
.card h3 { margin-top: 0; }
.stat { text-align: center; }
.stat__number { font-size: 2.5rem; font-weight: 800; color: var(--accent); display: block; }
.stat__label { font-size: 1rem; color: var(--fg-muted); }

/* --- forms --- */
.form-field { margin-block: var(--space-3); }
.form-field label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  background: var(--bg);
  color: var(--fg);
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--focus); }
.form-field .help { font-size: .875rem; color: var(--fg-muted); margin-top: var(--space-1); }

/* Honeypot field: hidden from people; bots that fill it get their submission dropped by Web3Forms. */
.hp { display: none !important; }

/* --- footer --- */
.site-footer {
  background: var(--bg-alt);
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  padding-block: var(--space-5);
  margin-top: var(--space-6);
}
.site-footer__inner {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-3);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.site-footer a { color: var(--link); }
.site-footer .small { font-size: .875rem; }
/* WCAG 2.2 AA target-size (SC 2.5.8): footer list links get a >=24px tappable height (19px text + padding). */
.site-footer li a { display: inline-block; padding-block: 6px; }

/* --- responsive utilities --- */
@media (max-width: 640px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; }
  .hero { padding-block: var(--space-5); }
}

/* --- print --- */
@media print {
  .site-header, .site-nav, .site-footer, .skip-link, .cta-row { display: none; }
  body { color: #000; background: #fff; }
}

/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
