/*
 * LRob - Pluginception blocks. Colours come from the theme: its button styles (.wp-element-button),
 * its palette variables and currentColor. No colour is written here.
 *
 * Contrast in both modes, whatever the theme: a text is always currentColor, and the background
 * under it is derived from the same base, color-mix( currentColor N%, transparent ), so that it
 * follows a light or a dark mode with its text. A palette colour only ever tints a background at
 * 18% at most, under currentColor text; it is never the colour of a text, nor a background under
 * a text taken from another variable. Secondary texts are never under 0.75 opacity.
 * Checked by calculation on a theme with a light and a dark palette: every text at 5.5:1 or more.
 */

.lrob-pc-buttons,
.lrob-pc-changelog,
.lrob-pc-index,
.lrob-pc-activity {
	--lrob-pc-accent: var(--wp--preset--color--accent-1, var(--wp--preset--color--primary, currentColor));
	--lrob-pc-line: color-mix(in srgb, currentColor 14%, transparent);
	--lrob-pc-soft: color-mix(in srgb, currentColor 6%, transparent);
	--lrob-pc-tint: color-mix(in srgb, currentColor 10%, transparent);
}

/* Tones of the visuals without image: 0 = neutral (no category), 1–4 = the categories in their
   order. A palette colour mixed at 18% under currentColor text. */
[data-tone] { --lrob-pc-tone-bg: color-mix(in srgb, currentColor 8%, transparent); }
[data-tone="1"] { --lrob-pc-tone-bg: color-mix(in srgb, var(--wp--preset--color--accent-1, var(--wp--preset--color--primary, currentColor)) 18%, transparent); }
[data-tone="2"] { --lrob-pc-tone-bg: color-mix(in srgb, var(--wp--preset--color--accent-2, var(--wp--preset--color--secondary, currentColor)) 18%, transparent); }
[data-tone="3"] { --lrob-pc-tone-bg: color-mix(in srgb, var(--wp--preset--color--accent-3, var(--wp--preset--color--tertiary, currentColor)) 18%, transparent); }
[data-tone="4"] { --lrob-pc-tone-bg: color-mix(in srgb, var(--wp--preset--color--accent-4, var(--wp--preset--color--primary, currentColor)) 18%, transparent); }

.lrob-pc-icon { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }

/* Facts of a release: version pill, "New", date, licence. */
.lrob-pc-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .35em .75em;
	margin: 0;
	font-size: .875em;
}
.lrob-pc-pill {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	padding: .15em .6em;
	border-radius: 999px;
	background: var(--lrob-pc-tint);
	color: inherit;
	font-weight: 600;
	white-space: nowrap;
}
/* "New": the text's own colour on a stronger tint of itself, framed: readable in both modes. */
.lrob-pc-new {
	display: inline-block;
	padding: .05em .5em;
	border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
	border-radius: 999px;
	background: color-mix(in srgb, currentColor 15%, transparent);
	color: inherit;
	font-size: .8em;
	font-weight: 700;
	letter-spacing: .03em;
	text-transform: uppercase;
	white-space: nowrap;
}
.lrob-pc-date, .lrob-pc-license, .lrob-pc-file, .lrob-pc-details, .lrob-pc-release-name { opacity: .78; }
.lrob-pc-license::before { content: "·"; margin-right: .75em; opacity: .6; }
.lrob-pc-meta > .lrob-pc-license:first-child::before { content: none; }
.lrob-pc-file { font-family: var(--wp--preset--font-family--monospace, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-size: .8em; word-break: break-all; }
.lrob-pc-status { font-style: italic; opacity: .8; }
.lrob-pc-meta .lrob-pc-date, .lrob-pc-meta .lrob-pc-license { opacity: .8; }

/* A discreet text link (the source code). */
.lrob-pc-text-link {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	font-size: .875em;
	color: inherit;
	opacity: .8;
	text-decoration: none;
}
.lrob-pc-text-link:hover, .lrob-pc-text-link:focus-visible { opacity: 1; text-decoration: underline; }

/* Buttons: the same border and padding for every kind (themes give each style their own),
   an icon, and a "soft" kind: tinted, without border. */
.lrob-pc-actions .wp-block-button,
.lrob-pc-card-actions .wp-block-button { display: flex; margin: 0; }
.lrob-pc-actions .wp-block-button__link,
.lrob-pc-card-actions .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5em;
	box-sizing: border-box;
	text-align: center;
	margin: 0;
	border: 2px solid transparent;
	padding: .6em 1.3em;
}
/* The soft button takes the text colour of the block (not the theme's button text, made for the
   theme's button background) and a tint of it. */
