/**
 * FLUXX — navigation, drawers and the search overlay.
 *
 * Reads tokens.css.
 */

/* ---------------------------------------------------------- primary nav */

.fx-header__nav ul {
	display: flex;
	align-items: center;
	gap: 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.fx-header__nav li {
	position: relative;
}

.fx-header__nav a {
	display: inline-flex;
	align-items: center;
	height: var(--fx-header-h-md);
	font-size: 12px;
	font-weight: var(--fx-weight-medium);
	letter-spacing: var(--fx-tracking-nav);
	text-transform: uppercase;
	white-space: nowrap;
}

/*
 * The underline grows from the left rather than appearing all at once.
 * A border that blinks on hover reads as a state change; one that draws reads
 * as a response.
 */
.fx-header__nav > ul > li > a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 22px;
	width: 100%;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform var(--fx-dur-exit) var(--fx-ease);
}

.fx-header__nav > ul > li:hover > a::after,
.fx-header__nav > ul > li.current-menu-item > a::after {
	transform: scaleX(1);
}

/* --------------------------------------------------------- the sub menu */

.fx-header__nav .sub-menu {
	position: absolute;
	top: 100%;
	inset-inline-start: -16px;
	z-index: var(--fx-z-header);
	display: grid;
	gap: 0;
	min-width: 200px;
	padding: 8px 0;
	background: var(--fx-paper);
	border: 1px solid var(--fx-border);
	box-shadow: var(--fx-shadow-panel);
	/* Hidden by opacity rather than display, so it can animate and so its links
	   stay in the document for crawlers. */
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity var(--fx-dur-exit) var(--fx-ease),
		transform var(--fx-dur-exit) var(--fx-ease),
		visibility var(--fx-dur-exit);
}

.fx-header__nav li:hover > .sub-menu,
.fx-header__nav li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.fx-header__nav .sub-menu a {
	height: auto;
	padding: 9px 20px;
	width: 100%;
	text-transform: none;
	letter-spacing: var(--fx-tracking-body);
	font-size: 13px;
	font-weight: var(--fx-weight-regular);
}

.fx-header__nav .sub-menu a:hover {
	background: var(--fx-surface);
	color: var(--fx-ink);
}

/* --------------------------------------------------------- menu drawer */

/* The menu opens from the leading edge; the bag from the trailing one. */
.fx-drawer--start {
	inset-inline: 0 auto;
	animation-name: fx-slide-in-start;
}

.fx-drawer--start.is-closing {
	animation-name: fx-panel-out-start;
}

@keyframes fx-slide-in-start {
	from { transform: translateX(-100%); opacity: 0; }
	to   { transform: translateX(0); opacity: 1; }
}

@keyframes fx-panel-out-start {
	from { transform: translateX(0); opacity: 1; }
	to   { transform: translateX(-24px); opacity: 0; }
}

.fx-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin-inline-end: -8px;
	color: var(--fx-ink);
}

.fx-drawer__nav {
	display: grid;
	margin: 0;
	padding: 0;
	list-style: none;
}

.fx-drawer__nav li {
	border-bottom: 1px solid var(--fx-border);
}

.fx-drawer__nav a {
	display: block;
	padding: 15px 0;
	font-size: 15px;
	letter-spacing: var(--fx-tracking-body);
}

.fx-drawer__nav--small a {
	padding: 11px 0;
	font-size: 13px;
	color: var(--fx-text-muted);
}

.fx-drawer__aside {
	margin-top: 28px;
}

/* --------------------------------------------------------- bag drawer */

