/*
 * Article Editorial System — Bản Tin-specific typography/rhythm layer.
 * Loaded after shared editorial-content.css + editorial-structured-content.css
 * and before the final Article Detail composition layer.
 *
 * Ownership:
 * - Article-specific Google Sans typography family + reading scale;
 * - article H1/H2/H3/H4 scale and spacing rhythm;
 * - article heading width/grid behavior (one desktop reading lane);
 * - article list spacing/rhythm;
 * - scroll-margin for sticky-header TOC navigation;
 * - H2/H3 pseudo-element treatment;
 * - article HR rhythm;
 * - article-specific content-box spacing (margin/padding only, NOT color);
 * - transition rhythm from article prose to the end-of-article content note;
 * - mobile article typography.
 *
 * This file does NOT own semantic colors. All semantic visual (content-box
 * families, blockquote, bullet/number color, link color, checklist/steps,
 * related-content, code) is owned by editorial-content.css via canonical
 * EDS v2 tokens. Do not redefine a parallel color palette here.
 */

/* --------------------------------------------------------------------------
 * Article font system
 *
 * Shared EDS loads Google Sans and exposes --ct-font-sans. Keep both heading
 * and body variables local to the Bản Tin detail surface so global marketing/
 * admin typography is not changed accidentally by this EDS layer.
 * ----------------------------------------------------------------------- */
.ct-news-detail-page {
  --font-heading: var(--ct-font-sans);
  --font-body: var(--ct-font-sans);
  font-family: var(--font-body);
}

/* The typography layer owns the canonical article H1 scale. This selector is
 * intentionally one level more specific than the later composition layer so
 * white-paper layout can own surface/composition without re-scaling the title.
 * H1 uses the full masthead width; pretty wrapping avoids an isolated last word
 * without forcing every line to have the same length. */
