/* Blog layout – legacy list view (used only where .blog-grid is alone) */
.blog-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.blog-grid article {
  background: #ffffff;
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.blog-grid article:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  border-color: #0ea5e9;
}

.blog-grid h1,
.blog-grid h2 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  line-height: 1.3;
}

.blog-grid h2 a {
  color: #0f172a;
  text-decoration: none;
}

.blog-grid h2 a:hover {
  color: #0ea5e9;
}

.blog-meta {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 0.75rem;
}

.blog-excerpt {
  font-size: 0.95rem;
  color: #1e293b;
  line-height: 1.6;
}

/* Single post */
.post {
  background: #ffffff;
}

.post h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.post .post-meta {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 1.5rem;
}

.post .content {
  font-size: 1rem;
  color: #0f172a;
  line-height: 1.7;
}

.post .content p {
  margin-bottom: 1.1rem;
}

/* Comments */
.comments {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.6);
  margin-top: 3rem;
}

.comments h2,
.comments h3 {
  margin: 2rem 0 1rem;
  font-size: 1.25rem;
}

.comment {
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background-color: #f8fafc;
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
}

.comment strong {
  font-size: 0.95rem;
  color: #0f172a;
}

.comment small,
.comment time {
  font-size: 0.8rem;
  color: #64748b;
}

/* Comment form */
#commentForm {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1rem;
}

#commentForm input[type="text"],
#commentForm input[type="email"],
#commentForm textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#commentForm input[type="text"]:focus,
#commentForm input[type="email"]:focus,
#commentForm textarea:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
}

#commentForm textarea {
  min-height: 120px;
  grid-column: 1 / -1;
  resize: vertical;
}

#commentForm .g-recaptcha,
#commentForm #g-recaptcha-response {
  grid-column: 1 / -1;
}

#commentForm button[type="submit"] {
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: none;
  background: #0ea5e9;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  justify-self: flex-start;
  transition: background 0.15s ease, transform 0.1s ease;
  grid-column: 1 / -1;
}

#commentForm button[type="submit"]:hover {
  background: #0284c7;
  transform: translateY(-1px);
}

/* Empty states */
.blog-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #64748b;
  font-size: 0.98rem;
}

/* Blog index page layout */
.blog-grid-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.blog-header {
  margin-bottom: 2.5rem;
  text-align: left;
}

/* Filters on index – card style with background */
.blog-filters {
  background: #ffffff;
  border-radius: 10px;
  padding: 1.75rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Make search wide, category + buttons on the right */
.blog-filters-row {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(200px, auto) auto;
  gap: 1rem 1.5rem;
  align-items: flex-end;
}

.blog-filter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.blog-filter label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.blog-filter input[type="search"],
.blog-filter select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 0.95rem;
  font-family: inherit;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.blog-filter input[type="search"]:focus,
.blog-filter select:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.blog-filter-actions {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

/* Index cards grid – 3 columns */
.blog-grid-page .blog-grid.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.75rem;
}

/* Individual blog cards on index */
.blog-card {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.blog-card-inner {
  padding: 1.3rem 1.4rem 1.2rem;
  gap: 0.65rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  border-color: #0ea5e9;
}

.blog-card-title {
  font-size: 1.05rem;
  margin: 0 0 0.3rem;
  color: #0f172a;
  line-height: 1.3;
}

.blog-card-title a {
  color: inherit;
  text-decoration: none;
}

.blog-card-title a:hover {
  color: #0ea5e9;
  text-decoration: underline;
}

.blog-date {
  font-size: 0.82rem;
  color: #6b7280;
  margin: 0;
}

.blog-card-excerpt {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

/* Button inside blog card */
.blog-card .btn {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
}

/* Post layout with sidebar */
.post-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.post-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
  align-items: start;
}

.post-main {
  min-width: 0;
}

/* Sidebar */
.post-sidebar {
  position: relative;
}

.sidebar-sticky {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.sidebar-card h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: #0f172a;
  font-weight: 700;
}

/* Table of Contents */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 0.65rem;
}

.toc-list a {
  color: #475569;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
  display: block;
  transition: color 0.15s ease, padding-left 0.15s ease;
}

.toc-list a:hover {
  color: #0ea5e9;
  padding-left: 0.5rem;
}

/* AdSense placeholder */
.adsense-card {
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.adsense-placeholder {
  width: 100%;
  min-height: 250px;
}

/* Recent posts */
.recent-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-post-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.recent-post-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.recent-post-item a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.recent-post-title {
  color: #0f172a;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  transition: color 0.15s ease;
}

.recent-post-item a:hover .recent-post-title {
  color: #0ea5e9;
}

.recent-post-date {
  color: #64748b;
  font-size: 0.8rem;
}

/* Indent h3 items in TOC */
.toc-item.toc-level-3 {
  padding-left: 1.2rem;
}

.toc-item.toc-level-3 a {
  font-size: 0.85rem;
  color: #64748b;
}

/* ========== NEW: Blog categories layout with sidebar ========== */

.blog-layout-with-sidebar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: flex-start;
}

/* Sidebar */
.blog-sidebar {
  position: relative;
}

.blog-sidebar .sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1rem;
}

