/**
 * OMI home: Latest News (latest 3 blog posts).
 * Figma: OMI Home Page → Latest News section (39:3).
 *
 * @author Sameer Ali
 */

.omi-home .omi-home-news {
	padding-top: 21px;
}

.omi-home .omi-home-news__panel {
	display: flex;
	flex-direction: column;
	gap: 40px;
	padding: 64px;
	border-radius: 60px;
	background: var(--omi-color-white);
}

.omi-home .omi-home-news__title {
	margin: 0;
	padding: 0;
	font: 700 34px/1.15 var(--omi-font);
	letter-spacing: 0;
	text-transform: none;
	color: var(--omi-color-text);
}

.omi-home .omi-home-news__list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ---------- Card (Figma: border #E2E8F0, radius 24, padding 24, gap 20, h440) ---------- */

.omi-home .omi-home-news__card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
	min-height: 440px;
	margin: 0;
	padding: 24px;
	border: 1px solid #e2e8f0;
	border-radius: 24px;
	background: var(--omi-color-white);
	list-style: none;
	transition: transform .45s var(--omi-ease), box-shadow .45s var(--omi-ease), border-color .45s var(--omi-ease);
}

.omi-home .omi-home-news__card::before {
	content: none;
}

.omi-home .omi-home-news__media {
	position: relative;
	display: block;
	height: 160px;
	border-radius: 20px;
	overflow: hidden;
	background: var(--omi-color-primary-soft, #eaf3ff);
	isolation: isolate;
}

.omi-home .omi-home-news__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 1.2s var(--omi-ease);
}

/* Post without a featured image. */
.omi-home .omi-home-news__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: var(--omi-color-primary);
}

.omi-home .omi-home-news__placeholder .omi-icon {
	width: 40px;
	height: 40px;
}

/* Category pill on the image corner (Figma: top 23, right 22.67). */
.omi-home .omi-home-news__badge {
	position: absolute;
	top: 23px;
	right: 23px;
	z-index: 1;
	padding: 8px 12px;
	border-radius: 100px;
	background: #c0ddff;
	font: 600 12px/1.2 var(--omi-font);
	color: var(--omi-color-text);
	pointer-events: none;
}

.omi-home .omi-home-news__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
}

/* Title: 2 lines (Figma 44px box). */
.omi-home .omi-home-news__name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	min-height: 2.8em;
	margin: 0;
	padding: 0;
	font: 600 16px/1.4 var(--omi-font);
	letter-spacing: 0;
	text-transform: none;
	color: var(--omi-color-text);
}

.omi-home .omi-home-news__date {
	margin: 4px 0 0; /* 12 gap + 4 = Figma 16 */
	padding: 0;
	font: 400 13px/1.5 var(--omi-font);
	color: #4a5568;
}

/* ---------- Read More (small dark pill; own rules so the section works alone) ---------- */

.omi-home .omi-home-news__link {
	gap: 12px;
	height: 44px;
	padding: 0 8px 0 16px;
	font-size: 14px;
	background: var(--omi-color-text);
	color: var(--omi-color-white);
}

.omi-home .omi-home-news__link .omi-btn__icon {
	width: 28px;
	height: 28px;
	background: #c0ddff;
	color: var(--omi-color-text);
}

.omi-home .omi-home-news__link .omi-btn__icon .omi-icon {
	width: 13px;
	height: 13px;
}

/* Whole card is clickable (the button link stretches over it). */
.omi-home .omi-home-news__link::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 24px;
}

/* The card lifts instead of the button (a transform on the link would also
   shrink its stretched click area). */
.omi-home .omi-home-news__card .omi-home-news__link:hover,
.omi-home .omi-home-news__card .omi-home-news__link:focus-visible {
	transform: none;
	box-shadow: none;
	color: var(--omi-color-white);
}

.omi-home .omi-home-news__link:focus-visible {
	outline: 2px solid var(--omi-color-primary);
	outline-offset: 3px;
}

.omi-home .omi-home-news .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (hover: hover) and (pointer: fine) {
	.omi-home .omi-home-news__card:hover {
		transform: translateY(-6px);
		border-color: #cfe2fb;
		box-shadow: 0 24px 40px -24px rgba(18, 50, 87, .35);
	}

	.omi-home .omi-home-news__card:hover .omi-home-news__img {
		transform: scale(1.12);
	}

	.omi-home .omi-home-news__card:hover .omi-btn__icon {
		background: var(--omi-color-primary);
		color: var(--omi-color-white);
	}

	.omi-home .omi-home-news__card:hover .omi-btn__icon .omi-icon {
		transform: rotate(45deg);
	}
}

/* ---------- Responsive ---------- */

@media (max-width: 1099px) {
	.omi-home .omi-home-news__panel {
		padding: 48px 0;
		border-radius: 0;
	}

	.omi-home .omi-home-news__title {
		font-size: 30px;
	}

	/* Keep 3 in a row (2 + 1 left a lonely card). */
	.omi-home .omi-home-news__list {
		gap: 16px;
	}

	.omi-home .omi-home-news__card {
		min-height: 0;
		padding: 16px;
		gap: 16px;
		border-radius: 20px;
	}

	.omi-home .omi-home-news__link::after {
		border-radius: 20px;
	}

	.omi-home .omi-home-news__media {
		border-radius: 14px;
	}

	.omi-home .omi-home-news__badge {
		top: 15px;
		right: 15px;
	}

	.omi-home .omi-home-news__media {
		height: auto;
		aspect-ratio: 16 / 9;
	}
}

@media (max-width: 767px) {
	.omi-home .omi-home-news__panel {
		gap: 28px;
		padding: 40px 0 24px;
	}

	.omi-home .omi-home-news__title {
		font-size: 26px;
	}

	.omi-home .omi-home-news__list {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
	}

	.omi-home .omi-home-news__card {
		padding: 20px;
		gap: 18px;
	}

	.omi-home .omi-home-news__badge {
		top: 19px;
		right: 19px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.omi-home .omi-home-news__card,
	.omi-home .omi-home-news__img {
		transition: none;
	}

	.omi-home .omi-home-news__card:hover,
	.omi-home .omi-home-news__card:hover .omi-home-news__img {
		transform: none;
	}
}
