/* Blog content (article detail) — Figma node 303:7691 "Blog content".
   Scoped to the single-2.php template via the .blog-article wrapper so it
   never leaks into other single templates. Colours / type follow the same
   design tokens the Newsroom listing (newsroom.css) already established. */

body:has(.blog-article) {
  color: #181818;
  background: #fff;
  /* Prevent horizontal scrolling without turning body into a scroll container,
     which would break the sticky On This Page sidebar. */
  overflow-x: clip;
}

/* The Chinese-redirect banner is not part of this design. */
body:has(.blog-article) .redirect-bar {
  display: none !important;
  height: 0 !important;
}

/* Match the fixed-nav height the hero tucks under. */
body:has(.blog-article) .header-menu,
body:has(.blog-article) .header-menu nav {
  height: 84px;
}

.blog-article,
.blog-article * {
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

/* Shared content column: 1320px, centred, with viewport-safe gutters. */
.blog-hero-inner,
.blog-main-inner,
.blog-author-inner,
.blog-readmore-inner {
  width: min(1320px, calc(100% - 80px));
  margin-inline: auto;
}

/* ── Hero (Header E) ─────────────────────────────────────────────── */
.blog-hero {
  margin-top: -84px;
  padding: 160px 0 80px;
  background: linear-gradient(180deg, #f7f6ff 0%, #fff 127.28%);
}

.blog-hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  text-align: center;
}

.blog-hero-title {
  margin: 0;
  color: #181818;
  font-size: 38px;
  font-weight: 700;
  line-height: 50px;
}

.blog-hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 14px;
  line-height: 24px;
}

.blog-meta-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #9581f3;
  font-weight: 600;
  text-decoration: none;
}

.blog-meta-author::before {
  width: 18px;
  height: 18px;
  content: "";
  background: url("../images/newsroom/author.svg") center / contain no-repeat;
}

.blog-meta-date {
  color: #999;
  font-weight: 400;
}

/* ── Article body + On-This-Page ─────────────────────────────────── */
.blog-main {
  padding: 40px 0;
  background: #fff;
}

.blog-main-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 40px;
  align-items: start;
}

.blog-body {
  min-width: 0;
  color: #181818;
  font-size: 18px;
  line-height: 24px;
  word-break: break-word;
}

/* Uniform 20px vertical rhythm between top-level blocks, per the design. */
.blog-body > * {
  margin: 0;
}

.blog-body > * + * {
  margin-top: 20px;
}

.blog-body h1 { font-size: 38px; line-height: 50px; }
.blog-body h2 { font-size: 28px; line-height: 38px; }
.blog-body h3 { font-size: 24px; line-height: 32px; }
.blog-body h4 { font-size: 20px; line-height: 26px; }
.blog-body h5 { font-size: 18px; line-height: 24px; }
.blog-body h6 { font-size: 16px; line-height: 22px; }

.blog-body h1,
.blog-body h2,
.blog-body h3,
.blog-body h4,
.blog-body h5,
.blog-body h6 {
  color: #181818;
  font-weight: 700;
  scroll-margin-top: 104px; /* keep headings clear of the sticky nav on anchor jumps */
}

.blog-body p,
.blog-body li {
  font-size: 18px;
  line-height: 24px;
}

.blog-body ul,
.blog-body ol {
  padding-left: 24px;
}

.blog-body li + li {
  margin-top: 8px;
}

.blog-body a {
  color: #7a62f0;
  text-decoration: underline;
}

.blog-body a:hover {
  color: #5a3fe0;
}

.blog-body img {
  max-width: 100%;
  height: auto;
}

