/*
 * Feature rc_visuals: photographs, pictograms and topics across the Resource Centre.
 *
 * Loaded only while the rc_visuals switch is on, on a guide or article and on the hub, search and archive pages (inc/features/rc-visuals.php),
 * after base.css and the other feature stylesheets. Every rule sits under body.cc-feature-rc_visuals, so nothing here can touch a page with
 * the switch off. Tokens only: square corners, one orange accent, no glow. Photographs are decorative (empty alt text); a pictogram sits beside
 * its visible label. A badge is a graphite square with the pictogram in orange, straddling the lower edge of a photograph.
 *
 * Markup: blocks/hub-sections/render.php, blocks/hub-library/render.php, blocks/guide-art/render.php, blocks/resource-type/render.php.
 */

/* ------------------------------------------------------------------ badges (card, topic tile, guide art) */

body.cc-feature-rc_visuals .cc-rc-card__badge,
body.cc-feature-rc_visuals .cc-rc-topic__badge,
body.cc-feature-rc_visuals .cc-rc-art__badge {
	position: absolute;
	left: var(--cc-space-l);
	bottom: 0;
	transform: translateY(50%);
	z-index: 1;
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	box-sizing: border-box;
	background: var(--cc-color-canvas);
	border: 1px solid var(--cc-color-line);
	color: var(--cc-color-action);
}

body.cc-feature-rc_visuals .cc-rc-card__badge .cc-icon,
body.cc-feature-rc_visuals .cc-rc-topic__badge .cc-icon,
body.cc-feature-rc_visuals .cc-rc-art__badge .cc-icon {
	width: 1.5rem;
	height: 1.5rem;
}

/* A photograph fills its frame at a chosen crop (--cc-rc-pos, a focal point set from the data). */
body.cc-feature-rc_visuals .cc-rc-card__media picture,
body.cc-feature-rc_visuals .cc-rc-topic__media picture,
body.cc-feature-rc_visuals .cc-rc-art picture {
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

body.cc-feature-rc_visuals .cc-rc-card__img,
body.cc-feature-rc_visuals .cc-rc-topic__img,
body.cc-feature-rc_visuals .cc-rc-art__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--cc-rc-pos, 50% 50%);
}

/* ------------------------------------------------------------------ the type label gets its pictogram */

body.cc-feature-rc_visuals .cc-resource-type .cc-icon {
	display: inline-block;
	width: 1.125em;
	height: 1.125em;
	margin-right: 0.4em;
	vertical-align: -0.2em;
}

/* ------------------------------------------------------------------ Something is not working: a pictogram beside the title */

body.cc-feature-rc_visuals .cc-rc-fix__tile {
	grid-template-columns: 1.75rem minmax(0, 1fr);
	column-gap: var(--cc-space-s);
	row-gap: var(--cc-space-xxs);
	align-items: start;
}

body.cc-feature-rc_visuals .cc-rc-fix__icon {
	grid-row: 1 / span 2;
	grid-column: 1;
	color: var(--cc-color-action);
	line-height: 0;
}

body.cc-feature-rc_visuals .cc-rc-fix__icon .cc-icon {
	width: 1.75rem;
	height: 1.75rem;
}

body.cc-feature-rc_visuals .cc-rc-fix__title,
body.cc-feature-rc_visuals .cc-rc-fix__text {
	grid-column: 2;
}

@media (max-width: 47.99em) {
	body.cc-feature-rc_visuals .cc-rc-fix__tile {
		grid-template-columns: minmax(0, 1fr);
	}

	body.cc-feature-rc_visuals .cc-rc-fix__icon {
		grid-row: auto;
		grid-column: 1;
	}

	body.cc-feature-rc_visuals .cc-rc-fix__title,
	body.cc-feature-rc_visuals .cc-rc-fix__text {
		grid-column: 1;
	}

	body.cc-feature-rc_visuals .cc-rc-fix__icon .cc-icon {
		width: 1.5rem;
		height: 1.5rem;
	}
}