.fx-drawer .woocommerce-mini-cart {
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * WooCommerce nests the thumbnail and the product name inside ONE anchor, then
 * emits the quantity as a sibling. Gridding the row itself therefore puts the
 * whole anchor in column one and the quantity alone in column two — the name
 * wraps to 76px and the quantity floats above it.
 *
 * So the row is a plain block, the anchor is the grid, and the quantity is
 * indented to line up under the name.
 */
.fx-drawer .woocommerce-mini-cart-item {
	position: relative;
	display: block;
	padding: 14px 0;
	border-bottom: 1px solid var(--fx-border);
}

.fx-drawer .woocommerce-mini-cart-item > a:not(.remove) {
	display: grid;
	grid-template-columns: 76px minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	/* Clear the absolutely-positioned remove button. */
	padding-inline-end: 28px;
	font-size: 13px;
	font-weight: var(--fx-weight-bold);
	line-height: 1.35;
}

.fx-drawer .woocommerce-mini-cart-item img {
	width: 76px;
	aspect-ratio: var(--fx-product-ratio);
	object-fit: cover;
	background: var(--fx-media-ground);
	/* WooCommerce floats this image; the grid handles placement instead. */
	float: none !important;
	margin: 0 !important;
}

.fx-drawer .woocommerce-mini-cart-item .quantity {
	display: block;
	/* 76px thumbnail plus the 12px gap, so it aligns under the name. */
	margin: 6px 0 0 88px;
	font-size: 12px;
	color: var(--fx-text-muted);
}

.fx-drawer .woocommerce-mini-cart-item .variation {
	margin: 4px 0 0 88px;
	font-size: 11px;
	color: var(--fx-text-muted);
}

.fx-drawer .woocommerce-mini-cart-item .variation dt,
.fx-drawer .woocommerce-mini-cart-item .variation dd {
	display: inline;
	margin: 0;
}

.fx-drawer .woocommerce-mini-cart-item .remove_from_cart_button {
	position: absolute;
	top: 14px;
	inset-inline-end: 0;
	width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0;
	color: var(--fx-text-muted);
}

.fx-drawer .woocommerce-mini-cart-item .remove_from_cart_button::after {
	content: "";
	width: 13px;
	height: 13px;
	background: currentColor;
	mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M22.5 7.5l-15 15m0-15l15 15'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* -------------------------------------------------- free shipping progress */

.fx-shipping-progress {
	margin-bottom: 14px;
	padding: 12px;
	background: var(--fx-sand);
}

.fx-shipping-progress__text {
	margin: 0 0 8px;
	font-size: 12px;
}

.fx-shipping-progress__track {
	height: 3px;
	background: rgba(11, 11, 11, .12);
	overflow: hidden;
}

.fx-shipping-progress__track span {
	display: block;
	height: 100%;
	background: var(--fx-ink);
	transition: width var(--fx-dur-enter) var(--fx-ease);
}

.fx-drawer .woocommerce-mini-cart__total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 16px 0;
	padding-top: 14px;
	border-top: 1px solid var(--fx-border);
	font-size: 14px;
	font-weight: var(--fx-weight-bold);
}

.fx-drawer .woocommerce-mini-cart__buttons {
	display: grid;
	gap: 8px;
	margin: 0;
}

/*
 * The mini-cart emits two plain links. Style them as the primary and secondary
 * buttons rather than leaving WooCommerce's defaults, which we dequeued.
 */
.fx-drawer .woocommerce-mini-cart__buttons a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: var(--fx-control-cta);
	padding-inline: 20px;
	border: 1px solid var(--fx-ink);
	background: transparent;
	color: var(--fx-ink);
	font-size: 13px;
	font-weight: var(--fx-weight-bold);
	letter-spacing: var(--fx-tracking-cta);
	text-transform: uppercase;
	transition: background-color var(--fx-dur) var(--fx-ease), color var(--fx-dur) var(--fx-ease);
}

.fx-drawer .woocommerce-mini-cart__buttons a.checkout {
	background: var(--fx-ink);
	color: var(--fx-text-on-dark);
	/* Checkout is the action; view-bag is the escape hatch. Order them so. */
	order: -1;
}

.fx-drawer .woocommerce-mini-cart__buttons a:hover {
	background: var(--fx-ink-hover);
	color: var(--fx-text-on-dark);
}

.fx-drawer .woocommerce-mini-cart__empty-message {
	padding: 32px 0;
	text-align: center;
	color: var(--fx-text-muted);
}

/* ------------------------------------------------------- search overlay */

