/*
 * TamilAIGuide tool archives (AI Tools and category pages): the Kelvi hero, the filter
 * bar's dropdowns and Tamil support toggle, active-filter chips, the Compare checkbox and
 * tray, the quick comparison table, Benefits and the Buying Guide (BUILD_PLAN R6; canvas
 * v4 "Category"; UI/UX §4.3, §11.0). Loaded after widgets.css, whose filter styles it
 * adjusts. Markup: includes/class-markup.php; behaviour: filters.js, compare.js.
 *
 * Colours, radii, type and spacing are tat-hello-child --tat-* tokens; component geometry
 * is in px. Lime is a fill with ink text; scores and the Tamil dots use --tat-color-hi.
 */

/* ---------- Hero ---------- */

.tat-chero {
	background-color: var(--tat-color-bg);
	background-image: var(--tat-hero-glow);
}

.tat-chero__inner {
	display: flex;
	flex-direction: column;
	gap: var(--tat-space-4);
	box-sizing: border-box;
	max-width: calc(var(--tat-container-max) + 2 * var(--tat-gutter));
	margin: 0 auto;
	padding: var(--tat-space-4) var(--tat-gutter) var(--tat-space-5);
}

.tat-chero__grid {
	display: grid;
	gap: var(--tat-space-5);
}

@media (min-width: 1024px) {
	.tat-chero__grid {
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		align-items: stretch;
	}

	/* Prompt pages (R8): no art, the text keeps a readable measure. */
	.tat-chero--plain .tat-chero__grid {
		grid-template-columns: minmax(0, 860px);
	}
}

.tat-chero__text {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 18px;
	min-width: 0;
}

.tat-chero .tat-chero__title {
	margin: 0;
	font-family: var(--tat-font-display);
	/* 8vw: long Tamil words (ஆசிரியர்களுக்கும்) can't wrap, and at 9.6vw they outran a phone. */
	font-size: min(var(--tat-text-h1), 8vw);
	font-weight: var(--tat-weight-h1);
	line-height: var(--tat-leading-heading);
	letter-spacing: 0;
	text-wrap: balance;
	overflow-wrap: anywhere;
}

