/*
 * The storefront's header on WooCommerce pages (/kassen/, /handlekurv/,
 * /min-konto/ — body.hartwell-shop-header, see inc/checkout-design.php):
 * announcement bar + black bar with the white logo.
 * MIRROR of hartwell-test components/site/announcement-bar.tsx and
 * components/site/site-header.tsx — keep them the same.
 */

/* Same side gutters as the storefront (px-6 / sm:px-8 / lg:px-16); on
   checkout, hartwell-checkout.css sets the same values for the page body.
   --header-height: the sticky header's fixed height (as in the storefront). */
body.hartwell-shop-header {
	--hw-gutter: 24px;
	--header-height: 64px;
}

@media (min-width: 640px) {
	body.hartwell-shop-header {
		--hw-gutter: 32px;
	}
}

@media (min-width: 1024px) {
	body.hartwell-shop-header {
		--hw-gutter: 64px;
		--header-height: 72px;
	}
}

/* Anchors and scrollIntoView() stop below the sticky header (+ admin bar). */
html:has(body.hartwell-shop-header) {
	scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 72px);
}

/* Kadence's #wrapper.site clips horizontal overflow with overflow-x: hidden,
   which turns it into a scroll container and breaks position: sticky for the
   header inside it. clip does the same clipping without that side effect. */
body.hartwell-shop-header #wrapper {
	overflow-x: clip;
}

/* ---------- Announcement bar (AnnouncementBar) ---------- */

body.hartwell-shop-header .hartwell-announcement {
	border-bottom: 1px solid rgba(255, 255, 255, 0.12); /* border-white/12 */
	background: var(--hw-ink);
	padding: 8px 16px; /* py-2 px-4 */
	text-align: center;
	font-family: var(--font-body);
	font-size: 12px; /* text-xs */
	line-height: 16px;
	letter-spacing: 0.025em; /* tracking-wide */
	color: #fff;
}

@media (min-width: 640px) {
	body.hartwell-shop-header .hartwell-announcement {
		font-size: 13px;
	}
}

body.hartwell-shop-header .hartwell-header-sentinel {
	display: block;
	height: 0;
}

/* ---------- Header (SiteHeader) ---------- */

/* Sticky under the (scrolling) announcement bar, like the storefront; below
   the WordPress admin bar when logged in (it stays fixed on mobile too here,
   so the admin-bar height applies at every width). Shadow only once it has left its
   place at the top (data-stuck, set by the small observer in
   inc/checkout-design.php). */
body.hartwell-shop-header .hartwell-checkout-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 30;
	height: var(--header-height);
	background: var(--hw-ink);
	color: #fff;
	transition: box-shadow 200ms;
}

body.hartwell-shop-header .hartwell-checkout-header[data-stuck="true"] {
	box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.45);
}

body.hartwell-shop-header .hartwell-checkout-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	max-width: 1800px; /* max-w-[1800px], as the storefront header — logo in the same place */
	height: 100%;
	margin-inline: auto;
	padding: 0 var(--hw-gutter);
}

body.hartwell-shop-header .hartwell-checkout-header__logo {
	display: inline-flex;
	border-radius: 2px;
}

body.hartwell-shop-header .hartwell-checkout-header__logo img {
	display: block;
	width: auto;
	height: 25px;
}

@media (min-width: 640px) {
	body.hartwell-shop-header .hartwell-checkout-header__logo img {
		height: 27px;
	}
}

body.hartwell-shop-header .hartwell-checkout-header__back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border-radius: 2px;
	font-family: var(--font-body);
	font-size: 14px; /* text-sm */
	line-height: 20px;
	color: #fff;
	text-decoration: none;
	text-underline-offset: 8px;
	transition: opacity 150ms;
}

body.hartwell-shop-header .hartwell-checkout-header__back:hover {
	color: #fff;
	text-decoration: underline;
}

body.hartwell-shop-header .hartwell-checkout-header__logo:hover {
	opacity: 0.7;
}

body.hartwell-shop-header .hartwell-checkout-header__logo:focus-visible,
body.hartwell-shop-header .hartwell-checkout-header__back:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 4px;
}

body.hartwell-shop-header .hartwell-checkout-header__back svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

