/* ==========================================================================
   Card — assets/css/cards.css
   ==========================================================================
   Flat, square, one of two grounds. The notch is the only shape move.

   Lifted out of blocks/stack-diagram/ when the values, routes and portal
   blocks needed the same card. It is not in base.css — that holds three
   primitives and nothing else — and it is not global: every block that uses it
   calls cloudco_card_assets(), so it loads only where a card renders.

   Type sizes: nothing on a card goes below 14px. Hierarchy comes from color
   and weight, not from making the lower-ranked thing harder to read.
   -------------------------------------------------------------------------- */

.cc-card {
	--cc-icon: 40px;
	--cc-icon-stroke: 2.25;
	--cc-notch: 32px;

	display: flex;
	flex-direction: column;
	/* Even on all four sides. The notch cuts the top-LEFT corner and the icon
	   is right-aligned, so they never meet and the top does not need to be
	   tighter than the rest to make room. */
	padding: var(--wp--preset--spacing--40);
}

.cc-notch {
	clip-path: polygon(
		var(--cc-notch) 0,
		100% 0,
		100% 100%,
		0 100%,
		0 var(--cc-notch)
	);
}

.cc-card--black {
	background: var(--wp--preset--color--black);
	color: var(--wp--preset--color--white);
}

/* Blue card = white card with a thick blue border (Andy, 2026-10-09).
   Black text on a solid blue ground was rejected as too hard to read, white
   text on it fails contrast, and no second blue is allowed — so the blue
   moved to the edge and the text sits on white.

   The border follows the notch. The card itself is painted blue and clipped
   by .cc-notch; ::before is a white layer clipped to the same shape, inset by
   --cc-border on every side. The diagonal is offset by border * tan(22.5deg)
   (0.4142) so it is exactly as thick as the straight sides. Technique after
   Kevin Powell's clip-path border CodePen (bGLmORx).

   Padding is NOT increased for the border: the content sits at the same
   distance from the card's outer edge as on a black card (24px inside the
   blue), so rows of mixed black and blue cards keep their text, titles and
   links on the same lines. Type and icon strokes run black; the icon
   inherits, so it can't drift from the text. */
.cc-card--blue {
	--cc-border: 8px;
	position: relative;
	isolation: isolate;
	background: var(--wp--preset--color--blue);
	color: var(--wp--preset--color--black);
}

/* No notch, no diagonal to inset. */
.cc-card--blue:not(.cc-notch) { --cc-notch: 0px; }

.cc-card--blue::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--wp--preset--color--white);
	clip-path: polygon(
		calc(var(--cc-notch) + var(--cc-border) * 0.4142) var(--cc-border),
		calc(100% - var(--cc-border)) var(--cc-border),
		calc(100% - var(--cc-border)) calc(100% - var(--cc-border)),
		var(--cc-border) calc(100% - var(--cc-border)),
		var(--cc-border) calc(var(--cc-notch) + var(--cc-border) * 0.4142)
	);
}

.cc-card--blue .cc-card__role { color: var(--cc-body); }

/* --- Marker --------------------------------------------------------------
   Icon when there is artwork, number when there is not. Both occupy the same
   slot at the same size so the row does not shift when icons arrive one at a
   time.                                                                      */

.cc-card__icon,
.cc-card__num {
	display: block;
	width: var(--cc-icon);
	height: var(--cc-icon);
	margin: 0 0 var(--wp--preset--spacing--30) auto;
	color: inherit;
}

