/**
 * Services Section (trang chủ) + slider component dùng chung (.tmnp-slider). Toàn bộ giá trị
 * --services-* là CSS custom property do tmnhanphat_render_services_css_vars() sinh ra, gắn
 * bằng wp_add_inline_style() trong inc/enqueue.php (PROJECT_RULES.md mục 22) — file này KHÔNG
 * hardcode giá trị người dùng đổi được trong Customizer.
 *
 * Progressive enhancement: KHÔNG có JS, .tmnp-slider__track là dải flex cuộn ngang được
 * (overflow-x + scroll-snap). Khi assets/js/components/slider.js chạy, section được gắn
 * .js-services-ready và slider root được gắn .is-enhanced → chuyển sang transform-based.
 */

.services-home {
	background-color: var(--services-bg, #ffffff);
	padding-block: 70px
}

.services-home__container {
	max-width: var(--services-container-width, var(--container-max-width));
}

/* ==================== HEADER ==================== */
.services-home__header {
	text-align: var(--services-heading-align, center);
}

.services-home__heading {
	margin: 0 0 var(--services-heading-margin, 37px);
	/* Figma: 85px — fluid theo tỉ lệ container (--fig1px). */
	font-size: clamp(2rem, calc(85 * var(--fig1px)), var(--services-heading-size, 85px));
	font-weight: var(--services-heading-weight, 900);
	line-height: 1.21;
	letter-spacing: -0.02em;
	/* Taste B: tracking âm nhẹ cho display lớn (premium). */
}

/* Heading dùng TYPOGRAPHY làm điểm nhấn — KHÔNG underline/gạch (chuẩn hoá Design System). */

.services-home__heading-red {
	color: var(--services-heading-red, #E31F2B);
}

.services-home__heading-blue {
	color: var(--services-heading-blue, #046AB5);
}

.services-home__description {
	margin: 0 auto var(--services-desc-margin, 57px);
	max-width: var(--services-desc-max-width, 820px);
	color: var(--services-desc-color, #464646);
	font-size: clamp(16px, calc(20 * var(--fig1px)), var(--services-desc-size, 20px));
	line-height: 1.5;
	/* Taste A: body văn xuôi leading thoáng. Migrate: sàn 16 (readability). */
}

/* ==================== SLIDER (generic .tmnp-slider) ==================== */
.tmnp-slider {
	position: relative;
}

.tmnp-slider__viewport {
	overflow: hidden;
	border-radius: 10px;
	cursor: grab;
	user-select: none;
	-webkit-user-select: none;
}

.tmnp-slider__viewport.is-dragging {
	cursor: grabbing !important;
}

.tmnp-slider__viewport:focus-visible {
	outline: 2px solid var(--services-dot-active, #046AB5);
	outline-offset: 4px;
}

/* No-JS fallback: track tự cuộn ngang + snap từng card. */
.tmnp-slider__track {
	display: flex;
	gap: var(--services-gap, 24px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	user-select: none;
	-webkit-user-select: none;
}

/* Bề rộng 1 slide theo số cột breakpoint — công thức Flexbox chuẩn của theme (mục 25). */
.tmnp-slider__slide {
	flex: 0 0 calc((100% - (var(--services-cols, 3) - 1) * var(--services-gap, 24px)) / var(--services-cols, 3));
	max-width: calc((100% - (var(--services-cols, 3) - 1) * var(--services-gap, 24px)) / var(--services-cols, 3));
	scroll-snap-align: start;
	user-select: none;
	-webkit-user-select: none;
}

.tmnp-slider__slide img {
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	user-drag: none;
}

/* JS đã nâng cấp: tắt cuộn tay (transform đảm nhiệm), ẩn scrollbar, track trượt mượt. */
.tmnp-slider.is-enhanced .tmnp-slider__track {
	overflow: visible;
	scroll-snap-type: none;
	will-change: transform;
	transition: transform var(--services-transition, 600ms) ease;
}

.tmnp-slider.is-enhanced .tmnp-slider__track.is-dragging {
	transition: none;
	cursor: grabbing !important;
	user-select: none !important;
	-webkit-user-select: none !important;
}

/* ==================== DOTS (slider.js sinh DOM khi bật) ==================== */
/* Figma (Services): dot 15px, gap 16, cách cards 37 — Projects/News override riêng theo scope. */
.tmnp-slider__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 37px;
}

.tmnp-slider__dot {
	position: relative;
	width: 8px;
	height: 8px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background-color: var(--services-dot-inactive, #D9D9D9);
	cursor: pointer;
	transition: width 0.3s ease, border-radius 0.3s ease, background-color 0.25s ease, transform 0.25s ease;
}

/* Vùng chạm trong suốt mở rộng 8px mỗi phía (dot 15px → hit ~31px, đạt WCAG 2.5.8
   ≥24px) — gap dots 16px nên 2 vùng chạm kề nhau vừa chạm mép, không chồng lấn. */
.tmnp-slider__dot::before {
	content: "";
	position: absolute;
	inset: -8px;
}

.tmnp-slider__dot:hover,
.tmnp-slider__dot:focus-visible {
	transform: scale(1.3);
}

.tmnp-slider__dot:focus-visible {
	outline: 2px solid var(--services-dot-active, #046AB5);
	outline-offset: 2px;
}

.tmnp-slider__dot.is-active {
	width: 24px;
	border-radius: 999px;
	background-color: var(--services-dot-active, #046AB5);
}

/* ==================== ARROWS (tuỳ chọn, slider.js sinh DOM khi bật) ==================== */
.tmnp-slider__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 50%;
	background-color: rgb(255 255 255 / 0.92);
	color: var(--services-dot-active, #046AB5);
	box-shadow: 0 4px 14px rgb(0 0 0 / 0.15);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.tmnp-slider__arrow:hover,
.tmnp-slider__arrow:focus-visible {
	background-color: #ffffff;
}

.tmnp-slider__arrow--prev {
	left: -8px;
}

.tmnp-slider__arrow--next {
	right: -8px;
}

/* ==================== SERVICE CARD ==================== */
/* Card = ảnh phủ kín + gradient overlay + nội dung đè lên đáy ảnh (đúng Figma). */
.service-card {
	position: relative;
	border-radius: var(--services-card-radius, 10px);
	overflow: hidden;
	box-shadow: 0 10px 28px rgb(6 24 44 / 0.12);
}

.service-card__link {
	display: block;
	position: relative;
	color: inherit;
}

.service-card__link:focus-visible {
	outline: 3px solid var(--services-dot-active, #046AB5);
	outline-offset: 2px;
}

.service-card__media {
	position: relative;
	aspect-ratio: var(--services-card-ratio, 510 / 453);
	background-color: #10202f;
	/* nền chờ khi Service chưa có Featured Image */
}

.service-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* giữ đúng ratio khung, không méo (yêu cầu Card) */
	transition: transform var(--services-hover-duration, 300ms) ease;
}

.service-card:hover .service-card__image,
.service-card__link:focus-visible .service-card__image {
	transform: scale(var(--services-hover-zoom, 1.06));
}

/* Gradient overlay — đậm dần về đáy để Title/Description trắng luôn đọc được trên mọi ảnh. */
.service-card__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgb(0 0 0 / 0) 35%, var(--services-overlay, rgb(10 20 32 / 0.55)) 100%);
	transition: opacity var(--services-hover-duration, 300ms) ease;
}

.service-card:hover .service-card__overlay {
	background: linear-gradient(180deg, rgb(0 0 0 / 0.08) 25%, var(--services-overlay-hover, rgb(10 20 32 / 0.7)) 100%);
}

.service-card__body {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	padding: var(--services-content-padding, 35px);
	padding-bottom: 28px;
}

.service-card__title {
	margin: 0;
	color: var(--services-title-color, #ffffff);
	font-size: 25px;
	font-weight: 700;
	line-height: 1.25;
	transition: color var(--services-hover-duration, 300ms) ease;
}

.service-card:hover .service-card__title,
.service-card__link:focus-visible .service-card__title {
	color: var(--services-title-hover, #046AB5);
}

/* ==================== CTA ==================== */
.services-home__cta-wrap {
	margin-top: var(--services-cta-margin-top, 40px);
	text-align: center;
}

.services-home__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--services-cta-padding, 12px 27px);
	border-radius: var(--services-cta-radius, 10px);
	background-color: var(--services-cta-bg, #046AB5);
	color: var(--services-cta-text, #ffffff);
	/* Figma: chữ CTA Inter 24/400 + shadow 0/4/4 25% — fluid theo container. */
	font-size: clamp(1rem, calc(24 * var(--fig1px)), var(--services-cta-size, 24px));
	font-weight: 400;
	/* Shadow mềm theo ngôn ngữ chung của trang (blur lớn, opacity thấp) — thay
	   0 4px 4px /25% cũ (blur = offset trông như viền bẩn, anti-pattern). */
	box-shadow: 0 10px 24px rgb(4 106 181 / 0.25);
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.services-home__cta:hover,
.services-home__cta:focus-visible {
	background-color: var(--services-cta-hover-bg, #03518a);
	color: var(--services-cta-text, #ffffff);
	transform: translateY(-2px);
}

.services-home__cta:focus-visible {
	outline: 3px solid var(--services-dot-active, #046AB5);
	outline-offset: 3px;
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {

	.tmnp-slider.is-enhanced .tmnp-slider__track,
	.service-card__image,
	.service-card__overlay,
	.service-card__title,
	.tmnp-slider__dot,
	.services-home__cta {
		transition: none;
	}

	.service-card:hover .service-card__image {
		transform: none;
	}
}