/*
 * Casetti header (template-parts/layout/site-header.php, inc/site/header.php): the announcement bar, the sticky header
 * (logo · menu · icons), the account block, the phone's welcome strip and menu drawer. The live shop's Elementor header
 * templates 47 (front page: over the hero, white) and 49 (other pages: white), Additional CSS 192–502.
 * --casetti-header-h: the header's height (header.js keeps it exact): the front page's hero reads it.
 */

:root {
	--casetti-header-h: 68px;
	scroll-padding-top: var(--casetti-header-h); /* A target or focused element is not hidden under the sticky header. */
}

:root:has(.site-header--overlay) {
	--casetti-header-h: 63px;
}

/* ---------- Announcement bar ---------- */

.c-topbar {
	position: relative;
	z-index: calc(var(--myco-z-header) + 1);
	display: flex;
	overflow: hidden;
	background: var(--myco-color-accent);
	color: var(--casetti-ink);
	user-select: none;
}

.c-topbar__track {
	display: flex;
	flex: 1 0 100%;
	min-width: 0;
}

.c-topbar__group {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: space-around;
	min-width: 100%;
	margin: 0;
	padding: 9px 0;
	list-style: none;
	white-space: nowrap;
	animation: c-topbar-marquee calc(var(--c-topbar-items, 8) * 28s / 6) linear infinite;
	will-change: transform;
}

.c-topbar__item {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 0 0 0 1.9rem; /* The separator ends each message; the next one's padding follows it. */
	font: 600 13px/1.25 var(--myco-font-sans);
	letter-spacing: 0.02em;
}

.c-topbar__item .c-icon {
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	stroke-width: 1.8;
	opacity: 0.85;
}

.c-topbar__sep {
	margin-inline-start: calc(1.9rem - 7px);
	font-size: 10px;
	line-height: 1;
	opacity: 0.4;
}

/* Paused: hovering, keyboard focus in the bar, or the pause button (kept for the visit: html.casetti-topbar-paused). */
.c-topbar:hover .c-topbar__group,
.c-topbar:focus-within .c-topbar__group,
.c-topbar.is-paused .c-topbar__group,
.casetti-topbar-paused .c-topbar__group {
	animation-play-state: paused;
}

.c-topbar__pause {
	position: absolute;
	inset-block: 0;
	inset-inline-end: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	padding: 0;
	border: 0;
	background: var(--myco-color-accent);
	box-shadow: -14px 0 12px var(--myco-color-accent);
	color: var(--casetti-ink);
	cursor: pointer;
}

.c-topbar__pause:focus-visible {
	outline: 2px solid var(--casetti-ink);
	outline-offset: -4px;
}

.c-topbar__icon-play,
.c-topbar.is-paused .c-topbar__icon-pause,
.casetti-topbar-paused .c-topbar__icon-pause {
	display: none;
}

.c-topbar.is-paused .c-topbar__icon-play,
.casetti-topbar-paused .c-topbar__icon-play {
	display: block;
}

html:not(.js) .c-topbar__pause {
	display: none;
}

@keyframes c-topbar-marquee {
	from { transform: translateX(0); }
	to { transform: translateX(-100%); }
}

@media (min-width: 768px) {
	.c-topbar__item {
		padding-inline-start: 2.4rem;
		font-size: 14px;
	}

	.c-topbar__sep {
		margin-inline-start: calc(2.4rem - 7px);
	}

	.c-topbar__group {
		animation-duration: calc(var(--c-topbar-items, 8) * 38s / 6);
	}
}

/* Reduced motion: the bar stands still, centred, one group; no button needed. */
@media (prefers-reduced-motion: reduce) {
	.c-topbar__group {
		justify-content: center;
		animation: none;
	}

	.c-topbar__group[aria-hidden="true"],
	.c-topbar__pause {
		display: none;
	}
}

/* ---------- Header ---------- */

