/*
 * Feature rc_polish: reading and card fixes across the Resource Centre.
 *
 * Loaded only while the rc_polish switch is on, on a guide or article and on card lists (inc/features/rc-polish.php), after
 * base.css. Every rule sits under body.cc-feature-rc_polish, so nothing here can touch a page with the switch off. Tokens only.
 *
 * 1. No mid-word hyphens in card titles ("inter-net", "mo-bile"), on the hub, search results and archives. base.css sets hyphens:
 *    auto on a card title; a word that does not fit still wraps inside its box (overflow-wrap), it just never gets a hyphen. The
 *    same rule on the guide title is defensive only: nothing in the theme hyphenates it today.
 * 2. The facts line that replaces the date on a card (p.cc-card-meta, inc/features/rc-polish.php).
 * 3. A long guide title is set smaller on a phone, so the guide opens with its answer rather than a wall of capitals; section headings
 *    step down a little on a phone so the title stays the largest heading. The classes
 *    cc-title--long (over 50 characters) and cc-title--xlong (over 70) come from the render filter. base.css sets the title
 *    size with !important over the editor preset, so these rules are !important too and win on specificity.
 * 4. The print button reads as a quiet link instead of a second main button under the title.
 * 5. One body size for every guide, and one reading measure (40rem for plain paragraphs and lists, left aligned). Figures, tables,
 *    components and headings keep their width; the wave two .rc wrapper keeps its 720 px box, because its components change layout
 *    at container widths measured on it (resource-visuals-v2.css).
 */

/* ------------------------------------------------------------------ 1. no mid-word hyphens */

body.cc-feature-rc_polish .cc-post-card .wp-block-post-title,
body.cc-feature-rc_polish .cc-article-header__title {
	hyphens: manual;
	overflow-wrap: break-word;
}

/* ------------------------------------------------------------------ 2. card facts line */

body.cc-feature-rc_polish .cc-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--cc-space-s);
	margin: 0;
	color: var(--cc-color-secondary);
}

body.cc-feature-rc_polish .cc-card-meta__item + .cc-card-meta__item::before {
	content: "\00b7";
	content: "\00b7" / "";
	margin-right: var(--cc-space-s);
}

/* ------------------------------------------------------------------ 3. long guide titles on a phone */

@media (max-width: 47.99em) {
	body.cc-feature-rc_polish .cc-article-header__title.cc-title--long.has-xxxl-font-size {
		font-size: clamp(1.5rem, 6.4vw, 1.75rem) !important;
		line-height: 1.1;
	}

	body.cc-feature-rc_polish .cc-article-header__title.cc-title--xlong.has-xxxl-font-size {
		font-size: clamp(1.25rem, 5.9vw, 1.375rem) !important;
		line-height: 1.12;
	}

	/* So a smaller guide title is still the largest heading on the page, section headings step down a little on a phone. Without
	   this the title (20 to 22 px) would sit below the section headings (about 24 px). */
	body.cc-feature-rc_polish .cc-reading h2 {
		font-size: clamp(1.1875rem, 5.4vw, 1.3125rem);
	}
}

/* ------------------------------------------------------------------ 4. print button as a quiet link */

body.cc-feature-rc_polish .cc-print .cc-print__btn {
	padding: 0;
	background: none;
	border: 0;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	letter-spacing: 0;
	text-transform: none;
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

body.cc-feature-rc_polish .cc-print .cc-print__btn:hover {
	color: var(--cc-color-white);
}

/* ------------------------------------------------------------------ 5. one body size, one measure */

body.cc-feature-rc_polish .cc-reading {
	font-size: clamp(1.0625rem, 0.9rem + 0.5vw, 1.125rem);
}

/* The running text of every guide is held to 40rem (640 px, about 71 characters a line at 18 px), left aligned so it shares an edge
   with the figures and components, which keep their width. Only plain text elements are touched: paragraphs and lists of the post
   content, and of the wave two .rc wrapper, and not an element whose class names a wave two component (the class contains "rc-"),
   so a component list such as .rc-cards keeps its full width and its three columns. Headings are left at full width. The wrapper
   itself is not narrowed, because wave two components change layout at container widths measured on it (resource-visuals-v2.css).
   Legacy posts built in Elementor have no plain text elements at this level, so they are not changed. The post content is a flow
   container, the .rc wrapper a constrained group: WordPress centres every child of a constrained group with !important margins, so
   the left margin needs !important to win there. */
body.cc-feature-rc_polish .cc-reading :is(.wp-block-post-content, .rc) > :is(p, ul, ol):not([class*="rc-"]) {
	max-width: 40rem;
	margin-inline-start: 0 !important;
}
