/**
 * Mzimba South Luwerezi Constituency — Base Stylesheet
 * CSS Reset, Semantic Typography, Accessibility & Layout Primitives.
 */

/* ==========================================================================
   1. BOX SIZING & RESET
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   2. ACCESSIBILITY & FOCUS CONTROLS
   ========================================================================== */
:focus-visible {
  outline: 2px solid var(--brand-navy-800);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--brand-navy-100);
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  top: -9999px;
  left: var(--space-4);
  background-color: var(--brand-navy-900);
  color: var(--color-white);
  padding: var(--space-3) var(--space-5);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  text-decoration: none;
  z-index: var(--z-skip-link);
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-gold-400);
  box-shadow: var(--shadow-modal);
}

.skip-link:focus {
  top: var(--space-4);
}

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

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

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--brand-navy-900);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

@media (min-width: 768px) {
  h1 { font-size: var(--font-size-4xl); }
  h2 { font-size: var(--font-size-3xl); }
}

@media (min-width: 1024px) {
  h1 { font-size: var(--font-size-5xl); }
}

p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

small, .text-sm {
  font-size: var(--font-size-sm);
}

.text-xs {
  font-size: var(--font-size-xs);
}

.text-2xs {
  font-size: var(--font-size-2xs);
}

.text-muted {
  color: var(--text-muted);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

.font-mono {
  font-family: var(--font-mono);
}

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

a {
  color: var(--brand-navy-800);
  text-decoration: none;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
  color: var(--brand-navy-600);
  text-decoration: underline;
}

a.underline {
  text-decoration: underline;
}

/* ==========================================================================
   4. CONTAINERS & LAYOUT GRIDS
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.section-bordered {
  border-top: var(--border-width-thin) solid var(--border-subtle);
  border-bottom: var(--border-width-thin) solid var(--border-subtle);
}

.bg-surface {
  background-color: var(--bg-surface);
}

.bg-default {
  background-color: var(--bg-page);
}

/* Flex & Grid Utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Two-column layout with sidebar */
.content-grid-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 1024px) {
  .content-grid-sidebar {
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
}

/* Spacing Helpers */
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.pt-0 { padding-top: 0; }
.pt-4 { padding-top: var(--space-4); }

.w-full { width: 100%; }
.max-w-md { max-width: 28rem; margin-left: auto; margin-right: auto; }
.max-w-lg { max-width: 32rem; margin-left: auto; margin-right: auto; }
.max-w-2xl { max-width: 42rem; margin-left: auto; margin-right: auto; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; margin-left: auto; margin-right: auto; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.block { display: block; }
.space-y-1 > * + * { margin-top: var(--space-1); }
.space-y-2 > * + * { margin-top: var(--space-2); }
.space-y-3 > * + * { margin-top: var(--space-3); }
.space-y-4 > * + * { margin-top: var(--space-4); }
.space-y-6 > * + * { margin-top: var(--space-6); }

.border { border: var(--border-width-thin) solid var(--border-subtle); }
.border-b { border-bottom: var(--border-width-thin) solid var(--border-subtle); }
.border-t { border-top: var(--border-width-thin) solid var(--border-subtle); }
.border-2 { border: var(--border-width-medium) solid var(--border-medium); }
.rounded { border-radius: var(--radius-sm); }