/* ------------------------------------------------------------------ journeys: a pictogram beside the journey name */

body.cc-feature-rc_visuals .cc-rc-journey__head {
	display: flex;
	align-items: center;
	gap: var(--cc-space-s);
}

body.cc-feature-rc_visuals .cc-rc-journey__icon {
	flex: none;
	color: var(--cc-color-action);
	line-height: 0;
}

body.cc-feature-rc_visuals .cc-rc-journey__icon .cc-icon {
	width: 1.75rem;
	height: 1.75rem;
}

/* ------------------------------------------------------------------ tools: a pictogram in a column beside the text */

body.cc-feature-rc_visuals .cc-rc-tool:has(.cc-rc-tool__icon) {
	grid-template-columns: 2.25rem minmax(0, 1fr);
	column-gap: var(--cc-space-s);
	align-items: start;
}

body.cc-feature-rc_visuals .cc-rc-tool__icon {
	grid-row: 1 / span 3;
	grid-column: 1;
	color: var(--cc-color-action);
	line-height: 0;
}

body.cc-feature-rc_visuals .cc-rc-tool__icon .cc-icon {
	width: 1.75rem;
	height: 1.75rem;
}

body.cc-feature-rc_visuals .cc-rc-tool:has(.cc-rc-tool__icon) > :not(.cc-rc-tool__icon) {
	grid-column: 2;
}

/* ------------------------------------------------------------------ Browse by topic */

body.cc-feature-rc_visuals .cc-rc-topics {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
	gap: var(--cc-space-m);
	margin: 0;
	padding: 0;
	list-style: none;
}

body.cc-feature-rc_visuals .cc-rc-topics > li {
	min-width: 0;
}

body.cc-feature-rc_visuals .cc-rc-topic {
	position: relative;
	display: grid;
	grid-template-rows: auto 1fr;
	height: 100%;
	box-sizing: border-box;
	background: var(--cc-color-raised);
	border: 1px solid var(--cc-color-line);
	color: var(--cc-color-white);
	text-decoration: none;
}

body.cc-feature-rc_visuals .cc-rc-topic:hover {
	border-color: var(--cc-color-action);
}

body.cc-feature-rc_visuals .cc-rc-topic:focus-visible {
	outline: var(--cc-focus-width) solid var(--cc-color-focus);
	outline-offset: var(--cc-focus-offset);
}

body.cc-feature-rc_visuals .cc-rc-topic__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--cc-color-canvas);
}

body.cc-feature-rc_visuals .cc-rc-topic__body {
	display: grid;
	gap: var(--cc-space-xxs);
	align-content: start;
	padding: calc(var(--cc-space-l) + 0.5rem) var(--cc-space-l) var(--cc-space-l);
}

body.cc-feature-rc_visuals .cc-rc-topic__name {
	font-family: var(--cc-font-heading);
	font-size: var(--cc-font-size-l);
	font-weight: 700;
	line-height: 1.25;
}

body.cc-feature-rc_visuals .cc-rc-topic__count {
	font-size: var(--cc-font-size-s);
	color: var(--cc-color-secondary);
}

/* ------------------------------------------------------------------ library: photograph cards and the topic chips */

body.cc-feature-rc_visuals .cc-rc-filter {
	display: grid;
	gap: var(--cc-space-s);
}

body.cc-feature-rc_visuals .cc-rc-filter__group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--cc-space-xs) var(--cc-space-m);
}

body.cc-feature-rc_visuals .cc-rc-filter__label {
	min-width: 3.5rem;
	font-size: var(--cc-font-size-xs);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--cc-color-secondary);
}

@media (min-width: 48em) {
	body.cc-feature-rc_visuals .cc-rc-filter__group {
		display: grid;
		grid-template-columns: 3.5rem minmax(0, 1fr);
		align-items: center;
	}
}

