/* ===== CSS Variables / Theming ===== */
:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --border: #30363d;
  --card-bg: #161b22;
  --tag-bg: #1f6feb33;
  --tag-text: #58a6ff;
  --max-width: 1100px;
  --radius: 8px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-secondary: #f6f8fa;
  --text: #1f2328;
  --text-secondary: #656d76;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --border: #d0d7de;
  --card-bg: #ffffff;
  --tag-bg: #ddf4ff;
  --tag-text: #0969da;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

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

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

img {
  max-width: 100%;
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

.nav a:hover {
  color: var(--text);
}

.social-link {
  display: flex;
  align-items: center;
}

.social-link svg {
  transition: color 0.2s;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

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

/* ===== Hero ===== */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
}

.terminal-prompt {
  display: inline-block;
  color: var(--accent);
  font-family: "SF Mono", "Fira Code", monospace;
  margin-right: 0.5rem;
}

/* ===== Articles Grid ===== */
.articles-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

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

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

.article-card .card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.article-card h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

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

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

.article-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  flex: 1;
  margin-bottom: 1rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 500;
}

/* ===== Article Page ===== */
.article-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.article-page .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.article-page .back-link:hover {
  color: var(--accent);
}

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

.article-page .article-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.article-page .article-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.article-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}

.article-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.article-content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
  margin: 0.5rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

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

.article-content code {
  font-family: "SF Mono", "Fira Code", monospace;
  background: var(--bg-secondary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid var(--border);
}

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

.article-content pre code {
  background: none;
  border: none;
  padding: 0;
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ===== Footer ===== */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.bmc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.45rem 1rem;
  background: #FFDD00;
  color: #000000;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  transition: opacity 0.2s, transform 0.2s;
}

.bmc-btn:hover {
  color: #000000;
  opacity: 0.85;
  transform: translateY(-1px);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

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

  .nav.active {
    display: flex;
  }

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

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