/* ==========================================================================
   NULLIFIER — ALL PIECES AND THE COLLECTION PAGES
   Loaded on the shop, collection and tag pages only. Markup from inc/shop.php.
   ========================================================================== */

/*
 * Full width, edge to edge. Interior pages get a side gutter and a top margin
 * on <main> (style.css, "body:not(.home) .wp-site-blocks > main"); the band
 * and the grid carry their own gutter on the inner wrapper instead, so both
 * are undone here with a selector that outranks those.
 */
body .wp-site-blocks > main.nf-shop-main {
	margin-block: 0 !important;
	padding: 0 !important;
}

/* The grid meets the footer's line with no strip of black between. */
body .wp-site-blocks > main.nf-shop-main + footer,
body .wp-site-blocks > main.nf-shop-main ~ footer {
	margin-block-start: 0 !important;
}

body .wp-site-blocks > main.nf-shop-main > * {
	margin-block: 0 !important;
}

.nf-shop__wrap {
	box-sizing: border-box;
	width: 100%;
	max-width: 1400px;
	margin-inline: auto;
	padding-inline: var(--nf-gutter, clamp(1.25rem, 4vw, 3rem));
}

.nf-shop .screen-reader-text,
.nf-shop-pages .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* --- The picture band ---------------------------------------------------- */

.nf-shop-hero {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-height: clamp(15rem, 27vw, 22rem);
	overflow: hidden;
	background: var(--nf-black, #0a0a0a);
	color: #fff;
	isolation: isolate;
}

.nf-shop-hero__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

/*
 * The darkness is the setting in Appearance → Shop page. The left side, where
 * the words are, is always a little darker than the right, so the words read
 * on any picture without the whole thing going flat.
 */
.nf-shop-hero.has-picture::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(90deg, rgba(5, 5, 8, 0.55) 0%, rgba(5, 5, 8, 0.2) 45%, rgba(5, 5, 8, 0) 75%),
		linear-gradient(0deg, rgba(5, 5, 8, 0.45) 0%, rgba(5, 5, 8, 0) 55%),
		rgba(5, 5, 8, var(--nf-shop-dim, 0.45));
}

.nf-shop-hero__words {
	padding-block: clamp(2.5rem, 5vw, 4rem) clamp(1.75rem, 4vw, 3rem);
}

.nf-shop-hero__kicker {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 1.25rem;
	margin: 0 0 clamp(0.75rem, 1.5vw, 1.1rem);
	font-size: 0.72rem;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.82);
}

.nf-shop-hero a.nf-shop-hero__back,
.nf-shop-hero a.nf-shop-hero__back:visited {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: rgba(255, 255, 255, 0.82);
	text-decoration: none;
	background-image: none;
}

.nf-shop-hero a.nf-shop-hero__back::before {
	content: "←";
	letter-spacing: 0;
	transition: transform 0.25s var(--nf-ease, ease);
}

.nf-shop-hero a.nf-shop-hero__back:hover,
.nf-shop-hero a.nf-shop-hero__back:focus-visible {
	color: #fff;
}

.nf-shop-hero a.nf-shop-hero__back:hover::before {
	transform: translateX(-3px);
}

.nf-shop-hero__title {
	margin: 0 !important;
	color: #fff !important;
	font-size: clamp(2.6rem, 6vw, 4.75rem) !important;
	font-weight: 500 !important;
	line-height: 0.98 !important;
	letter-spacing: -0.035em !important;
	text-wrap: balance;
}

.nf-shop-hero__text {
	max-width: 34rem;
	margin: clamp(0.8rem, 1.5vw, 1.1rem) 0 0;
	font-size: clamp(0.95rem, 1.2vw, 1.05rem);
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.86);
}

/* --- The pieces ---------------------------------------------------------- */

.nf-shop {
	--nf-ink: #0e0e10;
	--nf-ink-2: #56565a;
	--nf-rule: rgba(14, 14, 16, 0.14);
	padding-block: clamp(1.25rem, 2.5vw, 2rem) clamp(4rem, 8vw, 6.5rem);
	background: #efeeea;
	color: var(--nf-ink);
}

/* The bar: tabs on the left, the count and sort on the right. */
.nf-shop-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.75rem 2rem;
	margin-bottom: clamp(2rem, 4vw, 3rem);
	border-bottom: 1px solid var(--nf-rule);
}

.nf-shop-tabs {
	min-width: 0;
	max-width: 100%;
}