.blog-body figure,
.blog-body .wp-block-image {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.blog-body figure img,
.blog-body .wp-block-image img {
  border-radius: 8px;
}

.blog-body blockquote {
  padding: 4px 0 4px 20px;
  border-left: 3px solid #9581f3;
  color: #666;
}

/* ── Article tables ────────────────────────────────────────────────
   One shared rule covers Gutenberg wp-block-table figures and legacy raw
   tables. Existing posts often use TD cells in the first row instead of a
   semantic THEAD, so the first TBODY row is also treated as the header when
   that TBODY is the table's first child. */
.blog-body .wp-block-table {
  display: flex;
  width: 100%;
  max-width: 100%;
  flex-direction: column;
  align-items: stretch;
  margin: 0;
}

.blog-body table {
  display: table;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: visible;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 20px;
  color: #181818;
  background: #fff;
  font-size: 16px;
  line-height: 24px;
  table-layout: auto !important;
}

.blog-body table th,
.blog-body table td {
  height: auto;
  padding: 12px 16px;
  border: 0;
  color: #181818;
  background: #fff;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  text-align: left;
  vertical-align: top;
}

.blog-body table tr > * + * {
  border-left: 1px solid #e4e3ec;
}

.blog-body table > thead > tr > *,
.blog-body table > tbody:first-child > tr:first-child > * {
  padding-top: 8px;
  padding-bottom: 8px;
  color: #fff;
  background: #8f7bed;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.blog-body table > thead > tr:first-child > *:first-child,
.blog-body table > tbody:first-child > tr:first-child > *:first-child {
  border-top-left-radius: 20px;
}

.blog-body table > thead > tr:first-child > *:last-child,
.blog-body table > tbody:first-child > tr:first-child > *:last-child {
  border-top-right-radius: 20px;
}

/* With THEAD, stripe every second data row. Without THEAD, the first TBODY
   row is the header, so stripe rows 3, 5, 7... to keep row 2 white. */
.blog-body table > tbody:not(:first-child) > tr:nth-child(even) > *,
.blog-body table > tbody:first-child > tr:nth-child(odd):not(:first-child) > * {
  background: #f8f7fe;
}

.blog-body table > tbody:last-child > tr:last-child > *:first-child {
  border-bottom-left-radius: 20px;
}

.blog-body table > tbody:last-child > tr:last-child > *:last-child {
  border-bottom-right-radius: 20px;
}

.blog-body table caption,
.blog-body .wp-block-table figcaption {
  order: -1;
  padding: 0 0 12px;
  color: #999;
  caption-side: top;
  font-size: 20px;
  font-weight: 400;
  line-height: 28px;
  text-align: left;
}

/* On This Page — 无边框、无阴影，仅保留列表左侧紫色竖线。 */
.blog-toc {
  position: sticky;
  top: 104px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.blog-toc[hidden] {
  display: none;
}

.blog-toc-title {
  margin: 0;
  color: #181818;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
}

.blog-toc-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: auto;
  max-height: none;
  padding-left: 10px;
  overflow: visible;
  border: none;
  border-left: 1px solid #9581f3;
  box-shadow: none;
}

/* 只显示一级副标题（H2），字号与旧的二级相同，不加缩进。 */
.blog-toc-list a {
  color: #4a4a4a;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  text-decoration: none;
  transition: color .15s ease;
}

.blog-toc-list a:hover,
.blog-toc-list a.is-active {
  color: #7a62f0;
}

/* ── Author card ─────────────────────────────────────────────────── */
.blog-author {
  padding: 40px 0;
}

.blog-author-card {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  padding: 40px 60px;
  border: 1px solid #e6e6e6;
  border-radius: 20px;
  background: linear-gradient(180deg, #f7f6ff 0%, #fff 127.28%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.blog-author-avatar {
  flex: 0 0 120px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
}

.blog-author-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
}

.blog-author-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.blog-author-label {
  margin: 0;
  color: #7a62f0;
  font-size: 18px;
  line-height: 24px;
}

.blog-author-name {
  margin: 0;
  color: #181818;
  font-size: 28px;
  font-weight: 700;
  line-height: 38px;
}

.blog-author-bio {
  margin: 0;
  color: #666;
  font-size: 18px;
  line-height: 24px;
}

.blog-author-btn {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  padding: 12px 36px;
  border: 1px solid #a22bf6;
  border-radius: 50px;
  color: #7a62f0;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}

.blog-author-btn:hover {
  color: #fff;
  background: #a22bf6;
}

/* ── Read More (related articles) ────────────────────────────────── */
.blog-readmore {
  padding: 40px 0 80px;
}

.blog-readmore-title {
  margin: 0 0 40px;
  color: #181818;
  font-size: 38px;
  font-weight: 700;
  line-height: 50px;
  text-align: center;
}

.blog-readmore-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.blog-rm-card {
  display: flex;
  gap: 20px;
  box-sizing: border-box;
  height: 250px;
  padding: 20px 28px;
  overflow: hidden;
  border: 1px solid #e6e6e6;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

.blog-rm-img {
  display: block;
  flex: 0 0 280px;
  width: 280px;
  height: 100%;
  overflow: hidden;
  border-radius: 5px;
  background: #f6f6f8;
}

.blog-rm-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-rm-body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
}

.blog-rm-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.blog-rm-title {
  display: -webkit-box;
  overflow: hidden;
  color: #000;
  font-size: 20px;
  font-weight: 600;
  line-height: 26px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.blog-rm-card:hover .blog-rm-title {
  color: #a83afd;
}

.blog-rm-desc {
  display: -webkit-box;
  overflow: hidden;
  color: #666;
  font-size: 18px;
  font-weight: 300;
  line-height: 24px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.blog-rm-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  line-height: 24px;
}

.blog-rm-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #9581f3;
  font-weight: 600;
}

.blog-rm-author::before {
  width: 18px;
  height: 18px;
  content: "";
  background: url("../images/newsroom/author.svg") center / contain no-repeat;
}

.blog-rm-date {
  color: #999;
  font-weight: 300;
}

/* ── Tablet landscape (Blog@1024) ────────────────────────────────── */
@media (max-width: 1199.98px) {
  body:has(.blog-article) .header-menu,
  body:has(.blog-article) .header-menu nav {
    height: 74px;
  }

  .blog-hero-inner,
  .blog-main-inner,
  .blog-author-inner,
  .blog-readmore-inner {
    width: min(864px, calc(100% - 160px));
  }

  .blog-hero {
    margin-top: -74px;
    padding: 114px 0 50px;
  }

  .blog-hero-title {
    font-size: 34px;
    line-height: 48px;
  }

  .blog-main-inner {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .blog-toc {
    top: 94px;
  }

  .blog-author-card {
    padding: 40px;
  }

  .blog-readmore-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Tablet portrait (Blog@768): drop the TOC, single column ─────── */
@media (max-width: 768px) {
  body:has(.blog-article) .header-menu,
  body:has(.blog-article) .header-menu nav {
    height: 56px;
  }

  .blog-hero-inner,
  .blog-main-inner,
  .blog-author-inner,
  .blog-readmore-inner {
    width: min(688px, calc(100% - 80px));
  }

  .blog-hero {
    margin-top: -56px;
    padding: 82px 0 40px;
  }

  .blog-hero-title {
    font-size: 28px;
    line-height: 38px;
  }

  .blog-main-inner {
    grid-template-columns: 1fr;
  }

  .blog-toc {
    display: none;
  }

  /* Gutenberg provides a figure wrapper, so keep the table semantic and make
     only that wrapper scroll. Legacy raw tables fall back to being their own
     touch-scroll container. A fixed minimum width prevents columns collapsing
     into unreadable one-word stacks. */
  .blog-body .wp-block-table {
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 20px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
  }

  .blog-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
  }

  .blog-body .wp-block-table table {
    display: table;
    width: max-content;
    min-width: 680px;
    max-width: none;
    overflow: visible;
  }

  .blog-body table th,
  .blog-body table td {
    min-width: 140px;
  }
}

/* ── Mobile (Blog@360) ───────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .blog-hero-inner,
  .blog-main-inner,
  .blog-author-inner,
  .blog-readmore-inner {
    width: calc(100% - 40px);
  }

  .blog-hero {
    /* The hero still offsets the 56px mobile header with margin-top:-56px.
       Keep the title 44px below that header instead of leaving a 4px gap. */
    padding: 100px 0 20px;
    gap: 20px;
  }

  .blog-hero-title {
    font-size: 24px;
    line-height: 32px;
  }

  .blog-author-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
  }

  .blog-author-avatar {
    flex-basis: 96px;
    width: 96px;
    height: 96px;
    align-self: center;
  }

  .blog-author-name {
    font-size: 24px;
    line-height: 32px;
  }

  .blog-readmore {
    padding: 40px 0 60px;
  }

  .blog-readmore-title {
    margin-bottom: 20px;
    font-size: 28px;
    line-height: 38px;
  }

  /* Compact card: hide media + description, mirror the Newsroom mobile card. */
  .blog-rm-card {
    height: 180px;
    padding: 20px;
  }

  .blog-rm-img,
  .blog-rm-desc {
    display: none;
  }

  .blog-rm-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
