/* ============================================================
   GUURTI LEGISLATIVE PORTAL - DESIGN SYSTEM
   Somaliland House of Elders (Golaha Guurtida)
   SNPA National Identity Compliant
   ============================================================ */

/* ============================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */

:root {
  /* Somaliland National Palette (SNPA Standard) */
  --color-primary-green: #1EB53A;
  --color-primary-green-dark: #178a2e;
  --color-parliament-red: #D21034;
  --color-gold-accent: #FFD700;
  --color-gold-dark: #C9A500;
  --color-white: #FFFFFF;
  --color-black: #000000;
  
  /* UI Neutrals - WCAG AA Compliant */
  --color-neutral-dark: #1A1A1A;
  --color-neutral-medium: #3D3D3D; /* Improved: 7.5:1 contrast */
  --color-neutral-light: #D4D4D4;
  --color-background: #FAFAFA;
  --color-background-alt: #F0F0F0;
  
  /* Semantic Colors */
  --color-success: #0A7B3E;
  --color-warning: #B45309;
  --color-error: #B91C1C;
  --color-info: #1D4ED8;
  
  /* Guurti Specific */
  --color-guurti-gold: #FFD700;
  --color-heritage: #6B5344;
  
  /* Typography - Institutional */
  --font-heading: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'Noto Sans Arabic', 'Amiri', sans-serif;
  --font-legal: 'Georgia', 'Times New Roman', serif;
  
  /* Font Sizes - Increased for Readability */
  --text-xs: 0.8125rem;  /* 13px */
  --text-sm: 0.9375rem;  /* 15px */
  --text-base: 1.125rem; /* 18px - IPU Recommended */
  --text-lg: 1.25rem;    /* 20px */
  --text-xl: 1.5rem;     /* 24px */
  --text-2xl: 1.75rem;   /* 28px */
  --text-3xl: 2.25rem;   /* 36px */
  --text-4xl: 2.75rem;   /* 44px */
  --text-5xl: 3.5rem;    /* 56px */
  
  /* Line Heights - Document Standard */
  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.8;
  
  /* Spacing Scale */
  --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;
  
  /* Shadows - Subtle Government Style */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.10);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  
  /* Border Radius - Conservative */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;
  
  /* Transitions - Subtle */
  --transition-fast: 100ms ease-out;
  --transition-medium: 200ms ease-out;
  --transition-slow: 300ms ease-out;
  
  /* Focus Ring - WCAG AA */
  --focus-ring: 0 0 0 3px rgba(30, 181, 58, 0.4);
  --focus-ring-offset: 2px;
  
  /* Touch Targets - WCAG 2.1 */
  --touch-target-min: 44px;
  
  /* Grid */
  --container-max: 1200px;
  --grid-gutter: 2rem;
}

/* ============================================================
   2. RESET & BASE STYLES
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--color-neutral-dark);
  background-color: var(--color-white);
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-black);
  margin-bottom: var(--space-4);
}

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

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

a {
  color: var(--color-primary-green);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-parliament-red);
}

a:focus-visible {
  outline: 3px solid var(--color-primary-green);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Arabic Typography */
[lang="ar"], .arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
}

/* ============================================================
   4. LAYOUT COMPONENTS
   ============================================================ */

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

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

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { 
    grid-template-columns: 1fr; 
  }
}

/* ============================================================
   5. BUTTON COMPONENTS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  text-align: center;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary-green);
  outline-offset: 2px;
}

/* Primary Button */
.btn-primary {
  background-color: var(--color-primary-green);
  color: var(--color-white);
  border-color: var(--color-primary-green);
}

.btn-primary:hover {
  background-color: #1a9e33;
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Secondary Button */
.btn-secondary {
  background-color: transparent;
  color: var(--color-primary-green);
  border-color: var(--color-primary-green);
}

.btn-secondary:hover {
  background-color: var(--color-primary-green);
  color: var(--color-white);
}

/* Gold Button (Guurti Specific) */
.btn-gold {
  background-color: var(--color-gold-accent);
  color: var(--color-black);
  border-color: var(--color-gold-accent);
}

.btn-gold:hover {
  background-color: #e6c200;
  color: var(--color-black);
}

/* ============================================================
   6. CARD COMPONENTS
   ============================================================ */

.card {
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all var(--transition-medium);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
}

.card-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-neutral-light);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--color-neutral-light);
  background-color: var(--color-background);
}

/* Member/Elder Card */
.elder-card {
  text-align: center;
}

.elder-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.elder-card .card-body {
  padding: var(--space-4);
}

.elder-name {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-black);
  margin-bottom: var(--space-2);
}

.elder-region {
  color: var(--color-neutral-medium);
  font-size: var(--text-base);
}

/* ============================================================
   7. NAVIGATION COMPONENTS
   ============================================================ */

.navbar {
  background-color: var(--color-white);
  border-bottom: 1px solid var(--color-neutral-light);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-black);
}

.navbar-brand img {
  height: 50px;
  width: auto;
}

.navbar-menu {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}

.navbar-link {
  font-weight: 500;
  color: var(--color-neutral-dark);
  padding: var(--space-2) 0;
  position: relative;
}

.navbar-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary-green);
  transition: width var(--transition-medium);
}

.navbar-link:hover::after,
.navbar-link.active::after {
  width: 100%;
}

/* ============================================================
   8. UTILITY CLASSES
   ============================================================ */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Colors */
.text-primary { color: var(--color-primary-green); }
.text-gold { color: var(--color-gold-accent); }
.text-red { color: var(--color-parliament-red); }

.bg-primary { background-color: var(--color-primary-green); }
.bg-gold { background-color: var(--color-gold-accent); }
.bg-gray { background-color: var(--color-background); }

/* Spacing Utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Accessibility */
.sr-only {
  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: -40px;
  left: 0;
  background: var(--color-primary-green);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Focus Indicators (WCAG AA) */
*:focus-visible {
  outline: 3px solid var(--color-primary-green);
  outline-offset: 2px;
}

/* ============================================================
   9. RESPONSIVE UTILITIES
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --text-5xl: 2.25rem;
    --text-4xl: 1.875rem;
    --text-3xl: 1.5rem;
  }
  
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}