.nf-shop-tabs ul {
	display: flex;
	gap: clamp(1.1rem, 2.2vw, 1.9rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nf-shop-tabs li {
	margin: 0;
	flex: 0 0 auto;
}

.nf-shop a.nf-shop-tab,
.nf-shop a.nf-shop-tab:visited {
	position: relative;
	display: block;
	padding: 0.85rem 0 1rem;
	color: var(--nf-ink-2);
	font-size: 0.95rem;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	background-image: none;
	transition: color 0.2s var(--nf-ease, ease);
}

.nf-shop a.nf-shop-tab::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	height: 2px;
	background: var(--nf-blue, #0000fe);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.3s var(--nf-ease, ease);
}

.nf-shop a.nf-shop-tab:hover,
.nf-shop a.nf-shop-tab:focus-visible,
.nf-shop a.nf-shop-tab.is-current {
	color: var(--nf-ink);
}

.nf-shop a.nf-shop-tab.is-current {
	font-weight: 500;
}

.nf-shop a.nf-shop-tab.is-current::after,
.nf-shop a.nf-shop-tab:hover::after {
	transform: scaleX(1);
}

.nf-shop a.nf-shop-tab:hover:not(.is-current)::after {
	opacity: 0.35;
}

.nf-shop a.nf-shop-tab:focus-visible {
	outline: 2px solid var(--nf-blue, #0000fe);
	outline-offset: 2px;
}

.nf-shop-bar__side {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	margin-left: auto;
	padding-bottom: 0.5rem;
}

.nf-shop-bar.has-no-tabs .nf-shop-bar__side {
	margin-left: 0;
	width: 100%;
	justify-content: space-between;
}

.nf-shop-bar__count {
	font-size: 0.9rem;
	color: var(--nf-ink-2);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* The sort, dark on light. The menu itself is built by nullifier.js. */
.nf-shop .nf-sort__trigger {
	color: var(--nf-ink);
	font-size: 0.9rem;
}

.nf-shop .nf-sort__caption {
	color: var(--nf-ink-2);
	font-weight: 400;
}

.nf-shop .nf-sort__value {
	color: var(--nf-ink);
	font-weight: 500;
}

.nf-shop .nf-sort__trigger:focus-visible {
	outline-color: var(--nf-blue, #0000fe);
}

.nf-shop .nf-sort__menu {
	background: #fff;
	border: 1px solid var(--nf-rule);
	box-shadow: 0 18px 40px rgba(14, 14, 16, 0.14);
}

.nf-shop .nf-sort__option {
	color: var(--nf-ink);
}

.nf-shop .nf-sort__option:hover,
.nf-shop .nf-sort__option:focus-visible {
	background: #f3f2ee;
}

.nf-shop .nf-sort__option.is-selected {
	color: var(--nf-blue, #0000fe);
	font-weight: 500;
}

/* Before the script runs, or without it: the real select, dark on light. */
.nf-shop .nf-orderby__label {
	color: var(--nf-ink-2);
}

.nf-shop .nf-orderby__select {
	color: var(--nf-ink) !important;
	border-bottom-color: var(--nf-rule) !important;
	background-image: linear-gradient(45deg, transparent 50%, var(--nf-ink-2) 50%),
		linear-gradient(135deg, var(--nf-ink-2) 50%, transparent 50%) !important;
}

.nf-shop .nf-orderby__select option {
	background: #fff;
	color: var(--nf-ink);
}

/* The grid. */
.nf-shop-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(2.75rem, 5vw, 4.5rem) clamp(1.25rem, 2.5vw, 2rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nf-shop-card {
	margin: 0;
	min-width: 0;
}

.nf-shop a.nf-shop-card__link,
.nf-shop a.nf-shop-card__link:visited,
.nf-shop a.nf-shop-card__link:hover {
	display: flex;
	flex-direction: column;
	color: var(--nf-ink);
	text-decoration: none;
	background-image: none;
}

.nf-shop a.nf-shop-card__link:focus-visible {
	outline: 2px solid var(--nf-blue, #0000fe);
	outline-offset: 6px;
}

.nf-shop-card__shot {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	margin-bottom: 1rem;
	border-bottom: 1px solid var(--nf-rule);
	overflow: hidden;
}

.nf-shop-card__img {
	position: absolute;
	inset: 4% 4% 5%;
	width: 92%;
	height: 91%;
	max-width: none;
	object-fit: contain;
	/* The white of the photo drops out; the garment sits on the page. */
	mix-blend-mode: multiply;
	transition: opacity 0.45s ease, transform 0.6s var(--nf-ease, ease);
}

.nf-shop-card__img--back {
	opacity: 0;
}

.nf-shop-card__link:hover .nf-shop-card__img {
	transform: scale(1.035);
}

.nf-shop-card__link:hover .has-back .nf-shop-card__img:not(.nf-shop-card__img--back) {
	opacity: 0;
}

.nf-shop-card__link:hover .nf-shop-card__img--back {
	opacity: 1;
}

.nf-shop-card__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.35rem 1rem;
}

.nf-shop-card__name {
	min-width: 0;
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.3;
	color: var(--nf-ink);
	text-decoration: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.25em;
	transition: text-decoration-color 0.2s var(--nf-ease, ease);
}

.nf-shop-card__link:hover .nf-shop-card__name {
	text-decoration-color: var(--nf-blue, #0000fe);
}

.nf-shop-card__price {
	flex: 0 0 auto;
	font-size: 0.95rem;
	line-height: 1.3;
	color: var(--nf-ink);
	font-variant-numeric: tabular-nums;
}

.nf-shop-card__price del {
	margin-right: 0.35rem;
	color: var(--nf-ink-2);
}

.nf-shop-card__price ins {
	text-decoration: none;
}

.nf-shop-card__type {
	margin-top: 0.5rem;
	font-size: 0.7rem;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--nf-ink-2);
}

.nf-shop-card__flag {
	color: var(--nf-blue, #0000fe);
}

/* Nothing on this tab or in this collection yet. */
.nf-shop-empty {
	padding-block: clamp(3rem, 8vw, 6rem);
	text-align: center;
	color: var(--nf-ink-2);
}

.nf-shop-empty p {
	margin: 0 0 1.25rem;
	font-size: 1.05rem;
}

.nf-shop a.nf-shop-empty__link,
.nf-shop a.nf-shop-empty__link:visited {
	color: var(--nf-ink);
	border-bottom: 1px solid currentColor;
	text-decoration: none;
	background-image: none;
}

/* Page numbers, when there are more pieces than fit on one page. */
.nf-shop-pages {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.35rem;
	margin-top: clamp(3rem, 6vw, 4.5rem);
}

.nf-shop-pages .page-numbers,
.nf-shop-pages a.page-numbers:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding: 0 0.5rem;
	color: var(--nf-ink);
	font-size: 0.95rem;
	text-decoration: none;
	background-image: none;
	border: 1px solid transparent;
}

.nf-shop-pages a.page-numbers:hover {
	border-color: var(--nf-rule);
}

.nf-shop-pages .page-numbers.current {
	border-color: var(--nf-ink);
	font-weight: 500;
}

/* --- Tablet -------------------------------------------------------------- */

@media (max-width: 900px) {
	.nf-shop-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* --- Phone --------------------------------------------------------------- */

@media (max-width: 700px) {
	/*
	 * The tabs slide sideways rather than wrapping onto a second line, and run
	 * to the edge of the screen so it is clear there are more.
	 */
	.nf-shop-bar {
		margin-inline: calc(-1 * var(--nf-gutter, 1.25rem));
		border-bottom: 0;
	}

	.nf-shop-tabs {
		width: 100%;
		overflow-x: auto;
		scrollbar-width: none;
		border-bottom: 1px solid var(--nf-rule);
	}

	.nf-shop-tabs::-webkit-scrollbar {
		display: none;
	}

	.nf-shop-tabs ul {
		gap: 1.35rem;
		padding-inline: var(--nf-gutter, 1.25rem);
	}

	.nf-shop-tabs li:last-child {
		padding-right: var(--nf-gutter, 1.25rem);
	}

	.nf-shop-bar__side {
		width: 100%;
		justify-content: space-between;
		margin-left: 0;
		padding: 0.1rem var(--nf-gutter, 1.25rem) 0;
	}

	/* style.css stretches the sort form across a phone; here it sits right. */
	.nf-shop .nf-orderby {
		width: auto;
	}

	.nf-shop .nf-sort__menu {
		right: 0;
	}

	.nf-shop-bar.has-no-tabs {
		border-bottom: 1px solid var(--nf-rule);
	}

	.nf-shop-bar.has-no-tabs .nf-shop-bar__side {
		padding-bottom: 0.5rem;
	}

	.nf-shop-grid {
		gap: 2.25rem 0.9rem;
	}

	/* Two across is too narrow for name and price side by side. */
	.nf-shop-card__row {
		flex-direction: column;
		align-items: flex-start;
	}

	.nf-shop-card__name {
		font-size: 0.92rem;
	}

	.nf-shop-card__price {
		font-size: 0.88rem;
		color: var(--nf-ink-2);
	}

	.nf-shop-card__type {
		margin-top: 0.4rem;
		font-size: 0.64rem;
		letter-spacing: 0.14em;
	}

	.nf-shop-card__shot {
		margin-bottom: 0.75rem;
	}
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.nf-shop-card__link:hover .nf-shop-card__img {
		transform: none;
	}
}