/* Category tabs list */
.category-tabs {
  list-style: none;
  padding: 0.5rem;
  margin: 0 0 1.5rem;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.category-tab {
  margin: 0.1rem 0;
}

.category-tab a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #0f172a;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.category-tab a:hover {
  background: #eff6ff;
  color: #0ea5e9;
  padding-left: 0.95rem;
}

.category-tab.is-active a {
  background: #0ea5e9;
  color: #ffffff;
  font-weight: 600;
}

/* Active tab subtle left border (optional) */
.category-tab.is-active a {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

/* Category intro blurb */
.category-intro {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.35);
  margin-bottom: 1.5rem;
}

/* Date filter form in sidebar */
.category-date-filters {
  background: #ffffff;
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.category-date-filters fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.category-date-filters legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.8rem;
}

.date-filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.date-filter-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.date-filter-field input[type="date"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 0.9rem;
  font-family: inherit;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.date-filter-field input[type="date"]:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.date-filter-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.date-filter-actions .btn-primary,
.date-filter-actions .btn-secondary {
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
}

/* Main content area on categories page */
.blog-layout-with-sidebar .blog-main {
  min-width: 0;
}

/* Reuse card grid for categories page */
.blog-layout-with-sidebar .blog-grid.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem;
}

/* Responsive tweaks */
@media (max-width: 1024px) {
  .blog-grid-page .blog-grid.cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-filters-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-container {
    grid-template-columns: 1fr;
  }

  .sidebar-sticky {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
  }

  .blog-layout-with-sidebar {
    grid-template-columns: minmax(0, 1fr);
    padding: 2.5rem 1.25rem;
  }

  .blog-layout-with-sidebar .blog-main {
    order: 1;
  }

  .blog-layout-with-sidebar .blog-sidebar {
    order: 2;
  }

  .blog-layout-with-sidebar .blog-grid.cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .blog-grid-page {
    padding: 2rem 1rem;
  }

  .blog-filters {
    padding: 1.25rem 1.5rem;
  }

  .blog-filter-actions {
    justify-content: flex-start;
  }

  .blog-grid {
    padding: 2rem 1rem;
  }

  .post-layout {
    padding: 2rem 1rem;
  }

  .sidebar-sticky {
    grid-template-columns: 1fr;
  }

  #commentForm {
    grid-template-columns: 1fr;
  }

  #commentForm button[type="submit"] {
    width: 100%;
    justify-self: stretch;
    text-align: center;
  }

  .blog-layout-with-sidebar {
    padding: 2rem 1rem;
  }

  .blog-layout-with-sidebar .blog-grid.cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .blog-grid-page .blog-grid.cards-grid {
    grid-template-columns: 1fr;
  }
}