.ct-news-detail-page .ct-article .ct-article-title {
  width: 100%;
  max-width: none;
  font-family: var(--font-heading);
  font-size: clamp(36px, 3.1vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  text-wrap: pretty;
}

/* Later Article Detail CSS still contains a few legacy explicit family rules.
 * These higher-context selectors keep the EDS font contract authoritative
 * without using !important or redefining unrelated visual properties. */
.ct-news-detail-page .ct-article .ct-article-section-head h2,
.ct-news-detail-page .ct-article .ct-article-faq > h2,
.ct-news-detail-page .ct-article .ct-article-people > h2,
.ct-news-detail-page .ct-article .ct-news-grid.is-related .ct-news-title {
  font-family: var(--font-heading);
}

/* --------------------------------------------------------------------------
 * Article reading scale — intentionally larger than shared base
 * ----------------------------------------------------------------------- */
.ct-news-detail-page .ct-prose.is-article {
  font-family: var(--font-body);
  font-size: 17.5px;
  line-height: 1.78;
}

/* --------------------------------------------------------------------------
 * Article heading hierarchy — spacing, size, rhythm
 *
 * Article body is a grid on desktop, so vertical margins between grid items
 * do not collapse like normal block-flow margins. Keep heading separation
 * explicit and prevent the previous content block from adding a second gap.
 * Color remains owned by the shared EDS base in editorial-content.css; this
 * layer owns the article-specific Google Sans family and rhythm.
 * ----------------------------------------------------------------------- */
.ct-news-detail-page .ct-prose.is-article h2,
.ct-news-detail-page .ct-prose.is-article h3,
.ct-news-detail-page .ct-prose.is-article h4 {
  font-family: var(--font-heading);
  text-wrap: pretty;
}

.ct-news-detail-page .ct-prose.is-article h2,
.ct-news-detail-page .ct-prose.is-article h3 {
  scroll-margin-top: calc(var(--ct-detail-sticky-offset, 72px) + 24px);
}

/* Normalize the gap before headings. Paragraphs, lists, callouts, tables and
 * other semantic blocks already own a bottom margin; when a heading follows,
 * that margin would otherwise stack with the heading margin inside the grid.
 * Let the heading own the section break instead. */
.ct-news-detail-page .ct-prose.is-article
  > :where(p, ul, ol, blockquote, aside, section, figure, table, dl, div):has(+ :is(h2, h3, h4)) {
  margin-bottom: 0;
}

/* H2: clear major-section break without creating a large empty band. */
.ct-news-detail-page .ct-prose.is-article h2 {
  margin: clamp(44px, 4.6vw, 58px) 0 0.52em;
  font-size: clamp(24px, 2.2vw, 29px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.36;
}

.ct-news-detail-page .ct-prose.is-article h2::before {
  content: none;
  display: none;
}

/* A short gold rule gives major sections one restrained editorial signature.
 * It is deliberately much shorter than the reading lane and uses the existing
 * EDS gold token so headings remain typographic, not card-like. */
.ct-news-detail-page .ct-prose.is-article h2::after {
  display: block;
  width: 40px;
  height: 2px;
  margin-top: 9px;
  content: "";
  background: var(--ct-gold);
  border-radius: 999px;
  opacity: 0.86;
}

/* A subsection that starts immediately under its H2 belongs to that section.
 * The H2 accent already contributes a little vertical height, so the direct
 * H2 → H3 relationship gap stays compact instead of stacking two large gaps. */
.ct-news-detail-page .ct-prose.is-article h2:has(+ h3) {
  margin-bottom: 0;
}

.ct-news-detail-page .ct-prose.is-article h2 + h3 {
  margin-top: clamp(15px, 1.8vw, 18px);
}

/* H3 is intentionally quieter than H2: smaller/lighter and closer to the
 * paragraph it introduces. Repeated subsections should read as one series. */
.ct-news-detail-page .ct-prose.is-article h3 {
  margin: clamp(28px, 2.9vw, 34px) 0 0.42em;
  font-size: clamp(19px, 1.65vw, 21px);
  font-weight: 600;
  letter-spacing: -0.008em;
  line-height: 1.4;
}

.ct-news-detail-page .ct-prose.is-article h3::before {
  content: none;
  display: none;
}

.ct-news-detail-page .ct-prose.is-article h4 {
  margin: clamp(22px, 2.25vw, 28px) 0 0.45em;
  font-size: clamp(17px, 1.4vw, 18.5px);
  font-weight: 600;
  line-height: 1.42;
}

/* --------------------------------------------------------------------------
 * Article HR rhythm
 * ----------------------------------------------------------------------- */
.ct-news-detail-page .ct-prose.is-article hr {
  margin: clamp(34px, 3.8vw, 46px) 0 0;
  border-top: 1px solid var(--ct-border);
}

.ct-news-detail-page .ct-prose.is-article hr + h2 {
  margin-top: clamp(22px, 2.2vw, 28px);
}

/* --------------------------------------------------------------------------
 * Article list rhythm
 *
 * The lead-in paragraph stays visually attached to its list, while individual
 * items get a small deterministic gap. This is especially important for long
 * legal/accounting bullets where near-zero item margins make separate clauses
 * read like one continuous paragraph.
 * ----------------------------------------------------------------------- */
.ct-news-detail-page .ct-prose.is-article
  > p:has(+ :is(ul:not(.ct-checklist), ol:not(.ct-steps))) {
  margin-bottom: 0;
}

.ct-news-detail-page .ct-prose.is-article ul:not(.ct-checklist),
.ct-news-detail-page .ct-prose.is-article ol:not(.ct-steps) {
  margin: 0.4em 0 1em;
  padding-inline-start: 1.24em;
}

.ct-news-detail-page .ct-prose.is-article ul:not(.ct-checklist) > li,
.ct-news-detail-page .ct-prose.is-article ol:not(.ct-steps) > li {
  margin: 0;
  padding-inline-start: 0.16em;
  line-height: 1.58;
}

.ct-news-detail-page .ct-prose.is-article ul:not(.ct-checklist) > li + li,
.ct-news-detail-page .ct-prose.is-article ol:not(.ct-steps) > li + li {
  margin-top: 0.42em;
}

/* --------------------------------------------------------------------------
 * Article content-box relationship spacing — margin/padding only
 * ----------------------------------------------------------------------- */
.ct-news-detail-page .ct-prose.is-article
  > :where(p, ul, ol):has(+ .ct-content-box) {
  margin-bottom: 0;
}

.ct-news-detail-page .ct-prose.is-article > .ct-content-box {
  margin: clamp(20px, 2.2vw, 22px) 0 clamp(24px, 2.8vw, 28px);
}

.ct-news-detail-page .ct-prose.is-article > .ct-content-box + .ct-content-box {
  margin-top: 16px;
}

.ct-news-detail-page .ct-prose.is-article > .ct-content-box.is-note {
  padding: clamp(19px, 2.4vw, 23px) clamp(20px, 2.8vw, 25px);
}

/* --------------------------------------------------------------------------
 * End-of-article transition rhythm
 * ----------------------------------------------------------------------- */
.ct-news-detail-page .ct-article .ct-content-note {
  margin-top: clamp(28px, 3.2vw, 34px);
}

/* --------------------------------------------------------------------------
 * Mobile article typography
 * ----------------------------------------------------------------------- */
@media (max-width: 767px) {
  .ct-news-detail-page .ct-article .ct-article-title {
    font-size: clamp(28px, 7.5vw, 34px);
    letter-spacing: -0.016em;
    line-height: 1.22;
  }
}

@media (max-width: 640px) {
  .ct-news-detail-page .ct-prose.is-article {
    font-size: 16.5px;
    line-height: 1.76;
  }

  .ct-news-detail-page .ct-prose.is-article h2 {
    margin: 36px 0 0.54em;
    font-size: clamp(21px, 5.8vw, 24px);
    line-height: 1.38;
  }

  .ct-news-detail-page .ct-prose.is-article h2::before {
    content: none;
    display: none;
  }

  .ct-news-detail-page .ct-prose.is-article h2::after {
    width: 34px;
    height: 2px;
    margin-top: 8px;
  }

  .ct-news-detail-page .ct-prose.is-article h2 + h3 {
    margin-top: 14px;
  }

  .ct-news-detail-page .ct-prose.is-article h3 {
    margin: 25px 0 0.44em;
    font-size: clamp(18px, 4.8vw, 19.5px);
    font-weight: 600;
    line-height: 1.4;
  }

  .ct-news-detail-page .ct-prose.is-article h4 {
    margin-top: 20px;
    font-weight: 600;
  }

  .ct-news-detail-page .ct-prose.is-article hr {
    margin-top: 30px;
  }

  .ct-news-detail-page .ct-prose.is-article hr + h2 {
    margin-top: 18px;
  }

  .ct-news-detail-page .ct-prose.is-article ul:not(.ct-checklist),
  .ct-news-detail-page .ct-prose.is-article ol:not(.ct-steps) {
    margin-top: 0.36em;
    margin-bottom: 0.95em;
    padding-inline-start: 1.18em;
  }

  .ct-news-detail-page .ct-prose.is-article ul:not(.ct-checklist) > li,
  .ct-news-detail-page .ct-prose.is-article ol:not(.ct-steps) > li {
    margin: 0;
    line-height: 1.56;
  }

  .ct-news-detail-page .ct-prose.is-article ul:not(.ct-checklist) > li + li,
  .ct-news-detail-page .ct-prose.is-article ol:not(.ct-steps) > li + li {
    margin-top: 0.36em;
  }

  .ct-news-detail-page .ct-prose.is-article > .ct-content-box {
    margin-top: 18px;
    margin-bottom: 22px;
  }

  .ct-news-detail-page .ct-prose.is-article > .ct-content-box + .ct-content-box {
    margin-top: 14px;
  }

  .ct-news-detail-page .ct-prose.is-article > .ct-content-box.is-note {
    padding: 17px 18px;
  }

  .ct-news-detail-page .ct-article .ct-content-note {
    margin-top: 26px;
  }
}

/* --------------------------------------------------------------------------
 * Desktop article body: one stable reading lane, including headings.
 * ----------------------------------------------------------------------- */
@media (min-width: 856px) {
  .ct-news-detail-page .ct-article-paper .ct-prose.is-article {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .ct-news-detail-page .ct-article-paper .ct-prose.is-article > * {
    grid-column: 1;
    min-width: 0;
  }

  .ct-news-detail-page .ct-article-paper .ct-prose.is-article > h2,
  .ct-news-detail-page .ct-article-paper .ct-prose.is-article > h3,
  .ct-news-detail-page .ct-article-paper .ct-prose.is-article > h4 {
    grid-column: 1;
    width: auto;
    max-width: none;
    margin-right: 0;
    margin-left: 0;
    justify-self: stretch;
    text-align: left;
    text-wrap: pretty;
  }
}

/* --------------------------------------------------------------------------
 * Print
 * ----------------------------------------------------------------------- */
@media print {
  .ct-news-detail-page .ct-prose.is-article .ct-content-box.is-note {
    box-shadow: none;
  }
}
