* {
  box-sizing: border-box;
}

.blog-main {
  padding-top: calc(56px + 2rem);
  padding-bottom: 3rem;
}

.blog-content-wrap {
  max-width: 900px;
}

.blog-hero {
  margin-bottom: 1.25rem;
}

.blog-intro-card {
  border: 1px solid rgba(111, 132, 153, 0.22);
  border-radius: 14px;
  padding: 1.5rem 1.6rem;
  background: var(--bs-body-bg);
  position: relative;
  overflow: hidden;
}

.blog-intro-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #6f8499 0%, rgba(111,132,153,0.2) 100%);
  border-radius: 14px 14px 0 0;
}

h1,
h2 {
  line-height: 1.2;
}

.blog-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  margin-bottom: 0.55rem;
  letter-spacing: -0.01em;
}

.blog-hero p {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--bs-secondary-color);
}

.blog-listing-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
  gap: 1rem;
}

.blog-listing-head h2 {
  font-size: clamp(1.15rem, 2.8vw, 1.4rem);
  letter-spacing: -0.01em;
}

.blog-listing-head .post-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #6f8499;
  background: rgba(111, 132, 153, 0.1);
  border: 1px solid rgba(111, 132, 153, 0.22);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.blog-latest {
  margin-bottom: 1.35rem;
}

.featured-card-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.featured-card-footer .post-tags {
  flex: 1;
}

[data-bs-theme="light"] .post-card-featured {
  background: linear-gradient(135deg, rgba(111, 132, 153, 0.06) 0%, var(--bs-body-bg) 55%);
}

[data-bs-theme="dark"] .post-card-featured {
  background: linear-gradient(135deg, rgba(111, 132, 153, 0.1) 0%, var(--bs-body-bg) 55%);
}

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(111, 132, 153, 0.16);
  border-radius: 12px;
  background: rgba(111, 132, 153, 0.04);
}

.blog-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.blog-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: min(100%, 360px);
  flex: 1;
  justify-content: flex-end;
}

