/* Hat Bar Engine — global chrome (editorial header / footer) */
:root {
	--hatbar-sand: #f5f0e8;
	--hatbar-sand2: #ede6d6;
	--hatbar-sand3: #d8ccb4;
	--hatbar-sand4: #c4b898;
	--hatbar-ink: #1c1712;
	--hatbar-ink2: #3d3529;
	--hatbar-ink3: #6b5f4e;
	--hatbar-copper: #b8763a;
	--hatbar-copper-dim: #8a5628;
	--hatbar-white: #ffffff;
	--hatbar-serif: "Playfair Display", Georgia, serif;
	--hatbar-sans: "DM Sans", system-ui, sans-serif;
	--hatbar-header-height: 76px;
}

/* Space taken by fixed header; adds admin bar height when logged in (WP sets --wp-admin--admin-bar--height on html). */
html {
	--hatbar-main-offset: var(--hatbar-header-height);
}

html.admin-bar {
	--hatbar-main-offset: calc(var(--hatbar-header-height) + var(--wp-admin--admin-bar--height, 32px));
}

/* Canvas template: pad main so content clears the fixed header; when logged in, offset includes the admin bar because the header sits below it. */
#hb-main.hb-main-canvas {
	flex: 1;
	overflow: clip;
	padding-top: var(--hatbar-main-offset);
}

/*
 * `overflow: clip` (and many overflow values) on an ancestor breaks `position: sticky`
 * relative to the viewport. Standalone checkout needs a sticky order summary.
 */
#hb-main.hb-main-canvas:has(.hb-co-pay-outer) {
	overflow: visible;
}

/* Theme pages: injected fixed header; pad body so content is not hidden under header + admin bar. */
body:not(.hb-canvas) {
	padding-top: var(--hatbar-main-offset);
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal;
}

.hatbar-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	/* Below #wpadminbar (~99999); header is offset below the bar when logged in, not stacked over it. */
	z-index: 10050;
	height: var(--hatbar-header-height, 76px);
	display: flex;
	align-items: center;
	transition: background 0.3s, box-shadow 0.3s, top 0.2s ease;
	background: transparent;
}

/*
 * WordPress fixed admin bar sits at the top of the viewport. Keep our header flush under it.
 * body.admin-bar: html class can be missing on some setups; body is always tagged.
 * !important: beats theme rules that pin headers to top: 0.
 */
html.admin-bar #hb-site-header.hatbar-header,
body.admin-bar #hb-site-header.hatbar-header {
	top: var(--wp-admin--admin-bar--height, 32px) !important;
}

.hatbar-header.scrolled {
	background: rgba(245, 240, 232, 0.92);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	box-shadow: 0 1px 0 var(--hatbar-sand3);
}

.hatbar-nav-inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 40px;
	width: 100%;
	display: grid;
	grid-template-columns: minmax(100px, 1fr) auto minmax(100px, 1fr);
	align-items: center;
	gap: 12px 20px;
	position: relative;
}

.hatbar-nav-links {
	display: flex;
	gap: 36px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.hatbar-nav-links--center {
	justify-self: center;
}

.hatbar-nav-links a {
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--hatbar-ink3);
	text-decoration: none;
	position: relative;
	transition: color 0.2s;
}

.hatbar-nav-links a::after {
	content: "";
	position: absolute;
	bottom: -3px;
	left: 0;
	width: 0;
	height: 1px;
	background: var(--hatbar-copper);
	transition: width 0.25s ease;
}

.hatbar-nav-links a:hover {
	color: var(--hatbar-ink);
}

.hatbar-nav-links a:hover::after {
	width: 100%;
}

.hatbar-logo {
	font-family: var(--hatbar-serif);
	font-size: 28px;
	font-weight: 500;
	color: var(--hatbar-ink);
	letter-spacing: 0.04em;
	text-decoration: none;
	display: flex;
	align-items: center;
	justify-content: flex-start;
}

.hatbar-nav-lead {
	display: flex;
	align-items: center;
	gap: 10px;
	justify-self: start;
	min-width: 0;
}

.hatbar-nav-menu-toggle {
	display: none;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--hatbar-ink3);
	cursor: pointer;
	border-radius: 8px;
	transition: color 0.2s, background 0.2s;
}

.hatbar-nav-menu-toggle:hover {
	color: var(--hatbar-copper);
	background: rgba(184, 118, 58, 0.08);
}

.hatbar-nav-menu-bars {
	display: block;
	position: relative;
	width: 18px;
	height: 2px;
	background: currentColor;
	border-radius: 1px;
	box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.hatbar-nav-panel {
	justify-self: center;
}

.hatbar-nav-backdrop {
	position: fixed;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--hatbar-header-height, 76px));
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100080;
	background: rgba(28, 23, 18, 0.35);
	border: none;
	padding: 0;
	cursor: pointer;
}

