.article-content {
  padding-top: 60px;
  padding-bottom: 60px;
}

.article-body {
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.85;
  font-size: 16px;
  color: var(--text);
  overflow-x: auto;
}

.article-body h2 {
  font-family: Merriweather, serif;
  font-size: 28px;
  font-weight: 700;
  margin: 48px 0 20px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--article-link);
}

.article-body h3 {
  font-family: Merriweather, serif;
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 16px 0;
}

.article-body p {
  margin: 0 0 18px 0;
}

.article-body ul {
  margin: 0 0 18px 0;
  padding-left: 24px;
  list-style: disc;
}

.article-body ul li {
  margin-bottom: 8px;
}

.article-body code {
  font-family: 'Fira Code', 'Courier New', monospace;
  background: var(--card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  color: #c7254e;
}
[data-theme="dark"] .article-body code {
  color: #f4a0b5;
}

.article-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 20px 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.article-figure {
  margin: 28px 0;
  text-align: center;
}

.article-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.article-figure figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

.article-warning {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 6px 6px 0;
}
[data-theme="dark"] .article-warning {
  background: #3a2e00;
  border-left-color: #ffc107;
  color: #ffe48d;
}

.article-warning p {
  margin: 0;
}

.article-body a {
  color: var(--article-link);
  text-decoration: underline;
}

.article-intro {
  font-style: italic;
  color: var(--muted);
  margin-bottom: 28px;
}

.article-banner {
  margin-bottom: 28px;
}

.article-banner img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.solution-images {
  text-align: center;
  margin: 28px 0;
}

.solution-images img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  margin-bottom: 16px;
}

.properties-list,
.problem-list {
  margin: 0 0 18px 0;
  padding-left: 24px;
}

.properties-list li,
.problem-list li {
  margin-bottom: 10px;
}

.try-first {
  font-style: italic;
  color: var(--muted);
  margin: 24px 0;
}

.solution-content h3 {
  font-family: Merriweather, serif;
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 16px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.solution-content h4 {
  font-family: Merriweather, serif;
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 12px 0;
}

.solution-content hr {
  border: none;
  border-top: 2px solid var(--text);
  margin: 36px 0;
}

.solution-content p {
  margin: 0 0 12px 0;
}

.solution-content em {
  color: var(--muted);
}

.problem-box {
  border: 2px solid var(--text);
  border-radius: 8px;
  padding: 20px 28px;
  margin: 28px 0;
}

.problem-box h3 {
  margin-top: 0;
}

.problem-box p:last-child {
  margin-bottom: 0;
}

.problem-box .article-figure {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .article-content {
    padding-top: 40px;
    padding-bottom: 40px;
  }
  .article-body h2 {
    font-size: 24px;
  }
  .article-body h3 {
    font-size: 20px;
  }
  .article-body pre {
    padding: 14px 16px;
    font-size: 13px;
  }
}
/* MathJax display equation overflow fallback */
mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}
.article-body .MathJax_Display,
.article-body mjx-container {
  max-width: 100%;
}
/* Comments section */
.comments-section {
  max-width: 820px;
  margin: 3rem auto 0;
  padding: 0 0 3rem;
  border-top: 2px solid var(--border);
  padding-top: 2.5rem;
}
.comments-section h2 {
  font-family: Merriweather, serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

/* Article-page view count (below hero, above first heading) */
.article-view-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

/* Share section */
.share-section {
  margin: 2rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.share-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 0 0 .75rem;
  text-align: center;
}
.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: 4px;
  font-size: .82rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  line-height: 1;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.share-btn:hover { opacity: .85; transform: translateY(-1px); }
.share-btn:active { transform: translateY(0); }
.share-btn svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }
.share-facebook { background: #1877f2; color: #fff; }
.share-x        { background: #000; color: #fff; }
.share-linkedin { background: #0a66c2; color: #fff; }
.share-copy     { background: var(--card); color: var(--text); border: 1px solid var(--border); }

/* Comment list */
.comment-item {
  background: var(--card);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  box-shadow: 0 1px 2px var(--shadow);
}
.comment-item:last-child { margin-bottom: 0; }
.comment-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .5rem;
}
.comment-author {
  font-family: Merriweather, serif;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}
.comment-date {
  font-size: .78rem;
  color: var(--muted);
}
.comment-body {
  font-size: .95rem;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}
.comments-loading,
.comments-empty {
  font-size: .9rem;
  color: var(--muted);
  margin: .25rem 0 1rem;
}
.comments-error {
  font-size: .9rem;
  color: #721c24;
  margin: .25rem 0 1rem;
}
[data-theme="dark"] .comments-error { color: #ea868f; }

/* Comment form */
.comment-form {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.comment-form-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: 100%;
}
.comment-form-group label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}
.comment-form-group input,
.comment-form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--input-border, #ccc);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}
[data-theme="dark"] .comment-form-group input,
[data-theme="dark"] .comment-form-group textarea {
  border-color: var(--input-border, #444);
  background: var(--input-bg, #1a1a1a);
}
.comment-form-notice {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}
.comment-submit {
  align-self: flex-start;
  padding: 12px 24px;
  background: var(--btn-bg, #111);
  color: var(--btn-text, #fff);
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
[data-theme="dark"] .comment-submit {
  background: var(--btn-bg, #fff);
  color: var(--btn-text, #000);
}
.comment-submit:hover:not(:disabled) { opacity: .8; }
.comment-submit:disabled { opacity: .5; cursor: not-allowed; }
.comment-form-msg {
  font-size: .9rem;
  font-weight: 500;
  min-height: 1.2em;
}
.comment-form-msg--success { color: #155724; }
.comment-form-msg--error   { color: #721c24; }
[data-theme="dark"] .comment-form-msg--success { color: #75b798; }
[data-theme="dark"] .comment-form-msg--error   { color: #ea868f; }
