/* ============================================
   WORTH MY MONEY? BLOG STYLES
   Matches the main app's design system
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #2D2A26;
  background: #FFFFFF;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: #E85D3A;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #02b887;
}

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

/* --- Header --- */
.blog-header {
  background: #FFFFFF;
  border-bottom: 1.5px solid #EDEAE6;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.blog-header-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.blog-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #F5F3F0;
  border-radius: 10px;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.blog-logo:hover {
  background: #EDEAE6;
  transform: translateY(-1px);
}

.blog-title-link {
  text-decoration: none;
}

.blog-site-title {
  font-size: 18px;
  font-weight: 800;
  color: #2D2A26;
  margin: 0;
}

.blog-title-link:hover .blog-site-title {
  color: #E85D3A;
}

.blog-nav {
  margin-left: auto;
  display: flex;
  gap: 20px;
}

.blog-nav a {
  font-size: 14px;
  font-weight: 700;
  color: #6B6560;
}

.blog-nav a:hover {
  color: #E85D3A;
}

/* --- Language Switcher --- */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding-left: 16px;
  border-left: 1.5px solid #EDEAE6;
}

.lang-active {
  font-size: 13px;
  font-weight: 800;
  color: #E85D3A;
}

.lang-sep {
  font-size: 13px;
  color: #D0CCC8;
}

.lang-link {
  font-size: 13px;
  font-weight: 700;
  color: #A09A94;
  transition: color 0.2s;
}

.lang-link:hover {
  color: #E85D3A;
}

/* --- Main Content --- */
.blog-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  overflow-x: hidden;
}

/* --- Blog Index / Listing Page --- */
.blog-index-header {
  margin-bottom: 40px;
}

.blog-index-title {
  font-size: 34px;
  font-weight: 800;
  color: #2D2A26;
  margin-bottom: 8px;
}

.blog-index-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: #6B6560;
}

.blog-tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.blog-tag-filter {
  display: inline-block;
  padding: 6px 14px;
  background: #F5F3F0;
  color: #6B6560;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.blog-tag-filter:hover {
  background: #dedaff;
  color: #2D2A26;
  transform: translateY(-1px);
}

.blog-tag-filter.active {
  background: #E85D3A;
  color: #FFFFFF;
}

/* --- Post Cards --- */
.blog-post-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.blog-card {
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.blog-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.blog-card-body {
  padding: 20px 22px 24px;
}

.blog-card-meta {
  font-size: 13px;
  font-weight: 600;
  color: #A09A94;
  margin-bottom: 8px;
}

.blog-card-title {
  font-size: 19px;
  font-weight: 800;
  color: #2D2A26;
  margin-bottom: 8px;
  line-height: 1.3;
}

.blog-card-title a {
  color: inherit;
}

.blog-card-title a:hover {
  color: #E85D3A;
}

.blog-card-excerpt {
  font-size: 14px;
  font-weight: 600;
  color: #6B6560;
  line-height: 1.5;
  margin-bottom: 14px;
}

.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Tags --- */
.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.blog-tag {
  display: inline-block;
  padding: 4px 12px;
  background: #dedaff;
  color: #2D2A26;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.2s, transform 0.15s;
}

.blog-tag:hover {
  background: #bcffed;
  transform: translateY(-1px);
}

/* --- Pagination --- */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1.5px solid #EDEAE6;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #6B6560;
  background: #F5F3F0;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.pagination-btn:hover {
  background: #EDEAE6;
  color: #2D2A26;
}

.pagination-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.pagination-numbers {
  display: flex;
  gap: 4px;
}

.pagination-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 14px;
  font-weight: 700;
  color: #6B6560;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.pagination-num:hover {
  background: #F5F3F0;
  color: #2D2A26;
}

.pagination-num.active {
  background: #E85D3A;
  color: #FFFFFF;
}

/* --- Post Layout with TOC --- */
.blog-post-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.blog-main:has(.blog-post-layout) {
  max-width: 1100px;
}

