/* HumanDoc Blog Stylesheet */

.blog-shell, .article-container {
  width: calc(100% - 40px);
  max-width: 900px;
  margin-inline: auto;
  box-sizing: border-box;
}

.blog-shell {
  padding-block: 48px 80px;
}

.blog-header {
  max-width: 840px;
  margin-bottom: 56px;
}

.blog-header h1 {
  font-size: clamp(40px, 4.5vw, 64px);
  line-height: 1.08;
  margin-bottom: 20px;
}

.blog-header .lede {
  font-size: 20px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 0;
}

/* --- Breadcrumbs --- */
.blog-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 32px;
}

.blog-breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

.blog-breadcrumbs .sep {
  opacity: 0.5;
  user-select: none;
}

.blog-breadcrumbs .current {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 480px;
}

/* --- Post Grid & Cards --- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 36px 32px;
}

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

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(33, 59, 50, 0.08);
  border-color: var(--accent-border);
}

.blog-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #eaf0e6;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-media img {
  transform: scale(1.03);
}

.blog-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

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

.blog-tag {
  display: inline-block;
  padding: 3px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.blog-card-title {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.28;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.blog-card-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s;
}

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

.blog-card-desc {
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 20px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

.blog-card-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-card-likes {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--muted);
}

.blog-card-likes svg {
  width: 14px;
  height: 14px;
  fill: #d46377;
}

/* --- Article Detail View --- */
.article-container {
  padding-block: 36px 80px;
}

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

.article-header h1 {
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--ink);
}

.article-lede {
  font-size: 20px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 28px;
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 16px;
  border-block: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

.article-author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  border: 1px solid var(--accent-border);
}

.author-details strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.article-read-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Article Like Widget --- */
.like-widget {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.blog-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--white);
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.blog-like-btn:hover {
  border-color: #e0245e;
  background: #fff5f7;
  color: #e0245e;
}

.blog-like-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), fill 0.2s ease;
}

.blog-like-btn.liked {
  border-color: #e0245e;
  background: #fff0f3;
  color: #e0245e;
}

.blog-like-btn.liked svg {
  fill: #e0245e;
  stroke: #e0245e;
  transform: scale(1.15);
}

.blog-like-btn.animating svg {
  animation: heartPulse 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1.15); }
}

.like-count {
  font-weight: 700;
}

/* --- Article Cover Image --- */
.article-cover {
  margin-bottom: 48px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: #eef2ec;
}

