:root {
  /* Palette: Deep Cosmic Professional */
  --bg-dark: #030305;
  --bg-surface: rgba(255, 255, 255, 0.03);
  --bg-surface-hover: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.06);
  
  /* Accents: Sophisticated Electric Blue & Purple */
  --primary-accent: #3b82f6; /* Royal Blue */
  --secondary-accent: #8b5cf6; /* Violet */
  --tertiary-accent: #06b6d4; /* Cyan */
  
  --text-main: #ffffff;
  --text-muted: #94a3b8; /* Slate 400 */
  --text-dim: #64748b;    /* Slate 500 */
  
  --success-color: #10b981;
  --danger-color: #ef4444;

  --font-heading: "Poppins", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px -10px rgba(59, 130, 246, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 14px; /* Scaled down base font size from 16px */
}

body {
  font-family: var(--font-body);
  color: var(--text-muted);
  background-color: var(--bg-dark);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sophisticated Ambient Background */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
  z-index: -1;
  pointer-events: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

a {
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-accent);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

/* Utilitiy Classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Glassmorphism 2.0: Cleaner, Thinner, More Professional */
.glass-effect {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Header */
.site-header {
  height: 80px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(3, 3, 5, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
}

.main-nav ul li a {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

/* Running Text Bar */
.running-text-container {
  background: #08080a;
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  overflow: hidden;
  white-space: nowrap;
}

.running-text-content {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 30s linear infinite;
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.running-text-content span {
    color: var(--tertiary-accent);
    margin: 0 5px;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 6rem 0 4rem;
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto 3rem;
  line-height: 1.6;
}

.hero-search {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 16px 24px;
  font-size: 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: var(--text-main);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

#search-input:focus {
  outline: none;
  background: rgba(255,255,255,0.08);
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* Page Title */
.page-title-wrapper {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-block;
  position: relative;
}
.page-title::after {
  content: '';
  display: block;
  width: 100%;
  height: 2px;
  background: var(--primary-accent);
  position: absolute;
  bottom: -17px; /* Align with border-bottom */
  left: 0;
  border-radius: 2px;
}

/* Main Layout */
.main-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  padding: 40px 0;
}

.content-area {
  min-width: 0;
}

/* Article Cards */
#article-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.article-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
}

.article-card:hover .card-title a {
  color: var(--primary-accent);
}

.card-image {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #111;
  overflow: hidden;
  border-bottom: 1px solid var(--glass-border);
}

.card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0.9;
}

.article-card:hover .card-image img {
  transform: scale(1.05);
  opacity: 1;
}

.card-category {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 2;
}

.card-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.4;
}

.card-title a {
  color: var(--text-main);
  transition: color 0.2s ease;
}

.card-excerpt {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  gap: 16px;
  align-items: center;
}

.card-meta i {
  color: var(--text-muted);
  margin-right: 6px;
}

/* Featured Article Logic (Desktop) */
@media (min-width: 992px) {
  #article-list-grid > .article-card:first-child {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: stretch;
    min-height: 380px;
  }
  
  #article-list-grid > .article-card:first-child .card-image {
    width: 55%;
    padding-top: 0;
    order: 2; /* Image on right */
    border-bottom: none;
    border-left: 1px solid var(--glass-border);
  }
  
  #article-list-grid > .article-card:first-child .card-content {
    width: 45%;
    justify-content: center;
    padding: 48px;
    order: 1;
  }
  
  #article-list-grid > .article-card:first-child .card-title {
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
  }
  
  #article-list-grid > .article-card:first-child .card-excerpt {
    font-size: 1.1rem;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    margin-bottom: 1.5rem;
  }
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.widget {
  padding: 24px;
}

.widget-title {
  font-size: 1rem;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 12px;
}

.widget .profile-pic {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  border: 2px solid var(--glass-border);
}

.category-list, .recent-posts-list {
  list-style: none;
}

.category-list li, .recent-posts-list li {
  margin-bottom: 12px;
}
.category-list li:last-child { margin-bottom: 0; }

.category-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 6px 0;
  border-radius: 4px;
}

.category-list li a:hover {
  color: var(--primary-accent);
  padding-left: 4px; /* subtle shift */
}