/* --- Table of Contents Sidebar (Desktop) --- */
.blog-toc {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-nav {
  padding: 16px 0;
}

.toc-title {
  font-size: 11px;
  font-weight: 800;
  color: #A09A94;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding-left: 12px;
}

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

.toc-list li {
  margin-bottom: 1px;
}

.toc-list li a {
  display: block;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #A09A94;
  border-left: 2px solid #EDEAE6;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  line-height: 1.4;
}

.toc-list li a:hover {
  color: #2D2A26;
  background: #F5F3F0;
  border-radius: 0 8px 8px 0;
}

.toc-list li.active a {
  color: #E85D3A;
  border-left-color: #E85D3A;
  font-weight: 700;
}

.toc-list li.toc-sub a {
  padding-left: 24px;
  font-size: 12px;
}

/* --- Mobile TOC (hidden on desktop) --- */
.blog-toc-mobile {
  display: none;
  margin-bottom: 28px;
}

.toc-mobile-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: #F5F3F0;
  border: none;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #2D2A26;
  cursor: pointer;
  transition: background 0.15s;
}

.toc-mobile-toggle:active {
  background: #EDEAE6;
}

.toc-mobile-toggle .toc-chevron {
  margin-left: auto;
  transition: transform 0.2s;
}

.blog-toc-mobile.open .toc-chevron {
  transform: rotate(180deg);
}

.blog-toc-mobile .toc-nav {
  display: none;
  padding: 8px 16px 12px;
  background: #F5F3F0;
  border-radius: 0 0 12px 12px;
  margin-top: -4px;
}

.blog-toc-mobile .toc-title {
  display: none;
}

.blog-toc-mobile .toc-list li a {
  border-left: none;
  padding: 6px 0;
}

.blog-toc-mobile .toc-list li a:hover {
  background: none;
  color: #E85D3A;
}

.blog-toc-mobile .toc-list li.toc-sub a {
  padding-left: 16px;
}

.blog-toc-mobile.open .toc-nav {
  display: block;
}

/* --- Single Post --- */
.blog-post {
  max-width: 100%;
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

.blog-post-header {
  margin-bottom: 32px;
}

.blog-post-meta {
  font-size: 14px;
  font-weight: 600;
  color: #A09A94;
  margin-bottom: 12px;
}

.blog-post-title {
  font-size: 34px;
  font-weight: 800;
  color: #2D2A26;
  line-height: 1.2;
  margin-bottom: 12px;
}

.blog-post-description {
  font-size: 17px;
  font-weight: 600;
  color: #6B6560;
  line-height: 1.5;
}

.blog-post-image {
  margin-bottom: 32px;
  border-radius: 20px;
  overflow: hidden;
}

.blog-post-image img {
  width: 100%;
}

/* --- Post Content --- */
.blog-post-content {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.75;
  color: #2D2A26;
}

.blog-post-content h2 {
  font-size: 24px;
  font-weight: 800;
  color: #2D2A26;
  margin: 40px 0 16px;
}

.blog-post-content h3 {
  font-size: 19px;
  font-weight: 800;
  color: #2D2A26;
  margin: 32px 0 12px;
}

.blog-post-content p {
  margin-bottom: 20px;
}

.blog-post-content ul,
.blog-post-content ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.blog-post-content li {
  margin-bottom: 8px;
}

.blog-post-content blockquote {
  border-left: 4px solid #D4940A;
  background: #F5F3F0;
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 16px 16px 0;
  font-style: italic;
  color: #6B6560;
}

.blog-post-content code {
  font-family: 'Courier New', monospace;
  background: #F5F3F0;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 14px;
}

.blog-post-content pre {
  background: #F5F3F0;
  border-left: 4px solid #E85D3A;
  border-radius: 0 16px 16px 0;
  padding: 20px;
  margin: 24px 0;
  overflow-x: auto;
}

.blog-post-content pre code {
  background: none;
  padding: 0;
}

.blog-post-content img {
  border-radius: 16px;
  margin: 24px 0;
}

.blog-post-content a {
  color: #E85D3A;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(232, 93, 58, 0.3);
  text-underline-offset: 3px;
}

.blog-post-content a:hover {
  color: #02b887;
  text-decoration-color: rgba(2, 184, 135, 0.3);
}

/* --- Tables --- */
.blog-post-content .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
}

