/* One outer content boundary for every website template, matching the homepage.
 * Keep card padding and internal columns independent of the page gutter.
 * These rules intentionally win over widths in the exported legacy themes.
 */
@media screen {
  :root {
    --ch-content-max: 1192px;
    --ch-content-width: min(var(--ch-content-max), calc(100% - 40px));
    --ch-reading-max: 800px;
    --ch-reading-width: min(100%, var(--ch-reading-max));
    --ch-content-gutter: max(20px, calc((100vw - var(--ch-content-max)) / 2));
  }
  @media (max-width: 1399px) { :root { --ch-content-max: 1116px; } }
  @media (max-width: 1199px) { :root { --ch-content-max: 936px; } }
  @media (max-width: 991px) { :root { --ch-content-max: 696px; } }
  @media (max-width: 767px) { :root { --ch-content-max: 516px; } }
  @media (max-width: 575px) { :root { --ch-content-max: 1192px; } }

  body :is(.chn-bar, .chn-footer-inner, .chp-wrap, .chr-wrap, .ch-weekly-wrap,
    .ch-team-wrap, .chm-reading, .lh-reading, .chv-guide, .chac-shell),
  body :is(.htw-recap, .security-article),
  body :is(.policy-main, .single-post-main) > .single-post,
  body .single-post-main > .chr-review-next,
  body .ch-team-careers-hero .header-banner-info,
  body main .container:not(.generalPanel):not(.faceliftGeneralPanel),
  body .case-study-main .case-study {
    box-sizing: border-box;
    width: var(--ch-content-width) !important;
    max-width: none !important;
    margin-inline: auto !important;
    padding-inline: 0 !important;
    min-width: 0;
  }

  /* Nested containers inherit the available space, without a second gutter. */
  body main .container .container:not(.generalPanel):not(.faceliftGeneralPanel),
  body .single-post-main > .single-post .container,
  body .chp-wrap .chp-wrap {
    width: 100% !important;
  }

  /* Article content uses a centered measure within the existing outer shell. */
  body .chr-article :is(.chr-article-header, .chr-body.single-post, .chr-author, .chr-player),
  body .htw-recap > article,
  body .security-article .chr-wrap > article,
  body :is(.ch-linux-guide, .ch-platform) :is(.lh-reading, .chv-guide),
  body .single-post-main > .single-post,
  body .chm-case .chm-reading,
  body .policy-main > .single-post {
    max-width: var(--ch-reading-max) !important;
    min-width: 0;
    margin-inline: auto;
    padding-inline: 0;
  }
  body .chr-article .chr-article-header h1 {
    width: auto;
    max-width: none;
  }
  body :is(.chr-article .chr-article-header, .htw-header, .chv-guide, .lh-reading, .security-article article) h1 {
    font-size: clamp(36px, calc(25px + 2.16vw), 56px);
    line-height: 1.1;
    text-wrap: initial;
  }
  body :is(.chr-article .chr-body, .single-post-main > .single-post, .chv-guide, .lh-reading, .security-article article, .htw-recap article) :is(p, li, figcaption) a {
    overflow-wrap: anywhere;
  }
  body :is(.chr-article .chr-body, .chv-guide, .lh-reading, .security-article article) :is(pre, .wp-block-table, .table-scroll) {
    max-width: 100%;
    overflow-x: auto;
  }
  body .htw-recap :is(.htw-header, .htw-copy) {
    max-width: var(--ch-reading-width);
    padding-inline: 0;
  }
  body .ch-weekly-issue { --ch-weekly-rail: clamp(168px, 17vw, 245px); --ch-weekly-gap: clamp(24px, 4vw, 64px); }
  body .ch-weekly-issue .ch-weekly-issue-layout {
    grid-template-columns: var(--ch-weekly-rail) minmax(0, var(--ch-reading-max));
    gap: var(--ch-weekly-gap);
  }
  body .ch-weekly-issue .ch-weekly-issue-header {
    margin-left: calc(var(--ch-weekly-rail) + var(--ch-weekly-gap));
    max-width: var(--ch-reading-max);
  }
  @media (max-width: 991px) {
    body .ch-weekly-issue .ch-weekly-issue-layout { grid-template-columns: minmax(0, 1fr); }
    body .ch-weekly-issue .ch-weekly-issue-header { margin-left: 0; }
    body .ch-weekly-issue .ch-weekly-contents { position: static; }
  }

  /* Full-bleed customer-story backgrounds retain the same content gutter. */
  body .case-study-main .ch-ai-story { padding-inline: var(--ch-content-gutter); }

  /* An inset CTA is a card within the page boundary, not a narrower page. */
  body .single-post-main > .chr-review-next { padding-inline: 32px !important; }
  body .chp-final > .chp-wrap { padding-left: 56px !important; }
  @media (max-width: 760px) {
    body .single-post-main > .chr-review-next { padding-inline: 24px !important; }
    body .chp-final > .chp-wrap { padding-left: 0 !important; }
  }
}
