/*
 * Styles of the Tools/400 blocks. Colours and fonts come from the presets and custom properties
 * of the theme, with neutral fall-backs for other themes. Colours of the color scheme that have
 * no property of their own are mixed from these (color-mix).
 */
.t4-release,
.t4-facts-block,
.t4-catalog,
.t4-latest {
	--t4-ink: var(--wp--preset--color--ink, #0c1222);
	--t4-muted: var(--wp--preset--color--muted, #5b6578);
	--t4-line: var(--wp--preset--color--line, #e3e7ef);
	--t4-surface: var(--wp--preset--color--surface, #f5f7fb);
	--t4-paper: var(--wp--preset--color--paper, #fff);
	--t4-primary: var(--wp--preset--color--primary, #2b59ff);
	--t4-primary-soft: var(--wp--preset--color--primary-soft, #eaf0ff);
	--t4-amber: var(--wp--preset--color--amber, #975a16);
	--t4-success: var(--wp--custom--color--success, #107443);
	--t4-button: var(--wp--custom--color--button, var(--t4-primary));
	--t4-on-button: var(--wp--custom--color--on-button, #fff);
	--t4-mono: var(--wp--preset--font-family--mono, ui-monospace, Consolas, monospace);
	--t4-radius: 14px;
}

.t4-icon { flex: none; vertical-align: -0.2em; }

/* Version chip */
.t4-version {
	display: inline-block;
	padding: 0.1em 0.55em;
	border-radius: 999px;
	background: var(--t4-primary-soft);
	color: var(--t4-primary);
	font-family: var(--t4-mono);
	font-size: 0.8125rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.t4-version--source { background: var(--t4-surface); color: var(--t4-muted); font-weight: 500; }

.t4-badge {
	display: inline-block;
	padding: 0.15em 0.6em;
	border: 1px solid var(--t4-line);
	border-radius: 999px;
	color: var(--t4-muted);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.02em;
}
.t4-badge--legacy, .t4-badge--discontinued {
	border-color: color-mix(in srgb, var(--t4-amber) 35%, var(--t4-paper));
	background: color-mix(in srgb, var(--t4-amber) 8%, var(--t4-paper));
	color: var(--t4-amber);
}
.t4-badge--active {
	border-color: color-mix(in srgb, var(--t4-success) 35%, var(--t4-paper));
	background: color-mix(in srgb, var(--t4-success) 8%, var(--t4-paper));
	color: var(--t4-success);
}

/* ---------------------------------------------------------------- Release box */
.t4-release {
	padding: 1.5rem;
	border: 1px solid var(--t4-line);
	border-radius: var(--t4-radius);
	background: var(--t4-paper);
	box-shadow: 0 1px 2px rgb(12 18 34 / 0.04), 0 8px 24px -12px rgb(12 18 34 / 0.12);
}
.t4-release__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin-bottom: 1rem; }
.t4-release__label {
	flex-basis: 100%;
	color: var(--t4-muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.t4-release__version { font-family: var(--t4-mono); font-size: 1.5rem; font-weight: 700; color: var(--t4-ink); }
.t4-release__date, .t4-release__updated { color: var(--t4-muted); font-size: 0.875rem; }
.t4-release__note { margin: 0.75rem 0 0; color: var(--t4-muted); font-size: 0.875rem; }
.t4-release--discontinued .t4-release__head { margin-bottom: 0; }
.t4-release--discontinued .t4-release__label { color: var(--t4-amber); }

.t4-assets { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.t4-asset {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	column-gap: 0.75rem;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--t4-line);
	border-radius: 10px;
	color: var(--t4-ink);
	text-decoration: none;
	transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.t4-asset .t4-icon {
	grid-row: span 2;
	width: 2rem;
	height: 2rem;
	padding: 0.4rem;
	border-radius: 8px;
	background: var(--t4-primary-soft);
	color: var(--t4-primary);
}
.t4-asset__name { overflow-wrap: anywhere; font-family: var(--t4-mono); font-size: 0.875rem; font-weight: 600; }
.t4-asset__meta { color: var(--t4-muted); font-size: 0.8125rem; }
.t4-asset:hover, .t4-asset:focus-visible { border-color: var(--t4-primary); background: var(--t4-primary-soft); }
.t4-asset:hover .t4-icon { background: var(--t4-button); color: var(--t4-on-button); }

.t4-update-site { margin-bottom: 1rem; padding: 0.9rem; border-radius: 10px; background: var(--t4-surface); }
.t4-update-site + .t4-release__note { margin-top: 0; }
.t4-update-site__label { display: block; margin-bottom: 0.4rem; font-size: 0.8125rem; font-weight: 700; }
.t4-update-site__row { display: flex; gap: 0.5rem; align-items: center; }
.t4-update-site code {
	flex: 1;
	min-width: 0;
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--t4-line);
	border-radius: 8px;
	background: var(--t4-paper);
	font-family: var(--t4-mono);
	font-size: 0.75rem;
	line-height: 1.5;
	overflow-wrap: anywhere;
}
.t4-update-site__hint { display: block; margin-top: 0.4rem; color: var(--t4-muted); font-size: 0.75rem; }
.t4-copy {
	padding: 0.45rem 0.8rem;
	border: 0;
	border-radius: 8px;
	background: var(--t4-ink);
	color: var(--t4-paper);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
}
.t4-copy:hover { background: var(--t4-button); color: var(--t4-on-button); }

.t4-release__notes { margin-top: 1rem; border-top: 1px solid var(--t4-line); padding-top: 0.75rem; font-size: 0.875rem; }
.t4-release__notes summary { cursor: pointer; font-weight: 600; }
.t4-release__notes-body { max-height: 24rem; overflow: auto; color: var(--t4-muted); }
.t4-release__notes-body h1, .t4-release__notes-body h2, .t4-release__notes-body h3 { font-size: 1rem; color: var(--t4-ink); }

.t4-release__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	margin: 1.25rem 0 0;
	padding: 1rem 0 0;
	border-top: 1px solid var(--t4-line);
	list-style: none;
	font-size: 0.875rem;
}
.t4-release__links a { display: inline-flex; gap: 0.35rem; align-items: center; color: var(--t4-ink); font-weight: 600; text-decoration: none; }
.t4-release__links a:hover { color: var(--t4-primary); }

/* ---------------------------------------------------------------- Facts */
.t4-facts { margin: 0; }
.t4-facts__row { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--t4-line); font-size: 0.875rem; }
.t4-facts__row:last-child { border-bottom: 0; }
.t4-facts dt { color: var(--t4-muted); }
.t4-facts dd { margin: 0; font-weight: 500; }

/* ---------------------------------------------------------------- Catalogue */
.t4-filter { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 2.5rem; }
.t4-filter[hidden] { display: none; }
.t4-filter__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.t4-chip {
	padding: 0.45rem 0.9rem;
	border: 1px solid var(--t4-line);
	border-radius: 999px;
	background: var(--t4-paper);
	color: var(--t4-ink);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
}
.t4-chip span { margin-left: 0.25rem; color: var(--t4-muted); font-weight: 500; }
.t4-chip:hover { border-color: var(--t4-ink); }
.t4-chip.is-active { border-color: var(--t4-ink); background: var(--t4-ink); color: var(--t4-paper); }
.t4-chip.is-active span { color: color-mix(in srgb, var(--t4-paper) 70%, transparent); }
.t4-filter__search { position: relative; display: flex; align-items: center; flex: 0 1 18rem; }
.t4-filter__search .t4-icon { position: absolute; left: 0.8rem; color: var(--t4-muted); }
.t4-filter__search input {
	width: 100%;
	padding: 0.55rem 0.9rem 0.55rem 2.4rem;
	border: 1px solid var(--t4-line);
	border-radius: 999px;
	background: var(--t4-paper);
	color: var(--t4-ink);
	font: inherit;
	font-size: 0.9375rem;
}
.t4-filter__search input:focus { outline: 2px solid var(--t4-primary); outline-offset: 1px; border-color: transparent; }

.t4-group + .t4-group { margin-top: 3.5rem; }
.t4-group[hidden] { display: none; }
.t4-group__head { margin-bottom: 1.25rem; }
.t4-group__title { display: flex; align-items: center; gap: 0.6rem; margin: 0; font-size: 1.5rem; }
.t4-group__count { padding: 0.1em 0.55em; border-radius: 999px; background: var(--t4-surface); color: var(--t4-muted); font-size: 0.875rem; font-weight: 600; }
.t4-group__description { max-width: 46rem; margin: 0.4rem 0 0; color: var(--t4-muted); }

.t4-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr)); gap: 1rem; }
.t4-grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.t4-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.25rem;
	border: 1px solid var(--t4-line);
	border-radius: var(--t4-radius);
	background: var(--t4-paper);
	transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.t4-card[hidden] { display: none; }
.t4-card:hover {
	border-color: color-mix(in srgb, var(--t4-ink) 22%, var(--t4-line));
	box-shadow: 0 12px 28px -16px rgb(0 0 0 / 0.3);
	transform: translateY(-2px);
}
.t4-card__top { display: flex; flex-wrap: wrap; gap: 0.4rem; }
/* Within a group the type is in the heading already. */
.t4-group .t4-badge--type { display: none; }
.t4-group .t4-card__top:not(:has(.t4-badge:not(.t4-badge--type))) { display: none; }
.t4-card__title { margin: 0.25rem 0 0; font-size: 1.125rem; line-height: 1.3; }
.t4-card__title a { color: var(--t4-ink); text-decoration: none; }
.t4-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.t4-card__title a:focus-visible { outline: none; }
.t4-card:has(a:focus-visible) { outline: 2px solid var(--t4-primary); outline-offset: 2px; }
.t4-card--utilities .t4-card__title,
.t4-card--service-programs .t4-card__title { font-family: var(--t4-mono); letter-spacing: 0; }
.t4-card__tagline { flex: 1; margin: 0; color: var(--t4-muted); font-size: 0.9375rem; line-height: 1.5; }
.t4-card__meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; min-height: 1.5rem; color: var(--t4-muted); font-size: 0.8125rem; }

.t4-empty { color: var(--t4-muted); }
.t4-empty[hidden] { display: none; }

/* ---------------------------------------------------------------- Download table */
.t4-table-wrap { overflow-x: auto; border: 1px solid var(--t4-line); border-radius: var(--t4-radius); }
.t4-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.t4-table th, .t4-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--t4-line); text-align: left; vertical-align: top; }
.t4-table thead th { background: var(--t4-surface); color: var(--t4-muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.t4-table tbody tr:last-child > * { border-bottom: 0; }
.t4-table tbody tr:hover { background: color-mix(in srgb, var(--t4-surface) 50%, var(--t4-paper)); }
.t4-table .t4-table__group th { padding-top: 1.5rem; background: var(--t4-paper); color: var(--t4-ink); font-size: 1rem; font-weight: 700; }
.t4-table tbody tr.t4-table__group:hover { background: none; }
.t4-catalog--table { margin-bottom: 3rem; }
.t4-table__product { display: block; color: var(--t4-ink); font-weight: 700; text-decoration: none; }
.t4-table__product:hover { color: var(--t4-primary); }
.t4-table__type { color: var(--t4-muted); font-size: 0.8125rem; font-weight: 400; }
.t4-table__files { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.t4-file {
	display: inline-flex;
	gap: 0.3rem;
	align-items: center;
	padding: 0.25rem 0.6rem;
	border: 1px solid var(--t4-line);
	border-radius: 8px;
	color: var(--t4-ink);
	font-size: 0.8125rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.t4-file:hover { border-color: var(--t4-primary); color: var(--t4-primary); }
.t4-file .t4-icon { width: 15px; height: 15px; }

@media (max-width: 700px) {
	.t4-table thead { display: none; }
	.t4-table, .t4-table tbody, .t4-table tr, .t4-table th, .t4-table td { display: block; }
	.t4-table tr { padding: 0.75rem 1rem; border-bottom: 1px solid var(--t4-line); }
	.t4-table th, .t4-table td { padding: 0.2rem 0; border: 0; }
	.t4-table td::before { content: attr(data-label) ": "; color: var(--t4-muted); font-size: 0.8125rem; }
	.t4-table td:last-child::before { display: none; }
	.t4-table td:last-child { padding-top: 0.5rem; }
}

/* ---------------------------------------------------------------- Latest releases */
.t4-timeline { margin: 0; padding: 0; list-style: none; }
.t4-timeline__item {
	display: grid;
	grid-template-columns: 7rem 1fr;
	gap: 1rem;
	padding: 0.9rem 0;
	border-bottom: 1px solid var(--t4-line);
}
.t4-timeline__item:last-child { border-bottom: 0; }
.t4-timeline__date { color: var(--t4-muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.t4-timeline__body { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline; }
.t4-timeline__product { color: var(--t4-ink); font-weight: 700; text-decoration: none; }
.t4-timeline__product:hover { color: var(--t4-primary); }
.t4-timeline__type { flex-basis: 100%; color: var(--t4-muted); font-size: 0.8125rem; }

@media (prefers-reduced-motion: reduce) {
	.t4-card, .t4-asset { transition: none; }
	.t4-card:hover { transform: none; }
}