.tat-chero__hl {
	padding: 0 4px;
	background: linear-gradient(transparent 62%, var(--tat-hl-mark) 62%);
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

.tat-chero__lead {
	max-width: 58ch;
	color: var(--tat-color-text-muted);
	font-size: var(--tat-text-h4);
}

.tat-chero__quick .tat-icon {
	width: var(--tat-icon-sm);
	height: var(--tat-icon-sm);
	color: var(--tat-color-hi);
}

/* Header art (the category's illustration), or two decorative glows. */
.tat-chero__art {
	position: relative;
	min-height: 240px;
	overflow: hidden;
	border: 1px solid var(--tat-color-border);
	border-radius: var(--tat-radius-card);
	background-color: var(--tat-tile-5);
	background-image:
		radial-gradient(circle at 22% 28%, color-mix(in srgb, var(--tat-color-primary) 75%, transparent) 0, transparent 40%),
		radial-gradient(circle at 78% 70%, color-mix(in srgb, var(--tat-tile-3) 70%, transparent) 0, transparent 46%);
}

.tat-chero__art img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Drawn art (D6, owner 2026-10-28; TAT_Content_Types_Category_Art): the card and its motif
   take the theme's colours, so they follow light, dark and the theme switch. The supporting
   glow is the category's cobalt or clay tint. */
.tat-chero__art--drawn {
	--tat-art-glow: var(--tat-tile-3);
	background-color: var(--tat-color-raised);
	background-image:
		radial-gradient(circle at 68% 28%, color-mix(in srgb, var(--tat-color-primary) 55%, transparent) 0, transparent 52%),
		radial-gradient(circle at 28% 82%, color-mix(in srgb, var(--tat-art-glow) 32%, transparent) 0, transparent 50%);
}

.tat-chero__art--clay {
	--tat-art-glow: var(--tat-tile-2);
}

.tat-art {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.tat-art__planes {
	filter: drop-shadow(0 14px 22px color-mix(in srgb, var(--tat-color-text) 14%, transparent));
}

.tat-art__plane {
	fill: var(--tat-color-surface);
	fill-opacity: 0.82;
	stroke: var(--tat-color-hi);
	stroke-linejoin: round;
	stroke-width: 2.5;
}

.tat-art__plane--lime {
	fill: var(--tat-color-primary);
	fill-opacity: 1;
}

.tat-art__plane--accent {
	fill: var(--tat-art-glow);
	fill-opacity: 0.9;
	stroke: var(--tat-art-glow);
}

.tat-art__line {
	fill: none;
	stroke: var(--tat-color-hi);
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2.5;
	opacity: 0.75;
}

.tat-art__line--soft {
	opacity: 0.45;
}

.tat-art__line--faint {
	opacity: 0.25;
}

/* Ribbons and rings: a surface-coloured band with a thin outline. */
.tat-art__ribbon-edge,
.tat-art__ribbon {
	fill: none;
	stroke-linecap: round;
}

.tat-art__ribbon-edge {
	stroke: var(--tat-color-hi);
	stroke-width: 20;
}

.tat-art__ribbon {
	stroke: var(--tat-color-surface);
	stroke-width: 15;
}

.tat-art__node,
.tat-art__spark {
	fill: var(--tat-color-hi);
}

.tat-chero__caption {
	position: absolute;
	bottom: var(--tat-space-4);
	left: var(--tat-space-4);
	display: inline-flex;
	align-items: center;
	padding: 10px 14px;
	border-radius: var(--tat-radius-control);
	background: color-mix(in srgb, var(--tat-tile-5) 75%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: var(--tat-on-tile);
	font-size: var(--tat-text-small);
	font-weight: var(--tat-weight-strong);
}

@media (min-width: 1024px) {
	.tat-chero__art {
		min-height: 300px;
	}
}

/* ---------- Filter bar ---------- */

/* Full-bleed glass bar; its content lines up with the page container. */
.tat-filters {
	padding: var(--tat-space-3) max(var(--tat-gutter), calc((100% - var(--tat-container-max)) / 2));
	border-top: 1px solid var(--tat-color-border);
	border-bottom: 1px solid var(--tat-color-border);
	background: var(--tat-glass);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
}

.tat-filters__drop {
	display: none;
}

/* The Tamil support toggle: a pill with a tick, lime when on. */
.tat-chip--toggle span {
	gap: var(--tat-space-2);
}

.tat-chip--toggle .tat-icon {
	width: var(--tat-icon-sm);
	height: var(--tat-icon-sm);
	color: var(--tat-color-hi);
}

.tat-chip--toggle input:checked + span .tat-icon {
	color: var(--tat-color-on-primary);
}

@media (min-width: 1024px) {
	/* Along the bottom: the labelled selects are taller than the pills beside them. */
	.tat-filters.is-enhanced .tat-filters__panel {
		align-items: flex-end;
		gap: var(--tat-space-2);
	}

	.tat-filters__drop-group {
		position: relative;
	}

	.tat-filters.is-enhanced .tat-filters__drop {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: var(--tat-button-min-height);
		padding: 0 var(--tat-space-3);
		border: 1px solid var(--tat-color-border-control);
		border-radius: var(--tat-radius-pill);
		background: var(--tat-color-surface);
		color: var(--tat-color-text);
		font: inherit;
		font-size: var(--tat-text-small);
		font-weight: var(--tat-weight-strong);
		cursor: pointer;
	}

	.tat-filters.is-enhanced .tat-filters__drop:hover,
	.tat-filters.is-enhanced .tat-filters__drop:focus,
	.tat-filters.is-enhanced .tat-filters__drop[aria-expanded='true'] {
		background: var(--tat-color-raised);
		color: var(--tat-color-text);
	}

	.tat-filters__drop .tat-icon {
		width: var(--tat-icon-sm);
		height: var(--tat-icon-sm);
		transition: transform var(--tat-motion-base) var(--tat-ease-out);
	}

	.tat-filters__drop[aria-expanded='true'] .tat-icon {
		transform: rotate(180deg);
	}

	.tat-filters__drop-count:empty {
		display: none;
	}

	.tat-filters.is-enhanced .tat-filters__pop {
		position: absolute;
		top: calc(100% + 8px);
		left: 0;
		z-index: 2;
		display: none;
		box-sizing: border-box;
		width: max-content;
		min-width: 240px;
		max-width: 420px;
		padding: var(--tat-space-3);
		border: 1px solid var(--tat-color-border);
		border-radius: var(--tat-radius-card);
		background: var(--tat-color-surface);
		box-shadow: var(--tat-shadow-menu);
	}

	.tat-filters.is-enhanced .is-open > .tat-filters__pop {
		display: flex;
	}

	/* The dropdown's button already names the group. */
	.tat-filters.is-enhanced .tat-filters__pop > .tat-filters__label {
		position: absolute !important;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}
}

/* ---------- Results: active filters, Compare ---------- */

.tat-active {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--tat-space-2);
	margin-bottom: var(--tat-space-4);
	color: var(--tat-color-text-muted);
	font-size: var(--tat-text-small);
}

.tat-active__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tat-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.tat-active__chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 0 10px 0 var(--tat-space-3);
	border-radius: var(--tat-radius-pill);
	background: var(--tat-color-raised);
	color: var(--tat-color-text);
	font-weight: var(--tat-weight-strong);
	text-decoration: none;
}

.tat-active__chip:hover,
.tat-active__chip:focus-visible {
	background: var(--tat-color-border);
	color: var(--tat-color-text);
}

.tat-active__chip .tat-icon {
	width: var(--tat-icon-sm);
	height: var(--tat-icon-sm);
}

.tat-active__clear {
	margin-left: var(--tat-space-1);
	color: var(--tat-color-link);
	font-weight: var(--tat-weight-strong);
}

/* Compare sits above the card's stretched title link. */
.tat-card__compare {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	gap: var(--tat-space-2);
	min-height: 40px;
	margin-top: var(--tat-space-2);
	padding-top: var(--tat-space-2);
	color: var(--tat-color-text);
	font-size: var(--tat-text-small);
	cursor: pointer;
}

.tat-card__compare-box {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--tat-color-hi);
}

