/*
 * Fivany 404.
 *
 * Follows the block engine in home.css rather than inventing a layout: same
 * section rhythm, same rail heads, same flat surfaces. The only new thing is
 * the masthead, and it borrows the cream surface the header and footer
 * already use so the page reads as part of the shop, not an error screen
 * bolted onto it.
 */

.fv-404 {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

@media (min-width: 768px) {
	.fv-404 {
		gap: 0.5rem;
	}
}

/* ── Masthead ──────────────────────────────────────────────────── */

.fv-404 .fv-404-head {
	background: var(--fv-cream);
	border: 1px solid var(--fv-line);
	border-radius: var(--fv-radius-xl);
	padding: 40px 24px 34px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
}

@media (min-width: 768px) {
	.fv-404 .fv-404-head {
		padding: 64px 40px 56px;
	}
}

/*
 * The error code as a mono label, not a giant numeral.
 *
 * Mono carries every numeral in this design system at 11px uppercase — a
 * three-storey "404" would be the one place the shop shouts, and it would
 * be shouting the least useful thing on the page.
 */
.fv-404 .fv-404-head .code {
	font-family: var(--fv-mono);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--fv-accent);
	background: var(--fv-surface);
	border: 1px solid var(--fv-line);
	border-radius: var(--fv-radius-full);
	padding: 5px 12px;
	margin-bottom: 18px;
}

.fv-404 .fv-404-head h1 {
	margin: 0;
	font-size: clamp(26px, 5vw, 40px);
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 1.15;
	color: var(--fv-ink);
	text-wrap: balance;
}

.fv-404 .fv-404-head h1 em {
	font-style: normal;
	color: var(--fv-accent);
}

.fv-404 .fv-404-head .lede {
	margin: 12px 0 0;
	max-width: 46ch;
	font-size: 14px;
	line-height: 1.6;
	color: var(--fv-ink-2);
	text-wrap: pretty;
}

/* ── Search ────────────────────────────────────────────────────── */

/*
 * Same shape as the header search so it is recognisably the same control:
 * flush input and button inside one bordered pill, accent on the button.
 */
.fv-404 .fv-404-search {
	display: flex;
	width: 100%;
	max-width: 520px;
	margin: 24px 0 0;
	background: var(--fv-surface);
	border: 1px solid var(--fv-line-2);
	border-radius: var(--fv-radius-md);
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fv-404 .fv-404-search:focus-within {
	border-color: var(--fv-accent);
	box-shadow: 0 0 0 3px var(--fv-accent-soft);
}

.fv-404 .fv-404-search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	height: 44px;
	margin: 0;
	padding: 0 14px;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: 14px;
	color: var(--fv-ink);
	border-radius: 0;
	box-shadow: none;
}

.fv-404 .fv-404-search input[type="search"]:focus {
	outline: none;
	box-shadow: none;
}

.fv-404 .fv-404-search .go {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	height: 44px;
	padding: 0 18px;
	border: 0;
	border-radius: 0;
	background: var(--fv-accent);
	color: #fff;
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.fv-404 .fv-404-search .go:hover,
.fv-404 .fv-404-search .go:focus {
	background: var(--fv-accent-hover);
}

.fv-404 .fv-404-search .go .i {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ── Actions ───────────────────────────────────────────────────── */

.fv-404 .fv-404-acts {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
}

.fv-404 .fv-404-acts .btn {
	display: inline-flex;
	align-items: center;
	height: 36px;
	padding: 0 16px;
	border: 1px solid var(--fv-line-2);
	border-radius: var(--fv-radius-md);
	background: var(--fv-surface);
	color: var(--fv-ink-2);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.fv-404 .fv-404-acts .btn:hover,
.fv-404 .fv-404-acts .btn:focus {
	border-color: var(--fv-accent);
	color: var(--fv-accent);
}

.fv-404 .fv-404-acts .btn.primary {
	background: var(--fv-ink);
	border-color: var(--fv-ink);
	color: #fff;
}

.fv-404 .fv-404-acts .btn.primary:hover,
.fv-404 .fv-404-acts .btn.primary:focus {
	background: var(--fv-accent);
	border-color: var(--fv-accent);
	color: #fff;
}

/* ── Reused blocks ─────────────────────────────────────────────── */

.fv-404 section {
	scroll-margin-top: 90px;
}

/*
 * The tablet part-row trim from home.css, which is scoped to `.fv-home`.
 *
 * Four cards in a three-up grid leave a row of three and a lone orphan. A
 * card in the first column that is also among the last two items is by
 * definition starting a part row, so it and everything after it go.
 *
 * The count-based rules that hide short rails outright are deliberately not
 * copied: on the homepage a thin rail is filler, but here it is the whole
 * reason the visitor has somewhere to go.
 */
@media (min-width: 768px) and (max-width: 1023px) {
	.fv-404 .fv-rail-section .products > li.product:nth-child(3n + 1):nth-last-child(-n + 2),
	.fv-404 .fv-rail-section .products > li.product:nth-child(3n + 1):nth-last-child(-n + 2) ~ li.product {
		display: none;
	}
}