.hatbar-logo--lead {
	position: static;
	transform: none;
}

.hatbar-logo em {
	color: var(--hatbar-copper);
	font-style: italic;
	font-weight: 400;
}

.hatbar-logo-img {
	max-height: 40px;
	width: auto;
	display: block;
}

.hatbar-nav-right {
	display: flex;
	align-items: center;
	gap: 16px;
	justify-self: end;
	flex-wrap: nowrap;
	justify-content: flex-end;
	flex-shrink: 0;
	min-width: 0;
}

.hatbar-nav-cart {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--hatbar-ink3);
	cursor: pointer;
	border-radius: 8px;
	transition: color 0.2s, background 0.2s;
}

.hatbar-nav-cart:hover {
	color: var(--hatbar-copper);
	background: rgba(184, 118, 58, 0.08);
}

.hatbar-nav-cart-icon {
	font-size: 1.15rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hatbar-cart-count {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--hatbar-copper);
	color: var(--hatbar-white);
	font-size: 9px;
	font-weight: 700;
	font-family: var(--hatbar-sans);
	line-height: 16px;
	text-align: center;
	letter-spacing: 0;
	display: none;
}

.hatbar-nav-cart.has-items .hatbar-cart-count {
	display: inline-block;
}

.hatbar-nav-login,
.hatbar-nav-checkout {
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--hatbar-ink3);
	text-decoration: none;
	transition: color 0.2s;
}

.hatbar-nav-login:hover,
.hatbar-nav-checkout:hover {
	color: var(--hatbar-copper);
}

@media (max-width: 900px) {
	.hatbar-nav-inner {
		padding: 0 20px;
	}

	.hatbar-nav-links {
		gap: 16px;
	}

	.hatbar-logo {
		font-size: 22px;
	}
}

@media (max-width: 640px) {
	.hatbar-nav-menu-toggle {
		display: inline-flex;
	}

	.hatbar-nav-inner {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 0 16px;
	}

	.hatbar-nav-lead {
		flex: 1 1 auto;
		min-width: 0;
		justify-self: auto;
	}

	.hatbar-nav-panel {
		position: fixed;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--hatbar-header-height, 76px));
		right: 0;
		bottom: 0;
		left: auto;
		width: min(320px, calc(100vw - 16px));
		max-width: 100%;
		justify-self: auto;
		margin: 0;
		padding: 20px 20px 28px;
		padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
		background: var(--hatbar-sand);
		box-shadow: -8px 0 32px rgba(28, 23, 18, 0.14);
		z-index: 100090;
		transform: translateX(100%);
		visibility: hidden;
		pointer-events: none;
		transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.32s;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		box-sizing: border-box;
	}

	.hatbar-nav-panel.is-open {
		transform: translateX(0);
		visibility: visible;
		pointer-events: auto;
	}

	.hatbar-nav-links {
		flex-direction: column;
		align-items: flex-start;
		gap: 20px;
	}

	.hatbar-nav-links a::after {
		display: none;
	}

	.hatbar-logo {
		font-size: 20px;
	}

	.hatbar-logo-img {
		max-height: 34px;
	}
}

@media (min-width: 641px) {
	.hatbar-nav-menu-toggle {
		display: none !important;
	}
}

body.hb-cart-open,
body.hb-nav-open {
	overflow: hidden;
}

/*
 * The slide-out nav lives inside #hb-site-header (.hatbar-header, z-index 10050). The nav
 * backdrop is a sibling below the header in the DOM with z-index 100080, so it painted
 * above the entire header subtree and blocked clicks on the drawer. While the menu is
 * open, lift the header above the nav backdrop (still below cart drawer at 100105).
 */
body.hb-nav-open #hb-site-header.hatbar-header {
	z-index: 100095;
}

.hb-cart-backdrop {
	position: fixed;
	inset: 0;
	z-index: 100100;
	background: rgba(28, 23, 18, 0.35);
	backdrop-filter: blur(2px);
	border: none;
	padding: 0;
	cursor: pointer;
}

.hb-cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: auto;
	width: min(420px, 100%);
	max-width: min(420px, 100vw);
	box-sizing: border-box;
	z-index: 100105;
	background: var(--hatbar-sand);
	box-shadow: -8px 0 32px rgba(28, 23, 18, 0.12);
	display: flex;
	flex-direction: column;
	font-family: var(--hatbar-sans);
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: none;
	visibility: hidden;
	min-width: 0;
}

.hb-cart-drawer.is-open {
	transform: translateX(0);
	pointer-events: auto;
	visibility: visible;
}

.hb-cart-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 1.25rem 0.75rem;
	border-bottom: 1px solid var(--hatbar-sand3);
}

.hb-cart-drawer-title {
	margin: 0;
	font-family: var(--hatbar-serif);
	font-size: 1.35rem;
	font-weight: 500;
	color: var(--hatbar-ink);
}