@media (max-width: 47.99em) {
	body.cc-feature-rc_visuals .cc-rc-filter__group {
		display: grid;
		gap: var(--cc-space-xxs);
	}
}

body.cc-feature-rc_visuals .cc-rc-card--visual {
	position: relative;
	display: grid;
	grid-template-rows: auto 1fr;
	padding: 0;
}

body.cc-feature-rc_visuals .cc-rc-card--visual > * + * {
	margin-top: 0;
}

body.cc-feature-rc_visuals .cc-rc-card__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--cc-color-canvas);
}

body.cc-feature-rc_visuals .cc-rc-card__body {
	display: grid;
	gap: var(--cc-space-s);
	align-content: start;
	padding: calc(var(--cc-space-l) + 1.375rem) var(--cc-space-l) var(--cc-space-l);
}

body.cc-feature-rc_visuals .cc-rc-card--visual:hover {
	border-color: var(--cc-color-action);
}

/* The whole card is the link: the title link stretches over it, so the picture and the text open the same guide and no second link
   is added for a screen reader. */
body.cc-feature-rc_visuals .cc-rc-card--visual .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* The pictogram badge is decoration: a click or tap on it goes through to the title link that covers the card. */
body.cc-feature-rc_visuals .cc-rc-card__badge {
	pointer-events: none;
}

/* Keyboard focus shows on the card (the title link's own ring would be clipped by the picture), where the browser can tell. */
@supports selector(:has(a)) {
	body.cc-feature-rc_visuals .cc-rc-card--visual:has(.wp-block-post-title a:focus-visible) {
		outline: var(--cc-focus-width) solid var(--cc-color-focus);
		outline-offset: var(--cc-focus-offset);
	}

	body.cc-feature-rc_visuals .cc-rc-card--visual .wp-block-post-title a:focus-visible {
		outline: none;
	}
}

/* ------------------------------------------------------------------ guide header: the picture strip */

body.cc-feature-rc_visuals .cc-rc-art-wrap {
	padding-bottom: 0;
}

/* The one legacy layout that has no header block (the on-premise guide) sits its panel between the date line and a body that starts at once,
   so give the panel room above it and room below it for the badge that overhangs its lower edge. */
body.cc-feature-rc_visuals .cc-legacy-article .cc-rc-art-wrap {
	margin-block: var(--cc-space-m) var(--cc-space-xl);
}

body.cc-feature-rc_visuals .cc-rc-art {
	position: relative;
	margin: 0;
	aspect-ratio: 16 / 7;
	background: var(--cc-color-canvas);
	border: 1px solid var(--cc-color-line);
	border-bottom: 0;
}

@media (min-width: 48em) {
	body.cc-feature-rc_visuals .cc-rc-art {
		aspect-ratio: 24 / 5;
	}
}

body.cc-feature-rc_visuals .cc-rc-art__badge {
	left: var(--cc-space-l);
}

/* A drawn scene in the strip: a flat figure panel at the text edge, with the drawing fitted inside it. A picture 2:1 in a wide strip
   would float in empty space, so on a wide screen the panel keeps the drawing's own shape and stops at a comfortable width. */
body.cc-feature-rc_visuals .cc-rc-art--scene {
	box-sizing: border-box;
	aspect-ratio: 2 / 1;
	padding: var(--cc-space-m) var(--cc-space-l) calc(1.375rem + var(--cc-space-xs));
}