.cc-card__icon {
	fill: none;
	stroke: currentColor;
	stroke-width: var(--cc-icon-stroke);
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* A stroke or fill baked into the uploaded artwork would otherwise survive and
   break the contrast rule above. A CSS declaration outranks a presentation
   attribute, which is what makes this hold without editing the file. */
.cc-card__icon :is(path, circle, ellipse, rect, line, polyline, polygon) {
	stroke: currentColor;
	vector-effect: non-scaling-stroke;
}

.cc-card__num {
	font-size: var(--wp--preset--font-size--lg);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: var(--cc-icon);
	text-align: right;
}

/* --- Card type ------------------------------------------------------------ */

/* Two lines' worth of room whether or not the name needs it, so the body copy
   starts on the same line across the row. Without it the one short name in the
   set pulls its whole card's text up and the row reads as ragged rather than
   as five of the same thing.

   1.25 was too tight once these names wrapped: the underline on the first line
   sat almost on the cap height of the second. The underline needs somewhere to
   go, so the leading has to clear the descenders AND the stroke below them. */
/* text-transform and letter-spacing are NOT optional here. theme.json styles
   every h3 as an uppercase, letter-spaced section label — it is emitted as
   :root :where(h3), so a class beats it on specificity but only for the
   properties the class actually declares. Setting font-size alone left the
   uppercase in place, and every card title on the site was shouting. */
.cc-card__title {
	margin: 0 0 0.6rem;
	font-size: var(--wp--preset--font-size--md);
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: -0.005em;
	text-transform: none;
	color: inherit;
}

/* Reserving two lines for the title is how a ROW of cards keeps its body copy
   on one baseline, and it is opt-in for that reason: where the titles are all
   one line it buys nothing and reads as a hole. .cc-cards--even asks for it. */
.cc-cards--even .cc-card__title { min-height: 2.8em; }

@media (max-width: 560px) {
	/* One per row: nothing to line up with, and the reserved space is a gap. */
	.cc-cards--even .cc-card__title { min-height: 0; }
}

/* No underline at rest. Every card title being underlined put a heavy rule
   under two lines of type on every card in the row at once, and the underline
   was redundant: the whole card is the click target and the cue at the bottom
   already says so. It appears on hover and focus, where it is doing work.

   When it does appear it is a real underline rather than a bottom border: on a
   heading that wraps, a border is drawn tight against each line box with no way
   to move it, so it collides with the descenders. */
.cc-card__title a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.16em;
	text-decoration-color: transparent;
	transition: text-decoration-color var(--cc-hover-dur, 140ms) var(--cc-hover-ease, ease);
}

.cc-card__title a:hover,
.cc-card__title a:focus-visible { text-decoration-color: currentColor; }

@media (prefers-reduced-motion: reduce) {
	.cc-card__title a { transition: none; }
}

.cc-card__role {
	margin: 0;
	/* 16px, not the --sm preset (14px) — same legibility call as Split
	   Panel's list items: no theme.json preset sits at exactly 16px, so
	   this is a literal value. Shared by every .cc-card block (Values,
	   portal links, stack diagram, route cards). */
	font-size: 1rem;
	line-height: 1.55;
}

.cc-card--black .cc-card__role { color: var(--cc-body-dark); }

/* An occasional editor-typed inline link inside the role text (see
   render.php's wp_kses() note) — color inherits, same as .cc-card__title a,
   because this text already carries the correct color for either ground.
   Unlike the title, the whole card isn't otherwise a click target here, so
   the underline stays visible at rest instead of hover-only. */
.cc-card__role a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
	text-decoration-color: var(--wp--preset--color--blue);
	transition: text-decoration-color var(--cc-hover-dur, 140ms) var(--cc-hover-ease, ease);
}

/* Black ground: blue-on-black passes (5.62:1) at rest, same as everywhere
   else on the site — but hovering to black, the usual "darken on hover"
   instinct, would vanish into the card's own background. White instead. */
.cc-card--black .cc-card__role a:hover,
.cc-card--black .cc-card__role a:focus-visible { text-decoration-color: #fff; }

/* Blue cards are white inside now, so links take the site's standard
   treatment: blue underline at rest, black on hover. */
.cc-card--blue .cc-card__role a { color: var(--wp--preset--color--black); }
.cc-card--blue .cc-card__role a:hover,
.cc-card--blue .cc-card__role a:focus-visible { text-decoration-color: var(--wp--preset--color--black); }

/* Pushed to the bottom so the "on its own" line sits on the same baseline
   across the row however long the role above it runs.

   This was 12px and should not have been. It is the line that says the piece
   can be bought alone, which is the whole argument the section makes — that is
   reading matter, not a caption. It runs at the same size as the role above it
   and takes its lower rank from color and from the label, not from being
   harder to read. Nothing on this card is below 14px. */
.cc-card__alone {
	margin: auto 0 0;
	padding-top: var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--sm);
	line-height: 1.55;
}