.blog-search-input {
  width: min(100%, 280px);
  border: 1px solid rgba(111, 132, 153, 0.3);
  border-radius: 999px;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.blog-search-input:focus {
  outline: none;
  border-color: rgba(111, 132, 153, 0.6);
  box-shadow: 0 0 0 2px rgba(111, 132, 153, 0.2);
}

.blog-clear-btn {
  border: 1px solid rgba(111, 132, 153, 0.3);
  border-radius: 999px;
  background: transparent;
  color: var(--bs-body-color);
  padding: 0.3rem 0.75rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.blog-clear-btn:hover {
  border-color: rgba(111, 132, 153, 0.6);
  background: rgba(111, 132, 153, 0.1);
  transform: translateY(-1px);
}

.post-filter-empty {
  border: 1px dashed rgba(111, 132, 153, 0.28);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  color: var(--bs-secondary-color);
}




.filter-btn-count {
  opacity: 0.55;
  font-weight: 400;
  font-size: 0.9em;
  letter-spacing: 0;
}

.tag-filter-btn {
  border: 1px solid rgba(111, 132, 153, 0.3);
  border-radius: 999px;
  background: transparent;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--bs-body-color);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.tag-filter-btn:hover {
  border-color: rgba(111, 132, 153, 0.6);
  background: rgba(111, 132, 153, 0.1);
  transform: translateY(-1px);
}

[data-bs-theme="light"] .tag-filter-btn.active {
  background: #6f8499;
  border-color: #6f8499;
  color: #fff;
  box-shadow: 0 2px 8px rgba(111,132,153,0.3);
}

[data-bs-theme="dark"] .tag-filter-btn.active {
  background: #d8e0e8;
  border-color: #d8e0e8;
  color: #182028;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
  padding-bottom: 3rem;
}

.post-card,
.post {
  position: relative;
  border: 1px solid rgba(111, 132, 153, 0.2);
  background: var(--bs-body-bg);
  border-radius: 8px;
  padding: 1.25rem 1.4rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card[data-card-url] {
  cursor: pointer;
}

.post-card h2 {
  margin: 0.25rem 0 0.45rem;
  font-size: 1.15rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  line-height: 1.3;
}

.post-card p {
  margin-bottom: 0.95rem;
}

.post-hidden {
  display: none !important;
}

.post-card-featured {
  border: 1px solid rgba(111, 132, 153, 0.28);
  position: relative;
  overflow: hidden;
  padding: 1.5rem 1.6rem;
}

.post-card-featured::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #6f8499 0%, rgba(111,132,153,0.25) 100%);
  border-radius: 4px 0 0 4px;
}

.post-card-featured h2 {
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  letter-spacing: -0.01em;
}

.post-card a {
  color: var(--bs-body-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-card a:hover {
  color: #6f8499;
}

.post-card:hover {
  border-color: rgba(111, 132, 153, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(111, 132, 153, 0.12);
}

.post-card[data-card-url]:focus-visible {
  outline: 2px solid rgba(111, 132, 153, 0.65);
  outline-offset: 2px;
}

.post-card:hover h2 a {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.post {
  margin: 0;
  max-width: none;
}

.post-page {
  position: relative;
  margin-bottom: 3rem;
}

.post-progress {
  position: sticky;
  top: 56px;
  z-index: 6;
  height: 3px;
  margin: 0 0 1.25rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(111, 132, 153, 0.12);
}

.post-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6f8499, rgba(111,132,153,0.5));
  transition: width 0.12s linear;
}

.post-head {
  border-bottom: 1px solid rgba(111, 132, 153, 0.18);
  padding-bottom: 1.25rem;
}

.post-cover {
  margin-bottom: 1.75rem;
}

.post-cover-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.post-main {
  min-width: 0;
}

.post-sidebar {
  min-width: 0;
}

.post-comments {
  min-width: 0;
}

.post-comments .giscus-wrap {
  margin-top: 0 !important;
}

.post-side-card {
  border: 1px solid rgba(111, 132, 153, 0.18);
  border-radius: 8px;
  padding: 1.1rem 1.15rem;
  background: var(--bs-body-bg);
}

.post-side-list,
.post-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.post-side-list li,
.post-link-list li {
  border: 1px solid rgba(111, 132, 153, 0.15);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  background: rgba(111, 132, 153, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.post-link-list li {
  padding: 0;
}

.post-side-list li:hover,
.post-link-list li:hover {
  border-color: rgba(111, 132, 153, 0.35);
  background: rgba(111, 132, 153, 0.08);
}

.post-side-list li a,
.post-link-list li a {
  display: block;
  color: var(--bs-body-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  transition: color 0.15s ease;
}

.post-link-list li a {
  padding: 0.55rem 0.65rem;
}

.post-side-list li a:hover,
.post-link-list li a:hover {
  color: #6f8499;
}

.post-side-list li p {
  margin: 0.3rem 0 0;
  color: var(--bs-secondary-color);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.post-side-empty {
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
}

.post-side-card .eyebrow {
  margin-top: 0.25rem;
}

.post-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.post-toc-list li a {
  color: var(--bs-secondary-color);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: color 0.15s ease;
}

.post-toc-list li a:hover {
  color: #6f8499;
}

.post-toc-list .toc-sub {
  padding-left: 0.85rem;
}

.post-tags-large {
  margin-top: 0.85rem;
}

.post h1 {
  margin-bottom: 0.65rem;
  letter-spacing: -0.015em;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-body p,
.post-body li {
  color: var(--bs-secondary-color);
}

.post-body h2,
.post-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.post-body a {
  color: #6f8499;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-body a:hover {
  color: #5a6e80;
}

.post-body code {
  background: rgba(111, 132, 153, 0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  font-size: 0.875em;
  border: 1px solid rgba(111, 132, 153, 0.15);
}

.post-body pre {
  background: rgba(111, 132, 153, 0.08);
  border: 1px solid rgba(111, 132, 153, 0.18);
  border-radius: 10px;
  overflow: hidden;
  margin: 1.25rem 0;
}

.post-body pre code {
  display: block;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  background: transparent;
  border: none;
  font-size: 0.9rem;
  line-height: 1.65;
  border-radius: 0;
}

.post-body blockquote {
  border-left: 3px solid #6f8499;
  margin: 1.25rem 0;
  padding: 0.75rem 1.1rem;
  background: rgba(111, 132, 153, 0.06);
  border-radius: 0 8px 8px 0;
}

.post-body blockquote p {
  margin-bottom: 0;
  font-style: italic;
}

.post-meta {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6f8499;
  font-weight: 700;
  margin: 0;
}

.post-backlink {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  color: #6f8499;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 700;
  transition: color 0.15s ease, gap 0.15s ease;
}

.post-backlink::before {
  content: '←';
  transition: transform 0.15s ease;
}

.post-backlink:hover {
  color: #5a6e80;
}

.post-backlink:hover::before {
  transform: translateX(-3px);
}

.post-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(111, 132, 153, 0.18);
}

.post-toc-hidden {
  display: none;
}

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

.post-tag {
  display: inline-block;
  border: 1px solid rgba(111, 132, 153, 0.3);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #6f8499;
  background: rgba(111, 132, 153, 0.08);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.post-tag:hover {
  background: rgba(111, 132, 153, 0.15);
  border-color: rgba(111, 132, 153, 0.5);
}

.post-tag-filter {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.post-empty {
  border: 1px dashed rgba(111, 132, 153, 0.3);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  text-align: center;
}

.post-empty .eyebrow {
  margin-bottom: 0.5rem;
}

.excerpt {
  color: var(--bs-secondary-color);
  font-size: 1rem;
  line-height: 1.65;
}

/* ===== TABLE STYLING ===== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
  background: var(--bs-body-bg);
  border: 1px solid rgba(111, 132, 153, 0.2);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(111, 132, 153, 0.08);
}

thead {
  background: rgba(111, 132, 153, 0.08);
}

thead th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--bs-body-color);
  border-bottom: 2px solid rgba(111, 132, 153, 0.2);
}

tbody tr {
  transition: background-color 0.15s ease;
  border-bottom: 1px solid rgba(111, 132, 153, 0.15);
}

tbody tr:hover {
  background: rgba(111, 132, 153, 0.06);
}

tbody tr:last-child {
  border-bottom: none;
}

td, th {
  padding: 0.85rem 1rem;
  text-align: left;
}

td code {
  background: rgba(111, 132, 153, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Dark mode table styling */
[data-bs-theme="dark"] thead {
  background: rgba(216, 224, 232, 0.08);
}

[data-bs-theme="dark"] thead th {
  border-bottom-color: rgba(216, 224, 232, 0.2);
  color: #d8e0e8;
}

[data-bs-theme="dark"] table {
  border-color: rgba(216, 224, 232, 0.15);
}

[data-bs-theme="dark"] tbody tr {
  border-bottom-color: rgba(216, 224, 232, 0.12);
}

[data-bs-theme="dark"] tbody tr:hover {
  background: rgba(216, 224, 232, 0.08);
}

[data-bs-theme="dark"] td code {
  background: rgba(216, 224, 232, 0.12);
  color: #d8e0e8;
}

/* Responsive tables */
@media (max-width: 767.98px) {
  table {
    font-size: 0.85rem;
    margin: 1rem 0;
  }

  thead th, td {
    padding: 0.65rem 0.75rem;
  }

  thead th {
    font-size: 0.75rem;
  }
}

@media (min-width: 992px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .post-main {
    grid-column: 1;
  }

  .post-sidebar {
    grid-column: 2;
    position: sticky;
    top: 86px;
  }

  .post-comments {
    grid-column: 1;
  }

  .post-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-latest .post-card-featured {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr) 220px;
  }

  .post-main {
    grid-column: 1;
  }

  .post-sidebar {
    grid-column: 2;
    position: sticky;
    top: 86px;
  }

  .post-comments {
    grid-column: 1;
  }
}

@media (max-width: 767.98px) {
  .blog-main {
    padding-top: calc(56px + 1.4rem);
    padding-bottom: 2rem;
  }

  .blog-content-wrap {
    max-width: 100%;
  }

  .blog-listing-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .blog-toolbar {
    padding: 0.65rem;
  }

  .blog-search-wrap {
    width: 100%;
    justify-content: flex-start;
  }

  .blog-search-input {
    width: 100%;
  }

  .post-card,
  .post {
    padding: 1rem 1.1rem;
  }

  .post-progress {
    margin-bottom: 0.85rem;
  }
}