.blog-post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.blog-post-content th {
  background: #FFF8E7;
  font-weight: 800;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid #EDEAE6;
}

.blog-post-content td {
  padding: 10px 14px;
  border: 1px solid #EDEAE6;
}

.blog-post-content tr:nth-child(even) td {
  background: #FDFCFA;
}

/* --- Calculator Embed --- */
.calculator-embed {
  margin: 32px auto;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1.5px solid #EDEAE6;
  max-width: 380px;
}

.calculator-embed iframe {
  width: 100%;
  border: none;
  height: 560px;
}

/* Wider comparison calculator embed */
.calculator-embed.compare-embed {
  max-width: 480px;
}

.calculator-embed.compare-embed iframe {
  height: 680px;
  transition: height 0.3s ease;
}

.calculator-embed-caption {
  background: #F5F3F0;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #6B6560;
  text-align: center;
}

.calculator-embed-caption a {
  color: #D35233;
  text-decoration: none;
}

.calculator-embed-caption a:hover {
  text-decoration: underline;
}

/* --- Callout Box --- */
.blog-callout {
  background: #bcffed;
  border-radius: 16px;
  padding: 20px 22px;
  margin: 24px 0;
}

.blog-callout-title {
  font-size: 15px;
  font-weight: 800;
  color: #2D2A26;
  margin-bottom: 6px;
}

.blog-callout-body {
  font-size: 14px;
  color: #2D2A26;
}

/* --- Post Footer --- */
.blog-post-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1.5px solid #EDEAE6;
}

.blog-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #6B6560;
  transition: color 0.2s, transform 0.15s;
}

.blog-back-link:hover {
  color: #E85D3A;
  transform: translateX(-3px);
}

/* --- Tag Page --- */
.blog-tag-page-header {
  margin-bottom: 32px;
}

.blog-tag-page-title {
  font-size: 28px;
  font-weight: 800;
  color: #2D2A26;
}

.blog-tag-page-title span {
  color: #E85D3A;
}

.blog-tag-page-count {
  font-size: 15px;
  font-weight: 600;
  color: #A09A94;
  margin-top: 4px;
}

/* --- Footer --- */
.blog-footer {
  background: #F5F3F0;
  padding: 32px 24px;
  margin-top: 40px;
}

.blog-footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.blog-footer p {
  font-size: 13px;
  font-weight: 600;
  color: #A09A94;
}

.blog-footer-links {
  display: flex;
  gap: 20px;
}

.blog-footer-links a {
  font-size: 13px;
  font-weight: 700;
  color: #6B6560;
}

.blog-footer-links a:hover {
  color: #E85D3A;
}

/* --- Scroll to Top Button --- */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #E85D3A;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s, background 0.2s;
  z-index: 101;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: #D04A28;
}

/* --- Responsive: TOC breakpoint --- */
@media (max-width: 900px) {
  .blog-post-layout {
    flex-direction: column;
    gap: 0;
  }

  .blog-toc {
    display: none;
  }

  .blog-toc-mobile {
    display: block;
  }

  .blog-main:has(.blog-post-layout) {
    max-width: 800px;
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 600px) {
  .blog-pagination {
    gap: 4px;
  }

  .pagination-btn {
    padding: 8px 10px;
    font-size: 13px;
  }

  .pagination-num {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .blog-header-inner {
    flex-wrap: wrap;
  }

  .blog-site-title {
    font-size: 16px;
  }

  .blog-nav {
    gap: 14px;
  }

  .lang-switcher {
    padding-left: 10px;
    margin-left: 0;
  }

  .blog-main {
    padding: 28px 18px 48px;
  }

  .blog-index-title {
    font-size: 26px;
  }

  .blog-post-title {
    font-size: 26px;
  }

  .blog-post-content h2 {
    font-size: 20px;
  }

  .blog-card-image {
    height: 160px;
  }

  .blog-footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .calculator-embed {
    max-width: 100%;
  }
}