.wp-block-button.is-lrob-pc-soft > .wp-block-button__link,
.wp-block-button.is-lrob-pc-soft > .wp-block-button__link:visited {
	background: color-mix(in srgb, currentColor 10%, transparent);
	color: inherit;
}
.wp-block-button.is-lrob-pc-soft { color: inherit; }
.wp-block-button.is-lrob-pc-soft > .wp-block-button__link:hover,
.wp-block-button.is-lrob-pc-soft > .wp-block-button__link:focus-visible {
	background: color-mix(in srgb, currentColor 18%, transparent);
	color: inherit;
}

/* ---------- Project buttons ---------- */

/* One group: the button and the source link, then every text centred under them; placed left,
   centre (default) or right. */
.lrob-pc-buttons { display: flow-root; }
.lrob-pc-group {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .6em;
	width: fit-content;
	max-width: 100%;
	text-align: center;
}
.lrob-pc-group.is-center { margin-inline: auto; }
.lrob-pc-group.is-right { margin-left: auto; }
.lrob-pc-group > p { margin: 0; }
.lrob-pc-group > .lrob-pc-meta { justify-content: center; }
.lrob-pc-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: .75em 1.25em;
}
/* Panel: a framed box, a tint of the text; the version large beside the buttons. */
.lrob-pc-panel {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.25em 2.5em;
	box-sizing: border-box;
	width: fit-content;
	max-width: 100%;
	padding: 1.25em 1.75em;
	border: 1px solid var(--lrob-pc-line);
	border-radius: .75em;
	background: var(--lrob-pc-soft);
}
.lrob-pc-panel.is-center { margin-inline: auto; }
.lrob-pc-panel.is-right { margin-left: auto; }
.lrob-pc-panel-info { display: flex; flex-direction: column; gap: .4em; min-width: 0; }
.lrob-pc-panel-info > p { margin: 0; }
.lrob-pc-panel-version { display: flex; flex-wrap: wrap; align-items: center; gap: .15em .6em; }
.lrob-pc-panel-label { flex-basis: 100%; font-size: .8em; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; opacity: .8; }
.lrob-pc-panel-number { font-size: 2.25em; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lrob-pc-panel-facts { display: flex; flex-wrap: wrap; align-items: center; gap: .25em .5em; font-size: .875em; opacity: .85; }
.lrob-pc-sep { opacity: .6; }
.lrob-pc-panel > .lrob-pc-actions.is-stack { align-items: center; }
.lrob-pc-panel > .lrob-pc-actions.is-stack .wp-block-button__link { width: auto; }
/* Narrow screens: everything one under the other, centred when the panel is. */
@media (max-width: 36em) {
	.lrob-pc-panel { flex-direction: column; align-items: stretch; width: 100%; }
	.lrob-pc-panel.is-center { text-align: center; }
	.lrob-pc-panel.is-center .lrob-pc-panel-version,
	.lrob-pc-panel.is-center .lrob-pc-panel-facts { justify-content: center; }
}
.lrob-pc-actions.is-stack { flex-direction: column; align-items: stretch; }
.lrob-pc-actions.is-stack .wp-block-button__link { width: 100%; }
.lrob-pc-actions.is-stack .lrob-pc-text-link { justify-content: center; }

/* ---------- Release notes ---------- */

.lrob-pc-section-title { margin-bottom: .75em; }
.lrob-pc-release.is-latest > .lrob-pc-release-title {
	margin: 0;
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem);
	font-weight: 700;
	line-height: 1.15;
}
.lrob-pc-release-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4em .75em;
	margin: .4em 0 1em;
	font-size: .9375em;
}
.lrob-pc-release-name { margin: 0 0 .75em; }
.lrob-pc-notes > :first-child { margin-top: 0; }
.lrob-pc-notes img { max-width: 100%; height: auto; }
.lrob-pc-notes pre { overflow-x: auto; }
.lrob-pc-notes .lrob-pc-callout { border-left: 4px solid var(--lrob-pc-accent); padding: .5em 1em; margin-inline: 0; background: var(--lrob-pc-soft); }