.hb-cart-drawer-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	color: var(--hatbar-ink3);
	cursor: pointer;
	border-radius: 8px;
	transition: color 0.2s, background 0.2s;
}

.hb-cart-drawer-close:hover {
	color: var(--hatbar-copper);
	background: rgba(184, 118, 58, 0.08);
}

.hb-cart-drawer-body {
	flex: 1;
	overflow-y: auto;
	padding: 1rem 1.25rem;
	-webkit-overflow-scrolling: touch;
}

.hb-cart-line {
	display: flex;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid rgba(216, 204, 180, 0.5);
}

.hb-cart-line-img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
	background: var(--hatbar-sand2);
}

.hb-cart-line-meta {
	flex: 1;
	min-width: 0;
}

.hb-cart-line-title {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--hatbar-ink);
	margin: 0 0 4px;
}

.hb-cart-line-sub {
	font-size: 0.75rem;
	color: var(--hatbar-ink3);
	margin: 0;
	line-height: 1.4;
}

.hb-cart-line-price {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--hatbar-ink);
	white-space: nowrap;
}

.hb-cart-line-remove {
	align-self: flex-start;
	border: none;
	background: none;
	color: var(--hatbar-ink3);
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	cursor: pointer;
	padding: 4px 0;
}

.hb-cart-line-remove:hover {
	color: var(--hatbar-copper);
}

.hb-cart-empty {
	margin: 2rem 0;
	text-align: center;
	color: var(--hatbar-ink3);
	font-size: 0.9rem;
}

.hb-cart-drawer-foot {
	padding: 1rem max(1rem, env(safe-area-inset-right)) calc(1.25rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
	border-top: 1px solid var(--hatbar-sand3);
	background: var(--hatbar-sand2);
	min-width: 0;
	box-sizing: border-box;
}

.hb-cart-subtotal {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.85rem;
	color: var(--hatbar-ink3);
	margin-bottom: 12px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.hb-cart-subtotal strong {
	font-size: 1.1rem;
	color: var(--hatbar-ink);
	letter-spacing: 0;
}

.hb-cart-checkout-btn {
	display: block;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	text-align: center;
	padding: 14px 16px;
	background: var(--hatbar-ink);
	color: var(--hatbar-sand) !important;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	border-radius: 6px;
	transition: background 0.2s;
}

.hb-cart-checkout-btn:hover {
	background: var(--hatbar-copper-dim);
}

.hatbar-site-footer {
	background: var(--hatbar-ink);
	color: rgba(245, 240, 232, 0.5);
	padding: 80px 40px 40px;
	margin-top: auto;
	font-family: var(--hatbar-sans);
	position: relative;
}

.hatbar-site-footer::before {
	content: "";
	display: block;
	height: 3px;
	background: linear-gradient(to right, transparent, var(--hatbar-copper), transparent);
	position: relative;
	top: -80px;
}

.hatbar-footer-inner {
	max-width: 1280px;
	margin: 0 auto;
}

.hatbar-footer-top {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr 1fr;
	gap: 48px;
	padding-bottom: 64px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	margin-bottom: 48px;
}

.hatbar-footer-logo-text {
	font-family: var(--hatbar-serif);
	font-size: 32px;
	font-weight: 500;
	color: var(--hatbar-white);
	margin-bottom: 16px;
	display: block;
	text-decoration: none;
}

.hatbar-footer-logo-link {
	text-decoration: none;
	display: inline-block;
}

.hatbar-footer-logo-img {
	max-height: 44px;
	width: auto;
	display: block;
	margin-bottom: 16px;
}

.hatbar-footer-tagline {
	font-size: 13px;
	font-weight: 300;
	line-height: 1.7;
	color: rgba(245, 240, 232, 0.4);
	max-width: 220px;
	margin: 0;
}

.hatbar-footer-col-title {
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: rgba(245, 240, 232, 0.35);
	margin-bottom: 20px;
}

.hatbar-footer-links {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 0;
}

.hatbar-footer-links a {
	font-size: 13px;
	font-weight: 300;
	color: rgba(245, 240, 232, 0.55);
	text-decoration: none;
	transition: color 0.2s;
}

.hatbar-footer-links a:hover {
	color: var(--hatbar-copper);
}

.hatbar-footer-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 11px;
	color: rgba(245, 240, 232, 0.25);
	flex-wrap: wrap;
	gap: 12px;
}

.hatbar-footer-bottom-links {
	display: flex;
	gap: 24px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.hatbar-footer-bottom-links a {
	color: rgba(245, 240, 232, 0.25);
	text-decoration: none;
	font-size: 11px;
	transition: color 0.2s;
}

.hatbar-footer-bottom-links a:hover {
	color: var(--hatbar-copper);
}

@media (max-width: 900px) {
	.hatbar-footer-top {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 560px) {
	.hatbar-footer-top {
		grid-template-columns: 1fr;
	}
}