.article-cover img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Article Content Typography & Elements --- */
.article-prose {
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.article-prose h2 {
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.2;
  margin-top: 52px;
  margin-bottom: 20px;
  color: var(--ink);
  letter-spacing: -0.025em;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.article-prose h3 {
  font-size: 21px;
  line-height: 1.3;
  margin-top: 36px;
  margin-bottom: 14px;
  font-weight: 650;
  color: var(--ink);
}

.article-prose p {
  margin-bottom: 24px;
}

.article-prose ul, .article-prose ol {
  margin: 0 0 28px 24px;
  padding: 0;
}

.article-prose li {
  margin-bottom: 10px;
  line-height: 1.7;
}

.article-prose strong {
  font-weight: 650;
  color: #172a23;
}

/* --- Figures & Images --- */
.article-prose img, .article-prose figure, .article-cover img {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

.blog-figure {
  margin: 40px 0;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.blog-img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.blog-figcaption {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
  padding-inline: 12px;
}

/* --- SVG Flowcharts & Responsive Diagrams --- */
.svg-wrap {
  width: 100%;
  max-width: 100%;
  margin: 28px 0;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.blog-svg-chart {
  width: 100%;
  max-width: 860px;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--white);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.blog-figure .svg-wrap {
  margin: 0;
}

.blog-figure .blog-svg-chart {
  border: none;
  box-shadow: none;
  background: transparent;
  border-radius: 6px;
  max-width: 100%;
}


/* --- Callout Boxes --- */
.blog-callout {
  margin: 36px 0;
  padding: 24px 28px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 17px;
  line-height: 1.65;
}

.blog-callout p:last-child {
  margin-bottom: 0;
}

.blog-callout strong {
  color: var(--accent);
}

/* --- Tables --- */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 28px 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--white);
  display: block;
}

.blog-table {
  min-width: 640px;
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  text-align: left;
}

/* Fallback if any table is not wrapped */
.article-prose > table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.blog-table th, .blog-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  word-break: normal;
  overflow-wrap: normal;
  white-space: normal;
  vertical-align: top;
}

.blog-table th {
  background: #f1f4ed;
  font-weight: 650;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.blog-table td:first-child {
  white-space: nowrap;
  font-weight: 600;
}

.blog-table tr:last-child td {
  border-bottom: none;
}

.blog-table tbody tr:hover {
  background: #fafbf8;
}

.badge-success {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: #d8edd8;
  color: #1b5e20;
  font-weight: 600;
  font-size: 13px;
}

.badge-danger {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
  font-size: 13px;
}

.badge-warning {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: #fef3c7;
  color: #b45309;
  font-weight: 600;
  font-size: 13px;
}

/* --- Checklists --- */
.blog-checklist {
  list-style: none;
  margin: 28px 0;
  padding: 0;
}

.blog-checklist li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.blog-checklist li::before {
  content: "✓";
  position: absolute;
  left: 4px;
  top: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
}

.blog-footer-note {
  font-size: 14px;
  color: var(--muted);
  border-top: 1px dashed var(--rule);
  padding-top: 18px;
  margin-top: 40px;
}

/* --- Bottom Article Actions & Callout --- */
.article-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 12px;
  margin-top: 56px;
}

.article-cta-box {
  background: linear-gradient(135deg, #194730 0%, #285d45 100%);
  color: var(--white);
  border-radius: 14px;
  padding: 40px 36px;
  margin-top: 60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.article-cta-box h3 {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.2;
  color: var(--white);
  margin: 0;
}

.article-cta-box p {
  font-size: 17px;
  line-height: 1.6;
  color: #dce8d8;
  max-width: 620px;
  margin: 0;
}

.article-cta-box .button {
  background: var(--white);
  color: var(--accent-hover);
  border-color: var(--white);
  margin-top: 8px;
}

.article-cta-box .button:hover {
  background: var(--paper);
  color: var(--accent);
}

/* --- Related Posts Section --- */
.related-section {
  margin-top: 72px;
  padding-top: 48px;
  border-top: 2px solid var(--rule);
}

.related-section h2 {
  font-size: 28px;
  margin-bottom: 28px;
}

/* --- Auth Toast / Modal for Like prompt --- */
.blog-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 20px;
}

.blog-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.blog-modal {
  background: var(--white);
  border-radius: 14px;
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.16);
  border: 1px solid var(--rule);
  text-align: center;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.blog-modal-backdrop.show .blog-modal {
  transform: translateY(0) scale(1);
}

.blog-modal-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff0f3;
  color: #e0245e;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.blog-modal-icon svg {
  width: 28px;
  height: 28px;
  fill: #e0245e;
}

.blog-modal h3 {
  font-size: 22px;
  margin-bottom: 10px;
  font-family: var(--serif);
}

.blog-modal p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.blog-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.blog-modal-close {
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
}

.blog-modal-close:hover {
  text-decoration: underline;
}

/* --- Mobile Responsive Tweaks --- */
@media (max-width: 768px) {
  .blog-shell, .article-container {
    width: calc(100% - 40px);
    padding-block: 28px 48px;
  }
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .article-header h1 {
    font-size: 28px;
  }
  .article-meta-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .article-bottom-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .article-cta-box {
    padding: 28px 24px;
  }
}

@media (max-width: 480px) {
  .blog-shell, .article-container {
    width: calc(100% - 24px);
    padding-block: 20px 40px;
  }
  .blog-header h1 {
    font-size: 28px;
    line-height: 1.15;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .blog-header .lede {
    font-size: 16px;
    line-height: 1.5;
  }
  .article-header h1 {
    font-size: 24px;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .article-lede {
    font-size: 16px;
    line-height: 1.55;
  }
  .article-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .like-widget {
    width: 100%;
    justify-content: flex-start;
  }
  .blog-like-btn {
    padding: 6px 14px;
    font-size: 13px;
  }
  .blog-breadcrumbs {
    font-size: 13px;
    gap: 6px;
  }
  .blog-breadcrumbs .current {
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
  }
  .article-cta-box {
    padding: 24px 18px;
  }
  .article-cta-box h3 {
    font-size: 22px;
  }
  .article-cta-box p {
    font-size: 15px;
  }
  .article-prose {
    font-size: 16px;
    line-height: 1.65;
  }
  .article-prose h2 {
    font-size: 22px;
    margin-top: 36px;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .article-prose h3 {
    font-size: 18px;
    margin-top: 24px;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .blog-figure {
    padding: 8px;
    margin: 24px 0;
  }
  .svg-wrap {
    margin: 20px 0;
  }
  .blog-svg-chart {
    border-radius: 8px;
  }
  .blog-callout {
    padding: 18px 20px;
    font-size: 15px;
  }
  .blog-card-body {
    padding: 20px;
  }
  .blog-card-title {
    font-size: 20px;
  }
}

@media (max-width: 360px) {
  .blog-shell, .article-container {
    width: calc(100% - 20px);
  }
  .article-header h1 {
    font-size: 22px;
  }
  .blog-header h1 {
    font-size: 24px;
  }
  .blog-breadcrumbs {
    font-size: 12px;
  }
  .blog-tag {
    font-size: 11px;
    padding: 2px 7px;
  }
  .blog-card-body {
    padding: 16px;
  }
  .blog-card-title {
    font-size: 19px;
  }
}
