/* Critical CSS - Above the fold styles loaded first */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #f3f4f6;
  --accent: #8b5cf6;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --background: #ffffff;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --header-bg: #ffffff;
  --footer-bg: #f9fafb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 0.5rem;
  --transition: all 0.2s ease;
}

.dark-mode {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --secondary: #374151;
  --accent: #a78bfa;
  --text: #f9fafb;
  --text-secondary: #9ca3af;
  --background: #111827;
  --card-bg: #1f2937;
  --border: #374151;
  --header-bg: #1f2937;
  --footer-bg: #1f2937;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--background);
  transition: background-color 0.3s ease, color 0.3s ease;
  font-display: swap;
}

/* Critical above-the-fold styles */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.navbar {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: var(--transition);
  will-change: transform;
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  min-height: 60px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5rem 0;
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  width: 100%;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 50%;
  transition: var(--transition);
}

.theme-toggle:hover {
  background-color: var(--secondary);
  color: var(--text);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1.5rem;
}

.header {
  background: var(--header-bg);
  padding: 3rem 0;
  text-align: center;
}

.header-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.header-subtitle {
  color: var(--text-secondary);
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Skeleton loading styles for instant perceived performance */
.skeleton {
  background: linear-gradient(90deg, var(--secondary) 25%, transparent 50%, var(--secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 400px;
}

.skeleton-image {
  width: 100%;
  height: 220px;
  background: var(--secondary);
}

.skeleton-content {
  padding: 1.5rem;
}

.skeleton-title {
  height: 1.5rem;
  background: var(--secondary);
  border-radius: 4px;
  margin-bottom: 0.75rem;
  width: 80%;
}

.skeleton-text {
  height: 1rem;
  background: var(--secondary);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  width: 60%;
}

/* Performance optimizations */
.article-container {
  max-width: 800px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: var(--transition);
  font-weight: 500;
}

.back-button:hover {
  background-color: var(--secondary);
  color: var(--text);
}

.main {
  min-height: calc(100vh - 200px);
  padding: 3rem 0;
  background-color: var(--background);
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--secondary);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.article-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid var(--border);
  height: 100%;
  transform: translateY(0);
  will-change: transform;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.article-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background-color: var(--secondary);
  transition: opacity 0.3s ease;
}

.article-image.loading {
  opacity: 0;
}

.article-image.loaded {
  opacity: 1;
}

.article-card-content {
  padding: 1.5rem;
}

.article-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.article-card-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.article-meta svg {
  width: 16px;
  height: 16px;
}

.badge {
  display: inline-block;
  background-color: var(--secondary);
  color: var(--text);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.article-card:hover .badge {
  background-color: var(--primary);
  color: white;
}

.article {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.article-header {
  margin-bottom: 2.5rem;
}

.article-hero-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.article-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.article-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.article-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  size: 15px;
}

.article-date svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.article-content {
  line-height: 1.8;
}

.article-content p {
  margin-bottom: 1.5rem;
  color: var(--text);
}

.article-content h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.5rem 0 1.25rem 0;
}

.article-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 1rem 0;
}

.article-content img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.article-content ul {
  margin: 1.5rem 0;
  padding-left: 0;
}

.article-content li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.article-content li::before {
  content: "•";
  color: var(--primary);
  font-weight: bold;
  margin-right: 0.75rem;
  margin-top: 0.1rem;
}

.article-content li.nested {
  margin-left: 1.5rem;
}

.article-content a {
  color: var(--primary);
  text-decoration: underline;
  transition: var(--transition);
}

.article-content a:hover {
  color: var(--primary-hover);
}

.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.comments-section h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.no-articles {
  text-align: center;
  padding: 4rem 0;
}

.no-articles h2 {
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 1rem;
}

.no-articles p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.button {
  display: inline-block;
  background-color: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.button:hover {
  background-color: var(--primary-hover);
}

.button-secondary {
  background-color: var(--secondary);
  color: var(--text);
}

.button-secondary:hover {
  background-color: var(--border);
}

.footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  color: var(--text-secondary);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--primary);
}

/* Responsive design */
@media (max-width: 768px) {
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .article-title {
    font-size: 2rem;
  }

  .header-title {
    font-size: 2rem;
  }

  .article {
    padding: 1.5rem;
  }

  .container {
    padding: 0 1rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background-color: var(--header-bg);
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .nav-links.active {
    display: flex;
  }

  .mobile-menu-btn {
    display: block;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .article-card-content {
    padding: 1rem;
  }

  .article-title {
    font-size: 1.75rem;
  }

  .article {
    padding: 1rem;
  }

  .header {
    padding: 2rem 0;
  }

  .header-title {
    font-size: 1.75rem;
  }

  .article-hero-image {
    height: 250px;
  }
}

/* Performance optimizations */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Preload critical resources */
.preload-image {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.image-logo{
  height: 30px;
  border-radius: 25px;
}

@media (max-width: 1220px) {
  .image-logo{
    margin-left: 10px;
  }
}

@media (max-width: 400px) {
  .logo div{
    display: none;
  }
}

.image-refresh{
  background: transparent !important;
}