.site-header {
	position: sticky;
	z-index: var(--myco-z-header);
	top: 0;
	background: var(--myco-color-bg);
	color: var(--casetti-ink-strong);
	transition: background-color 0.3s ease;
}

.admin-bar .site-header {
	top: var(--wp-admin--admin-bar--height, 0px);
}

@media (max-width: 600px) {
	.admin-bar .site-header {
		top: 0; /* WordPress's bar scrolls away on phones. */
	}
}

/* Front page: transparent and white over the hero (the hero pulls itself up under the header with
   margin-top: calc(-1 * var(--casetti-header-h)), home.css); dark once scrolled. */
.site-header--overlay {
	border-bottom: 1px solid var(--myco-color-border);
	background: transparent;
	color: var(--myco-color-white);
}

.site-header--overlay.is-scrolled {
	background: rgba(16, 12, 9, 0.93);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 68px;
}

.site-header--overlay .site-header__inner {
	min-height: 62px;
}

.c-logo {
	display: inline-flex;
	flex: 0 1 auto;
	align-items: center;
	min-width: 0;
	margin-inline-end: auto;
	line-height: 0;
	text-decoration: none;
}

.c-logo__img {
	width: 150px;
	max-width: 100%;
	height: auto;
}

.site-header--overlay .c-logo__img {
	width: 152px;
}

.c-logo__name {
	color: inherit;
	font: 700 1.1rem/1.2 var(--myco-font-sans);
}

