:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-lead: #475569;
  --code-bg: #0f172a;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Site Header */
.top-bar {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-bar-left { display: flex; align-items: center; gap: 0.75rem; }
.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.15rem;
}
.brand-icon-box {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}
.top-bar-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.nav-btn-secondary {
  background: #f1f5f9;
  color: #475569;
}
.nav-btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-main);
}
.nav-btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.nav-btn-primary:hover {
  background: var(--primary-hover);
}

/* Blog Listing Page */
.blog-container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}
.blog-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.hero-brand {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}
.hero-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(13, 148, 136, 0.25);
  flex-shrink: 0;
}
.hero-text h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.articles-grid {
  display: grid;
  gap: 1.75rem;
}
.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  border-color: #cbd5e1;
}
.article-date {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}
.article-card-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
.article-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}
.article-card-title a:hover {
  color: var(--primary);
}
.article-summary {
  font-size: 1rem;
  color: var(--text-lead);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
}
.read-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: gap 0.15s ease, color 0.15s ease;
}
.read-link:hover {
  color: var(--primary-hover);
  gap: 0.55rem;
}

/* Single Article Page */
.article-container {
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}
.article-nav { margin-bottom: 1.75rem; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease, transform 0.15s ease;
}
.back-link:hover {
  color: var(--primary);
  transform: translateX(-3px);
}
.article-main {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.75rem 2.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.article-header { margin-bottom: 2rem; }
.article-meta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.article-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}
.article-lead {
  font-size: 1.15rem;
  color: var(--text-lead);
  line-height: 1.65;
  font-style: italic;
}
.article-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 2.25rem;
}

/* Markdown Content */
.markdown-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #334155;
}
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.35;
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.015em;
}
.markdown-content h1 { font-size: 1.75rem; }
.markdown-content h2 {
  font-size: 1.45rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
}
.markdown-content h3 { font-size: 1.2rem; }
.heading-anchor {
  text-decoration: none;
  color: #cbd5e1;
  margin-right: 0.4rem;
  font-size: 0.85em;
  opacity: 0;
  transition: opacity 0.15s;
}
h2:hover .heading-anchor, h3:hover .heading-anchor { opacity: 1; }
.markdown-content p {
  margin-top: 0;
  margin-bottom: 1.25rem;
}
.markdown-content ul,
.markdown-content ol {
  margin-top: 0;
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
}
.markdown-content li { margin-bottom: 0.5rem; }
.markdown-content strong {
  font-weight: 700;
  color: var(--text-main);
}
.markdown-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.markdown-content a:hover { color: var(--primary-hover); }
.markdown-content hr.blog-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Blockquotes & Callouts */
.markdown-content blockquote,
.callout {
  margin: 1.75rem 0;
  padding: 1rem 1.35rem;
  background: var(--bg-page);
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  color: var(--text-lead);
  border-top: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.callout-info {
  background: #eff6ff;
  border-left-color: #3b82f6;
}
.callout-info p { color: #1e40af !important; }
.callout-warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
}
.callout-warning p { color: #92400e !important; }
.callout p { margin-bottom: 0 !important; }

/* Tables */
.table-responsive {
  overflow-x: auto;
  margin: 2rem 0;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.925rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
th, td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
  line-height: 1.5;
}
th:last-child, td:last-child { border-right: none; }
tr:last-child td { border-bottom: none; }
th {
  background-color: #f1f5f9;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid #cbd5e1;
}
tr:nth-child(even) td { background-color: #fcfdfe; }
tr:hover td { background-color: #f8fafc; }

/* Code Blocks */
code {
  background: #f1f5f9;
  color: #0f766e;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  border: 1px solid var(--border);
}
.code-container {
  background: var(--code-bg);
  border-radius: 8px;
  margin: 1.75rem 0;
  overflow: hidden;
  border: 1px solid #1e293b;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.code-header {
  background: #090e17;
  padding: 0.45rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1e293b;
}
.code-lang {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.copy-code-btn {
  background: #334155;
  border: none;
  color: #f8fafc;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.copy-code-btn:hover { background: #475569; }
.copy-code-btn.copied { background: #16a34a; }
.code-container pre {
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 0;
  color: #f8fafc;
  line-height: 1.6;
}
.code-container code {
  background: transparent;
  color: #e2e8f0;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: 0.9rem;
}

/* Figures & Video Embeds */
.blog-figure {
  margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.blog-image {
  max-width: 100%;
  height: auto;
  display: block;
}
.blog-figure figcaption {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-page);
  border-top: 1px solid var(--border);
  text-align: center;
  font-style: italic;
}
.video-embed-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin: 2rem 0;
  background: #000;
}
.video-embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Article & Site Footers */
.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.page-footer {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
.page-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}
.page-footer a:hover { color: var(--primary); }

@media (max-width: 768px) {
  .article-main {
    padding: 1.75rem 1.25rem;
    border-radius: 8px;
  }
  .article-title { font-size: 1.75rem; }
  .article-lead { font-size: 1.05rem; }
  .hero-brand { flex-direction: column; }
  .hero-text h1 { font-size: 1.75rem; }
  .article-card { padding: 1.5rem 1.25rem; }
}
