/* ============================================
   MalawiPastPapers — Design System
   Signal Blue #0057FF | Porcelain #F8F7F4
   ============================================ */

:root {
  --signal-blue: #0057FF;
  --signal-blue-dark: #0046CC;
  --signal-blue-light: #3377FF;
  --porcelain: #F8F7F4;
  --porcelain-dark: #EEEDE8;
  --white: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #5C5C6F;
  --text-muted: #8E8E9A;
  --border: #E5E4DF;
  --success: #10B981;
  --warning: #F59E0B;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 87, 255, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1200px;
  --header-height: 72px;
  --transition: 0.2s ease;
}

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

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

body {
  font-family: var(--font);
  background: var(--porcelain);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--signal-blue);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--signal-blue-dark);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; color: var(--text-secondary); }

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

main {
  flex: 1;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--signal-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1rem;
  flex-shrink: 0;
}

.logo span {
  color: var(--signal-blue);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-desktop a {
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-desktop a:hover,
.nav-desktop a.active {
  color: var(--signal-blue);
  background: rgba(0, 87, 255, 0.06);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-primary);
}

.nav-mobile {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  z-index: 99;
}

.nav-mobile.open {
  display: block;
}

.nav-mobile a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-mobile a:hover {
  background: rgba(0, 87, 255, 0.06);
  color: var(--signal-blue);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font);
  line-height: 1;
}

.btn-primary {
  background: var(--signal-blue);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--signal-blue-dark);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--white);
  color: var(--signal-blue);
  border: 2px solid var(--signal-blue);
}

.btn-secondary:hover {
  background: rgba(0, 87, 255, 0.06);
  color: var(--signal-blue-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--signal-blue);
  color: var(--signal-blue);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--signal-blue-dark) 100%);
  color: var(--white);
  padding: 4rem 0 5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 0.375rem 0.875rem;
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero h1 {
  color: var(--white);
  margin-bottom: 1rem;
}

.hero p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

.hero-search {
  display: flex;
  gap: 0.75rem;
  max-width: 560px;
}

.hero-search input {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--shadow-lg);
}

.hero-search input::placeholder {
  color: var(--text-muted);
}

.hero-search .btn-primary {
  flex-shrink: 0;
  padding: 0.875rem 1.75rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.stat-item strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
}

.stat-item span {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
}

/* ---- Ad Zones (AdSense-ready) ---- */
.ad-zone {
  background: var(--porcelain-dark);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.5rem 0;
  overflow: hidden;
}

.ad-zone-leaderboard {
  min-height: 90px;
  max-width: 728px;
  margin-left: auto;
  margin-right: auto;
}

.ad-zone-rectangle {
  min-height: 250px;
}

.ad-zone-mobile {
  min-height: 100px;
  display: none;
}

.ad-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.375rem;
  text-align: center;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 87, 255, 0.15);
  transform: translateY(-2px);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: rgba(0, 87, 255, 0.08);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.card-link {
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ---- Grid ---- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

/* ---- Sections ---- */
.section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3rem;
}

.section-header p {
  font-size: 1.0625rem;
  margin-top: 0.75rem;
}

.section-alt {
  background: var(--white);
}

/* ---- Paper List ---- */
.paper-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.paper-item:hover {
  border-color: rgba(0, 87, 255, 0.2);
  box-shadow: var(--shadow-sm);
}

.paper-icon {
  width: 44px;
  height: 44px;
  background: rgba(0, 87, 255, 0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--signal-blue);
  font-size: 1.125rem;
}

.paper-info {
  flex: 1;
  min-width: 0;
}

.paper-info h4 {
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paper-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.paper-tag {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  background: var(--porcelain);
  border-radius: 100px;
  color: var(--text-secondary);
  font-weight: 500;
}

.paper-tag.blue {
  background: rgba(0, 87, 255, 0.08);
  color: var(--signal-blue);
}

/* ---- Filters ---- */
.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.filter-select {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  min-width: 160px;
}

.filter-select:focus {
  border-color: var(--signal-blue);
  box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.1);
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--signal-blue);
}

.breadcrumb-sep {
  color: var(--border);
}

/* ---- Page Layout with Sidebar ---- */
.page-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
}

.sidebar-widget {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.sidebar-widget h4 {
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.sidebar-links {
  list-style: none;
}

.sidebar-links li {
  border-bottom: 1px solid var(--border);
}

.sidebar-links li:last-child {
  border-bottom: none;
}

.sidebar-links a {
  display: block;
  padding: 0.625rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.sidebar-links a:hover {
  color: var(--signal-blue);
}

/* ---- Blog ---- */
.blog-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

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

.blog-card-image {
  height: 180px;
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--signal-blue-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.blog-card-body {
  padding: 1.25rem;
}

.blog-card-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.blog-card h3 {
  font-size: 1.0625rem;
  margin-bottom: 0.5rem;
}

.blog-card p {
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

/* ---- Download Page ---- */
.download-box {
  background: var(--white);
  border: 2px solid var(--signal-blue);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.download-box .paper-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  font-size: 1.75rem;
}

.download-box h2 {
  margin-bottom: 0.5rem;
}

.download-box p {
  margin-bottom: 1.5rem;
}

.download-steps {
  text-align: left;
  background: var(--porcelain);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.download-steps ol {
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.download-steps li {
  margin-bottom: 0.5rem;
}

/* ---- Legal Pages ---- */
.legal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 2.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.legal-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.375rem;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content ul, .legal-content ol {
  margin: 0.75rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

.legal-content li {
  margin-bottom: 0.375rem;
}

.legal-updated {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ---- Contact Form ---- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--signal-blue);
  box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.1);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--text-primary);
  color: rgba(255, 255, 255, 0.7);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9375rem;
  margin-top: 0.75rem;
}

.footer-brand .logo {
  color: var(--white);
}

.footer-brand .logo span {
  color: var(--signal-blue-light);
}

.footer-col h4 {
  color: var(--white);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.5rem;
}

.footer-col a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--white);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8125rem;
}

.footer-bottom a {
  color: rgba(255, 255, 255, 0.5);
}

.footer-countries {
  display: flex;
  gap: 0.75rem;
}

.country-badge {
  padding: 0.25rem 0.625rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

/* ---- Country Selector ---- */
.country-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.country-tab {
  padding: 0.625rem 1.25rem;
  border-radius: 100px;
  border: 2px solid var(--border);
  background: var(--white);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.country-tab:hover,
.country-tab.active {
  border-color: var(--signal-blue);
  color: var(--signal-blue);
  background: rgba(0, 87, 255, 0.06);
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-list { display: flex; flex-direction: column; gap: 0.75rem; }

.page-hero {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0;
}

.page-hero h1 {
  margin-bottom: 0.5rem;
}

.page-hero p {
  font-size: 1.0625rem;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

@media (max-width: 768px) {
  .nav-desktop { display: none; }
  .nav-toggle { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 2.5rem 0 3rem; }
  .hero-search { flex-direction: column; }
  .hero-stats { gap: 1.5rem; }
  .section { padding: 2.5rem 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .ad-zone-mobile { display: flex; }
  .ad-zone-desktop { display: none; }
  .legal-content { padding: 1.5rem; }
  .download-box { padding: 1.5rem; }
}

@media (min-width: 769px) {
  .ad-zone-mobile { display: none; }
}
