/* ==========================================================================
   Barra superior
   ========================================================================== */

.tw-topbar {
	background: var(--tw-navy);
	color: #FFFFFF;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
}

.tw-topbar__inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px 28px;
	padding-block: 10px;
}

.tw-topbar__item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.tw-topbar__item .tw-icon {
	color: var(--tw-gold);
}

/* ==========================================================================
   Cabecera — escritorio (≥ 1200px)
   ========================================================================== */

.tw-header {
	position: relative;
	z-index: 40;
	background: var(--tw-surface);
	border-bottom: 1px solid var(--tw-border);
}

.tw-header__inner {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 12px 32px;
	padding-block: 12px;
}

.tw-header__toggle {
	display: none;
}

/* Marca */
body.twog .tw-brand {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 14px;
	color: var(--tw-navy);
	text-decoration: none;
}

.tw-brand__logo {
	display: block;
	width: 64px;
	height: 56px;
	object-fit: contain;
}

.tw-brand__text {
	display: flex;
	flex-direction: column;
	padding-left: 14px;
	border-left: 1px solid var(--tw-border);
	line-height: 1.15;
}

.tw-brand__name {
	font-family: var(--tw-font-display);
	font-size: 24px;
	font-weight: 400;
}

.tw-brand__tag {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--tw-muted);
}

/* Navegación */
.tw-nav {
	flex: 1 0 auto;
}

.tw-nav__list {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tw-nav__item {
	margin: 0;
}

body.twog .tw-nav__link {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: var(--tw-tap);
	padding: 0 16px;
	border: 1px solid transparent;
	border-radius: var(--tw-r-pill);
	color: var(--tw-navy);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}

body.twog .tw-nav__item[class*="lic-"] > .tw-nav__link {
	font-weight: 700;
}

body.twog .tw-nav__link:hover,
body.twog .tw-nav__link:focus {
	background: var(--tw-bg);
	color: var(--tw-navy);
}

/* Elemento activo: con los colores de su licencia si la tiene */
body.twog .tw-nav__item.current-menu-item > .tw-nav__link,
body.twog .tw-nav__item.current-menu-ancestor > .tw-nav__link,
body.twog .tw-nav__item.current-product_cat-ancestor > .tw-nav__link {
	background: var(--lic-soft, var(--tw-blue-soft));
	color: var(--lic-soft-fg, var(--tw-blue));
	font-weight: 800;
}

/* Acciones: búsqueda, cuenta, carrito */
.tw-header__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 1 344px;
	min-width: 0;
}

.tw-search {
	display: flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	flex: 1 1 auto;
	min-width: 150px;
	height: var(--tw-tap);
	padding: 0 16px;
	border: 1px solid var(--tw-border);
	border-radius: var(--tw-r-pill);
	background: var(--tw-bg);
	color: var(--tw-muted);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.tw-search:focus-within {
	border-color: var(--tw-blue);
	box-shadow: 0 0 0 3px rgba(1, 106, 172, .15);
}

/* Supera los estilos de input[type=search] de GeneratePress */
.tw-search input[type="search"],
.tw-search input[type="search"]:focus {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--tw-navy);
	font: inherit;
	font-size: 14px;
	outline: none;
}

.tw-search input[type="search"]::placeholder {
	color: var(--tw-muted);
	opacity: 1;
}

.tw-search input[type="search"]::-webkit-search-decoration {
	-webkit-appearance: none;
}

.tw-cart-count {
	position: absolute;
	top: -4px;
	right: -4px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: var(--tw-r-pill);
	background: var(--tw-gold);
	color: var(--tw-navy);
	font-size: 12px;
	font-weight: 800;
	line-height: 1;
}

.tw-cart-count[data-count="0"] {
	display: none;
}

/* ==========================================================================
   Cabecera — móvil y tablet (< 1200px)
   Fila 1: menú · marca · carrito | Fila 2: búsqueda | Fila 3: chips
   ========================================================================== */

