/*
 * Header 2 tầng (máy tính ≥1025px) — header.php, inc/header-layout.php, nav.js.
 *
 *   Đầu trang:  tầng 1 navy (logo lớn + liên hệ) + tầng 2 xanh royal (menu + nút),
 *               nằm tuyệt đối ở đỉnh trang, cuộn đi cùng trang.
 *   Cuộn quá:   .is-compact → dính đỉnh màn, 1 hàng thấp (logo nhỏ + menu + nút),
 *               .is-dropped → trượt từ trên xuống.
 *
 * Màu trộn theo logo: navy #091F5B → royal #3B63A8, điểm nhấn cyan #00B2FF
 * → sky → cam #EC6207 (vạch gradient dưới header).
 *
 * --tri-header-h (dùng cho sidebar dính, mục lục, scroll-margin, sales
 * landing) = chiều cao header GỌN, vì khi mấy thứ đó dính thì trang đã cuộn
 * và header gọn đang hiện. Phần chừa chỗ đầu trang dùng --tri-hd-full.
 *
 * Điện thoại / máy tính bảng: không đổi gì (tầng 1 ẩn, header 1 hàng cũ).
 */

.tri-header__top,
.tri-logo--lg {
	display: none;
}

@media (min-width: 1025px) {
	body.tri-hd-two {
		--tri-hd-top: clamp(64px, calc(76 / var(--tri-type-ref) * var(--tri-vp)), 100px);
		--tri-hd-bar: clamp(48px, calc(54 / var(--tri-type-ref) * var(--tri-vp)), 70px);
		--tri-hd-compact: clamp(56px, calc(62 / var(--tri-type-ref) * var(--tri-vp)), 80px);
		--tri-hd-full: calc(var(--tri-hd-top) + var(--tri-hd-bar));
		--tri-header-h: var(--tri-hd-compact);
		--tri-hd-accent: linear-gradient(
			90deg,
			var(--wp--preset--color--cyan) 0%,
			var(--wp--preset--color--sky) 45%,
			var(--wp--preset--color--orange) 100%
		);
	}

	.tri-hd-two .tri-main {
		padding-top: var(--tri-hd-full);
	}

	/* ── Khung ─────────────────────────────────────────────────── */

	.tri-hd-two .tri-header {
		position: absolute;
		height: auto;
		background: linear-gradient(90deg, #0d2c7e 0%, #16398f 55%, #1d4296 100%);
		box-shadow: none;
	}

	/* Vạch màu logo dưới đáy header (cả 2 trạng thái). */
	.tri-hd-two .tri-header::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 3;
		height: 3px;
		background: var(--tri-hd-accent);
		pointer-events: none;
	}

	/* Mega tràn ngang neo vào chính header (top:100%) thay vì tính theo
	   biến chiều cao — header lúc to lúc gọn, lúc tuyệt đối lúc dính. Muốn
	   vậy khung giữa không được là containing block. */
	.tri-hd-two .tri-header__inner {
		position: static;
		height: var(--tri-hd-bar);
		gap: clamp(16px, calc(24 / var(--tri-type-ref) * var(--tri-vp)), 32px);
	}

	.tri-hd-two .tri-mega--rong .tri-mega__panel {
		position: absolute;
		top: 100%;
	}

	/* Backdrop mega nằm dưới header (z 40 < 50) → phủ từ đỉnh là đủ. */
	.tri-hd-two .tri-mega-backdrop {
		inset: var(--tri-adminbar) 0 0;
	}

	/* ── Tầng 1: logo + liên hệ ────────────────────────────────── */

	.tri-hd-two .tri-header__top {
		display: block;
		position: relative;
		height: var(--tri-hd-top);
		background:
			radial-gradient(520px 160px at 88% -30%, color-mix(in srgb, var(--wp--preset--color--cyan) 22%, transparent), transparent 70%),
			radial-gradient(420px 140px at 30% 140%, color-mix(in srgb, var(--wp--preset--color--royal) 45%, transparent), transparent 70%),
			var(--wp--preset--color--navy);
		border-bottom: 1px solid rgba(186, 214, 235, 0.1);
	}

	.tri-header__top-inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 32px;
		height: 100%;
		width: var(--tri-chrome);
		max-width: 100%;
		margin-inline: auto;
	}

	.tri-hd-two .tri-logo--lg {
		display: block;
		box-sizing: border-box;
		width: clamp(128px, calc(150 / var(--tri-type-ref) * var(--tri-vp)), 190px);
		height: clamp(60px, calc(70 / var(--tri-type-ref) * var(--tri-vp)), 88px);
		padding-block: clamp(4px, calc(6 / var(--tri-type-ref) * var(--tri-vp)), 8px);
		padding-inline: clamp(2px, calc(4 / var(--tri-type-ref) * var(--tri-vp)), 6px);
	}

	.tri-hc-list {
		display: flex;
		align-items: center;
		min-width: 0;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.tri-hc {
		display: flex;
		min-width: 0;
		padding-inline: clamp(14px, calc(22 / var(--tri-type-ref) * var(--tri-vp)), 30px);
	}

	.tri-hc + .tri-hc {
		border-left: 1px solid rgba(186, 214, 235, 0.18);
	}

	.tri-hc:last-child {
		padding-right: 0;
	}

	.tri-hc__link {
		display: flex;
		align-items: center;
		gap: 12px;
		min-width: 0;
		color: var(--wp--preset--color--white);
	}

	.tri-hc__icon {
		display: grid;
		place-items: center;
		flex-shrink: 0;
		width: 40px;
		height: 40px;
		border-radius: 50%;
		color: var(--wp--preset--color--cyan);
		background: rgba(255, 255, 255, 0.06);
		box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wp--preset--color--sky) 45%, transparent);
		transition:
			background-color var(--wp--custom--motion--duration-mid, 0.2s) ease,
			color var(--wp--custom--motion--duration-mid, 0.2s) ease,
			transform var(--wp--custom--motion--duration-mid, 0.2s) ease;
	}

	/* Hotline là thứ muốn khách bấm nhất → nút cam có vòng sáng. */
	.tri-hc--phone .tri-hc__icon {
		color: var(--wp--preset--color--white);
		background: var(--wp--preset--color--orange);
		box-shadow: 0 0 0 4px color-mix(in srgb, var(--wp--preset--color--orange) 22%, transparent);
		animation: tri-hc-ring 2.4s ease-out infinite;
	}

	.tri-hc__text {
		display: flex;
		flex-direction: column;
		min-width: 0;
		line-height: 1.25;
	}

	.tri-hc__label {
		font-size: 12px;
		font-weight: 500;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		color: var(--wp--preset--color--ice);
	}

	.tri-hc__value {
		overflow: hidden;
		max-width: clamp(180px, calc(260 / var(--tri-type-ref) * var(--tri-vp)), 360px);
		font-size: 15px;
		font-weight: 600;
		white-space: nowrap;
		text-overflow: ellipsis;
		transition: color var(--wp--custom--motion--duration-mid, 0.2s) ease;
	}

	.tri-hc--phone .tri-hc__value {
		font-family: var(--wp--preset--font-family--beau-sans);
		font-size: 18px;
		font-weight: 700;
		letter-spacing: 0.02em;
	}

	a.tri-hc__link:hover .tri-hc__value,
	a.tri-hc__link:focus-visible .tri-hc__value {
		color: var(--wp--preset--color--cyan);
	}

	a.tri-hc__link:hover .tri-hc__icon,
	a.tri-hc__link:focus-visible .tri-hc__icon {
		transform: translateY(-2px);
		background: color-mix(in srgb, var(--wp--preset--color--cyan) 18%, transparent);
	}

	.tri-hc--phone a.tri-hc__link:hover .tri-hc__icon,
	.tri-hc--phone a.tri-hc__link:focus-visible .tri-hc__icon {
		background: var(--wp--preset--color--orange-hover);
	}

	/* ── Tầng 2: menu + nút ────────────────────────────────────── */

	/* Logo ở hàng menu chỉ dùng khi thu gọn (tầng 1 đã có logo lớn). */
	.tri-hd-two .tri-header:not(.is-compact) .tri-logo--bar {
		display: none;
	}

	/* Menu nằm GIỮA thanh. Lưới 3 cột 1fr | menu | 1fr để menu giữa
	   thật sự dù bên trái có logo (header gọn) còn bên phải trống hoặc có
	   nút cam — flex + space-between sẽ lệch theo độ rộng hai bên. */
	.tri-hd-two .tri-header__inner {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
		align-items: center;
	}

	.tri-hd-two .tri-logo--bar {
		grid-column: 1;
		justify-self: start;
	}

	.tri-hd-two .tri-nav {
		grid-column: 2;
		justify-content: center;
	}

	.tri-hd-two .tri-header__actions {
		grid-column: 3;
		justify-self: end;
	}

	.tri-hd-two .tri-nav > a,
	.tri-hd-two .tri-mega__trigger {
		position: relative;
	}

	/* Gạch chân màu logo chạy ra khi rê chuột / trang đang mở. */
	.tri-hd-two .tri-nav > a::after,
	.tri-hd-two .tri-mega__trigger::after {
		content: "";
		position: absolute;
		left: 16px;
		right: 16px;
		bottom: 2px;
		height: 2px;
		border-radius: 2px;
		background: var(--tri-hd-accent);
		transform: scaleX(0);
		transform-origin: left center;
		transition: transform var(--wp--custom--motion--duration-mid, 0.2s) ease;
	}

	.tri-hd-two .tri-nav > a:hover::after,
	.tri-hd-two .tri-nav > a.is-current::after,
	.tri-hd-two .tri-mega__trigger:hover::after,
	.tri-hd-two .tri-mega.is-open .tri-mega__trigger::after,
	.tri-hd-two .tri-mega.is-current .tri-mega__trigger::after {
		transform: scaleX(1);
	}

	.tri-hd-two .tri-header .tri-header__cta {
		box-shadow: 0 6px 16px color-mix(in srgb, var(--wp--preset--color--orange) 35%, transparent);
	}

	/* ── Thu gọn khi cuộn ──────────────────────────────────────── */

	.tri-hd-two .tri-header.is-compact {
		position: fixed;
		transform: translateY(calc(-100% - 8px));
		background: color-mix(in srgb, var(--wp--preset--color--navy) 90%, transparent);
		-webkit-backdrop-filter: blur(14px) saturate(1.4);
		backdrop-filter: blur(14px) saturate(1.4);
		box-shadow: 0 12px 32px rgba(9, 31, 91, 0.28);
	}

	.tri-hd-two .tri-header.is-compact.is-dropped {
		transform: none;
		transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
	}

	.tri-hd-two .tri-header.is-compact .tri-header__top {
		display: none;
	}

	.tri-hd-two .tri-header.is-compact .tri-header__inner {
		height: var(--tri-hd-compact);
	}

	.tri-hd-two .tri-header.is-compact .tri-logo--bar {
		width: clamp(90px, calc(104 / var(--tri-type-ref) * var(--tri-vp)), 132px);
		height: clamp(42px, calc(48 / var(--tri-type-ref) * var(--tri-vp)), 62px);
	}

	.tri-hd-two .tri-header.is-compact::after {
		height: 2px;
	}
}

@keyframes tri-hc-ring {
	0% {
		box-shadow: 0 0 0 0 color-mix(in srgb, var(--wp--preset--color--orange) 45%, transparent);
	}
	70%,
	100% {
		box-shadow: 0 0 0 10px color-mix(in srgb, var(--wp--preset--color--orange) 0%, transparent);
	}
}

@media (prefers-reduced-motion: reduce) {
	.tri-hc--phone .tri-hc__icon {
		animation: none;
	}

	.tri-hd-two .tri-header.is-compact,
	.tri-hd-two .tri-header.is-compact.is-dropped {
		transition: none;
	}
}
