:root {
  --detail-bg: #f5f7fb;
  --detail-surface: #ffffff;
  --detail-border: rgba(16, 49, 73, 0.12);
  --detail-accent: #1d9a8a;
  --detail-muted: #5b6875;
  --detail-radius: 18px;
  --detail-shadow: 0 24px 50px rgba(20, 63, 73, 0.14);
}

.detail-shell {
  padding: 110px 0 90px;
  background: var(--detail-bg);
}

.detail-article {
  background: var(--detail-surface);
  border-radius: var(--detail-radius);
  border: 1px solid var(--detail-border);
  box-shadow: var(--detail-shadow);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  display: grid;
  gap: 1.6rem;
  max-width: 960px;
  margin: 0 auto;
  overflow: hidden;
  min-width: 0;
}

.detail-article h1 {
  margin: 0;
  font-size: clamp(2.1rem, 3.5vw, 2.8rem);
  font-weight: 700;
  color: #15212e;
}

.detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.4rem;
  color: var(--detail-muted);
  font-size: 0.95rem;
}

.detail-meta img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid rgba(29, 154, 138, 0.25);
}

.detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 1.1rem;
  background: rgba(29, 154, 138, 0.08);
  border-radius: var(--detail-radius);
}

.detail-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: #15212e;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.detail-actions form,
.detail-actions form.d-inline {
  display: contents !important;
}

.detail-actions .btn {
  border-radius: 999px;
  font-weight: 600;
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
  flex: 0 0 auto;
  width: auto !important;
}

/* ===== Rendered Markdown Content ===== */
.article-content {
  color: #1b2d40;
  line-height: 1.85;
  font-size: 1.05rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

.article-content h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #0f2f4a;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f2f4a;
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f2f4a;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.article-content h4,
.article-content h5,
.article-content h6 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0f2f4a;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

.article-content p {
  margin-bottom: 1rem;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 1rem 0;
  display: block;
}

.article-content blockquote {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid #1d9a8a;
  background: rgba(29, 154, 138, 0.06);
  border-radius: 0 8px 8px 0;
  color: #3a4f5c;
  font-style: italic;
}

.article-content blockquote p:last-child {
  margin-bottom: 0;
}

.article-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.article-content code {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.88em;
}

.article-content :not(pre) > code {
  background: rgba(29, 154, 138, 0.1);
  color: #1d9a8a;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.article-content ul,
.article-content ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.35rem;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.article-content th,
.article-content td {
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(16, 49, 73, 0.12);
  text-align: left;
}

.article-content th {
  background: rgba(29, 154, 138, 0.08);
  font-weight: 600;
}

.article-content tr:nth-child(even) {
  background: rgba(245, 247, 251, 0.6);
}

.article-content a {
  color: #1d9a8a;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.article-content a:hover {
  color: #17867a;
}

.article-content hr {
  border: none;
  border-top: 1px solid rgba(16, 49, 73, 0.12);
  margin: 1.5rem 0;
}

.detail-comments {
  background: var(--detail-surface);
  border-radius: var(--detail-radius);
  border: 1px solid var(--detail-border);
  box-shadow: var(--detail-shadow);
  padding: 1.6rem;
  max-width: 960px;
  margin: 1.5rem auto 0;
  display: grid;
  gap: 1.2rem;
}

.detail-comment {
  border-bottom: 1px solid var(--detail-border);
  padding-bottom: 1rem;
}

.detail-comment:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-comment__author {
  font-weight: 600;
  color: #15212e;
}

.detail-comment__meta {
  font-size: 0.85rem;
  color: var(--detail-muted);
}

.detail-reply {
  margin-left: 2rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(29, 154, 138, 0.25);
}

@media (max-width: 575.98px) {
  .detail-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-stats {
    gap: 0.5rem 1rem;
  }
}

/* ── Explore more articles ── */
.explore-articles {
  padding-top: 1.5rem;
  border-top: 1px solid var(--detail-border);
}

.explore-articles__heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: #15212e;
  margin-bottom: 1rem;
}

.explore-articles__heading i {
  color: var(--detail-accent);
  margin-right: 0.4rem;
  font-size: 0.95rem;
}

.explore-articles__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.explore-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.explore-card:hover {
  border-color: var(--detail-accent);
  box-shadow: 0 2px 12px rgba(29, 154, 138, 0.12);
  color: inherit;
  text-decoration: none;
}

.explore-card__img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f0f0;
}

.explore-card__body {
  flex: 1;
  min-width: 0;
}

.explore-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.explore-card__meta {
  font-size: 0.75rem;
  color: #adb5bd;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: center;
}

.explore-card__author {
  color: var(--detail-muted);
}

@media (max-width: 576px) {
  .explore-articles__grid {
    grid-template-columns: 1fr;
  }
  .explore-card__img {
    width: 64px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