/* A line of text that opens, with a chevron: never styled as an action button. */
.lrob-pc-toggle {
	display: flex;
	align-items: center;
	gap: .6em;
	cursor: pointer;
	list-style: none;
}
.lrob-pc-toggle::-webkit-details-marker { display: none; }
.lrob-pc-toggle::after {
	content: "";
	flex: none;
	width: .45em;
	height: .45em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-25%) rotate(45deg);
	transition: transform .2s;
}
details[open] > .lrob-pc-toggle::after { transform: translateY(15%) rotate(-135deg); }
.lrob-pc-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.lrob-pc-history { margin-top: 1.75em; }
.lrob-pc-history > .lrob-pc-toggle { display: inline-flex; font-size: .9375em; opacity: .8; }
.lrob-pc-history > .lrob-pc-toggle:hover { opacity: 1; text-decoration: underline; }

/* The previous versions: one discreet line each, one open at a time. */
.lrob-pc-versions { margin-top: .75em; border-top: 1px solid var(--lrob-pc-line); }
.lrob-pc-versions > .lrob-pc-release { border-bottom: 1px solid var(--lrob-pc-line); scroll-margin-top: 5em; }
.lrob-pc-versions > .lrob-pc-release > .lrob-pc-toggle {
	justify-content: space-between;
	padding: .6em .5em;
	border-radius: .35em;
	transition: background-color .15s;
}
.lrob-pc-versions > .lrob-pc-release > .lrob-pc-toggle:hover { background: var(--lrob-pc-soft); }
.lrob-pc-versions .lrob-pc-release-title {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: .2em .75em;
	margin: 0;
	font-size: 1em;
	font-weight: 600;
}
.lrob-pc-versions .lrob-pc-release-title .lrob-pc-date { font-weight: normal; font-size: .875em; }
.lrob-pc-versions > .lrob-pc-release[open] { padding: 0 .5em 1em; }
.lrob-pc-versions > .lrob-pc-release[open] > .lrob-pc-toggle { margin-inline: -.5em; }
/* Collapsed: every version a line (title, date, excerpt); the whole notes open below and scroll. */
.lrob-pc-versions.is-collapsed { margin-top: 0; }
.lrob-pc-versions.is-collapsed > .lrob-pc-release > .lrob-pc-toggle {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: .3em .75em;
}
.lrob-pc-versions.is-collapsed > .lrob-pc-release > .lrob-pc-toggle::after { grid-column: 2; grid-row: 1; }
.lrob-pc-release-label { font-weight: 600; }
.lrob-pc-release-label::before { content: "· "; opacity: .6; }
.lrob-pc-release-excerpt { grid-column: 1; grid-row: 2; font-size: .9375em; opacity: .8; }
.lrob-pc-versions.is-collapsed .lrob-pc-release-body {
	max-height: 20em;
	overflow-y: auto;
	padding-right: .5em;
}
.lrob-pc-versions.is-collapsed .lrob-pc-release-body:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.lrob-pc-versions-more, .lrob-pc-more { margin: .75em 0 0; font-size: .9375em; }
.lrob-pc-placeholder { opacity: .8; font-style: italic; }

/* ---------- Projects index ---------- */

.lrob-pc-filter ul {
	display: flex;
	flex-wrap: wrap;
	gap: .5em;
	list-style: none;
	margin: 0 0 1.25em;
	padding: 0;
}
.lrob-pc-filter a {
	display: inline-block;
	padding: .25em .85em;
	border: 1px solid var(--lrob-pc-line);
	border-radius: 999px;
	text-decoration: none;
	color: inherit;
	font-size: .9375em;
	transition: background-color .15s, border-color .15s;
}
.lrob-pc-filter a:hover, .lrob-pc-filter a:focus-visible { border-color: currentColor; }
.lrob-pc-filter a[aria-current] {
	border-color: transparent;
	font-weight: 600;
	background: color-mix(in srgb, currentColor 14%, transparent);
}

/* At most --lrob-pc-columns cards a row, fewer when a card would go under --lrob-pc-min. */
.lrob-pc-cards {
	--lrob-pc-gap: 1.5em;
	--lrob-pc-min: 16rem;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(max(var(--lrob-pc-min), calc((100% - (var(--lrob-pc-columns, 3) - 1) * var(--lrob-pc-gap)) / var(--lrob-pc-columns, 3))), 1fr));
	gap: var(--lrob-pc-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}
