/* ============================================================
   SURVIVING SOUTH AFRICA — Design System
   Palette: Deep Slate / Safety Orange / White
   Font: Inter (Google Fonts)
   Target: < 500KB total page weight, mobile-first (91.5% SA mobile)
   ============================================================ */

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

/* --- CSS Custom Properties --- */
:root {
  /* Slate Scale */
  --slate-950: #12141a;
  --slate-900: #1a1d23;
  --slate-800: #242830;
  --slate-700: #2e333d;
  --slate-600: #3d4451;
  --slate-500: #5a6375;
  --slate-400: #8b95a5;
  --slate-300: #a8b2c1;
  --slate-200: #c8ced8;
  --slate-100: #e2e6ec;
  --white: #f0f2f5;

  /* Accent */
  --orange: #e86830;
  --orange-hover: #c45520;
  --orange-glow: rgba(232,104,48,0.12);
  --orange-soft: rgba(232,104,48,0.08);

  /* Semantic */
  --green: #2ecc71;
  --green-bg: rgba(46,204,113,0.1);
  --red: #e74c3c;
  --red-bg: rgba(231,76,60,0.1);
  --teal: #1abc9c;
  --teal-bg: rgba(26,188,156,0.1);
  --purple: #9b59b6;
  --purple-bg: rgba(155,89,182,0.1);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Montserrat', var(--font);

  /* Spacing */
  --gap: clamp(1rem, 3vw, 2rem);
  --section-pad: clamp(3rem, 8vw, 6rem);
  --container: min(1200px, 92vw);

  /* Misc */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.25);
  --transition: 0.25s ease;
}

/* --- 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);
  background: var(--slate-900);
  color: var(--slate-200);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--orange); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--orange-hover); }
ul { list-style: none; }

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

/* --- Typography --- */
h1, h2, h3, h4 {
  color: var(--white);
  font-weight: 700;
  line-height: 1.2;
}
h1 { font-size: clamp(1.75rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }
h4 { font-size: 1rem; }

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.75rem;
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
}
.section-header p {
  color: var(--slate-400);
  margin-top: 0.75rem;
  font-size: 1.05rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-family: var(--font);
  min-height: 48px; /* touch target */
}
.btn-primary {
  background: var(--orange);
  color: #fff;
}
.btn-primary:hover {
  background: var(--orange-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232,104,48,0.3);
}
.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 1.5px solid var(--slate-600);
}
.btn-secondary:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26,29,35,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-700);
  padding: 0.75rem 0;
}
.header-inner {
  width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--white);
  white-space: nowrap;
}
.site-name span { color: var(--orange); }

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-links a {
  color: var(--slate-300);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--orange); }
.nav-links .emergency-link {
  color: var(--orange);
  font-weight: 700;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  align-items: center;
}
.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--white);
  transition: all var(--transition);
  border-radius: 2px;
}

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 75vw;
    max-width: 300px;
    height: 100vh;
    background: var(--slate-800);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    gap: 1.25rem;
    transition: right var(--transition);
    box-shadow: -4px 0 24px rgba(0,0,0,0.4);
    z-index: 200;
  }
  .nav-links.open { right: 0; }
  .nav-links a { font-size: 1.1rem; }
  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
  }
  .nav-overlay.open { display: block; }
}

/* ============================================================
   HERO — Search-First
   ============================================================ */
.hero {
  padding: var(--section-pad) 0;
  text-align: center;
  background: linear-gradient(180deg, var(--slate-950) 0%, var(--slate-900) 100%);
}
.hero-content {
  width: var(--container);
  margin: 0 auto;
}
.hero h1 {
  margin-bottom: 1rem;
}
.hero-sub {
  color: var(--slate-400);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Search Bar */
.search-wrap {
  max-width: 640px;
  margin: 0 auto 1.5rem;
  position: relative;
}
.search-wrap input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  border-radius: 50px;
  border: 2px solid var(--slate-600);
  background: var(--slate-800);
  color: var(--white);
  font-size: 1rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
  min-height: 56px;
}
.search-wrap input::placeholder { color: var(--slate-500); }
.search-wrap input:focus { border-color: var(--orange); }
.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-500);
  width: 20px;
  height: 20px;
}

/* Trending Pills */
.trending {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}
.trending-label {
  font-size: 0.8rem;
  color: var(--slate-500);
  font-weight: 600;
  align-self: center;
}
.pill {
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  color: var(--slate-300);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.pill:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-soft);
}

/* ============================================================
   TRUST BANNER
   ============================================================ */
.trust-banner {
  background: var(--slate-700);
  border-left: 4px solid var(--orange);
  padding: 1rem 0;
}
.trust-banner-inner {
  width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.trust-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--slate-200);
  font-weight: 500;
}
.trust-check {
  color: var(--green);
  flex-shrink: 0;
}
.trust-link {
  font-size: 0.85rem;
  color: var(--slate-400);
  white-space: nowrap;
}
.trust-link:hover { color: var(--orange); }

/* ============================================================
   ARTICLE GRID — "Risk Map" Blog Layout
   ============================================================ */
.articles {
  padding: var(--section-pad) 0;
}
.articles-grid {
  width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
}

