:root {
  --bg-main: #f0f4f8;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --tag-bg: #e0f2fe;
  --border-color: #e2e8f0;
  --radius: 12px;
  --radius-sm: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

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

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Top Nav */
.top-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.menu a:hover,
.menu .active > a {
  color: var(--accent);
}

.burger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-main);
}

.burger-icon {
  width: 24px;
  height: 2px;
  background: currentColor;
  position: relative;
  transition: background-color 0.2s ease;
}

.burger-icon::before,
.burger-icon::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: currentColor;
  left: 0;
  transition: transform 0.2s ease, top 0.2s ease;
}

.burger-icon::before { top: -6px; }
.burger-icon::after { top: 6px; }

.burger-btn.active .burger-icon {
  background: transparent;
}

.burger-btn.active .burger-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.burger-btn.active .burger-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Hero / Header Section */
.site-header {
  padding: 40px 0 24px;
  text-align: center;
}

.site-header h1 {
  font-size: 2.2rem;
  color: #0f172a;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.site-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 680px;
  margin: 0 auto;
}

/* Layout Grid */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  margin-bottom: 60px;
  align-items: start;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 20px;
}

/* Post Cards Grid (2 cols) */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(2, 132, 199, 0.08);
  border-color: #cbd5e1;
}

.post-thumbnail {
  position: relative;
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: #e2e8f0;
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-thumbnail img {
  transform: scale(1.05);
}

.post-category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.post-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
  color: #0f172a;
}

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

.post-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-author-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.author-info {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.post-meta-details {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-tags,
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.tag-item {
  background: var(--tag-bg);
  color: var(--accent-hover);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-block;
}

.tag:hover,
.tag-item:hover {
  background: var(--accent);
  color: #fff;
}

/* Sidebar Widgets */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.widget-title {
  font-size: 1.1rem;
  color: #0f172a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  display: block;
}

.categories-list {
  list-style: none;
}

.categories-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--border-color);
}

.categories-list li:last-child {
  border: none;
  padding-bottom: 0;
}

.categories-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
}

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

.count,
.category-count {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 10px;
}

.tags-cloud .tag,
.tags-cloud .tag-item {
  border-radius: 14px;
  padding: 5px 12px;
  font-size: 0.8rem;
}

/* Single Article & Page Content */
.single-article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.article-header {
  margin-bottom: 24px;
}

.badge-label {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.article-title {
  font-size: 2rem;
  line-height: 1.25;
  color: #0f172a;
  margin-bottom: 16px;
}

.article-hero-cover {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  margin-bottom: 28px;
}

.page-lead {
  font-size: 1.15rem;
  color: #334155;
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}

/* Content Area Typography & Elements */
.content,
.post-body-content {
  font-size: 1rem;
  line-height: 1.75;
  color: #334155;
}

.content h2,
.post-body-content h2 {
  font-size: 1.45rem;
  color: #0f172a;
  margin: 32px 0 14px;
  font-weight: 700;
}

.content h3,
.post-body-content h3 {
  font-size: 1.25rem;
  color: #0f172a;
  margin: 24px 0 10px;
  font-weight: 600;
}

.content p,
.post-body-content p {
  margin-bottom: 16px;
}

.content ul,
.content ol,
.post-body-content ul,
.post-body-content ol {
  margin: 0 0 20px 24px;
}

.content li,
.post-body-content li {
  margin-bottom: 6px;
}

.content blockquote,
.post-body-content blockquote {
  border-left: 4px solid var(--accent);
  background: #f8fafc;
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 24px 0;
  font-style: italic;
  color: #475569;
}

.content table,
.post-body-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.content th,
.content td,
.post-body-content th,
.post-body-content td {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.content th,
.post-body-content th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
}

.content pre,
.post-body-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 20px 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.content code,
.post-body-content code {
  font-family: var(--font-mono);
  background: #f1f5f9;
  color: var(--accent-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.content pre code,
.post-body-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.content figure,
.post-body-content figure {
  margin: 24px 0;
}

.content figcaption,
.post-body-content figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* Table of Contents (TOC) */
.toc-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 24px 0;
}

.toc-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  margin-bottom: 6px;
}

.toc-item a {
  color: #334155;
  font-size: 0.92rem;
}

.toc-item a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.toc-subitem {
  padding-left: 18px;
  margin-top: 4px;
}

/* Contact Grid & Form */
.contact-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.contact-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.contact-card h4 {
  color: #0f172a;
  margin-bottom: 6px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #0f172a;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-self: flex-start;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

/* Footer */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 50px 0 24px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid #1e293b;
}

.footer-col h4 {
  color: #f8fafc;
  margin-bottom: 14px;
  font-size: 1rem;
}

.footer-links {
  list-style: none;
  font-size: 0.9rem;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a:hover {
  color: #38bdf8;
}

.footer-bottom {
  text-align: center;
  font-size: 0.85rem;
  padding-top: 20px;
}

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

@media (max-width: 768px) {
  .burger-btn {
    display: block;
  }
  .menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    flex-direction: column;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    gap: 14px;
    align-items: flex-start;
  }
  .menu.open {
    display: flex;
  }
  .single-article-card {
    padding: 20px;
  }
  .article-title {
    font-size: 1.5rem;
  }
  .contact-cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
