/*
 * Resource Centre guide visuals: the "cc-resource-visual" summary blocks and "cc-resource-image" figures that sit inside a guide's
 * post content (core group, paragraph, list and image blocks, no custom block). Loaded only on a single post (functions.php).
 * The numbered list is the accessible source of each flow; the arrows are decorative. Square edges, tokens only, no glow.
 * Adapted from the launch kit's visual-components.css (kit colours mapped to tokens.css).
 */

.cc-resource-visual {
	box-sizing: border-box;
	margin: var(--cc-space-xl) 0;
	padding: clamp(1.15rem, 3vw, 1.8rem);
	border: 1px solid var(--cc-color-line);
	border-top: 3px solid var(--cc-color-action);
	background: var(--cc-color-raised);
	color: var(--cc-color-white);
}

.cc-resource-visual * {
	box-sizing: border-box;
}

.cc-resource-visual .cc-resource-visual__kicker {
	margin: 0 0 var(--cc-space-xs);
	color: var(--cc-color-action-hover);
	font-size: var(--cc-font-size-xs);
	line-height: 1.3;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.cc-resource-visual .cc-resource-visual__title {
	margin: 0 0 var(--cc-space-m);
	color: var(--cc-color-white);
	font-family: var(--cc-font-heading);
	font-size: clamp(1.2rem, 2vw, 1.5rem);
	line-height: 1.25;
	font-weight: 700;
}

.cc-resource-visual .cc-resource-visual__steps {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--cc-space-s);
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: cc-steps;
}

.cc-resource-visual .cc-resource-visual__steps li {
	position: relative;
	counter-increment: cc-steps;
	display: block;
	margin: 0;
	padding: var(--cc-space-m) var(--cc-space-m) var(--cc-space-m) 3.2rem;
	min-height: 5.4rem;
	background: var(--cc-color-canvas);
	border: 1px solid var(--cc-color-line-strong);
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.cc-resource-visual .cc-resource-visual__steps li::before {
	content: counter(cc-steps, decimal-leading-zero);
	position: absolute;
	left: var(--cc-space-m);
	top: var(--cc-space-m);
	color: var(--cc-color-action-hover);
	font-size: var(--cc-font-size-xs);
	font-weight: 700;
	letter-spacing: 0.04em;
}

.cc-resource-visual .cc-resource-visual__steps strong {
	display: block;
	margin: 0 0 var(--cc-space-xxs);
	color: var(--cc-color-white);
	font-size: var(--cc-font-size-m-min);
	line-height: 1.25;
}

.cc-resource-visual .cc-resource-visual__note {
	margin: var(--cc-space-m) 0 0;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	line-height: 1.5;
}

/* Light panel variant (uses the panel tokens, which are contrast checked as a set). */
.cc-resource-visual--light {
	background: var(--cc-color-panel);
	color: var(--cc-color-panel-ink);
	border-color: var(--cc-color-panel-line);
	border-top-color: var(--cc-color-action);
}

.cc-resource-visual--light .cc-resource-visual__kicker {
	color: var(--cc-color-panel-link);
}

.cc-resource-visual--light .cc-resource-visual__title,
.cc-resource-visual--light .cc-resource-visual__steps strong {
	color: var(--cc-color-panel-ink);
}

.cc-resource-visual--light .cc-resource-visual__steps li {
	background: var(--cc-color-white);
	color: var(--cc-color-panel-ink);
	border-color: var(--cc-color-panel-line-strong);
}

.cc-resource-visual--light .cc-resource-visual__steps li::before {
	color: var(--cc-color-panel-link);
}

.cc-resource-visual--light .cc-resource-visual__note {
	color: var(--cc-color-panel-muted);
}

/* Guide image: the existing project artwork, illustrative only. */
.cc-resource-image {
	margin: var(--cc-space-xl) 0;
}

.cc-resource-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.cc-resource-image figcaption {
	margin-top: var(--cc-space-xs);
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-xs);
	line-height: 1.4;
}

/* Flow variant: four steps in a row from 641px, with a small square arrow marker between them. */
.cc-resource-visual--flow .cc-resource-visual__steps {
	gap: var(--cc-space-m);
}