.cc-card__alonelabel {
	display: block;
	margin-bottom: 0.3rem;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.cc-card--black .cc-card__alone { color: var(--cc-muted-dark); }
.cc-card--black .cc-card__alonelabel { color: var(--wp--preset--color--blue); }

/* --- Panel: several items inside one card --------------------------------
   The values block asked for four items in one large card rather than four
   separate ones. The items are divided by space, not by rules — the card's own
   edge is the only boundary the eye needs, and hairlines between them put the
   bordered-box look straight back.

   --panel-cols comes from the template so the track count follows the content.
   1fr tracks, not auto-fit: these are peers and must be equal width.          */

.cc-card--panel {
	display: grid;
	grid-template-columns: repeat(var(--panel-cols, 4), minmax(0, 1fr));
	gap: var(--wp--preset--spacing--50);
	padding: var(--wp--preset--spacing--50);
}

.cc-card__cell { min-width: 0; }

/* The icon is the top of each cell here, not a marker in the corner, so it
   loses the auto left margin that right-aligns it on a standalone card. */
.cc-card--panel .cc-card__icon {
	margin: 0 0 var(--wp--preset--spacing--20) 0;
}

.cc-card--panel .cc-card__title { min-height: 0; }

/* A subgrid card lays its own children out on the parent's rows, so the gap
   between them comes from the grid, not from the children's margins. Zeroing
   the trailing margins stops every row inheriting a phantom extra space. */
@supports (grid-template-rows: subgrid) {
	.cc-routes__card > * { margin-block: 0; }
	.cc-routes__card .cc-card__icon { margin-bottom: 0; }
	.cc-routes__card .cc-card__cue { padding-top: 0; }
}

@media (max-width: 1023px) {
	.cc-card--panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 599px) {
	.cc-card--panel {
		grid-template-columns: 1fr;
		gap: var(--wp--preset--spacing--40);
		padding: var(--wp--preset--spacing--40);
	}
}

/* --- Rows: destinations inside one card ----------------------------------
   The portal block. Three destinations someone is already hunting for, so they
   read as one utility object rather than three things being pitched.

   ACROSS, not down. Stacked, three rows in a full-width card left most of the
   card empty and put each arrow half a screen from its own label. Side by side,
   the card is the height of one destination and each is a compact target.     */

.cc-card--rows {
	display: grid;
	grid-template-columns: repeat(var(--row-count, 3), minmax(0, 1fr));
	gap: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--40);
}

/* Flex, not grid. As a grid with a fixed first track, a row with no icon put
   its body into the 40px icon column and wrapped every word onto its own line —
   which is exactly what happened, because no icon has been chosen yet. Flex has
   no tracks to fall into: with no icon the body simply starts at the left. */
.cc-card__row {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
	min-width: 0;
}

.cc-card--rows .cc-card__icon { margin: 0 0 var(--wp--preset--spacing--20) 0; flex: 0 0 auto; }
.cc-card__rowbody { min-width: 0; }

/* The arrow sits on the label's own line rather than at the far edge of the
   card. At the edge it was a hand's width from the thing it pointed at. */
.cc-card__row .cc-card__title {
	display: flex;
	align-items: baseline;
	gap: 0.45rem;
	min-height: 0;
	margin: 0 0 0.2rem;
}

/* The whole row is the target, so the link's own box does not have to be. */
.cc-card__row a::after {
	content: '';
	position: absolute;
	inset: 0;
}

.cc-card__arrow {
	font-size: var(--wp--preset--font-size--md);
	line-height: 1;
	transition: transform var(--cc-hover-dur, 140ms) var(--cc-hover-ease, ease);
}

/* Movement on hover is the one exception the house style allows itself, and
   only because an arrow that does not move does not read as an arrow. It
   travels along its own axis rather than lifting the row. */
.cc-card__row:hover .cc-card__arrow,
.cc-card__row:focus-within .cc-card__arrow { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
	.cc-card__arrow { transition: none; }
	.cc-card__row:hover .cc-card__arrow,
	.cc-card__row:focus-within .cc-card__arrow { transform: none; }
}

@media (max-width: 899px) {
	.cc-card--rows { grid-template-columns: 1fr; gap: var(--wp--preset--spacing--30); }
}

/* --- Kicker and cue ------------------------------------------------------
   Used by the route cards. The kicker names who the card is for; the cue is the
   visible "read more" the stretched link makes clickable.                    */

.cc-card__kicker {
	margin: 0 0 0.5rem;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.cc-card--black .cc-card__kicker { color: var(--wp--preset--color--blue); }

.cc-card__cue {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin: auto 0 0;
	padding-top: var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
}

/* Cue text: white on black cards, black on the white (blue-bordered) cards,
   with a blue underline on both (Andy, 2026-10-09). The underline sits on the
   label span only, so the arrow isn't underlined. Hover darkens/lightens the
   underline to the text color, same as links elsewhere; nothing moves. */
.cc-card--black .cc-card__cue { color: var(--wp--preset--color--white); }
.cc-card--blue .cc-card__cue  { color: var(--wp--preset--color--black); }

.cc-card__cuetext {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
	text-decoration-color: var(--wp--preset--color--blue);
	transition: text-decoration-color var(--cc-hover-dur, 140ms) var(--cc-hover-ease, ease);
}

.cc-routes__card:hover .cc-card__cuetext,
.cc-routes__card:focus-within .cc-card__cuetext { text-decoration-color: currentColor; }

@media (prefers-reduced-motion: reduce) {
	.cc-card__cuetext { transition: none; }
}

.cc-routes__card:hover .cc-card__arrow,
.cc-routes__card:focus-within .cc-card__arrow { transform: translateX(4px); }

.cc-card__rowbody { min-width: 0; }