/* Featured (hero) card */
.article-card {
  background: var(--slate-800);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--slate-700);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.article-card:hover {
  border-color: var(--slate-600);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.article-card.featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}
@media (max-width: 700px) {
  .article-card.featured {
    grid-template-columns: 1fr;
  }
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--slate-700);
}
.article-card.featured .card-thumb {
  aspect-ratio: auto;
  height: 100%;
  min-height: 250px;
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}
.card-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  width: fit-content;
}
.tag-safety { background: var(--orange-glow); color: var(--orange); }
.tag-digital { background: var(--teal-bg); color: var(--teal); }
.tag-sme { background: var(--purple-bg); color: var(--purple); }
.tag-home { background: var(--green-bg); color: var(--green); }
.tag-opsec { background: var(--red-bg); color: var(--red); }

.card-title {
  font-size: 1.1rem;
  line-height: 1.35;
}
.article-card.featured .card-title {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}
.card-excerpt {
  color: var(--slate-400);
  font-size: 0.9rem;
  line-height: 1.6;
  flex: 1;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--slate-700);
}

/* ============================================================
   COMPARISON TABLE — ChataBok vs WhatsApp
   ============================================================ */
.comparison {
  padding: var(--section-pad) 0;
  background: var(--slate-950);
}
.comparison-wrap {
  width: var(--container);
  margin: 0 auto;
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
}
.comparison-table th,
.comparison-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--slate-700);
}
.comparison-table thead th {
  background: var(--slate-800);
  color: var(--white);
  font-weight: 700;
  font-size: 0.95rem;
}
.comparison-table th:nth-child(2) { color: var(--red); }
.comparison-table th:nth-child(3) { color: var(--green); }

.comparison-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
.comparison-table td:first-child {
  color: var(--white);
  font-weight: 600;
}
.icon-no {
  color: var(--red);
  font-weight: 800;
}
.icon-yes {
  color: var(--green);
  font-weight: 800;
}
.compare-disclaimer {
  font-size: 0.8rem;
  color: var(--slate-500);
  font-style: italic;
  margin-top: 1rem;
}

/* Mobile table scroll */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--slate-700);
}

/* ============================================================
   SERVICES CTA
   ============================================================ */
.services {
  padding: var(--section-pad) 0;
}
.services-grid {
  width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.service-card {
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all var(--transition);
}
.service-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}
.service-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--orange-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
}
.service-card h3 { font-size: 1.15rem; }
.service-card p {
  color: var(--slate-400);
  font-size: 0.95rem;
  flex: 1;
}

/* ============================================================
   EMERGENCY FOOTER
   ============================================================ */
.site-footer {
  background: var(--slate-950);
  border-top: 1px solid var(--slate-700);
  padding: 3rem 0 2rem;
}
.footer-inner {
  width: var(--container);
  margin: 0 auto;
}

.emergency-block {
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.emergency-block h3 {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.emergency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.emergency-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  background: var(--slate-700);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  min-height: 48px;
}
.emergency-item:hover { background: var(--slate-600); }
.emergency-item .label {
  font-size: 0.8rem;
  color: var(--slate-400);
}
.emergency-item .number {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--orange);
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.copy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}
.copy-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.footer-disclaimer {
  font-size: 0.8rem;
  color: var(--slate-500);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-left: 3px solid var(--slate-600);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-700);
  font-size: 0.8rem;
  color: var(--slate-500);
}
.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--slate-400);
  font-size: 0.8rem;
}

/* ============================================================
   POST / ARTICLE PAGE LAYOUT
   ============================================================ */
.post-page {
  padding: var(--section-pad) 0;
}
.post-container {
  width: min(780px, 92vw);
  margin: 0 auto;
}
.post-header {
  margin-bottom: 2rem;
}
.post-header h1 {
  margin: 0.75rem 0 1rem;
}
.post-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--slate-400);
  margin-bottom: 1.5rem;
}

.post-hero-img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  aspect-ratio: 21/9;
  object-fit: cover;
  background: var(--slate-800);
}

/* Article prose */
.prose h2 {
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-700);
}
.prose h3 {
  margin: 2rem 0 0.75rem;
}
.prose p {
  margin-bottom: 1.25rem;
}
.prose ul, .prose ol {
  margin: 1rem 0 1.5rem 1.5rem;
  list-style: disc;
}
.prose ol { list-style: decimal; }
.prose li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}
.prose strong { color: var(--white); }
.prose blockquote {
  border-left: 3px solid var(--orange);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--orange-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--slate-200);
  font-style: italic;
}
.prose .callout {
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.prose .callout-title {
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sidebar CTA in posts */
.post-cta {
  background: var(--slate-800);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
  text-align: center;
}
.post-cta h4 { margin-bottom: 0.5rem; }
.post-cta p {
  color: var(--slate-400);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Related posts at bottom */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--slate-700);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ============================================================
   UTILITIES & ANIMATIONS
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Print styles */
@media print {
  .site-header, .hamburger, .nav-overlay, .search-wrap, .trending { display: none; }
  body { background: #fff; color: #000; }
  .article-card, .service-card { break-inside: avoid; }
}
