/* Color Palette and System Variables */
/* Color Palette and System Variables */
:root {
  --primary-blue: #0044cc;
  --dark-blue: #002244;
  --accent-light: #e2e8f0;
  --text-dark: #1a202c;
  --text-light: #ffffff;
  --bg-light: #f4f7f6;
  --bg-main: #ffffff;
  --card-bg: #ffffff;
  --border-color: #cbd5e0;
  --mint-bg: #e0f2f1;
  --teal-text: #004d40;
  --preloader-bg: #ffffff;
  --preloader-text: #718096;
  --transition: all 0.3s ease-in-out;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --primary-blue: #38bdf8;
  --dark-blue: #0f172a;
  --accent-light: #334155;
  --text-dark: #f8fafc;
  --text-light: #ffffff;
  --bg-light: #1e293b;
  --bg-main: #0f172a;
  --card-bg: #1e293b;
  --border-color: #334155;
  --mint-bg: #134e4a;
  --teal-text: #2dd4bf;
  --preloader-bg: #0f172a;
  --preloader-text: #94a3b8;
}

/* Page Core */
body {
  color: var(--text-dark);
  line-height: 1.6;
  background-color: var(--bg-main);
}

/* Base Card Defaults */
.card {
  background-color: var(--card-bg);
  color: var(--text-dark);
  border-left: 4px solid var(--primary-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Blog Feed Layout Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  width: 100%;
}

.blog-card {
  padding: 0;
  border-left: none;
  border-top: 4px solid var(--primary-blue);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  min-height: 100%; /* Ensures cards stretch properly on mobile */
}

.blog-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark) !important; /* Uses dynamic variable for light/dark mode */
  line-height: 1.35;
  margin-bottom: 10px;
}

.blog-card-summary {
  font-size: 0.92rem;
  color: var(--text-dark);
  opacity: 0.85;
  margin-bottom: 18px;
  flex: 1;
}

/* Responsive Fix for Mobile Viewports */
@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* Preloader Background Sync */
#preloader-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--preloader-bg);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease, visibility 0.5s ease, background-color 0.3s ease;
}

.preloader-text {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--preloader-text);
  font-weight: 600;
}

/* Theme Toggle Button */
/* --- Theme Toggle Button Styling --- */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  color: #63b3ed;
  border-color: #63b3ed;
}

