/* ═══════════════════════════════════════════════
   Article Page Styles — scoped under .page-article
   ═══════════════════════════════════════════════ */

/* ── Scoped Variables ── */
.page-article {
  --art-ink: var(--ytm-dark, #0F172A);
  --art-muted: var(--ytm-muted, #416075);
  --art-gold: var(--ytm-gold, #e89b2c);
  --art-border: var(--ytm-border, #e2ebee);
  --art-bg: var(--ytm-bg, #f5f7fa);
  --art-surface: var(--ytm-surface, #FFFFFF);
  --art-primary: var(--ytm-primary, #123553);
  --art-accent: var(--ytm-accent, #1d70b7);
  --art-radius-sm: var(--ytm-radius-sm, 8px);
  --art-radius-md: var(--ytm-radius-md, 12px);
  --art-radius-lg: var(--ytm-radius-lg, 24px);
  --art-shadow-sm: var(--ytm-shadow-sm);
  --art-shadow-md: var(--ytm-shadow-md);
}

/* ── Reading Progress Bar ── */
.article-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--art-accent), var(--art-gold));
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ── Page Base ── */
.page-article {
  color: var(--art-ink);
  background: var(--art-bg);
  font-family: var(--ytm-font, "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif);
  line-height: 1.8;
}

/* Shared article navigation. It is injected by the static build so new
   articles inherit the same orientation cue without manual markup. */
.article-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
  padding: 2px 4px 0;
  color: var(--art-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.article-breadcrumb a {
  color: var(--art-accent);
  text-decoration: none;
}

.article-breadcrumb a:hover {
  color: var(--ytm-gold-dark, #b86f08);
  text-decoration: underline;
}

.article-breadcrumb > span[aria-hidden="true"] {
  color: var(--art-gold);
  font-size: 1.1em;
}

.article-breadcrumb__current {
  max-width: 52ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-article .zoneShirt,
.page-article .unitShirt,
.page-article .allblog_container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
}

.page-article .blog_featured_image_zone {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 20px 0;
}

/* legacy platform exports a percentage padding here as a legacy image placeholder.
   Reset it so every featured image uses the same centered media frame. */
.page-article .blog_featured_image_zone .reserved_image_area {
  position: relative;
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  height: auto !important;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.page-article .blog_featured_image_zone .blog_featured_image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 470px;
  margin: 0 auto;
  border-radius: var(--art-radius-lg);
  box-shadow: var(--art-shadow-md);
  object-fit: contain;
}

/* ── Blog Header ── */
.page-article .blog_header {
  max-width: 1100px;
  margin: 20px auto 0;
  padding: 30px 40px 22px;
  background: var(--art-surface);
  border: 1px solid var(--art-border);
  border-top: 4px solid var(--art-gold);
  border-radius: var(--art-radius-md);
  box-shadow: var(--art-shadow-sm);
}

.page-article .blog_header::before {
  display: block;
  margin-bottom: 10px;
  color: var(--art-accent);
  content: "บริการรับแปลภาษาและเอกสาร";
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.page-article .blog_header .blog_title {
  margin: 0;
  padding: 0;
  color: var(--art-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* ── Article Meta Bar ── */
.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 12px 20px;
  background: var(--art-bg);
  border-radius: var(--art-radius-sm);
  font-size: 0.875rem;
  color: var(--art-muted);
}

.article-meta-bar .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.article-meta-bar .meta-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.article-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--art-accent);
  border-radius: var(--ytm-radius-full, 999px);
  font-weight: 600;
  font-size: 0.8125rem;
}

/* ── Content Container ── */
.page-article .blogcontent_container {
  max-width: 1100px;
  margin: 16px auto 56px;
  padding: clamp(24px, 4vw, 48px);
  background: var(--art-surface);
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius-md);
  box-shadow: var(--art-shadow-sm);
}

/* ── Blog Content ── */
.page-article .blog_content {
  max-width: 900px;
  margin: 0 auto 48px;
  color: var(--art-ink);
  font-size: 18px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.page-article .blog_content p {
  margin: 0 0 1.2em;
}

.page-article .blog_content center {
  display: block;
  text-align: center;
}

/* Normalize legacy editor formatting while preserving meaningful alignment. */
.page-article .blog_content [style*="font-size"],
.page-article .blog_content [style*="font-family"],
.page-article .blog_content [style*="color"],
.page-article .blog_content [style*="background-color"] {
  color: inherit !important;
  font-family: inherit !important;
  font-size: inherit !important;
  background-color: transparent !important;
}

.page-article .blog_content > p:first-of-type {
  margin-bottom: 1.6em;
  padding: 16px 20px;
  color: var(--art-primary);
  font-size: 1.06em;
  line-height: 1.8;
  border-left: 4px solid var(--art-accent);
  border-radius: 0 var(--art-radius-md) var(--art-radius-md) 0;
  background: #eef9f7;
}

/* ── Headings ── */
.page-article .blog_content h2 {
  color: var(--art-ink);
  font-size: 1.65em;
  font-weight: 700;
  line-height: 1.45;
  margin: 2.1em 0 0.75em;
  padding: 0.15em 0 0.15em 14px;
  border-left: 4px solid var(--art-gold);
  scroll-margin-top: 24px;
}

.page-article .blog_content h2:first-child {
  margin-top: 0;
}

.page-article .blog_content h3 {
  color: var(--art-ink);
  font-size: 1.2em;
  font-weight: 700;
  line-height: 1.5;
  margin: 1.5em 0 0.55em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--art-border);
  scroll-margin-top: 24px;
}

.page-article .blog_content h4 {
  color: var(--art-ink);
  font-size: 1.08em;
  font-weight: 700;
  line-height: 1.55;
  margin: 1.25em 0 0.45em;
  scroll-margin-top: 24px;
}

/* ── Inline Text ── */
.page-article .blog_content strong {
  color: var(--art-ink);
  font-weight: 700;
}

.page-article .blog_content a {
  color: var(--art-accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.page-article .blog_content a:hover {
  color: var(--art-gold);
}

/* ── Lists ── */
.page-article .blog_content ul,
.page-article .blog_content ol {
  margin: 0.5em 0 1.25em;
  padding-left: 1.6em;
}

.page-article .blog_content li {
  margin: 0.4em 0;
  padding-left: 0.2em;
  line-height: 1.8;
}

.page-article .blog_content li::marker {
  color: var(--art-accent);
  font-weight: 700;
}

/* ── Blockquotes ── */
.page-article .blog_content blockquote {
  margin: 1.5em 0;
  padding: 1.25em 1.5em;
  color: var(--art-muted);
  background: var(--art-bg);
  border-left: 4px solid var(--art-gold);
  border-radius: 0 var(--art-radius-sm) var(--art-radius-sm) 0;
  font-style: italic;
}

.page-article .blog_content blockquote p:last-child {
  margin-bottom: 0;
}

/* ── Horizontal Rule ── */
.page-article .blog_content hr {
  border: 0;
  border-top: 1px solid var(--art-border);
  margin: 2em 0;
}

/* ── Images ── */
.page-article .blog_content img {
  display: block !important;
  width: auto;
  max-width: 100%;
  height: auto !important;
  margin: 28px auto;
  border-radius: var(--art-radius-md);
  box-shadow: var(--art-shadow-md);
  object-fit: contain;
}

.page-article .blog_content figure.article-figure {
  margin: 1.75rem 0 2rem;
}

.page-article .blog_content figure.article-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.page-article .blog_content figure figcaption {
  margin-top: 0.5em;
  color: var(--art-muted);
  font-size: 0.875em;
  text-align: center;
}

.page-article .blog_content video,
.page-article .blog_content iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 28px auto;
  border: 0;
  border-radius: var(--art-radius-md);
}

/* ── Tables ── */
.page-article .blog_content table {
  width: 100%;
  margin: 1.25em 0 1.75em;
  border: 1px solid var(--art-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--art-radius-sm);
  overflow: hidden;
}

.page-article .blog_content table thead {
  background: var(--art-primary);
}

.page-article .blog_content th {
  color: var(--art-ink);
  background: var(--art-primary);
  color: #fff;
  font-weight: 700;
  text-align: left;
}

.page-article .blog_content th,
.page-article .blog_content td {
  padding: 0.75em 0.9em;
  border-bottom: 1px solid var(--art-border);
  vertical-align: top;
}

.page-article .blog_content tr:last-child td {
  border-bottom: 0;
}

.page-article .blog_content tr:nth-child(even) {
  background: var(--art-bg);
}

.page-article .blog_content code,
.page-article .blog_content pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.page-article .blog_content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 16px 18px;
  color: #eef5fb;
  background: #123553;
  border-radius: var(--art-radius-sm);
}

/* ── Table of Contents ── */
.article-toc {
  margin: 0 0 32px;
  padding: 20px 24px;
  background: var(--art-bg);
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius-md);
}

.article-toc h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--art-ink);
}

.article-toc ol {
  margin: 0;
  padding-left: 20px;
  list-style: decimal;
}

.article-toc li {
  margin: 6px 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.article-toc a {
  color: var(--art-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.article-toc a:hover {
  color: var(--art-accent);
}

/* ── Social Share ── */
.article-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
  padding-top: 20px;
  border-top: 1px solid var(--art-border);
}

.article-share span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--art-muted);
  margin-right: 8px;
}

.article-share a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--ytm-radius-full, 999px);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.article-share a.share-line {
  background: #1d70b7;
  color: #fff;
}

.article-share a.share-line:hover {
  background: #15558d;
}

.article-share a.share-facebook {
  background: #1877f2;
  color: #fff;
}

.article-share a.share-facebook:hover {
  background: #1565d8;
}

.article-share a.share-twitter {
  background: #1da1f2;
  color: #fff;
}

.article-share a.share-twitter:hover {
  background: #1a8cd8;
}

/* ── Meta Info ── */
.page-article .blog_date,
.page-article .blog_author,
.page-article .blog_stats {
  color: var(--art-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.page-article .blog_date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-article .blog_author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-article .blog_stats {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.page-article .blog_stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Tags Section ── */
.page-article .blog_tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
  padding-top: 20px;
  border-top: 1px solid var(--art-border);
}

.page-article .blog_tags a,
.page-article .blog_tags span {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  background: var(--art-bg);
  border: 1px solid var(--art-border);
  border-radius: var(--ytm-radius-full, 999px);
  color: var(--art-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.page-article .blog_tags a:hover {
  background: var(--art-accent);
  border-color: var(--art-accent);
  color: #fff;
}

/* ── Related Articles ── */
.page-article .related-articles {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--art-border);
}

.page-article .related-articles h2 {
  margin: 0 0 20px;
  font-size: 1.3em;
  font-weight: 700;
  color: var(--art-ink);
}

.page-article .related-articles .related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.page-article .related-articles .related-card {
  display: flex;
  flex-direction: column;
  background: var(--art-surface);
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius-md);
  box-shadow: var(--art-shadow-sm);
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow 0.3s, transform 0.3s;
}

.page-article .related-articles .related-card:hover {
  box-shadow: var(--art-shadow-md);
  transform: translateY(-3px);
}

.page-article .related-articles .related-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.page-article .related-articles .related-card .card-body {
  padding: 16px;
}

.page-article .related-articles .related-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--art-ink);
  line-height: 1.5;
}

.page-article .related-articles .related-card p {
  margin: 0;
  color: var(--art-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ── Central editorial blocks ── */
.page-article .article-intro-card {
  margin: 0 0 28px;
  padding: 22px 24px 8px;
  background: linear-gradient(135deg, #f8fbff, #ffffff);
  border: 1px solid var(--art-border);
  border-left: 4px solid var(--art-accent);
  border-radius: var(--art-radius-md);
}

.page-article .article-intro-card h2 {
  margin-top: 0;
  border-left: 0;
  padding-left: 0;
}

.page-article .article-media {
  max-width: 820px;
  margin: 28px auto 24px;
  text-align: center;
}

.page-article .article-media img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius-md);
  box-shadow: var(--art-shadow-sm);
}

.page-article .article-media figcaption {
  margin-top: 9px;
  color: var(--art-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.page-article .article-related-links,
.page-article .article-cluster-links {
  margin: 32px 0;
  padding: 22px 24px;
  background: #f8fbff;
  border: 1px solid var(--art-border);
  border-radius: var(--art-radius-md);
}

.page-article .article-related-links h2,
.page-article .article-cluster-links h2 {
  margin-top: 0;
}

.page-article .article-link-list {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  padding-left: 20px;
}

.page-article .article-link-list a {
  color: var(--art-accent);
  font-weight: 700;
  text-decoration: none;
}

.page-article .article-link-list a:hover {
  color: var(--ytm-gold-dark, #b86f08);
  text-decoration: underline;
}

.page-article .article-scope-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 30px;
}

.page-article .article-scope-grid > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: #f8fbff;
  border: 1px solid var(--art-border);
  border-top: 3px solid var(--art-accent);
  border-radius: var(--art-radius-md);
}

.page-article .article-scope-grid strong {
  color: var(--art-primary);
  font-size: 1rem;
}

.page-article .article-scope-grid span {
  flex: 1;
  color: var(--art-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.page-article .article-scope-grid a {
  color: var(--art-accent);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.page-article .article-cta {
  margin: 34px 0 8px;
  padding: 22px 24px;
  background: #f5f9fd;
  border: 1px solid #cfe0ef;
  border-left: 4px solid var(--art-gold);
  border-radius: var(--art-radius-md);
}

.page-article .article-cta h2 {
  margin-top: 0;
}

.page-article .article-cta p:last-of-type {
  margin-bottom: 0;
}

.page-article .article-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.page-article .article-cta__actions a {
  text-decoration: none;
}

/* ── Focus Visible ── */
.page-article a:focus-visible,
.page-article button:focus-visible,
.page-article summary:focus-visible {
  outline: 2px solid var(--art-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .page-article .related-articles .related-card {
    transition: none;
  }
}

/* ── Mobile Responsive ── */
@media (max-width: 700px) {
  .page-article .blog_featured_image_zone {
    width: calc(100% - 28px);
    padding: 18px 0 0;
  }

  .page-article .blog_featured_image_zone .reserved_image_area {
    width: 100%;
    border-radius: var(--art-radius-md);
  }

  .page-article .blog_featured_image_zone .blog_featured_image {
    max-height: 320px;
  }

  .page-article .blog_header {
    margin-top: 14px;
    padding: 22px 20px 16px;
  }

  .article-breadcrumb {
    width: calc(100% - 28px);
    padding-top: 0;
    font-size: 0.8125rem;
  }

  .article-breadcrumb__current {
    max-width: 34ch;
  }

  .page-article .blog_header .blog_title {
    font-size: 26px;
    padding: 0;
    border-radius: 0;
  }

  .page-article .blogcontent_container {
    padding: 20px 16px;
    border-radius: var(--art-radius-sm);
  }

  .page-article .blog_content {
    font-size: 16px;
    line-height: 1.85;
  }

  .page-article .blog_content h2 {
    font-size: 1.4em;
    padding-left: 11px;
  }

  .page-article .blog_content table {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }

  .page-article .blog_tags {
    gap: 6px;
  }

  .page-article .related-articles .related-grid {
    grid-template-columns: 1fr;
  }

  .page-article .article-scope-grid {
    grid-template-columns: 1fr;
  }

  .page-article .article-intro-card,
  .page-article .article-related-links,
  .page-article .article-cluster-links,
  .page-article .article-cta {
    padding: 18px 16px 6px;
  }

  .page-article .article-cta__actions {
    flex-direction: column;
  }

  .page-article .article-cta__actions a {
    width: 100%;
    text-align: center;
  }

  .article-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Tablet article rhythm: keep related/scope cards readable before the
   single-column mobile breakpoint takes over. */
@media (min-width: 701px) and (max-width: 900px) {
  .page-article .article-scope-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-article .related-articles .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-article .blog_header,
  .page-article .blogcontent_container {
    width: calc(100% - 28px);
  }
}
