/*
 * Workspace card landings.
 *
 * The same visual language as the Visibility Dash feature cards shipped in
 * 1.31.0 -- same border, radius, icon column, badge treatment -- so a card reads
 * the same wherever somebody meets one. The difference is what it is: these are
 * links to a section, not switches, so the whole card is the target and it has
 * hover and focus states a switch does not need.
 */

.ai-o-optimiser-workspace-landing {
	margin: 20px 0 8px;

	/*
	 * Reflows on the width this landing actually has, not the width of the
	 * window. Folding the WordPress admin menu changes the first by about 160px
	 * and the second not at all, so a viewport breakpoint picks three columns
	 * for a container with room for two.
	 *
	 * The container is this wrapper and never the grid: a container query styles
	 * the container's descendants and not the container itself, so querying the
	 * grid from the grid leaves it at one column forever.
	 */
	container-type: inline-size;
}

.ai-o-optimiser-workspace-landing-eyebrow {
	margin: 0 0 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #646970;
}

.ai-o-optimiser-workspace-landing-heading {
	margin: 0 0 6px;
	padding: 0;
	font-size: 18px;
	line-height: 1.35;
	font-weight: 600;
	color: #1d2327;
	max-width: 52ch;
	text-wrap: balance;
}

.ai-o-optimiser-workspace-landing-summary {
	margin: 0 0 18px;
	font-size: 13px;
	color: #646970;
	max-width: 62ch;
}

.ai-o-optimiser-workspace-landing-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
}

@container (min-width: 560px) {
	.ai-o-optimiser-workspace-landing-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/*
 * Two columns is the widest this goes. Three columns leaves a four-card
 * workspace with its fourth card alone beside two empty cells -- a shape that
 * reads as something missing rather than as a layout.
 *
 * Workspaces are not all four cards, though: Metadata has five. An odd last
 * card would sit alone in a half-width cell, so it takes the whole row instead.
 * That fills, and reads as deliberate rather than as a gap. It only applies
 * once there are two columns to span; at one column every card is full width
 * already.
 */
@container (min-width: 560px) {
	.ai-o-optimiser-workspace-landing-grid > :last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}
}

/* ------------------------------------------------------------------- the card */

.ai-o-optimiser-workspace-card {
	display: grid;
	grid-template-columns: 24px minmax(0, 1fr);
	column-gap: 11px;
	align-items: start;
	padding: 14px 15px 15px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	text-decoration: none;
	color: inherit;
	transition: border-color .12s ease-in-out, box-shadow .12s ease-in-out;
}

.ai-o-optimiser-workspace-card:hover,
.ai-o-optimiser-workspace-card:focus {
	border-color: #2271b1;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
	color: inherit;
}

.ai-o-optimiser-workspace-card:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.ai-o-optimiser-workspace-card > .dashicons {
	color: #8c8f94;
	width: 22px;
	height: 22px;
	font-size: 22px;
	margin-top: 1px;
}

.ai-o-optimiser-workspace-card.is-done > .dashicons,
.ai-o-optimiser-workspace-card.is-clear > .dashicons {
	color: #007a5c;
}

.ai-o-optimiser-workspace-card.is-needs-setup > .dashicons,
.ai-o-optimiser-workspace-card.is-measure > .dashicons {
	color: #996800;
}

.ai-o-optimiser-workspace-card-body {
	min-width: 0;
	display: block;
}

.ai-o-optimiser-workspace-card-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}

.ai-o-optimiser-workspace-card-title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: #1d2327;
}

.ai-o-optimiser-workspace-card-description {
	display: block;
	margin: 5px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: #646970;
}

/* ------------------------------------------------------------------ the badge */

.ai-o-optimiser-workspace-badge {
	flex: none;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
	border-radius: 3px;
	padding: 2px 6px;
	white-space: nowrap;
	background: #f0f0f1;
	color: #646970;
	font-variant-numeric: tabular-nums;
}

.ai-o-optimiser-workspace-card.is-done .ai-o-optimiser-workspace-badge,
.ai-o-optimiser-workspace-card.is-clear .ai-o-optimiser-workspace-badge {
	background: #e2f2ec;
	color: #00614a;
}

/*
 * A measure badge counts outstanding work, so it wears the same amber as
 * "needs setup" -- both mean there is something here for you. At zero the
 * section reports is-clear instead and the badge goes green, which is the whole
 * point of counting down rather than scoring up.
 */
.ai-o-optimiser-workspace-card.is-needs-setup .ai-o-optimiser-workspace-badge,
.ai-o-optimiser-workspace-card.is-measure .ai-o-optimiser-workspace-badge {
	background: #fbf0d7;
	color: #7a5300;
}

@media (prefers-reduced-motion: reduce) {
	.ai-o-optimiser-workspace-card {
		transition: none;
	}
}

/*
 * The way back, on a section page. The landing replaced the tab row rather than
 * stacking with it, so without this the only route back to the card grid would
 * be the browser button -- and a reader who arrived from the dashboard has no
 * back to press.
 */
.ai-o-optimiser-workspace-landing-back {
	margin: 14px 0 4px;
	font-size: 13px;
}