/* Centralize Toggle Link in Mobile Menu */
@media (max-width: 768px) {
  .nav-links li.theme-toggle-li {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* Card Updates */
.card, .drawer-links li a {
  background: var(--card-bg) !important;
  color: var(--text-dark) !important;
  border-color: var(--border-color) !important;
}

.blog-card-summary {
  color: var(--text-dark);
  opacity: 0.8;
}


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Preserved Preloader Animation Styles --- */
#preloader-container.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  margin-bottom: 25px;
  animation: logoHeartbeat 1.4s ease-in-out infinite;
}

@keyframes logoHeartbeat {
  0%, 100% { transform: scale(1); }
  14%, 42% { transform: scale(1.12); }
}

.progress-meter-container {
  width: 250px;
  height: 16px;
  background-color: #e2e8f0;
  border-radius: 50px;
  padding: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.progress-meter-bar {
  height: 100%;
  width: 0%;
  background-color: var(--primary-blue);
  border-radius: 50px;
  transition: width 0.1s linear, background-color 0.4s ease;
}

.progress-meter-bar.fully-complete {
  background-color: var(--dark-blue) !important;
}

/* --- Header & Navigation --- */
header {
  position: sticky;
  top: 0;
  background-color: var(--dark-blue);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo {
  height: 38px;
  width: auto;
}

.brand-name {
  color: var(--text-light);
  font-weight: 700;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 18px;
}

.nav-links a {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
  color: #63b3ed;
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background-color: var(--text-light);
  border-radius: 2px;
}

/* --- Section Structural Framework --- */
/* --- Section Structural Framework --- */
.scroll-section {
  padding: 80px 20px;
  opacity: 0;
  transform: translateY(35px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.scroll-section.visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Fail-safe Mobile Override: Ensures sections render even if observer delays */
@media (max-width: 768px) {
  .scroll-section {
    opacity: 1 !important;
    transform: none !important;
    padding: 50px 15px;
  }
}

.bg-light {
  background-color: var(--bg-light);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

h2 {
  font-size: 2rem;
  color: var(--primary-blue);
  margin-bottom: 12px;
  position: relative;
  display: inline-block;
}

h2::after {
  content: '';
  display: block;
  width: 50%;
  height: 3px;
  background-color: var(--primary-blue);
  margin: 6px auto 0;
  border-radius: 2px;
}

/* --- Hero Section --- */
.hero {
  background: linear-gradient(rgba(0, 34, 68, 0.92), rgba(0, 68, 204, 0.85)), url('hero-bg.jpg') center/cover no-repeat;
  color: var(--text-light);
  text-align: center;
  padding: 120px 20px 90px;
}

.hero-logo {
  width: 90px;
  height: auto;
  margin-bottom: 15px;
}

.hero-content h1 {
  font-size: 2.8rem;
  margin-bottom: 15px;
}

.hero-content p {
  font-size: 1.15rem;
  max-width: 700px;
  margin: 0 auto 25px;
  opacity: 0.92;
}

.btn {
  display: inline-block;
  background-color: var(--primary-blue);
  color: var(--text-light);
  padding: 12px 28px;
  text-decoration: none;
  border-radius: 25px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  background-color: #002244;
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 6px;
  margin-top: 10px;
}

/* --- Drawer List (TOC) --- */
.drawer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 600px;
  margin: 25px auto 0;
  text-align: left;
}

.drawer-links li a {
  display: block;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-weight: 600;
  color: var(--dark-blue);
  text-decoration: none;
  transition: var(--transition);
}

.drawer-links li a:hover {
  background-color: var(--primary-blue);
  color: #ffffff;
  padding-left: 24px;
}

/* --- Card Grids & Blog Layouts --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.card {
  background: #ffffff;
  padding: 24px;
  border-radius: 10px;
  border-left: 4px solid var(--primary-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-align: left;
}

/* Fix Mobile Grid Rendering & Flex Container Stack */
.blog-card-media {
    width: 100%;
    height: 200px;
    background-color: var(--bg-light);
    overflow: hidden; /* Prevents image overflow outside borders */
    border-bottom: 1px solid var(--border-color);
}

.blog-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Edge-to-edge fill while maintaining aspect ratio */
    object-position: center; /* Keeps important content centered */
}

.blog-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-topic-badge {
  align-self: flex-start;
  background-color: var(--mint-bg);
  color: var(--teal-text);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.blog-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark-blue);
  line-height: 1.35;
  margin-bottom: 10px;
}

.blog-card-summary {
  font-size: 0.92rem;
  margin-bottom: 18px;
  flex: 1;
}

.support-card {
  text-align: center;
  border-left: none;
  border-top: 4px solid var(--primary-blue);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.ecosystem-card {
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
}

.ecosystem-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 68, 204, 0.12);
}

.card-img-box {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.card-img-box img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.margin-top-xs { margin-top: 6px; }
.margin-top-sm { margin-top: 12px; }
.margin-top-md { margin-top: 25px; }

/* --- Footer --- */
footer {
  background-color: var(--dark-blue);
  color: var(--text-light);
  padding: 25px 20px;
  border-top: 4px solid var(--primary-blue);
}

footer a {
  color: #63b3ed;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  /* Ensure header remains on top of the overlay */
  header {
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .nav-links {
    position: fixed;
    top: 60px; /* Adjust this value to match your exact header height */
    left: 0;
    width: 100vw;
    height: calc(100dvh - 60px); /* Covers the remaining height below header */
    background-color: var(--dark-blue);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Aligns links starting below header */
    padding-top: 20px;
    
    /* Smooth toggle controls */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease-in-out, visibility 0.35s ease-in-out;
    z-index: 999;
  }

  .nav-links.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: block;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .hero-content h1 {
    font-size: 2rem;
  }
}

/**
* BLOGS SEARCH BAR STYLING
**/

.search-container-wrapper {
  max-width: 500px;
  margin: 20px auto 10px auto;
  padding: 0 15px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 15px;
  transition: var(--transition);
}

/* Accesible focus highlight ring */
.search-box:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 68, 204, 0.15);
  background-color: #ffffff;
}

.search-icon {
  color: #718096;
  font-size: 1rem;
  margin-right: 10px;
}

#article-search {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-dark);
  padding: 8px 0;
}

#article-search::placeholder {
  color: #a0aec0;
}

/* Mobile Screen Overrides */
@media (max-width: 768px) {
  .search-container-wrapper {
    max-width: 100%;
    margin: 15px 0 5px 0;
  }
}