.lrob-pc-card {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--lrob-pc-line);
	border-radius: .6em;
	overflow: hidden;
	margin: 0;
	transition: transform .15s, box-shadow .15s, border-color .15s;
}
.lrob-pc-card:hover, .lrob-pc-card:focus-within {
	transform: translateY(-2px);
	border-color: color-mix(in srgb, var(--lrob-pc-accent) 45%, transparent);
	box-shadow: 0 .5em 1.5em color-mix(in srgb, currentColor 10%, transparent);
}
.lrob-pc-card[hidden] { display: none; }
.lrob-pc-card-image { display: block; aspect-ratio: 16 / 9; overflow: hidden; }
.lrob-pc-card-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .3s;
}
.lrob-pc-card:hover .lrob-pc-card-image img { transform: scale(1.03); }

/* No image: the initials, discreet, on the category's tone (neutral without category); never a
   bare card, never the name twice. */
.lrob-pc-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	background: var(--lrob-pc-tone-bg);
	text-align: center;
}
.lrob-pc-fallback > span {
	font-size: 1.6em;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .06em;
	color: inherit;
	opacity: .8;
}
a.lrob-pc-card-image { color: inherit; text-decoration: none; }

.lrob-pc-card-body {
	display: flex;
	flex-direction: column;
	gap: .6em;
	flex: 1;
	padding: 1.25em;
}
.lrob-pc-card-title { margin: 0; font-size: 1.25em; line-height: 1.3; }
.lrob-pc-card-title a { text-decoration: none; color: inherit; }
.lrob-pc-card-title a:hover, .lrob-pc-card-title a:focus-visible { text-decoration: underline; }
.lrob-pc-card-excerpt { margin: 0; }
.lrob-pc-card-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: .5em;
	margin-top: auto;
	padding-top: .4em;
}
.lrob-pc-card-actions .wp-block-button__link { font-size: .875em; padding: .45em 1em; }
.lrob-pc-card-source { margin: 0; }

/* Compact cards (default): smaller image, margins and buttons, three lines of excerpt. */
.lrob-pc-cards.is-compact { --lrob-pc-gap: 1em; --lrob-pc-min: 13rem; }
.lrob-pc-cards.is-compact .lrob-pc-card-image { aspect-ratio: 2 / 1; }
.lrob-pc-cards.is-compact .lrob-pc-fallback > span { font-size: 1.15em; }
.lrob-pc-cards.is-compact .lrob-pc-card-body { gap: .45em; padding: .85em 1em 1em; }
.lrob-pc-cards.is-compact .lrob-pc-card-title { font-size: 1.05em; }
.lrob-pc-cards.is-compact .lrob-pc-card-excerpt {
	font-size: .9em;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}
.lrob-pc-cards.is-compact .lrob-pc-meta { font-size: .8em; }
.lrob-pc-cards.is-compact .lrob-pc-card-actions { gap: .4em; padding-top: .25em; }
.lrob-pc-cards.is-compact .lrob-pc-card-actions .wp-block-button__link { font-size: .8em; padding: .35em .8em; }

/* Who it is for: a quiet line under the excerpt. */
.lrob-pc-audience { margin: 0; font-size: .875em; opacity: .8; }
.lrob-pc-cards.is-compact .lrob-pc-audience { font-size: .8em; }

/* Sections by category: a title, then its grid. */
.lrob-pc-section + .lrob-pc-section, .lrob-pc-featured + .lrob-pc-section,
.lrob-pc-featured + .lrob-pc-filter, .lrob-pc-featured + .lrob-pc-cards { margin-top: 2.5em; }
.lrob-pc-section-title { margin: 0 0 .75em; }

