: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: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.25rem 1.5rem 5rem;
}
.blog-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}
.hero-brand {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.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;
  max-width: 720px;
}
.blog-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 280px;
  max-width: 520px;
}
.search-input-wrapper .search-icon {
  position: absolute;
  left: 0.9rem;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
}
.blog-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 2.25rem 0.65rem 2.5rem;
  font-size: 0.925rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.blog-search-input:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.articles-count-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
}
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
}
.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  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(-3px);
  box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  border-color: #cbd5e1;
}
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.article-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.card-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.article-card-title {
  font-size: 1.35rem;
  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: 0.95rem;
  color: var(--text-lead);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.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 - Ergonomic Two-Column Layout */
.article-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 5rem;
}
.article-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb-separator { color: #cbd5e1; }
.current-crumb {
  color: #475569;
  font-weight: 500;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-switcher-trigger { display: none; }
.btn-switcher-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-switcher-toggle svg { width: 16px; height: 16px; color: var(--primary); }

.article-layout {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
}
.article-content-column {
  flex: 1;
  min-width: 0;
  max-width: 820px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease, transform 0.15s ease;
}
.back-link:hover {
  color: var(--primary-hover);
  transform: translateX(-3px);
}
.article-main {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.75rem 2.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.article-header { margin-bottom: 2rem; }
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.article-meta .meta-dot { color: #cbd5e1; }
.article-badge {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: #0f766e;
}
.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;
}

/* Sequential Article Switcher (Prev / Next) */
.article-pagination-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 3.5rem 0 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.pagination-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}
.pagination-card:hover {
  background: #ffffff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.pagination-card:hover .pagination-direction { color: var(--primary); }
.pagination-direction {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  transition: color 0.15s ease;
}
.pagination-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pagination-next { text-align: right; }
.pagination-next .pagination-direction { justify-content: flex-end; }
.pagination-spacer { display: block; }

/* Sticky Quick-Switcher Sidebar */
.articles-switcher-sidebar {
  width: 340px;
  flex-shrink: 0;
}
.sidebar-sticky-panel {
  position: sticky;
  top: 5.5rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  max-height: calc(100vh - 7rem);
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.sidebar-title .sidebar-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}
.sidebar-title .count-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
}
.sidebar-header .btn-close-drawer { display: none; }
.sidebar-filter-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.sidebar-filter-wrapper .filter-icon {
  position: absolute;
  left: 0.75rem;
  width: 15px;
  height: 15px;
  color: #94a3b8;
  pointer-events: none;
}
.sidebar-filter-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
}
.sidebar-filter-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}
.sidebar-articles-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.sidebar-article-item {
  border-radius: 8px;
  transition: background 0.15s ease;
}
.sidebar-article-link {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: #334155;
  transition: all 0.15s ease;
  position: relative;
}
.sidebar-article-link .active-indicator {
  width: 3px;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: transparent;
  border-radius: 4px 0 0 4px;
}
.sidebar-article-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.sidebar-article-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1e293b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sidebar-article-date {
  font-size: 0.75rem;
  color: #94a3b8;
}
.sidebar-article-link:hover {
  background: #f1f5f9;
}
.sidebar-article-link:hover .sidebar-article-title {
  color: var(--primary);
}
.sidebar-article-item.active {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
}
.sidebar-article-item.active .active-indicator { background: var(--primary); }
.sidebar-article-item.active .sidebar-article-title {
  color: #0f766e;
  font-weight: 700;
}
.sidebar-article-item.active .sidebar-article-date {
  color: var(--primary);
  font-weight: 500;
}
  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-left: 0.5rem;
  font-size: 0.8em;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  vertical-align: middle;
}
.markdown-content h1:hover .heading-anchor,
.markdown-content h2:hover .heading-anchor,
.markdown-content h3:hover .heading-anchor,
.markdown-content h4:hover .heading-anchor {
  opacity: 1;
  color: var(--primary);
}
.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;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  background: var(--bg-surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}
th, td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  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: left;
  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; }
}
