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

/* Reset & Base */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0d0d1a;
  --bg-secondary: #12121f;
  --bg-card: #161625;
  --bg-ad: #1a1a2e;
  --border-color: #222;
  --border-ad: #333;
  --text-primary: #e8e8ed;
  --text-secondary: #9a9ab0;
  --text-muted: #6a6a80;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --max-width: 1200px;
  --radius: 8px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

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

/* Navigation */
.navbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.navbar .logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.navbar .logo span {
  color: var(--accent);
}

.navbar nav {
  display: flex;
  gap: 2rem;
}

.navbar nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.navbar nav a:hover,
.navbar nav a.active {
  color: var(--text-primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Ad Mode Toggle */
.ad-mode-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: 1.5rem;
  padding-left: 1.5rem;
  border-left: 1px solid var(--border-color);
}

.toggle-indicator {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background-color: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}

.toggle-btn.active + .toggle-label,
.ad-mode-toggle:has(.toggle-btn.active) .toggle-indicator {
  background-color: rgba(81, 207, 102, 0.15);
  color: #51cf66;
}

.toggle-btn {
  position: relative;
  width: 40px;
  height: 22px;
  background-color: #333;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.toggle-btn.active {
  background-color: var(--accent);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-btn.active .toggle-knob {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Hero / Page Header */
.page-header {
  padding: 3rem 0 2rem;
  text-align: center;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Layout with Sidebar */
.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  padding: 2rem 0;
}

.layout .main-content {
  min-width: 0;
}

.layout .sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-widget {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.sidebar-widget h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sidebar-widget ul {
  list-style: none;
}

.sidebar-widget ul li {
  padding: 0.4rem 0;
}

.sidebar-widget ul li a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.sidebar-widget ul li a:hover {
  color: var(--text-primary);
}

/* Article Cards */
.articles-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.article-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  transition: border-color 0.2s, transform 0.2s;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.article-card .meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.article-card .meta .tag {
  background-color: rgba(108, 99, 255, 0.15);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.article-card .meta .date {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.article-card h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.3px;
}

.article-card h2 a {
  color: var(--text-primary);
}

.article-card h2 a:hover {
  color: var(--accent);
}

.article-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Article Page */
.article-content {
  max-width: 720px;
}

.article-content .article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.article-content .article-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.5px;
  margin-bottom: 1rem;
}

.article-content .article-header .meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.article-content .article-header .meta .tag {
  background-color: rgba(108, 99, 255, 0.15);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.article-content .article-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  letter-spacing: -0.3px;
}

.article-content .article-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.article-content .article-body p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.8;
}

.article-content .article-body code {
  background-color: var(--bg-ad);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent);
}

.article-content .article-body pre {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.article-content .article-body pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.article-content .article-body ul,
.article-content .article-body ol {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.article-content .article-body li {
  margin-bottom: 0.5rem;
}

.article-content .article-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* About Page */
.about-content {
  max-width: 720px;
  padding: 2rem 0;
}

.about-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
}

.about-content p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.8;
}

.about-content ul {
  color: var(--text-secondary);
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.about-content li {
  margin-bottom: 0.5rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
  }

}

@media (max-width: 640px) {
  .navbar .container {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .navbar nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
  }

  .navbar nav.open {
    display: flex;
  }

  .mobile-menu-btn {
    display: block;
  }

  .ad-mode-toggle {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border-color);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    justify-content: center;
  }

  .toggle-label {
    display: none;
  }

  .container {
    padding: 0 1rem;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }

  .article-card {
    padding: 1.25rem;
  }

  .article-card h2 {
    font-size: 1.1rem;
  }

  .article-content .article-header h1 {
    font-size: 1.6rem;
  }

}
