/* Pill header aligned with the Cargo marketing bar. The page container stays 1200px;
   this bar uses the same outer max-width, with 20px / 24px of horizontal padding. */

.header-area.envia-pill-header,
.header-area.envia-pill-header.is-sticky {
	position: sticky;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 100;
	min-height: 0;
	padding-top: 12px;
	background: transparent !important;
	box-shadow: none !important;
}

@media (min-width: 768px) {
	.header-area.envia-pill-header,
	.header-area.envia-pill-header.is-sticky {
		padding-top: 20px;
	}
}

/*
 * The site's CSS sets `html, body { height: 100% }` (common.css, main.css): body is then one
 * screen tall and a sticky header, held inside it, lets go after the first screen. On every page
 * with this header, body grows with the page instead, so the header stays on top while scrolling.
 */
body:has(.envia-pill-header) {
	height: auto;
	min-height: 100%;
}

/* Some pages (e.g. rastreo, #headerTracking) wrap the header in a div of its own height, where a
   sticky header has no room to move: that wrapper sticks instead. */
body > div:has(> .header-area.envia-pill-header) {
	position: sticky;
	top: 0;
	z-index: 100;
}

body.has-desktop-banner > div:has(> .header-area.envia-pill-header) {
	top: var(--desktop-banner-height, 44px);
}

body.has-desktop-banner > div:has(> .header-area.envia-pill-header) > .header-area.envia-pill-header {
	top: 0;
}

/* The desktop-app banner is fixed at the top: the header sticks right under it, not behind it. */
body.has-desktop-banner .header-area.envia-pill-header,
body.has-desktop-banner .header-area.envia-pill-header.is-sticky {
	top: var(--desktop-banner-height, 44px);
}

.envia-pill-header__wrap {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 0px;
}

/* Phones: the pill keeps clear of the screen edges. */
@media (max-width: 767.98px) {
	.envia-pill-header__wrap {
		padding-inline: 12px;
	}
}

.envia-pill-header__bar {
	--bar-ink: #00122d;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	height: 44px;
	border-radius: 999px;
	padding-inline: 6px;
	border: 1px solid rgb(255 255 255 / 0.55);
	background-color: rgb(255 255 255 / 0.92);
	background-image: linear-gradient(
		160deg,
		rgb(255 255 255 / 0.44) 60%,
		rgb(255 255 255 / 0.1) 80%,
		rgb(255 255 255 / 0.24) 100%
	);
	backdrop-filter: blur(30px) saturate(185%);
	-webkit-backdrop-filter: blur(30px) saturate(185%);
	box-shadow:
		inset 0 1px 0 rgb(255 255 255 / 0.8),
		0 4px 10px rgb(20 80 168 / 0.12),
		0 16px 36px -12px rgb(20 80 168 / 0.38);
}

@media (min-width: 768px) {
	.envia-pill-header__bar {
		height: 56px;
		padding-inline: 10px;
	}
}

.header-area.envia-pill-header .envia-pill-header__menu.mobile-navigation-icon {
	position: relative;
	left: auto;
	display: none;
	width: 40px;
	height: 40px;
	margin: 0;
	place-items: center;
	border-radius: 8px;
	cursor: pointer;
}

/* Clicks must land on #mobile-menu-trigger itself: main.js closes the menu on any other target. */
.envia-pill-header__menu-icon {
	pointer-events: none;
	display: block;
	width: 24px;
	height: 24px;
	color: #00122d;
}

@media (max-width: 1199.98px) {
	.header-area.envia-pill-header .envia-pill-header__menu.mobile-navigation-icon {
		display: grid;
	}
}

.envia-pill-header__logo {
	display: flex;
	align-items: center;
	margin-right: auto;
	flex-shrink: 0;
	line-height: 0;
}

.envia-pill-header__logo img {
	width: auto;
	height: 30px;
}

@media (min-width: 768px) {
	.envia-pill-header__logo img {
		height: 36px;
	}
}

.envia-pill-header__nav {
	display: flex;
	align-items: center;
	min-width: 0;
	height: 100%;
	flex-grow: 0;
}

.envia-pill-header .navigation-menu {
	height: 100%;
}

