/* ============================================
   Blog article page (blog_posts#show)
   app.css resets every margin/padding to 0 and makes links inherit the text
   colour, so the article body needs its own typography.
   ============================================ */

.blog-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

@media (min-width: 768px) {
  .blog-article {
    padding: 3rem 2rem 5rem;
  }
}

/* === HEADER === */
.blog-article__back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 1.5rem;
  color: #2563eb;
  font-size: 0.9375rem;
  font-weight: 600;
}

.blog-article__back:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.blog-article__title {
  margin-bottom: 1rem;
  color: #111827;
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

.blog-article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin-bottom: 2rem;
  color: #6b7280;
  font-size: 0.875rem;
}

.blog-article__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
}

.blog-article__meta-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.blog-article__image {
  display: block;
  width: 100%;
  margin-bottom: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

/* === BODY === */
.blog-article__body {
  color: #374151;
  font-size: 1.0625rem;
  line-height: 1.75;
}

@media (min-width: 768px) {
  .blog-article__body {
    font-size: 1.125rem;
  }
}

.blog-article__body p,
.blog-article__body ul,
.blog-article__body ol,
.blog-article__body blockquote,
.blog-article__body pre,
.blog-article__body table,
.blog-article__body figure {
  margin-bottom: 1.25em;
}

.blog-article__body h1,
.blog-article__body h2 {
  margin: 2.25em 0 0.75em;
  padding-top: 1.25em;
  border-top: 1px solid #e5e7eb;
  color: #111827;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.blog-article__body h3 {
  margin: 1.75em 0 0.5em;
  color: #111827;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.4;
}

.blog-article__body h4 {
  margin: 1.5em 0 0.5em;
  color: #111827;
  font-size: 1.0625rem;
  font-weight: 700;
}

.blog-article__body > .trix-content > :first-child,
.blog-article__body > .trix-content > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.blog-article__body h2 + p,
.blog-article__body h3 + p,
.blog-article__body h2 + ul,
.blog-article__body h2 + ol,
.blog-article__body h3 + ul,
.blog-article__body h3 + ol {
  margin-top: 0;
}

.blog-article__body ul,
.blog-article__body ol {
  padding-inline-start: 1.5em;
}

.blog-article__body ul {
  list-style: disc;
}

.blog-article__body ol {
  list-style: decimal;
}

.blog-article__body li {
  margin-bottom: 0.5em;
  padding-inline-start: 0.25em;
}

.blog-article__body li::marker {
  color: #2563eb;
  font-weight: 700;
}

.blog-article__body li > ul,
.blog-article__body li > ol {
  margin: 0.5em 0 0;
}

.blog-article__body strong,
.blog-article__body b {
  color: #111827;
  font-weight: 700;
}

.blog-article__body a {
  color: #2563eb;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.blog-article__body a:hover {
  color: #1d4ed8;
  text-decoration-color: currentColor;
}

.blog-article__body blockquote {
  padding: 0.75em 1.25em;
  border-inline-start: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  background: #eff6ff;
  color: #1f2937;
}

[dir="rtl"] .blog-article__body blockquote {
  border-radius: 8px 0 0 8px;
}

.blog-article__body pre {
  padding: 1em;
  overflow-x: auto;
  border-radius: 8px;
  background: #f3f4f6;
  font-size: 0.875em;
}

.blog-article__body img {
  border-radius: 10px;
}

.blog-article__body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375em;
}

.blog-article__body th,
.blog-article__body td {
  padding: 0.625em 0.875em;
  border: 1px solid #e5e7eb;
  text-align: start;
}

.blog-article__body th {
  background: #f9fafb;
  color: #111827;
  font-weight: 700;
}

.blog-article__body hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
}

.blog-article__body .attachment {
  display: block;
  margin-bottom: 1.25em;
}

.blog-article__body .attachment__caption {
  color: #6b7280;
  font-size: 0.875em;
  text-align: center;
}

/* === RELATED POSTS === */
.blog-related {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid #e5e7eb;
}

.blog-related__heading {
  margin-bottom: 1.5rem;
  color: #111827;
  font-size: 1.5rem;
  font-weight: 700;
}

.blog-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.blog-related__card {
  display: block;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-related__card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

.blog-related__image {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.blog-related__image--placeholder {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.blog-related__text {
  padding: 1rem 1.125rem 1.25rem;
}

.blog-related__title {
  margin-bottom: 0.375rem;
  color: #111827;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.blog-related__date {
  color: #6b7280;
  font-size: 0.8125rem;
}

[dir="rtl"] .blog-article__back-arrow {
  display: inline-block;
  transform: scaleX(-1);
}
