/* ==========================================================================
   Cabecera: topbar, masthead, navegación translúcida y mega menús
   ========================================================================== */

/* Topbar */
.topbar { background: var(--ink); color: #E7E9EE; font-size: 12.5px; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 38px; gap: 18px; }
.topbar .ship { opacity: .8; }
.topbar .util { display: flex; align-items: center; gap: 26px; }
.topbar .util a { opacity: .85; transition: opacity var(--t); }
.topbar .util a:hover { opacity: 1; }
.pts-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 1px solid rgba(218, 191, 137, .45);
	border-radius: var(--r-pill);
	padding: 4px 13px;
	opacity: 1 !important;
	transition: background var(--t), border-color var(--t);
}
.pts-pill:hover { background: rgba(218, 191, 137, .12); border-color: var(--gold); }
.pts-pill .i { width: 9px; height: 9px; fill: var(--gold); stroke: none; }
.pts-pill b { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Masthead */
.masthead { background: var(--paper); }
.masthead .wrap { display: flex; align-items: center; gap: 40px; height: 92px; }
.logo { display: block; flex: none; color: var(--ink); }
.logo .logo-svg { height: 44px; width: auto; }

.site-search {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 0 6px 0 18px;
	height: 52px;
	transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.site-search .search-ico { color: var(--faint); font-size: 19px; }
.site-search:focus-within { background: var(--paper); border-color: var(--royal); box-shadow: var(--ring); }
.site-search input[type="search"] {
	flex: 1;
	min-width: 0;
	border: none;
	background: none;
	font-size: 15px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}
.site-search input::placeholder { color: var(--faint); }
.site-search input:focus-visible { box-shadow: none; }
.site-search .go {
	background: var(--navy);
	color: #fff;
	height: 40px;
	padding: 0 18px;
	border-radius: 10px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
	font-weight: 600;
	transition: background var(--t);
}
.site-search .go:hover { background: var(--ink); }
.site-search .go .i { font-size: 16px; }

.ico-actions { display: flex; align-items: center; gap: 2px; }
.ico-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	padding: 8px 14px;
	border-radius: var(--r-sm);
	font-size: 12px;
	font-weight: 500;
	color: var(--muted);
	transition: color var(--t), background var(--t);
}
.ico-btn:hover { color: var(--ink); background: var(--bg); }
.ico-btn > .i, .ico-btn .ico-wrap > .i { width: 23px; height: 23px; }
.ico-wrap { position: relative; display: inline-flex; }
.badge {
	position: absolute;
	top: -7px; right: -11px;
	background: var(--navy);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	min-width: 19px;
	height: 19px;
	display: grid;
	place-items: center;
	padding: 0 5px;
	line-height: 1;
	border-radius: var(--r-pill);
	border: 2px solid var(--paper);
	box-sizing: content-box;
}
.badge[hidden] { display: none; }

/* Cuenta: nombre del socio y menú rápido (solo con ratón o teclado; en táctil el botón abre Mi cuenta) */
.acct-menu { position: relative; z-index: 80; }
.acct-name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-pop {
	position: absolute;
	top: 100%;
	right: -8px;
	padding-top: 8px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity .18s, transform .18s var(--ease), visibility .18s;
}
.acct-menu:focus-within .acct-pop { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) {
	.acct-menu:hover .acct-pop { opacity: 1; visibility: visible; transform: none; }
}
.acct-box { width: 236px; padding: 16px 12px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.acct-hi { margin: 0 8px 10px; font-size: 15px; font-weight: 600; color: var(--ink); }
.acct-hi span { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.acct-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.acct-box a { display: block; padding: 7px 8px; border-radius: 8px; font-size: 14.5px; color: var(--muted); transition: color var(--t), background var(--t); }
.acct-box a:hover, .acct-box a:focus-visible { color: var(--ink); background: var(--bg); }
.acct-box .acct-out { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }

.burger { display: none; }

/* Navegación (translúcida y pegajosa) */
.mainnav {
	background: rgba(255, 255, 255, .88);
	-webkit-backdrop-filter: saturate(180%) blur(16px);
	backdrop-filter: saturate(180%) blur(16px);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 60;
}
.admin-bar .mainnav { top: 32px; }
.mainnav .wrap { display: flex; align-items: stretch; }
.nav-list { display: flex; align-items: stretch; list-style: none; margin: 0 0 0 -14px; padding: 0; }
.nav-item { position: relative; display: flex; align-items: center; }
.nav-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	height: 56px;
	padding: 0 16px;
	font-size: 15px;
	font-weight: 500;
	color: var(--ink);
	transition: color var(--t);
}
.nav-link::after {
	content: "";
	position: absolute;
	left: 16px; right: 16px; bottom: 0;
	height: 2px;
	background: var(--royal);
	border-radius: 2px 2px 0 0;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .25s var(--ease);
}
.nav-link.club { color: var(--gold-ink); }
.nav-link.club::before { content: ""; width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); border-radius: 1px; }
.nav-link .chev { width: 12px; height: 12px; color: var(--faint); transition: transform .2s; }
.nav-item:hover .nav-link,
.nav-item:focus-within .nav-link { color: var(--royal); }
.nav-item:hover .nav-link.club, .nav-item:focus-within .nav-link.club { color: var(--gold-ink); }
.nav-item:hover .nav-link::after,
.nav-item:focus-within .nav-link::after { transform: scaleX(1); }
.nav-item:hover .nav-link.club::after { background: var(--gold); }
.nav-item:hover .nav-link .chev { transform: rotate(180deg); }
.nav-right { margin-left: auto; display: flex; align-items: center; }
.nav-tag {
	font-size: 13px;
	font-weight: 600;
	color: var(--gold-ink);
	background: var(--gold-soft);
	border-radius: var(--r-pill);
	padding: 7px 16px;
	transition: background var(--t);
}
.nav-tag:hover { background: #EFE3C8; }

/* Mega menú */
.mega {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 1px;
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--shadow-lg);
	padding: 34px 36px;
	width: min(940px, 93vw);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .18s, transform .18s var(--ease), visibility .18s;
	z-index: 70;
}
.mega.mega-sm { width: min(680px, 93vw); }
.nav-item:hover .mega,
.nav-item:focus-within .mega,
.mega.open { opacity: 1; visibility: visible; transform: translateY(0); }
.mega-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1.2fr; gap: 36px; }
.mega-col h4 { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 0 0 16px; font-weight: 600; }
.mega-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mega-col a {
	font-size: 15px;
	color: var(--muted);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 7px 10px;
	margin: 0 -10px;
	border-radius: 8px;
	transition: color var(--t), background var(--t);
}
.mega-col a:hover { color: var(--ink); background: var(--bg); }
.mega-col a .ct { font-size: 12px; color: var(--faint); }
.mega-col a.all { color: var(--royal); font-weight: 600; margin-top: 6px; }
.mega-col a.all:hover { background: var(--royal-soft); }
.mega-feature {
	position: relative;
	overflow: hidden;
	border-radius: var(--r-md);
	padding: 22px;
	display: flex;
	flex-direction: column;
	background: linear-gradient(160deg, var(--navy-2), var(--navy) 60%, var(--ink));
	color: #fff;
}
.mega-feature::before {
	content: "";
	position: absolute;
	right: -60px; top: -60px;
	width: 180px; height: 180px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(218, 191, 137, .35), transparent 70%);
}
.mega-feature > * { position: relative; }
.mega-feature .tag { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.mega-feature h5 { font-size: 22px; font-weight: 300; margin: 10px 0 8px; line-height: 1.15; letter-spacing: -.02em; }
.mega-feature p { font-size: 13.5px; color: #B9C2D3; margin: 0 0 18px; }
.mega-feature .btn-mini {
	align-self: flex-start;
	background: var(--gold);
	color: var(--ink);
	font-size: 13px;
	font-weight: 600;
	padding: 10px 18px;
	border-radius: var(--r-sm);
	margin-top: auto;
	transition: background var(--t);
}
.mega-feature .btn-mini:hover { background: #E6CFA3; }

/* Vinos: cinco columnas (tipo, D.O., uva, ocasión, descubrir) y dos accesos destacados debajo */
.mega.mega-wide { width: min(1120px, 95vw); }
.mega-top.has-sale { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 28px; align-items: start; }
.mega-grid.mega-grid--5 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 24px; } /* 4 o 5 columnas según haya ocasiones */
.mega-promos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.mega-promo { position: relative; display: grid; gap: 4px; padding: 18px 22px; overflow: hidden; border-radius: var(--r-md); background: linear-gradient(160deg, var(--navy-2), var(--navy) 60%, var(--ink)); color: #fff; transition: transform var(--t); }
.mega-promo::before { content: ""; position: absolute; right: -50px; top: -60px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(218, 191, 137, .32), transparent 70%); }
.mega-promo + .mega-promo { background: var(--gold-soft); color: var(--ink); }
.mega-promo + .mega-promo::before { background: radial-gradient(circle, rgba(218, 191, 137, .5), transparent 70%); }
.mega-promo > * { position: relative; }
.mega-promo .tag { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.mega-promo + .mega-promo .tag { color: var(--gold-ink); }
.mega-promo b { font-size: 19px; font-weight: 400; letter-spacing: -.015em; }
.mega-promo span:last-child { font-size: 13.5px; color: #B9C2D3; }
.mega-promo + .mega-promo span:last-child { color: var(--muted); }
.mega-promo:hover { transform: translateY(-2px); }
.mega-sale { display: grid; align-content: start; gap: 12px; padding: 16px; border-radius: var(--r-md); background: var(--sale-soft); border: 1px solid var(--sale-line); }
.mega-sale-head { display: grid; justify-items: start; gap: 6px; }
.mega-sale-head .tag { padding: 3px 10px; border-radius: var(--r-pill); background: var(--sale); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.mega-sale-head b { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.mega-sale-all { font-size: 13.5px; font-weight: 600; color: var(--sale-ink); }
.mega-sale-head:hover .mega-sale-all { text-decoration: underline; text-underline-offset: 3px; }
.mega-sale-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; }
.mega-sale-list a { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; height: 100%; padding: 8px 10px 8px 8px; border-radius: 12px; background: var(--paper); transition: box-shadow var(--t); }
.mega-sale-list a:hover { box-shadow: var(--shadow-sm); }
.mega-sale-list img { grid-row: span 2; width: 44px; height: 56px; object-fit: contain; }
.mega-sale-off { position: absolute; top: 6px; left: 6px; padding: 1px 6px; border-radius: var(--r-pill); background: var(--sale); color: #fff; font-size: 10.5px; font-weight: 700; }
.mega-sale-name { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--ink); }
.mega-sale-price { font-size: 13px; font-weight: 700; color: var(--sale-ink); }
.mega-sale-price del { margin-right: 4px; font-weight: 400; color: var(--faint); }
.mega-sale-price ins { text-decoration: none; }

/* Responsive */
@media (max-width: 1080px) {
	.masthead .wrap { gap: 24px; }
	.mega-grid { grid-template-columns: 1fr 1fr 1.2fr; }
	.nav-link { padding: 0 12px; }
	.nav-link::after { left: 12px; right: 12px; }
}
@media (max-width: 1180px) and (min-width: 861px) {
	.nav-right { display: none; } /* El outlet sigue en Vinos › Descubrir › Ofertas y outlet */
}

@media (max-width: 860px) {
	.topbar .ship { display: none; }
	.topbar .wrap { justify-content: flex-end; }

	.masthead .wrap { flex-wrap: wrap; height: auto; gap: 12px 12px; padding-top: 14px; padding-bottom: 14px; }
	.logo { margin-right: auto; }
	.logo .logo-svg { height: 36px; }
	.site-search { order: 3; flex: 1 1 100%; height: 48px; }
	.site-search .go span { display: none; }
	.site-search .go { padding: 0 14px; }
	.ico-btn > span:not(.ico-wrap) { display: none; } /* Solo el texto: el contador de la cesta va dentro de .ico-wrap. */
	.ico-btn { padding: 10px; }
	.burger { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 22px; }

	.mainnav .wrap { flex-wrap: wrap; padding: 0; }
	.nav-list {
		display: none;
		position: absolute;
		top: 100%; left: 0; right: 0;
		flex-direction: column;
		margin: 0;
		background: var(--paper);
		border-bottom: 1px solid var(--line);
		box-shadow: var(--shadow-md);
		padding: 8px var(--gutter) 16px;
		max-height: calc(100vh - 140px);
		overflow-y: auto;
	}
	.nav-list.open { display: flex; }
	.nav-item { flex-direction: column; align-items: stretch; }
	.nav-link { height: auto; padding: 16px 0; width: 100%; justify-content: space-between; border-bottom: 1px solid var(--line); }
	.nav-link::after { display: none; }
	.mega { position: static; width: 100% !important; border: none; border-radius: 0; box-shadow: none; padding: 14px 0 18px; display: none; transform: none; margin: 0; }
	.mega.open { display: block; opacity: 1; visibility: visible; }
	.nav-item:hover .mega:not(.open), .nav-item:focus-within .mega:not(.open) { opacity: 0; visibility: hidden; }
	.mega-grid { grid-template-columns: 1fr 1fr !important; gap: 22px; }
	.mega-feature { grid-column: 1 / -1; }
	.mega-promos { grid-template-columns: minmax(0, 1fr); margin-top: 18px; padding-top: 16px; }
	.mega-top.has-sale { grid-template-columns: minmax(0, 1fr); }
	.nav-right { display: none; }
}

@media (max-width: 560px) {
	.mega-grid { grid-template-columns: 1fr !important; }
	.topbar .util { gap: 16px; white-space: nowrap; font-size: 12px; }
	.topbar .util > a:first-child, .topbar .util > a:last-child { display: none; }
	/* Cuenta, favoritos, cesta y menú caben junto al logo desde 360 px. */
	.ico-actions { gap: 0; }
	.ico-btn { padding: 9px 8px; }
	.burger { width: 44px; height: 44px; }
}