.envia-pill-header .navigation-menu > ul {
	display: flex;
	align-items: center;
	height: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.envia-pill-header .navigation-menu > ul > li {
	display: flex;
	align-items: center;
	height: 100%;
}

.envia-pill-header .navigation-menu > ul > li > a {
	display: inline-flex;
	align-items: center;
	height: 100%;
	padding: 0 8px !important;
	color: #00122d !important;
	background: none !important;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.02em;
	line-height: 1;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.4em;
	text-decoration-color: transparent;
	text-decoration-skip-ink: none;
	transition: text-decoration-color 180ms ease-out;
}

@media (min-width: 768px) {
	.envia-pill-header .navigation-menu > ul > li > a {
		padding: 0 12px !important;
	}
}

.envia-pill-header .navigation-menu > ul > li > a {
	/* Every link at the same weight ("Rastrear" came bold from font-weight--emphasis). */
	font-weight: 500 !important;
}

/*
 * Underline on hover and on the current page's own link only: not on "Cotizar" all the time, and
 * not on a dropdown (e.g. "Plataforma") just because the current page sits inside it.
 */
.envia-pill-header .navigation-menu > ul > li > a:hover,
.envia-pill-header .navigation-menu > ul > li.active:not(.has-children) > a {
	color: #00122d !important;
	text-decoration-color: #009fe6;
}

.envia-pill-header__actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

@media (min-width: 768px) {
	.envia-pill-header__actions {
		gap: 12px;
	}
}

.envia-pill-header__search {
	display: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #00122d;
	cursor: pointer;
}

.envia-pill-header__search svg {
	width: 18px;
	height: 18px;
}

@media (min-width: 768px) {
	.envia-pill-header__search {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
}

.envia-pill-header .registerButton,
.envia-pill-header .dashboardButton,
.envia-pill-header__login {
	display: none !important;
	width: auto !important;
	height: 36px;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0 16px !important;
	border: 0 !important;
	border-radius: 999px;
	/* Solid accent (#0074FF), no gradient and no glow. */
	background-color: #0074ff !important;
	background-image: none !important;
	box-shadow: none !important;
	color: #fff !important;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.02em;
	line-height: 1;
	white-space: nowrap;
	text-decoration: none !important;
	transition: filter 200ms ease-out;
}

@media (min-width: 768px) {
	/* .d-none comes from main.js when the visitor has a session (user_token): no "Regístrate" then. */
	.envia-pill-header .registerButton:not(.d-none),
	.envia-pill-header .dashboardButton:not(.d-none),
	.envia-pill-header__login:not(.d-none) {
		display: inline-flex !important;
	}
}

.envia-pill-header .registerButton:hover,
.envia-pill-header .dashboardButton:hover,
.envia-pill-header__login:hover {
	filter: brightness(1.1);
	color: #fff !important;
}

/* "Iniciar sesión" on the home's light blue (#edf2f9) with navy text, on every page. */
.envia-pill-header__login,
.envia-pill-header__login:hover {
	background-color: #edf2f9 !important;
	color: #00122d !important;
}

.envia-pill-header .dashboardButton svg {
	width: 14px;
	height: 14px;
}

/* The language flag and its panel: hidden on phones (the mobile menu has its own), from 768px a round flag. */
.envia-pill-header__lang {
	position: relative;
	display: none;
}

@media (min-width: 768px) {
	.envia-pill-header__lang {
		display: block;
	}
}

.envia-pill-header__flag {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	cursor: pointer;
}

.envia-pill-header__flag img {
	width: 32px;
	height: 32px;
	border-radius: 999px;
	object-fit: cover;
	box-shadow: 0 1px 4px rgba(0, 18, 45, 0.18);
	transition: transform 180ms ease-out;
}

.envia-pill-header__flag:hover img {
	transform: scale(1.06);
}

.envia-pill-header__langs {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 50;
	width: 250px;
	max-height: 360px;
	overflow: hidden;
	padding: 8px 0 0;
	border-radius: 5px;
	border-bottom: 3px solid #0074ff;
	background: #fff;
	box-shadow: 0 2px 29px rgba(0, 0, 0, 0.12);
}

.envia-pill-header__langs.is-open {
	display: block;
}

.envia-pill-header__langs-title {
	margin: 0 0 8px;
	padding: 0 16px;
	color: #00122d;
	font-size: 14px;
	font-weight: 500;
}

.envia-pill-header__langs-search {
	display: block;
	width: calc(100% - 16px);
	height: 36px;
	margin: 0 8px 8px;
	padding: 0 12px;
	border: 1px solid #e8edf5;
	border-radius: 6px;
	background: #f1f5fa;
	color: #00122d;
	font-size: 14px;
}

.envia-pill-header__langs-search:focus {
	border-color: #003875;
	outline: none;
}

.envia-pill-header #langSearch {
	max-height: 260px;
	overflow-y: auto;
	padding-bottom: 8px;
}

.envia-pill-header__langs-item {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 8px 16px;
	color: #00122d;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
}

.envia-pill-header__langs-item img {
	width: 20px;
	height: 20px;
	border-radius: 2px;
	object-fit: cover;
}

.envia-pill-header__langs-item:hover,
.envia-pill-header__langs-item.is-current {
	background: #f1f5fa;
	color: #00122d;
	text-decoration: none;
}

.envia-pill-header__langs-item.is-current {
	border-left: 3px solid #009fe6;
	padding-left: 13px;
}

@media (prefers-reduced-motion: reduce) {
	.envia-pill-header__login::after,
	.envia-pill-header .navigation-menu > ul > li > a {
		transition: none;
	}
}

/* Phones: sign-in (or the dashboard, with a session) stays in the pill, not only in the menu. */
@media (max-width: 767.98px) {
	.envia-pill-header .dashboardButton:not(.d-none),
	.envia-pill-header__login:not(.d-none) {
		display: inline-flex !important;
		height: 32px;
		padding: 0 12px !important;
		font-size: 13px;
	}
}