/* ---------- Compare tray (D9) ---------- */

.tat-tray {
	position: fixed;
	right: 0;
	bottom: var(--tat-space-3);
	left: 0;
	z-index: var(--tat-z-sticky-cta);
	display: flex;
	justify-content: center;
	padding: 0 var(--tat-space-3);
	pointer-events: none;
}

.tat-tray[hidden] {
	display: none;
}

/* Names over the status on the left; Compare now and clear beside them, so phones get two rows. */
.tat-tray__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 2px var(--tat-space-3);
	max-width: 100%;
	box-sizing: border-box;
	padding: 10px 10px 10px 18px;
	border-radius: var(--tat-radius-card);
	background: var(--tat-color-text);
	box-shadow: var(--tat-shadow-menu);
	color: var(--tat-color-bg);
	pointer-events: auto;
}

.tat-tray__names {
	grid-area: 1 / 1;
	font-weight: var(--tat-weight-heading);
}

.tat-tray__status {
	grid-area: 2 / 1;
	font-size: var(--tat-text-small);
	opacity: 0.85;
}

.tat-tray__status:empty {
	display: none;
}

.tat-tray__go {
	grid-area: 1 / 2 / span 2;
	display: inline-flex;
	align-items: center;
	gap: var(--tat-space-2);
	min-height: 44px;
	padding: 0 18px;
	border-radius: var(--tat-radius-pill);
	background: var(--tat-color-primary);
	color: var(--tat-color-on-primary);
	font-weight: var(--tat-weight-heading);
	text-decoration: none;
}

.tat-tray__go:hover,
.tat-tray__go:focus-visible {
	background: var(--tat-color-primary-strong);
	color: var(--tat-color-on-primary);
}