/* ---------- Footer ---------- */

/*
 * The storefront's black footer (inc/storefront-footer.php) — MIRROR of
 * hartwell-test components/site/site-footer.tsx: #1A1A1A like the header,
 * white logo, white body-sm Medium headings, links white 70 % (100 % on
 * hover), 12 % rules, caption copyright at 50 %. Contrast on ink:
 * white/70 ≈ 9.6:1, white/50 ≈ 5.6:1 (WCAG AA).
 */
body.hartwell-shop-header .hartwell-footer {
	margin-top: 64px;
	background: var(--hw-ink);
	color: #fff;
	font-family: var(--font-body);
}

body.hartwell-shop-header .hartwell-footer__inner {
	display: grid;
	grid-template-columns: 1fr;
	gap: 40px;
	max-width: 72rem; /* max-w-6xl */
	margin-inline: auto;
	padding: 56px 16px;
}

@media (min-width: 640px) {
	body.hartwell-shop-header .hartwell-footer__inner {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		padding-inline: 24px;
	}
	body.hartwell-shop-header .hartwell-footer__brand {
		grid-column: span 2;
	}
}

@media (min-width: 1024px) {
	body.hartwell-shop-header .hartwell-footer__inner {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		padding-inline: 32px;
	}
	body.hartwell-shop-header .hartwell-footer__brand {
		grid-column: auto;
		order: 99; /* last, as lg:order-last in the storefront */
	}
}

body.hartwell-shop-header .hartwell-footer__logo img {
	display: block;
	width: auto;
	height: 22px;
}

body.hartwell-shop-header .hartwell-footer__brand p {
	max-width: 20rem;
	margin: 20px 0 0;
	font-size: var(--type-body-sm-size);
	line-height: var(--type-body-sm-lh);
	color: rgb(255 255 255 / 0.7);
}

body.hartwell-shop-header .hartwell-footer__brand p + p {
	margin-top: 8px;
}

body.hartwell-shop-header .hartwell-footer a {
	color: inherit;
	text-decoration: none;
	transition: color 150ms, opacity 150ms;
}

body.hartwell-shop-header .hartwell-footer__strong {
	font-weight: 500;
	color: #fff !important;
}

body.hartwell-shop-header .hartwell-footer__strong:hover {
	text-decoration: underline;
}

body.hartwell-shop-header .hartwell-footer__social {
	display: flex;
	gap: 16px;
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
}

body.hartwell-shop-header .hartwell-footer__social a {
	display: block;
	color: #fff;
	opacity: 0.7;
}

body.hartwell-shop-header .hartwell-footer__social a:hover {
	opacity: 1;
}

body.hartwell-shop-header .hartwell-footer__social svg {
	display: block;
	width: 20px;
	height: 20px;
}

body.hartwell-shop-header .hartwell-footer__title {
	margin: 0;
	font-size: var(--type-body-sm-size);
	line-height: var(--type-body-sm-lh);
	font-weight: 500;
	color: #fff;
}

body.hartwell-shop-header .hartwell-footer__column ul {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
	font-size: var(--type-body-sm-size);
	line-height: var(--type-body-sm-lh);
	color: rgb(255 255 255 / 0.7);
}

body.hartwell-shop-header .hartwell-footer__column a:hover {
	color: #fff;
}

body.hartwell-shop-header .hartwell-footer__legal {
	border-top: 1px solid rgb(255 255 255 / 0.12);
	padding: 24px 16px;
	text-align: center;
	font-size: var(--type-caption-size);
	line-height: var(--type-caption-lh);
	color: rgb(255 255 255 / 0.5);
}

body.hartwell-shop-header .hartwell-footer a:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* «Cookie-innstillinger» (inc/tracking.php) — a button that must look like the footer links. */
body.hartwell-shop-header .hartwell-footer__column button.hartwell-footer__cookies {
	all: unset;
	cursor: pointer;
	font: inherit;
	color: inherit;
}

body.hartwell-shop-header .hartwell-footer__column button.hartwell-footer__cookies:hover {
	color: #fff;
}

body.hartwell-shop-header .hartwell-footer__column button.hartwell-footer__cookies:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}
