/* ============================================================
   BASE.CSS — Shared Design System
   Modern, mobile-first, Core Web Vitals friendly
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;

  /* Neutral Palette */
  --white: #FFFFFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Brand — overridden per site via site.css */
  --color-primary: #2563EB;
  --color-primary-light: #3B82F6;
  --color-primary-dark: #1D4ED8;
  --color-accent: #F59E0B;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F9FAFB;
  --color-text: #1F2937;
  --color-text-muted: #6B7280;
  --color-border: #E5E7EB;

  /* Spacing Scale */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */

  /* Layout */
  --max-width: 1200px;
  --content-width: 780px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

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

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

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--gray-900);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: -0.01em;
  margin-top: var(--space-3xl);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-border);
}

h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  margin-top: var(--space-2xl);
}

h4 {
  font-size: 1.1rem;
  margin-top: var(--space-xl);
}

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

strong {
  font-weight: 600;
}

small, .text-sm {
  font-size: 0.875rem;
}

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

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.content-container {
  max-width: var(--content-width);
  margin: 0 auto;
}

.section {
  padding: var(--space-3xl) 0;
}
.section-sm {
  padding: var(--space-2xl) 0;
}
.section-lg {
  padding: var(--space-4xl) 0;
}

/* Grid */
.grid {
  display: grid;
  gap: var(--space-lg);
}
.grid-2 {
  grid-template-columns: 1fr;
}
.grid-3 {
  grid-template-columns: 1fr;
}
.grid-4 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .container { padding: 0 var(--space-xl); }
}

/* Flex helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Text alignment */
.text-center { text-align: center; }

/* --- Article Content Styles --- */
.article-content p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--gray-700);
}

.article-content ul,
.article-content ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}
.article-content ul {
  list-style: disc;
}
.article-content ol {
  list-style: decimal;
}
.article-content li {
  margin-bottom: var(--space-sm);
  line-height: 1.7;
  color: var(--gray-700);
}

.article-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xl) 0;
  background: var(--color-surface-alt);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--gray-600);
}

.article-content table {
  margin: var(--space-xl) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.95rem;
}
.article-content th {
  background: var(--color-surface-alt);
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--color-border);
}
.article-content td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
}
.article-content tr:last-child td {
  border-bottom: none;
}
.article-content tr:hover {
  background: var(--gray-50);
}

/* Responsive table wrapper */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-xl) 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
.table-wrapper table {
  margin: 0;
  border: none;
  border-radius: 0;
}

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

.no-scroll {
  overflow: hidden;
}

/* --- Print Styles --- */
@media print {
  .header, .footer, .ad-slot, .toc, .mobile-nav-toggle {
    display: none !important;
  }
  body {
    font-size: 12pt;
    color: #000;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
}
