/* Article text keylines, not a new type or spacing system.
 * Each existing layout declares its ordinary text measure. Its body and Take
 * consume that measure; figures, charts, cards and recognition keep their owners.
 */

/* The generated Take is outside .ag-single-visual-flow, so use their common
 * parent. Keep the body's existing 47rem geometry and responsive outer gutters.
 */
body.single-post .ag-article-content--magazine.ag-hype-article-flow {
  --ag-reading-column-measure: 47rem;
}

.ag-single-visual-flow .ag-reading-column {
  width: min(100%, var(--ag-reading-column-measure, 47rem)) !important;
  max-width: var(--ag-reading-column-measure, 47rem) !important;
}

body.single-post .ag-article-content--magazine.ag-hype-article-flow .ag-editorial-take-box:not(.ag-label-recognition) {
  --ag-reading-take-measure: var(--ag-reading-column-measure, 47rem);
}

/* Both legacy and native research Takes live below .ag-research. The legacy
 * neutral_take_css() adapter already consumes --ag-reading-take-measure, so it
 * receives the same value without another competing width declaration.
 * Do not require .ag-research--article: the legacy321 root does not have it.
 */
body.single-post .ag-mockup-stage .ag-research {
  --ag-reading-column-measure: 790px;
}

body.single-post .ag-mockup-stage .ag-research-reading > .ag-research-body,
body.single-post .ag-mockup-stage .ag-research--chronological .ag-research-reading--continuous > .ag-research-body {
  width: min(100%, var(--ag-reading-column-measure, 790px));
}

body.single-post .ag-mockup-stage .ag-research .ag-story-section--take:not(.ag-label-recognition),
body.single-post .ag-mockup-stage .ag-research .ag-editorial-take-box:not(.ag-label-recognition) {
  --ag-reading-take-measure: var(--ag-reading-column-measure, 790px);
}

/* LTV's existing lead is680px including20px side gutters, hence640px of text.
 * Substitute the same values through tokens; do not narrow its body or touch
 * the independent40px end-of-paper clearance. No other gallery is selected.
 */
body.single-post #ag-cod-ltv {
  --ag-reading-column-measure: 640px;
  --ag-reading-column-inset: 20px;
}

#ag-cod-ltv#ag-cod-ltv#ag-cod-ltv .lead {
  max-width: calc(var(--ag-reading-column-measure, 640px) + var(--ag-reading-column-inset, 20px) + var(--ag-reading-column-inset, 20px)) !important;
  padding-inline: var(--ag-reading-column-inset, 20px) !important;
}

body.single-post #ag-cod-ltv > .ag-cod-feature-body > .ag-editorial-take-box:not(.ag-label-recognition) {
  --ag-reading-take-measure: min(var(--ag-reading-column-measure, 640px), calc(100% - var(--ag-reading-column-inset, 20px) - var(--ag-reading-column-inset, 20px)));
}

/* Coffee's ordinary section has responsive side padding before its760px text
 * cap. Preserve those exact original values. The Take uses the resulting text
 * width and no second internal gutter, fixing the old16px-versus19px phone edge.
 */
body.single-post .ag-rl-feature .ag-rl-article {
  --ag-reading-column-measure: 760px;
  --ag-reading-column-inset: max(-560px + 50vw, 7vw);
}

@media (width <= 760px) {
  body.single-post .ag-rl-feature .ag-rl-article {
    --ag-reading-column-inset: 7vw;
  }
}

@media (width <= 620px) {
  body.single-post .ag-rl-feature .ag-rl-article {
    --ag-reading-column-inset: 19px;
  }
}

/* Match the existing repeated-ID Coffee owner rather than adding unrelated
 * global authority. These properties already have!important in that owner.
 */
html body.single-post :is(#ag-main-content#ag-main-content, #wp--skip-link--target#wp--skip-link--target).ag-rl-feature .ag-rl-article > .level2:not(#the-americana-gecko-take):not(.ag-label-recognition) {
  padding-inline: var(--ag-reading-column-inset) !important;
}

html body.single-post :is(#ag-main-content#ag-main-content, #wp--skip-link--target#wp--skip-link--target).ag-rl-feature .ag-rl-article > .level2:not(#the-americana-gecko-take) > :is(p, ul, blockquote) {
  width: min(100%, var(--ag-reading-column-measure, 760px)) !important;
}

html body.single-post :is(#ag-main-content#ag-main-content, #wp--skip-link--target#wp--skip-link--target).ag-rl-feature .ag-rl-article > #the-americana-gecko-take:not(.ag-label-recognition) {
  /* All existing light/dark width owners already consume this property,
   * including the late Apple stylesheet. Reuse it rather than outranking them.
   */
  --ag-reading-take-measure: min(var(--ag-reading-column-measure, 760px), calc(100% - var(--ag-reading-column-inset) - var(--ag-reading-column-inset)));
  --ag-reading-coffee-take-inset: 0px;
}

/*321's qualification belongs to its centered opening, not to the left edge of
 * the wider hero wrapper. Preserve its700px cap, font, copy and top spacing.
 */
body.single-post.postid-321 #ag-main-content .ag-mockup-stage .ag-research-hero--public .ag-research-hero__note {
  margin-inline: auto;
  text-align: center;
}