/* The menu button (phones): three thin lines, the bottom one shorter (757164); a thin × while open. */
.site-header__toggle {
	position: relative;
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	order: -1;
	width: 40px;
	min-width: 0;
	height: 40px;
	min-height: 0;
	margin-inline-start: -8px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.site-header__toggle:active {
	opacity: 0.55;
}

.site-header__toggle-line,
.site-header__toggle-line::before,
.site-header__toggle-line::after {
	display: block;
	width: 22px;
	height: 1.6px;
	border-radius: 2px;
	background: currentColor;
	transition: transform var(--myco-transition), background-color var(--myco-transition);
}

.site-header__toggle-line::before,
.site-header__toggle-line::after {
	content: "";
	position: absolute;
}

.site-header__toggle-line::before {
	transform: translateY(-6.5px);
}

.site-header__toggle-line::after {
	width: 14px;
	transform: translateY(6.5px);
}

.site-header__toggle[aria-expanded="true"] .site-header__toggle-line {
	background: transparent;
}

.site-header__toggle[aria-expanded="true"] .site-header__toggle-line::before {
	width: 20px;
	transform: rotate(45deg);
}

.site-header__toggle[aria-expanded="true"] .site-header__toggle-line::after {
	width: 20px;
	transform: rotate(-45deg);
}

/* Without JS the menu is a plain row, the button hidden. */
html:not(.js) .site-header__toggle {
	display: none;
}

/* Menus in general (footer and fallback lists use .menu too). */
.menu {
	display: flex;
	flex-direction: column;
	gap: var(--myco-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.menu a {
	display: inline-flex;
	align-items: center;
	min-height: 2.6rem;
	color: var(--myco-color-primary);
	font-weight: 600;
	text-decoration: none;
}

.menu a:hover {
	color: var(--myco-color-accent);
}

.site-header .site-header__menu {
	gap: 0;
}

.site-header .site-header__menu a {
	color: inherit;
	font: 400 14px/1.3 var(--myco-font-sans);
}

.site-header .site-header__menu a:hover {
	color: var(--myco-color-accent);
}

.site-header .site-header__menu a:focus-visible {
	outline-offset: -2px;
}

body.has-open-menu {
	overflow: hidden;
}

/* The icons on the right: 40 px buttons, thin line icons; hover a light square (on the front page a white veil). */
.site-header__actions {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 4px;
}

.site-header .site-header__action {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	min-width: 40px;
	height: 40px;
	min-height: 40px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.site-header .site-header__action:hover,
.site-header .site-header__action:focus-visible {
	background: #f5f5f5;
	color: inherit;
}

.site-header--overlay .site-header__action:hover,
.site-header--overlay .site-header__action:focus-visible {
	background: rgba(255, 255, 255, 0.14);
}

.site-header .site-header__action svg {
	width: 22px;
	height: 22px;
}

.site-header .site-header__action svg [stroke-width] {
	stroke-width: 1.6;
}

.myco-header-search {
	display: flex;
}

/* Counts: the live shop's red badge. */
.site-header .myco-cart-count,
.site-header .myco-wishlist-count {
	position: absolute;
	inset-block-start: 3px;
	inset-inline-end: 2px;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--casetti-heart);
	color: var(--myco-color-white);
	font: 600 10px/17px var(--myco-font-sans);
	text-align: center;
}

.site-header .myco-cart-count[hidden],
.site-header .myco-wishlist-count[hidden] {
	display: none;
}

/* The support button's dot: grey, green while the shop is open (support.js). */
.c-support-open__dot {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-end: 7px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #b9b0a2;
	box-shadow: 0 0 0 2px var(--myco-color-white);
}

.c-support-open.is-online .c-support-open__dot {
	background: var(--casetti-online);
}

.site-header--overlay .c-support-open__dot {
	box-shadow: none;
}

/* ---------- Account block ---------- */

.c-account {
	position: relative;
}

.site-header .c-account__link {
	gap: 8px;
	width: auto;
	padding: 0 8px;
}

.c-account__text {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
	text-align: start;
}

.c-account__text small {
	color: #757575;
	font-size: 11px;
	letter-spacing: 0.02em;
}

.c-account__text strong {
	max-width: 90px;
	overflow: hidden;
	color: var(--casetti-ink-strong);
	font-size: 13px;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.site-header--overlay .c-account__text small {
	color: rgba(255, 255, 255, 0.75);
}

.site-header--overlay .c-account__text strong {
	color: var(--myco-color-white);
}

.site-header .c-account__link .c-account__chev {
	display: none;
	flex: none;
	width: 12px;
	height: 12px;
	color: #888;
}

.site-header--overlay .c-account__chev {
	color: rgba(255, 255, 255, 0.75);
}

.c-account.is-user .c-account__chev {
	display: block;
}

.c-account__menu {
	position: absolute;
	z-index: 2;
	inset-block-start: 100%;
	inset-inline-end: 0;
	min-width: 200px;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	border: 1px solid #eee;
	border-radius: 8px;
	background: var(--myco-color-white);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.2s, transform 0.2s, visibility 0s linear 0.2s;
}

.c-account:hover .c-account__menu,
.c-account:focus-within .c-account__menu {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.2s, transform 0.2s, visibility 0s;
}

.c-account__menu a {
	display: block;
	padding: 9px 18px;
	color: var(--casetti-ink-strong);
	font-size: 14px;
	text-decoration: none;
}

.c-account__menu a:hover {
	background: #f7f7f7;
	color: var(--casetti-ink-strong);
}

.c-account__menu .c-account__out {
	margin-top: 6px;
	padding-top: 12px;
	border-top: 1px solid #eee;
	color: #757575; /* Live #888: 3.5:1. */
}

/* ---------- Welcome strip (phones) ---------- */

.c-welcome {
	display: none;
}

/* ---------- Phones and tablets: menu button · logo · search · support · heart · cart; the strip below ---------- */

@media (max-width: 899.98px) {
	:root {
		--casetti-header-h: 105px;
	}

	:root:has(.site-header--overlay) {
		--casetti-header-h: 97px;
	}

	.site-header__inner {
		gap: 6px;
		min-height: 69px;
	}

	.site-header--overlay .site-header__inner {
		min-height: 60px;
	}

	.c-logo {
		margin-inline-end: auto;
	}

	.site-header__actions {
		gap: 0;
	}

	.site-header .site-header__action {
		width: 36px;
		min-width: 36px;
		height: 36px;
		min-height: 36px;
	}

	.c-account {
		display: none;
	}

	.c-welcome {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		height: 36px;
		padding: 0 16px;
		border-top: 1px solid #ececec;
		background: #f6f5f2;
		color: #666;
		font: 400 13px/1.2 var(--myco-font-sans);
		text-decoration: none;
	}

	.c-welcome:hover {
		color: #666;
	}

	.c-welcome__hi {
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.c-welcome strong {
		color: var(--casetti-ink-strong);
		font-weight: 600;
	}

	.c-welcome__go {
		flex: none;
		color: var(--casetti-ink-strong);
		font-size: 12.5px;
	}

	.c-welcome.is-user .c-welcome__go strong {
		font-weight: 400;
	}

	.site-header--overlay .c-welcome {
		border-top-color: rgba(255, 255, 255, 0.15);
		background: rgba(0, 0, 0, 0.35);
		color: rgba(255, 255, 255, 0.8);
	}

	.site-header--overlay .c-welcome strong,
	.site-header--overlay .c-welcome__go {
		color: var(--myco-color-white);
	}

	/* The menu: a drawer from the right, full height (light; dark on the front page), as the live JetNav panel. */
	html.js .site-header__nav {
		position: fixed;
		z-index: 1;
		inset: 0 0 0 auto;
		width: min(312px, 80vw);
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 50px 0 calc(var(--casetti-mobile-nav-h) + 24px + env(safe-area-inset-bottom));
		background: #e5e5e5;
		box-shadow: 0 0 26px 1px rgba(0, 0, 0, 0.3);
		color: var(--casetti-ink);
		visibility: hidden;
		transform: translateX(100%);
		transition: transform 0.3s ease, visibility 0s linear 0.3s;
	}

	html.js .site-header--overlay .site-header__nav {
		background: var(--casetti-ink);
		color: var(--myco-color-white);
	}

	html.js .site-header__nav.is-open {
		visibility: visible;
		transform: none;
		transition: transform 0.3s ease, visibility 0s;
	}

	.site-header .site-header__menu a {
		display: flex;
		min-height: 51px;
		padding: 0 34px;
		font-size: 17px;
	}

	html:not(.js) .site-header__inner {
		flex-wrap: wrap;
	}

	html:not(.js) .site-header__nav {
		order: 9;
		flex: 1 0 100%;
	}

	html:not(.js) .site-header__menu {
		flex-flow: row wrap;
	}
}

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
	body.has-open-menu {
		overflow: auto;
	}

	.c-mnav {
		display: none; /* The phone's bottom bar (its stylesheet loads for narrow screens only). */
	}

	.site-header__toggle {
		display: none;
	}

	.site-header--overlay .c-logo__img {
		width: 195px;
	}

	.c-logo {
		flex: 0 0 auto;
		margin-inline-end: 0;
	}

	.site-header__nav {
		flex: 1 1 auto;
		min-width: 0;
		margin-inline-start: 18px;
	}

	.site-header--overlay .site-header__nav {
		margin-inline-start: 21px;
	}

	.site-header .site-header__menu {
		flex-flow: row wrap;
		align-items: center;
	}

	.site-header .site-header__menu a {
		min-height: 40px;
		padding: 0 12px;
	}

	.site-header--overlay .site-header__menu a {
		padding: 0 9px;
	}
}

/* A narrow desktop: only the person icon (the live 1025–1129 px rule). */
@media (min-width: 900px) and (max-width: 1129.98px) {
	.c-account__text,
	.site-header .c-account__link .c-account__chev {
		display: none !important; /* Beats .c-account.is-user's arrow. */
	}

	.site-header .c-account__link {
		width: 40px;
		padding: 0;
	}

	.site-header .site-header__menu a,
	.site-header--overlay .site-header__menu a {
		padding: 0 7px;
	}
}
