/* ========================================
   Article Detail Page
   ======================================== */

.container--narrow {
  max-width: 780px;
}

/* Loading Shimmer */
.article-loading {
  padding: 4rem 0;
}

.article-loading__shimmer {
  max-width: 780px;
  margin: 0 auto;
}

.shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.shimmer--tag { width: 120px; height: 28px; border-radius: 999px; margin-bottom: 1.25rem; }
.shimmer--title { width: 100%; height: 40px; margin-bottom: 0.75rem; }
.shimmer--title-short { width: 60%; }
.shimmer--meta { width: 280px; height: 20px; margin-bottom: 2.5rem; margin-top: 0.5rem; }
.shimmer--line { width: 100%; height: 16px; }
.shimmer--line-short { width: 75%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error State */
.article-error {
  padding: 6rem 0;
}

.article-error__content {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.article-error__content svg {
  margin-bottom: 1.5rem;
}

.article-error__content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.article-error__content p {
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
  font-size: 1.0625rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

/* Article Header */
.article__header {
  padding: 3.5rem 0 2.5rem;
  background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-bg) 100%);
}

.article__category-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.875rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--color-primary);
  color: #fff;
  margin-bottom: 1.25rem;
  transition: background 0.15s;
}

.article__category-badge:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

.article__title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.article__excerpt {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
}

.article__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.article__author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.article__author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.article__author-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.article__date {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.article__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.article__tag {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--color-bg-alt);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* Article Body — Prose Styles */
.article__body {
  padding: 3rem 0;
}

.prose {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--color-text);
}

.prose h1 {
  display: none; /* Hide first H1, we show it in the header */
}

.prose h2 {
  font-size: 1.625rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary-light);
}

.prose h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.prose h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.prose p {
  margin-bottom: 1.25rem;
}

.prose a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.prose a:hover {
  color: var(--color-primary-dark);
}

.prose strong {
  font-weight: 600;
  color: var(--color-text);
}

.prose ul, .prose ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.prose li::marker {
  color: var(--color-primary);
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--color-primary);
  background: var(--color-primary-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--color-text-secondary);
}

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

.prose pre {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
  border-radius: 0;
  border: none;
}

.prose code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--color-bg-alt);
  color: #e11d48;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

.prose table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose thead {
  background: var(--color-bg-alt);
}

.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
}

.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.prose tbody tr:hover {
  background: var(--color-primary-light);
}

.prose hr {
  margin: 2.5rem 0;
  border: none;
  border-top: 2px solid var(--color-border);
}

.prose img {
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.prose em {
  font-style: italic;
}

/* Article Footer */
.article__footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--color-border);
}

.article__share {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.article__share-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.article__share-buttons {
  display: flex;
  gap: 0.5rem;
}

.article__share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0;
}

.article__share-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.article__nav {
  display: flex;
  justify-content: flex-start;
}

.article__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--color-primary);
  padding: 0.5rem 0;
}

.article__back:hover {
  color: var(--color-primary-dark);
}

/* Toast for copy link */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-text);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .article__header {
    padding: 2.5rem 0 2rem;
  }

  .article__title {
    font-size: 1.5rem;
  }

  .article__excerpt {
    font-size: 1rem;
  }

  .article__meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .prose pre {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    border-radius: 0;
    padding: 1rem;
  }

  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