.fx-search-overlay {
	position: fixed;
	inset: 0;
	z-index: var(--fx-z-modal);
	display: flex;
	flex-direction: column;
	background: var(--fx-ink);
	color: var(--fx-text-on-dark);
	animation: fx-fade-in var(--fx-dur-exit) var(--fx-ease-out) both;
}

.fx-search-overlay.is-closing {
	animation: fx-fade-out var(--fx-dur-exit) var(--fx-ease-in) both;
}

.fx-search-overlay__head {
	padding-block: 18px;
	border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.fx-search-overlay__bar {
	display: flex;
	align-items: center;
	gap: 16px;
}

.fx-search-overlay__bar .fx-search {
	flex: 1 1 auto;
	min-width: 0;
}

/* On the dark overlay the field is borderless and the type is large. */
.fx-search-overlay .fx-search__field {
	height: auto;
	padding: 0;
	border: 0;
	background: transparent;
}

.fx-search-overlay .fx-search__input {
	font-size: 20px;
	color: var(--fx-text-on-dark);
}

.fx-search-overlay .fx-search__input::placeholder {
	color: rgba(255, 255, 255, .45);
}

.fx-search-overlay .fx-search__icon,
.fx-search-overlay .fx-search__submit {
	color: var(--fx-text-on-dark);
}

.fx-search-overlay__close {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	color: var(--fx-text-on-dark);
}

.fx-search-overlay__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding-block: 28px;
}

.fx-search-overlay__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.fx-search-overlay__chips .fx-pill {
	background: transparent;
	border-color: rgba(255, 255, 255, .35);
	color: var(--fx-text-on-dark);
}

.fx-search-overlay__chips .fx-pill:hover {
	background: var(--fx-paper);
	border-color: var(--fx-paper);
	color: var(--fx-ink);
}

/* Predictive results, injected by fluxx.js. */
.fx-search-overlay__results {
	display: grid;
	gap: 2px;
	margin-top: 24px;
}

.fx-search-result {
	display: grid;
	grid-template-columns: 60px minmax(0, 1fr) auto;
	gap: 14px;
	align-items: center;
	padding: 10px 0;
	border-bottom: 1px solid rgba(255, 255, 255, .12);
	color: var(--fx-text-on-dark);
}

.fx-search-result img {
	width: 60px;
	aspect-ratio: var(--fx-product-ratio);
	object-fit: cover;
	background: rgba(255, 255, 255, .08);
}

.fx-search-result__name {
	font-size: 13px;
}

.fx-search-result__price {
	font-size: 13px;
	font-weight: var(--fx-weight-bold);
	white-space: nowrap;
}

.fx-search-result:hover {
	background: rgba(255, 255, 255, .06);
}

.fx-search-result__more {
	display: inline-block;
	margin-top: 18px;
	padding-bottom: 2px;
	border-bottom: 1px solid currentColor;
	color: var(--fx-text-on-dark);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: var(--fx-tracking-nav);
}

/*
 * An empty result is a place to help, not a dead end. It names the term that
 * failed and suggests what usually works instead.
 */
.fx-search-overlay__empty {
	margin: 0;
	padding: 28px 0;
	color: rgba(255, 255, 255, .7);
	font-size: 14px;
}

/* ------------------------------------------------------- the size chart */

.fx-sizechart table {
	width: 100%;
	border-collapse: collapse;
	margin-block: 12px 24px;
	font-size: 13px;
}

.fx-sizechart th,
.fx-sizechart td {
	padding: 9px 8px;
	border-bottom: 1px solid var(--fx-border);
	text-align: start;
}

.fx-sizechart th {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: var(--fx-tracking-nav);
	white-space: nowrap;
}

/* A wide measurement table must scroll inside itself, not widen the drawer. */
.fx-sizechart {
	overflow-x: auto;
}

.fx-sizechart h2 {
	margin-top: 24px;
	font-size: 15px;
	font-weight: var(--fx-weight-bold);
	text-transform: uppercase;
	letter-spacing: var(--fx-tracking-nav);
}