.cc-resource-visual--flow .cc-resource-visual__steps li:not(:last-child)::after {
	position: absolute;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 1.3rem;
	height: 1.3rem;
	background: var(--cc-color-action);
	color: var(--cc-color-action-ink);
	font: 700 1rem/1 system-ui, sans-serif;
}

@media (min-width: 641px) {
	.cc-resource-visual--flow .cc-resource-visual__steps {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.cc-resource-visual--flow .cc-resource-visual__steps li {
		padding: var(--cc-space-m);
	}

	.cc-resource-visual--flow .cc-resource-visual__steps li::before {
		position: static;
		display: block;
		margin-bottom: var(--cc-space-xs);
	}

	.cc-resource-visual--flow .cc-resource-visual__steps li:not(:last-child)::after {
		content: "\2192";
		right: -1.15rem;
		top: 2.8rem;
	}
}

@media (max-width: 640px) {
	.cc-resource-visual--flow .cc-resource-visual__steps {
		grid-template-columns: minmax(0, 1fr);
	}

	.cc-resource-visual--flow .cc-resource-visual__steps li:not(:last-child)::after {
		content: "\2193";
		left: calc(50% - 0.65rem);
		bottom: -1.1rem;
	}
}

@media (max-width: 480px) {
	.cc-resource-visual .cc-resource-visual__steps {
		grid-template-columns: minmax(0, 1fr);
	}

	.cc-resource-visual .cc-resource-visual__steps li {
		min-height: 0;
	}
}

@media print {
	.cc-resource-visual,
	.cc-resource-visual--light {
		background: var(--cc-color-white);
		color: var(--cc-color-canvas);
		border: 1px solid var(--cc-color-panel-line-strong);
	}

	.cc-resource-visual .cc-resource-visual__title,
	.cc-resource-visual .cc-resource-visual__kicker,
	.cc-resource-visual .cc-resource-visual__steps strong,
	.cc-resource-visual .cc-resource-visual__note,
	.cc-resource-visual .cc-resource-visual__steps li,
	.cc-resource-visual .cc-resource-visual__steps li::before {
		background: var(--cc-color-white);
		color: var(--cc-color-canvas);
		border-color: var(--cc-color-panel-line-strong);
	}

	.cc-resource-visual--flow .cc-resource-visual__steps li:not(:last-child)::after {
		display: none;
	}
}

/* ==== BEGIN guide authoring support: worksheet styles (appended block, new selectors only, existing tokens only) ====
 * For the guide fragments in release/agent-ready-drafts. None of these classes is used by a published post today, so no
 * existing guide changes. Every visual keeps a text equivalent in its markup (a list, a table or a caption).
 *
 *   .cc-resource-visual--unnumbered   the steps grid without the 01 to 04 counters, for dependencies that have no order.
 *   .cc-resource-status               a status WORD in a bordered chip. The border repeats the meaning, so colour is never the
 *                                     only cue: solid is the default, dashed is --unknown, double is --failed or --unavailable.
 *   .cc-resource-plan                 labelled zones as a plain list; the table beside it is the text equivalent.
 *   pre.wp-block-code                 copyable text that wraps instead of scrolling sideways at 320px.
 *   .cc-table--write-in, .cc-write-in worksheet cells with room to write by hand once printed.
 *
 * Tables use the existing .cc-table and .cc-table--stack in base.css. Inside a light visual they follow the panel colours,
 * because base.css only switches the caption and header colours for .is-style-panel. */

/* 1. Unnumbered variant: reuses the steps card grid where 01, 02 would wrongly imply an order. */
.cc-resource-visual--unnumbered .cc-resource-visual__steps li {
	padding-left: var(--cc-space-m);
}

.cc-resource-visual--unnumbered .cc-resource-visual__steps li::before {
	content: none;
}

/* 2. Tables inside a light visual (the dark variant has no table tokens, so worksheet tables are light only). */
.cc-resource-visual--light .cc-table {
	margin: 0 0 var(--cc-space-m);
}

.cc-resource-visual--light .cc-table caption {
	line-height: 1.4;
}

.cc-resource-visual--light .cc-table caption,
.cc-resource-visual--light .cc-table thead th,
.cc-resource-visual--light .cc-table tbody th {
	color: var(--cc-color-panel-ink);
}

.cc-resource-visual--light .cc-table th,
.cc-resource-visual--light .cc-table td {
	border-bottom-color: var(--cc-color-panel-line);
}

.cc-resource-visual--light .cc-table thead th {
	border-bottom-color: var(--cc-color-panel-line-strong);
}

.cc-resource-visual--light .cc-table--stack tr {
	border-bottom-color: var(--cc-color-panel-line);
}

.cc-resource-visual--light .cc-table--stack td::before {
	color: var(--cc-color-panel-muted);
}

/* 3. Status words. The word carries the meaning; the border style is a second, non colour cue. */
.cc-resource-status {
	display: inline-block;
	padding: 0 0.45em;
	border: 2px solid currentColor;
	font-size: var(--cc-font-size-xs);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.cc-resource-status--unknown {
	border-style: dashed;
}

.cc-resource-status--failed,
.cc-resource-status--unavailable {
	border-width: 4px;
	border-style: double;
}

/* 4. Plan view: two or more labelled zones as a plain list. */
.cc-resource-plan {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--cc-space-s);
	margin: 0 0 var(--cc-space-m);
	padding: 0;
	list-style: none;
}

.cc-resource-plan li {
	margin: 0;
	padding: var(--cc-space-m);
	border: 2px solid var(--cc-color-panel-line-strong);
	background: var(--cc-color-white);
	color: var(--cc-color-panel-ink);
	font-size: var(--cc-font-size-s);
	line-height: 1.6;
	overflow-wrap: anywhere;
}

.cc-resource-plan .cc-resource-plan__entry {
	margin: var(--cc-space-xs) 0 0;
}

@media (max-width: 480px) {
	.cc-resource-plan {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* 5. Copyable text: wraps instead of scrolling sideways. */
.cc-resource-visual pre.wp-block-code {
	max-width: 100%;
	margin: 0;
	padding: var(--cc-space-m);
	border: 1px solid var(--cc-color-panel-line-strong);
	background: var(--cc-color-white);
	color: var(--cc-color-panel-ink);
	font-size: var(--cc-font-size-s);
	line-height: 1.55;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

/* 6. Write-in cells: room to write by hand once printed, and a visible blank when the table stacks on a phone. */
.cc-resource-visual .cc-table--write-in td.cc-write-in {
	height: 3rem;
	border-bottom: 1px solid var(--cc-color-panel-line-strong);
}

@media (max-width: 47.99em) {
	.cc-resource-visual .cc-table--stack td.cc-write-in {
		height: auto;
		min-height: 4rem;
		border-bottom: 1px solid var(--cc-color-panel-line-strong);
	}
}

/* 7. Print: visible cell borders, dark caption and header text, a header row that stays in the page and a table that stays a table. */
@media print {
	.cc-resource-visual .cc-table caption,
	.cc-resource-visual .cc-table th,
	.cc-resource-visual .cc-table td {
		color: var(--cc-color-canvas);
	}

	.cc-resource-visual .cc-table th,
	.cc-resource-visual .cc-table td,
	.cc-resource-visual--light .cc-table th,
	.cc-resource-visual--light .cc-table td {
		padding: var(--cc-space-xs);
		border: 1px solid var(--cc-color-canvas);
	}

	.cc-resource-visual .cc-table--write-in td.cc-write-in {
		height: 4rem;
		border: 1px solid var(--cc-color-canvas);
	}

	.cc-resource-visual .cc-table--stack thead {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip-path: none;
	}

	.cc-resource-visual .cc-table--stack tr,
	.cc-resource-visual--light .cc-table--stack tr {
		display: table-row;
		padding: 0;
		border-bottom: 0;
	}

	.cc-resource-visual .cc-table--stack th,
	.cc-resource-visual .cc-table--stack td {
		display: table-cell;
	}

	.cc-resource-visual .cc-table--stack td::before,
	.cc-resource-visual--light .cc-table--stack td::before {
		content: none;
	}

	.cc-resource-visual .cc-resource-status,
	.cc-resource-visual pre.wp-block-code,
	.cc-resource-plan li {
		border-color: var(--cc-color-canvas);
		color: var(--cc-color-canvas);
	}
}
/* ==== END guide authoring support: worksheet styles ==== */