/* Featured: a wide card, picture beside the text from tablet width up. */
.lrob-pc-featured { display: flex; flex-direction: column; gap: 1.5em; }
.lrob-pc-card.is-featured { flex-direction: column; }
.lrob-pc-card.is-featured .lrob-pc-card-image { aspect-ratio: 2 / 1; }
.lrob-pc-card.is-featured .lrob-pc-card-body { gap: .75em; padding: 1.5em; }
.lrob-pc-card.is-featured .lrob-pc-card-title { font-size: 1.6em; }
.lrob-pc-tagline { margin: 0; font-weight: 600; font-size: 1.05em; }
.lrob-pc-highlights { margin: 0; padding-left: 1.25em; display: grid; gap: .25em; }
.lrob-pc-highlights li::marker { color: color-mix(in srgb, currentColor 60%, transparent); }
.lrob-pc-card.is-featured .lrob-pc-card-actions { margin-top: .5em; }
@media (min-width: 48em) {
	.lrob-pc-card.is-featured { flex-direction: row; }
	.lrob-pc-card.is-featured.is-image-right { flex-direction: row-reverse; }
	.lrob-pc-card.is-featured .lrob-pc-card-image { flex: 0 0 45%; aspect-ratio: auto; min-height: 16em; }
	.lrob-pc-card.is-featured .lrob-pc-card-body { padding: 1.75em 2em; justify-content: center; }
}

/* ---------- Recent activity ---------- */

.lrob-pc-tabs {
	display: flex;
	gap: 1.25em;
	margin-bottom: .5em;
	border-bottom: 1px solid var(--lrob-pc-line);
}
.lrob-pc-tab {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	margin: 0 0 -1px;
	padding: .4em 0;
	color: inherit;
	font: inherit;
	cursor: pointer;
	opacity: .8;
}
.lrob-pc-tab[aria-selected="true"] { border-bottom-color: currentColor; opacity: 1; font-weight: 600; }
.lrob-pc-tab:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.lrob-pc-activity-list { list-style: none; margin: 0; padding: 0; }
.lrob-pc-activity-list[aria-busy="true"]:empty { min-height: 3em; }
.lrob-pc-activity-item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .3em .75em;
	padding: .55em .5em;
	border-bottom: 1px solid var(--lrob-pc-line);
	border-radius: .35em;
	transition: background-color .15s;
}
.lrob-pc-activity-item:hover { background: var(--lrob-pc-soft); }
.lrob-pc-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 2em;
	height: 2em;
	border-radius: 50%;
	overflow: hidden;
	background: var(--lrob-pc-tone-bg, color-mix(in srgb, currentColor 8%, transparent));
	font-size: .8em;
	font-weight: 700;
	line-height: 1;
}
.lrob-pc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lrob-pc-activity-project { font-weight: 600; color: inherit; text-decoration: none; }
.lrob-pc-activity-project:hover { text-decoration: underline; }
.lrob-pc-activity-label { overflow-wrap: anywhere; }
a.lrob-pc-pill { color: inherit; text-decoration: none; font-size: .875em; }
a.lrob-pc-pill:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.lrob-pc-activity-date { margin-left: auto; font-size: .875em; opacity: .8; white-space: nowrap; }
/* Release notes unfolding under the line, aligned with the project's name; long ones scroll. */
.lrob-pc-activity-notes { flex: 1 0 100%; padding-left: 2.35em; }
.lrob-pc-activity-notes > .lrob-pc-toggle { display: inline-flex; font-size: .875em; opacity: .8; }
.lrob-pc-activity-notes > .lrob-pc-toggle:hover { opacity: 1; text-decoration: underline; }
.lrob-pc-activity-notes > .lrob-pc-notes {
	max-height: 20em;
	overflow-y: auto;
	margin-top: .5em;
	padding-right: .5em;
	font-size: .9375em;
}
.lrob-pc-activity-notes > .lrob-pc-notes:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.lrob-pc-activity-state { margin: .75em 0 0; }
.lrob-pc-activity-more { margin: .75em 0 0; text-align: center; }
.lrob-pc-more-button {
	appearance: none;
	background: none;
	border: 0;
	padding: .3em 0;
	color: inherit;
	font: inherit;
	font-size: .9375em;
	opacity: .8;
	display: inline-flex;
}
.lrob-pc-more-button:hover { opacity: 1; text-decoration: underline; }
.lrob-pc-more-button[disabled] { opacity: .5; cursor: progress; }
.lrob-pc-activity-forges { list-style: none; margin: 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
	.lrob-pc-toggle::after,
	.lrob-pc-card,
	.lrob-pc-card-image img,
	.lrob-pc-activity-item,
	.lrob-pc-versions > .lrob-pc-release > .lrob-pc-toggle { transition: none; }
	.lrob-pc-card:hover, .lrob-pc-card:focus-within { transform: none; }
	.lrob-pc-card:hover .lrob-pc-card-image img { transform: none; }
}
