/*
 * Design System - AELITA
 * components/home-news.css - homepage "НОВИНИ" block.
 *
 * WP4 redesign: unified section heading (title + red accent + "all news"
 * link), one featured card for the latest news (image + title + intro + date,
 * max half the width on desktop) and a compact vertical list of the next three
 * news (small thumbnail + title + date). Dates match the car cards.
 *
 * Scoped to .a-home-news. Consumes tokens.css only; no hex, no !important.
 * Loaded on the front page only (see inc/enqueue.php).
 */

/* -------------------------------------------------------------------- */
/* Section                                                              */
/* -------------------------------------------------------------------- */
.a-home-news {
	padding-block: var(--home-section-space);
	background-color: var(--bg);
}

.a-home-news .a-container {
	max-width: var(--container);
}

/* -------------------------------------------------------------------- */
/* Header (unified section heading)                                     */
/* -------------------------------------------------------------------- */
.a-home-news__header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-4);
	margin-bottom: var(--space-6);
}

.a-home-news__heading {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

/* Matches .a-home-models__title / .a-home-brands__title. */
.a-home-news__title {
	margin: 0;
	font-family: var(--font-display-strong);
	font-size: var(--fs-h2);
	font-weight: var(--fw-bold);
	line-height: var(--lh-heading);
	color: var(--text-primary);
	text-transform: uppercase;
}

.a-home-news__accent {
	display: block;
	width: var(--space-8); /* 64px */
	height: var(--space-1); /* 4px */
	background-color: var(--c-red-600);
}

.a-home-news__all {
	display: inline-flex;
	align-items: center;
	align-self: flex-end;
	gap: var(--space-2);
	min-height: calc(var(--space-6) + var(--space-3)); /* 44px touch target */
	font-family: var(--font-body);
	font-size: var(--fs-h4); /* 18px */
	font-weight: var(--fw-semibold);
	color: var(--link);
	text-decoration: none;
	transition: color var(--dur-popover) var(--ease-out);
}

.a-home-news__all-arrow {
	transition: transform var(--dur-popover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
	.a-home-news__all:hover {
		color: var(--link-hover);
	}

	.a-home-news__all:hover .a-home-news__all-arrow {
		transform: translateX(var(--space-1));
	}
}

.a-home-news__all:focus-visible {
	outline: 2px solid var(--focus-ring) !important;
	outline-offset: 2px;
}

/* -------------------------------------------------------------------- */
/* Layout: featured (left) + list (right)                               */
/* -------------------------------------------------------------------- */
.a-home-news__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-6);
	align-items: start;
}

.a-home-news__col {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	align-items: flex-start;
}

/* -------------------------------------------------------------------- */
/* Shared link + date                                                    */
/* -------------------------------------------------------------------- */
.a-home-news__link,
.a-home-news__item-link {
	display: flex;
	color: inherit;
	text-decoration: none;
}

.a-home-news__link {
	flex-direction: column;
	height: 100%;
}

.a-home-news__link:hover,
.a-home-news__link:focus,
.a-home-news__item-link:hover,
.a-home-news__item-link:focus {
	color: inherit;
	text-decoration: none;
}

.a-home-news__link:focus-visible,
.a-home-news__item-link:focus-visible {
	outline: 2px solid var(--focus-ring) !important;
	outline-offset: -2px;
}

.a-home-news__date {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	font-size: var(--fs-small); /* 14px, matches .a-car-card__date */
	color: var(--text-secondary);
	line-height: var(--lh-heading);
	font-variant-numeric: tabular-nums;
}

.a-home-news__date-icon {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	color: var(--c-ink-300);
}

/* -------------------------------------------------------------------- */
/* Featured card                                                        */
/* -------------------------------------------------------------------- */
.a-home-news__featured {
	display: flex;
	background-color: var(--bg);
	border-radius: var(--radius);
}

.a-home-news__media {
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background-color: var(--bg-muted);
}

.a-home-news__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--dur-dropdown) var(--ease-out);
}

.a-home-news__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	gap: var(--space-3);
	padding: var(--space-5);
}

.a-home-news__card-title {
	font-family: var(--font-display-strong);
	font-size: var(--fs-h3); /* 24px */
	font-weight: var(--fw-bold);
	line-height: var(--lh-heading);
	color: var(--text-primary);
	text-transform: none;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	transition: color var(--dur-popover) var(--ease-out);
}

.a-home-news__excerpt {
	font-family: var(--font-body);
	font-size: var(--fs-body); /* 16px */
	line-height: var(--lh-body);
	color: var(--text-secondary);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

.a-home-news__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	margin-block-start: auto;
	padding-block-start: var(--space-2);
}

/* "Читати" affordance, mirroring the news category featured card. */
.a-home-news__more {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--fs-small);
	font-weight: var(--fw-semibold);
	color: var(--text-primary);
}

.a-home-news__more svg {
	width: 16px;
	height: 16px;
	transition: transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
	.a-home-news__featured:hover .a-home-news__media img {
		transform: scale(1.035);
	}

	.a-home-news__featured:hover .a-home-news__card-title {
		color: var(--link-hover);
	}

	.a-home-news__featured:hover .a-home-news__more {
		color: var(--link-hover);
	}

	.a-home-news__featured:hover .a-home-news__more svg {
		transform: translateX(3px);
	}
}

/* -------------------------------------------------------------------- */
/* Vertical list (next news)                                            */
/* -------------------------------------------------------------------- */
.a-home-news__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.a-home-news__item + .a-home-news__item {
	border-top: var(--border-w) solid var(--border);
}

.a-home-news__item-link {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	align-items: center;
	gap: var(--space-4);
	padding-block: var(--space-3);
}

/* Raise the first row so its content aligns with the featured card top. */
.a-home-news__item:first-child .a-home-news__item-link {
	padding-block-start: 0;
}

.a-home-news__item-media {
	display: block;
	overflow: hidden;
	aspect-ratio: 3 / 2;
	background-color: var(--bg-muted);
}

.a-home-news__item-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--dur-dropdown) var(--ease-out);
}

.a-home-news__item-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	min-width: 0;
}

.a-home-news__item-title {
	font-family: var(--font-display-strong);
	font-size: var(--fs-h4); /* 18px */
	font-weight: var(--fw-bold);
	line-height: var(--lh-heading);
	color: var(--text-primary);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	transition: color var(--dur-popover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
	.a-home-news__item-link:hover .a-home-news__item-media img {
		transform: scale(1.05);
	}

	.a-home-news__item-link:hover .a-home-news__item-title {
		color: var(--link-hover);
	}
}

/* -------------------------------------------------------------------- */
/* Mobile: single column (featured on top, list below)                  */
/* -------------------------------------------------------------------- */
@media (max-width: 768px) {
	.a-home-news__grid {
		grid-template-columns: 1fr;
		gap: var(--space-5);
	}
}

@media (prefers-reduced-motion: reduce) {
	.a-home-news__media img,
	.a-home-news__item-media img,
	.a-home-news__card-title,
	.a-home-news__item-title,
	.a-home-news__all,
	.a-home-news__all-arrow,
	.a-home-news__more svg,
	.a-home-news__featured {
		transition-duration: 0.01ms;
	}

	.a-home-news__featured:hover .a-home-news__media img,
	.a-home-news__featured:hover .a-home-news__more svg,
	.a-home-news__item-link:hover .a-home-news__item-media img {
		transform: none;
	}
}