@media (max-width: 1199.98px) {
	.tw-topbar {
		font-size: 12px;
	}

	.tw-topbar__inner {
		padding-block: 9px;
	}

	.tw-topbar__item:not(:first-child) {
		display: none;
	}

	.tw-header__inner {
		display: grid;
		grid-template-columns: var(--tw-tap) minmax(0, 1fr) var(--tw-tap);
		grid-template-areas:
			"toggle brand cart"
			"search search search"
			"nav nav nav";
		gap: 10px 8px;
		padding-block: 10px 12px;
	}

	.tw-header__toggle {
		display: inline-flex;
		grid-area: toggle;
	}

	body.twog .tw-brand {
		grid-area: brand;
		justify-self: center;
		gap: 10px;
	}

	.tw-brand__logo {
		width: 50px;
		height: 44px;
	}

	.tw-brand__text {
		padding-left: 10px;
	}

	.tw-brand__name {
		max-width: 5.4em;
		font-size: 19px;
		line-height: 1.05;
	}

	.tw-brand__tag {
		display: none;
	}

	.tw-header__actions {
		display: contents;
	}

	.tw-search {
		grid-area: search;
		height: 46px;
	}

	/* 16px evita el zoom automático de iOS al enfocar */
	.tw-search input[type="search"],
	.tw-search input[type="search"]:focus {
		font-size: 16px;
	}

	.tw-header__account {
		display: none;
	}

	.tw-cart-link {
		grid-area: cart;
	}

	/* Chips con scroll horizontal hasta el borde de la pantalla */
	.tw-nav {
		grid-area: nav;
		margin-inline: calc(var(--tw-gutter) * -1);
		overflow-x: auto;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.tw-nav::-webkit-scrollbar {
		display: none;
	}

	.tw-nav__list {
		flex-wrap: nowrap;
		gap: 8px;
		width: max-content;
		padding-inline: var(--tw-gutter);
	}

	body.twog .tw-nav__link {
		min-height: 42px;
		border-color: var(--tw-border);
		font-size: 14px;
	}

	body.twog .tw-nav__item[class*="lic-"] > .tw-nav__link,
	body.twog .tw-nav__item[class*="lic-"] > .tw-nav__link:hover,
	body.twog .tw-nav__item[class*="lic-"] > .tw-nav__link:focus {
		border-color: transparent;
		background: var(--lic-main);
		color: var(--lic-on-main);
	}
}

/* ==========================================================================
   Menú lateral móvil
   ========================================================================== */

.tw-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000;
	visibility: hidden;
	transition: visibility 0s linear .25s;
}

.tw-drawer.is-open {
	visibility: visible;
	transition-delay: 0s;
}

body.twog .tw-drawer__overlay,
body.twog .tw-drawer__overlay:hover,
body.twog .tw-drawer__overlay:focus {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: rgba(14, 34, 64, .55);
	opacity: 0;
	cursor: pointer;
	transition: opacity .2s ease;
}

.tw-drawer.is-open .tw-drawer__overlay {
	opacity: 1;
}

.tw-drawer__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	box-sizing: border-box;
	width: min(320px, 86vw);
	padding: 12px 16px 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--tw-surface);
	transform: translateX(-100%);
	transition: transform .25s var(--tw-ease);
}

.tw-drawer.is-open .tw-drawer__panel {
	transform: none;
}

.tw-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 8px;
}

.tw-drawer__logo {
	display: block;
	width: 50px;
	height: 44px;
	object-fit: contain;
}

.tw-drawer__label {
	margin: 0;
	padding-top: 16px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--tw-muted);
}

.tw-drawer__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tw-drawer__item {
	margin: 0;
}

body.twog .tw-drawer__link {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	border-bottom: 1px solid var(--tw-border);
	color: var(--tw-navy);
	font-size: 17px;
	font-weight: 600;
	text-decoration: none;
}

body.twog .tw-drawer__link:hover,
body.twog .tw-drawer__link:focus {
	color: var(--tw-blue);
}

body.twog .tw-drawer__link--icon {
	font-size: 16px;
}

body.twog .tw-drawer__item[class*="lic-"] > .tw-drawer__link {
	font-weight: 700;
}

/* Punto de color de la licencia */
.tw-drawer__item[class*="lic-"] > .tw-drawer__link::before {
	content: "";
	flex: 0 0 12px;
	width: 12px;
	height: 12px;
	border-radius: var(--tw-r-pill);
	background: var(--lic-main);
	box-shadow: inset 0 0 0 1px var(--lic-dot-ring);
}

.tw-drawer__item.current-menu-item > .tw-drawer__link,
.tw-drawer__item.current-menu-ancestor > .tw-drawer__link {
	color: var(--lic-soft-fg, var(--tw-blue));
}

.tw-drawer__foot {
	margin: 24px 0 0;
	font-size: 13px;
	color: var(--tw-muted);
}

@media (min-width: 1200px) {
	.tw-drawer {
		display: none;
	}
}