/* Page: Single Article */
.single-article {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.article-header {
  margin-bottom: 40px;
  text-align: center;
  max-width: 900px;
  margin: 0 auto 40px;
}

.single-article h1.article-title {
  font-size: 2.75rem;
  margin-bottom: 24px;
  line-height: 1.2;
}

.single-article .meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.article-featured-image {
  width: 100%;
  height: auto;
  aspect-ratio: 21/9;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 48px;
  border: 1px solid var(--glass-border);
}

.article-content {
  font-size: 1.125rem; /* 18px */
  line-height: 1.8;
  color: var(--text-light); /* Slightly lighter than muted */
  max-width: 800px;
  margin: 0 auto;
}

.article-content p {
  margin-bottom: 2rem;
}

.article-content h2 {
  font-size: 1.75rem;
  margin: 3rem 0 1.5rem;
  color: var(--text-main);
}

.article-content h3 {
  font-size: 1.4rem;
  margin: 2.5rem 0 1.25rem;
  color: var(--text-main);
}

.article-content ul, .article-content ol {
  margin-bottom: 2rem;
  padding-left: 1.5rem;
}
.article-content li { margin-bottom: 0.75rem; }

.article-content img {
  border-radius: var(--radius-sm);
  max-width: 100%;
  height: auto;
  margin: 2rem 0;
  border: 1px solid var(--glass-border);
}

.article-content blockquote {
  border-left: 3px solid var(--primary-accent);
  margin: 2.5rem 0;
  padding: 1rem 0 1rem 1.5rem;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--text-main);
  background: transparent;
}

/* TOC */
.toc-container {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 32px;
  margin: 40px 0;
}
.toc-title { font-size: 1.1rem; margin-bottom: 16px; font-weight: 600; }
.toc-list { list-style: none; padding: 0; }
.toc-list li { margin-bottom: 8px; }
.toc-list a { color: var(--text-muted); font-size: 0.95rem; }
.toc-list a:hover { color: var(--primary-accent); }

/* Load More */
#load-more-btn {
  display: inline-block;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 14px 32px;
  border-radius: 100px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 40px;
}
#load-more-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-muted);
}
#load-more-container { text-align: center; }

/* Footer */
.site-footer {
  margin-top: 120px;
  border-top: 1px solid var(--glass-border);
  background: #020203;
  padding: 80px 0 40px;
  font-size: 0.95rem;
}

.footer-widgets {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 64px;
  margin-bottom: 64px;
}

.footer-widget h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-main);
  margin-bottom: 24px;
}

.footer-widget p { color: var(--text-dim); }

.social-links {
  display: flex;
  gap: 16px;
}

.social-links a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  transition: all 0.2s;
}

.social-links a:hover {
  background: var(--primary-accent);
  color: #fff;
  border-color: var(--primary-accent);
  transform: translateY(-2px);
}

.copyright {
  border-top: 1px solid var(--glass-border);
  padding-top: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 992px) {
  .main-wrapper { grid-template-columns: 1fr; gap: 60px; }
  .hero-title { font-size: 2.5rem; }
  .single-article h1.article-title { font-size: 2rem; }
}

@media (max-width: 768px) {
  .site-header { height: auto; padding: 16px 0; }
  .site-header .container { flex-direction: column; gap: 16px; }
  .main-nav ul { gap: 8px; flex-wrap: wrap; justify-content: center; }
  .footer-widgets { grid-template-columns: 1fr; gap: 40px; }
  
  /* Reset featured article on mobile */
  #article-list-grid > .article-card:first-child {
    grid-column: auto;
    flex-direction: column;
  }
  #article-list-grid > .article-card:first-child .card-image,
  #article-list-grid > .article-card:first-child .card-content {
    width: 100%;
    order: unset;
  }
  #article-list-grid > .article-card:first-child .card-image {
    padding-top: 56.25%;
  border-bottom: 1px solid var(--glass-border);
  border-left: none;
  }
}

/* === ENHANCEMENTS: Progress Bar & Back To Top === */
.reading-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 1002;
  pointer-events: none;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary-accent), var(--primary-accent), var(--tertiary-accent));
  width: 0%;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px var(--primary-accent);
}

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: var(--bg-surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-main);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-accent);
  color: #fff;
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
  border-color: var(--primary-accent);
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px; 
    height: 40px;
  }
}