@media (min-width: 48em) {
	body.cc-feature-rc_visuals .cc-rc-art--scene {
		aspect-ratio: 2 / 1;
		max-width: 36rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.cc-feature-rc_visuals .cc-rc-card--visual,
	body.cc-feature-rc_visuals .cc-rc-topic {
		transition: none;
	}
}

@media (forced-colors: active) {
	body.cc-feature-rc_visuals .cc-rc-card__badge,
	body.cc-feature-rc_visuals .cc-rc-topic__badge,
	body.cc-feature-rc_visuals .cc-rc-art__badge {
		border-color: CanvasText;
	}
}

/* ------------------------------------------------------------------ drawn scenes (inc/rc-scenes.php) */

/* A scene is a technical drawing on a 240 x 120 grid. Hairlines stay one weight at any size, so the drawing scales like a picture and
   reads like a diagram: neutral for the setup, orange for the one path that matters, dashed for what is missing. */
body.cc-feature-rc_visuals .cc-rcs__draw {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

body.cc-feature-rc_visuals .cc-rcs__line,
body.cc-feature-rc_visuals .cc-rcs__tick,
body.cc-feature-rc_visuals .cc-rcs__cross,
body.cc-feature-rc_visuals .cc-rcs__icon {
	fill: none;
	stroke-width: 1.5;
	stroke-linecap: square;
	stroke-linejoin: miter;
	vector-effect: non-scaling-stroke;
}

body.cc-feature-rc_visuals .cc-rcs__line {
	stroke: var(--cc-color-line-strong);
}

body.cc-feature-rc_visuals .cc-rcs__line--action,
body.cc-feature-rc_visuals .cc-rcs__tick,
body.cc-feature-rc_visuals .cc-rcs__icon {
	stroke: var(--cc-color-action);
}

body.cc-feature-rc_visuals .cc-rcs__line--dash {
	stroke-dasharray: 4 6;
}

body.cc-feature-rc_visuals .cc-rcs__cross {
	stroke: var(--cc-color-line-strong);
	opacity: 0.7;
}

body.cc-feature-rc_visuals .cc-rcs__node {
	fill: var(--cc-color-raised);
	stroke: var(--cc-color-line-strong);
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
}

body.cc-feature-rc_visuals .cc-rcs__node--action {
	stroke: var(--cc-color-action);
}

body.cc-feature-rc_visuals .cc-rcs__hub {
	fill: var(--cc-color-canvas);
	stroke: var(--cc-color-action);
	stroke-width: 1.5;
	vector-effect: non-scaling-stroke;
}

body.cc-feature-rc_visuals .cc-rcs__dot {
	fill: var(--cc-color-action);
}

body.cc-feature-rc_visuals .cc-rcs__soft {
	fill: none;
	stroke: var(--cc-color-line-strong);
	stroke-width: 1;
	stroke-linecap: square;
	opacity: 0.75;
	vector-effect: non-scaling-stroke;
}

body.cc-feature-rc_visuals .cc-rcs__fill {
	fill: color-mix(in srgb, var(--cc-color-white) 6%, transparent);
	stroke: var(--cc-color-line);
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
}

body.cc-feature-rc_visuals .cc-rcs__ring {
	fill: color-mix(in srgb, var(--cc-color-action) 7%, transparent);
	stroke: var(--cc-color-action);
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
}

body.cc-feature-rc_visuals .cc-rcs__ring--far {
	fill: color-mix(in srgb, var(--cc-color-action) 3%, transparent);
	stroke-opacity: 0.55;
}

body.cc-feature-rc_visuals .cc-rcs__ring--faint {
	stroke-opacity: 0.6;
}

body.cc-feature-rc_visuals .cc-rcs__scene {
	max-height: 100%;
}

body.cc-feature-rc_visuals .cc-rc-card--visual:hover .cc-rcs__line--action,
body.cc-feature-rc_visuals .cc-rc-topic:hover .cc-rcs__line--action {
	stroke-width: 2;
}

/* A frame that holds a drawing: a flat dark panel with room around the drawing, which is fitted inside it. */
body.cc-feature-rc_visuals .cc-rc-card__media--scene,
body.cc-feature-rc_visuals .cc-rc-topic__media--scene {
	box-sizing: border-box;
	padding: var(--cc-space-m) var(--cc-space-l) calc(1.375rem + var(--cc-space-xs));
}