.tat-tray__go[hidden] {
	display: none;
}

.tat-tray__go .tat-icon,
.tat-tray__clear .tat-icon {
	width: var(--tat-icon-sm);
	height: var(--tat-icon-sm);
}

.tat-tray .tat-tray__clear {
	grid-area: 1 / 3 / span 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--tat-radius-pill);
	background: transparent;
	color: var(--tat-color-bg);
	cursor: pointer;
}

.tat-tray .tat-tray__clear:hover,
.tat-tray .tat-tray__clear:focus-visible {
	background: color-mix(in srgb, var(--tat-color-bg) 15%, transparent);
	color: var(--tat-color-bg);
}

.tat-tray .tat-tray__clear:focus-visible,
.tat-tray__go:focus-visible {
	outline: var(--tat-focus-width) solid var(--tat-color-bg);
	outline-offset: 2px;
}

/* Above the phone tab bar. */
@media (max-width: 767.98px) {
	body:has(.tat-tabbar) .tat-tray {
		bottom: calc(var(--tat-tabbar-height) + env(safe-area-inset-bottom, 0px) + var(--tat-space-2));
	}
}

/* While the tray shows, keyboard focus scrolls clear of it (WCAG 2.4.11; R9). The tray is
   at most about 100px tall. */
html:has(.tat-tray:not([hidden])) {
	scroll-padding-bottom: calc(100px + 2 * var(--tat-space-3));
}

@media (max-width: 767.98px) {
	html:has(.tat-tabbar):has(.tat-tray:not([hidden])) {
		scroll-padding-bottom: calc(var(--tat-tabbar-height) + env(safe-area-inset-bottom, 0px) + 100px + 2 * var(--tat-space-3));
	}
}

/* ---------- Quick comparison table ---------- */

.tat-compare__tool {
	display: inline-flex;
	align-items: center;
	gap: var(--tat-space-3);
}

.tat-compare__tool .tat-card__logo {
	width: 32px;
	height: 32px;
	border-radius: 10px;
	font-size: var(--tat-text-small);
}

.tat-compare--tools .tat-compare__score {
	color: var(--tat-color-hi);
	font-family: var(--tat-font-display);
	font-weight: var(--tat-weight-heading);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* ---------- Benefits and Buying Guide (editor lists as cards) ---------- */

.tat-benefits .tat-prose ul {
	display: grid;
	gap: var(--tat-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {
	.tat-benefits .tat-prose ul {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.tat-benefits .tat-prose ul > li {
	margin: 0;
	padding: 18px;
	border: 1px solid var(--tat-color-border);
	border-radius: 20px;
	background: var(--tat-color-bg);
	line-height: var(--tat-leading-body);
}

.tat-benefits .tat-prose li > strong:first-child,
.tat-buying-guide .tat-prose li > strong:first-child {
	display: block;
	margin-bottom: var(--tat-space-1);
}

.tat-buying-guide .tat-prose ul,
.tat-buying-guide .tat-prose ol {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tat-buying-guide .tat-prose ul > li,
.tat-buying-guide .tat-prose ol > li {
	position: relative;
	margin: 0;
	padding: var(--tat-space-3) var(--tat-space-3) var(--tat-space-3) 56px;
	border: 1px solid var(--tat-color-border);
	border-radius: 18px;
	background: var(--tat-color-bg);
	line-height: var(--tat-leading-body);
}

.tat-buying-guide .tat-prose ul > li::before,
.tat-buying-guide .tat-prose ol > li::before {
	position: absolute;
	top: var(--tat-space-3);
	left: var(--tat-space-3);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: var(--tat-radius-pill);
	background: var(--tat-color-primary);
	color: var(--tat-color-on-primary);
	content: '✓';
	font-weight: var(--tat-weight-heading);
}

.tat-benefits .tat-prose li + li,
.tat-buying-guide .tat-prose li + li {
	margin-top: 0;
}

@media (prefers-reduced-motion: reduce) {
	.tat-filters__drop .tat-icon {
		transition: none;
	}
}
