/*
 * kingy-content-width-fix.css
 * ---------------------------------------------------------------------------
 * Owner: ai-launches-redesign / child-theme track (this repo's driver).
 * Added 2026-07-20. Generalised 2026-07-20 (Curtis-approved).
 * Child theme only — zero parent-theme edits, zero KALI edits, zero
 * post_content writes.
 *
 * PROBLEM
 * The parent theme caps page body copy at 760px:
 *     kingy-spectrum/style.css:170   .entry-content{max-width:760px}
 *     kingy-spectrum/style.css:171   body.single-post .entry-content{max-width:100%}
 * Line 171 exempts blog posts; pages were never exempted. Because
 * .entry-content also has no auto margin, that 760px column is jammed against
 * the left edge of the 1240px .wrap — measured 456px of dead space on the
 * right at a 1440px viewport.
 *
 * WHY MOST PAGES LOOKED FINE ANYWAY
 * A one-time pass on 2026-07-08 stamped a per-page un-cap directly into each
 * page's post_content:
 *     <style id="kingy-page-width-{ID}-20260708">
 *     body.page-id-{ID} .wrap.content-area > .entry-content{
 *         max-width:min(1180px,100%); width:100%; }
 * That pass covered 554 pages and never ran again — the newest page carrying
 * it dates to 2026-06-28. Every page created after 2026-07-08 is therefore
 * born clamped (38 as of 2026-07-20, ~3/day). The defect regenerates; a 555th
 * inline copy would not stop it.
 *
 * FIX (section 1)
 * Replace the per-page pattern with one rule. Every page that ships its own
 * design system emits its <style> block as a DIRECT CHILD of .entry-content
 * (verified in the rendered DOM: `<div class="entry-content"><style>`), so
 * `:has(> style)` is an exact structural test for "this page owns its own
 * layout — get out of its way".
 *
 * The value matches the 554-page precedent exactly, so this is the site's
 * established page width rather than a new number, and the 554 pages that
 * already carry the inline copy render identically (their own block and this
 * rule agree).
 *
 * Deliberately NOT matched: the 68 plain-prose pages that ship no <style>.
 * They keep the 760px cap, which for unstyled running prose is a correct
 * reading measure rather than a defect.
 *
 * :has() is unsupported only on browsers that also predate these pages; there
 * the rule is skipped and the current (capped) rendering is what remains —
 * degrades safely, never worse.
 *
 * Retirement trigger: the parent theme exempts pages from the 760px cap
 * natively.
 */

/* ---------- 1. un-cap any page that ships its own design system ----------- */

.entry-content:has(> style) {
	max-width: min(1180px, 100%);
	width: 100%;
}

/* ---------- 2. the two fluid guide systems go full-bleed ------------------
 * .kingy-edge-guide (7 pages) and .kingy-comparison-page (19 pages) are
 * authored fluid — both wrappers compute to max-width:none and manage their
 * own internal measures. They were verified at the full 1192px .wrap on
 * 2026-07-20 (comparison tables have an 860px natural width and regained it
 * there, killing a horizontal scrollbar), so they keep that rather than the
 * 1180px site default.
 *
 * NOTE ON ORDER: this selector and the one in section 1 have IDENTICAL
 * specificity (0,2,0), so the cascade falls through to source order. Keeping
 * both rules in THIS file makes that order deterministic — do not split them
 * across stylesheets, where enqueue order would decide the winner instead.
 */

.entry-content:has(> .kingy-edge-guide),
.entry-content:has(> .kingy-comparison-page) {
	max-width: none;
}

/* ---------- 3. keep a reading measure on running prose --------------------
 * Only the contexts that actually run full-bleed once the cap is lifted.
 * Deliberately NOT listed:
 *   .kg-lede / .kc-lede   — self-caps at 880px in the page's own stylesheet
 *   .kg-card / .kc-card   — already constrained by the 2-col grid (~541px)
 *   .kg-grid / .kc-grid   — must span the full width, that is the point
 *   .kg-table-wrap / .kc-table-wrap — must span the full width
 *
 * Scoped to these two systems on purpose. The other 43 design systems on the
 * site manage their own internal measures already (e.g. .kc-shell 1180px,
 * .kc-content-title 920px, .kc-subheadline 760px, .hero-copy 780px,
 * .narrow 850px, .kh-lede 820px), so a blanket prose rule would fight their
 * own typography rather than help it.
 */

.kingy-edge-guide .kg-section > p,
.kingy-edge-guide .kg-section > ul,
.kingy-edge-guide .kg-section > ol,
.kingy-edge-guide .kg-check > p,
.kingy-edge-guide .kg-note,
.kingy-edge-guide .kg-meta,
.kingy-comparison-page .kc-section > p,
.kingy-comparison-page .kc-section > ul,
.kingy-comparison-page .kc-section > ol,
.kingy-comparison-page .kc-check > p,
.kingy-comparison-page .kc-note,
.kingy-comparison-page .kc-meta {
	max-width: 72ch;
}

/* ---------- 4. reading measure for the other two /ai-hardware/ systems -----
 * Added 2026-07-20 (Curtis-approved scope: 12 pages).
 *
 * Section 1 above already un-caps these pages — .kingy-local-ai-page (10) and
 * .kingy-hardware-page (2) both ship their own <style> block, so `:has(> style)`
 * catches them and they render at 1180px. Verified there: the 920px release-
 * calendar table and the 760px compatibility tables both fit, and
 * .kl-table-wrap no longer scrolls. No un-cap selector is duplicated here.
 *
 * What section 1 cannot do is give their running prose a measure. Unlike the
 * systems cited in section 3's note, these two cap only their LEDE
 * (.kl-lede 850px, .kh-lede 820-860px). Their body copy — .kX-section > p,
 * .kX-note, .kX-meta — has no max-width of its own and measured 138 characters
 * per line at 1180px, past the 109 that this file's own record already rejects
 * as too long. Hence the same 72ch treatment the two guide systems get.
 *
 * .kl-faq / .kh-faq are the same component as .kg-check / .kc-check in
 * section 3, only renamed (identical CSS: border-top + 18px 0 padding).
 *
 * Two exclusions specific to these systems:
 *   .kh-list  — a 2-COLUMN GRID that is a direct child of .kh-section, so a
 *               bare `> ul` would clamp it to 748px and break the layout. The
 *               systems in section 3 have no grid-list, which is why their
 *               rule needs no such :not().
 *   .kl-steps — deliberately INCLUDED via `> ol` (Curtis-confirmed): it is a
 *               numbered prose method list, not a card component.
 *
 * Retirement trigger: same as section 3.
 */

.kingy-local-ai-page .kl-section > p,
.kingy-local-ai-page .kl-section > ul,
.kingy-local-ai-page .kl-section > ol,
.kingy-local-ai-page .kl-faq > p,
.kingy-local-ai-page .kl-note,
.kingy-local-ai-page .kl-meta,
.kingy-hardware-page .kh-section > p,
.kingy-hardware-page .kh-section > ul:not(.kh-list),
.kingy-hardware-page .kh-section > ol,
.kingy-hardware-page .kh-faq > p,
.kingy-hardware-page .kh-note,
.kingy-hardware-page .kh-meta {
	max-width: 72ch;
}
