/**
 * Header CSS — log-core
 * Covers: ticker bar, site header, mobile search bar, mobile nav panel.
 * Values mirror the reference header in website_reference/*.html.
 */

/* Marquee plugin JS sets body padding-top:50px; correct to exact marquee height.
   34px matches the reference ticker bar (9px padding + 13px/1.2 text + 9px).
   overflow-x:clip instead of hidden — hidden breaks position:sticky by making body the scroll container.
   clip has no effect on browsers that don't understand it (full mobile Safari support only
   landed in iOS 16) — the invalid declaration is dropped, silently leaving body's default
   overflow-x:visible and letting the marquee's wide duplicated track cause horizontal scroll.
   The hidden fallback below covers those browsers; clip overrides it wherever it's supported. */
body {
	padding-top: 34px !important;
	overflow-x: hidden !important;
	overflow-x: clip !important;
}

/* ── Ticker bar ───────────────────────────────────────────────
   The bar itself is rendered by WC Smart Sales Popup; its colours, height,
   font-size and scroll speed come from --wc-ssp-* tokens in design-tokens.css.
   The rules below cover the few properties that plugin exposes no variable
   for, so the bar matches .ticker-bar / .ticker-track in the reference. */
.wc-ssp-marquee-bar {
	border-bottom: 1px solid var(--line-gold);
}

.wc-ssp-marquee-item {
	font-weight: 600;
	/* Reference spaces ticker items 46px apart; the plugin spaces them with
	   per-item padding, so each side carries half the gap. */
	padding: 0 23px;
}

/* ── Scroll progress bar ─────────────────────────────────────
   Width updated via JS (assets/js/log-interactions.js) as page-scroll %. */
#scroll-bar {
	position: fixed;
	top: 0;
	left: 0;
	height: 3px;
	width: 100%;
	z-index: 9999;
	background: linear-gradient(90deg, var(--gold-600), var(--gold-400));
	pointer-events: none;
	/* Fill left-to-right via a scale transform, not width — width is set on
	   every scroll event (log-interactions.js), and animating a layout
	   property at that frequency forces a layout recalc on every tick. */
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .1s linear;
}

/* ── Site Header ──────────────────────────────────────────── */
header.log-site-header {
	background: var(--paper);
	position: sticky;
	top: 34px;
	/* ticker bar height */
	z-index: 200;
	border-bottom: 1px solid var(--line);
	transition: box-shadow .35s var(--ease);
	/* iOS Safari defers repainting position:sticky/fixed elements during
	   active scroll, so this (and the marquee bar above it, same fix in
	   public-marquee.css) can visibly lag/clip until scroll settles.
	   Forcing a GPU compositor layer keeps both painted correctly mid-scroll. */
	-webkit-transform: translate3d(0, 0, 0);
	transform: translateZ(0);
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

header.log-site-header.scrolled {
	box-shadow: 0 4px 20px rgba(212, 175, 55, .12);
}

.log-nav-row {
	display: flex;
	align-items: center;
	height: 84px;
	padding: 0 48px;
	transition: height .35s var(--ease);
}

header.log-site-header.scrolled .log-nav-row {
	height: 64px;
}

/* Logo */
.log-site-logo {
	display: flex;
	align-items: center;
	gap: 12px;
	font-family: var(--display);
	font-size: 22px;
	font-weight: 800;
	color: var(--ink-900);
	transition: font-size .35s var(--ease);
	flex-shrink: 0;
	min-width: 200px;
	text-decoration: none;
}

header.log-site-header.scrolled .log-site-logo {
	font-size: 19px;
}

.log-logo-mark {
	width: 44px;
	height: 44px;
	border-radius: 13px;
	background: linear-gradient(150deg, var(--gold-500), var(--ink-900));
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--paper);
	box-shadow: var(--shadow-sm);
	flex-shrink: 0;
	transition: width .35s, height .35s;
}

header.log-site-header.scrolled .log-logo-mark {
	width: 36px;
	height: 36px;
}

.log-logo-mark svg {
	width: 21px;
	height: 21px;
	stroke: var(--paper);
	fill: none;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.log-site-logo b {
	color: var(--gold-600);
}

.log-site-logo.has-image {
	min-width: 0;
}

.log-site-logo.has-image .custom-logo-link {
	display: flex;
	align-items: center;
}

.log-site-logo.has-image img {
	height: 4em;
	width: auto;
	max-width: 100%;
	transition: height .35s var(--ease);
}

header.log-site-header.scrolled .log-site-logo.has-image img {
	height: 4em;
}

/* Desktop Nav */
nav.log-main-links {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
}

nav.log-main-links ul {
	display: flex;
	align-items: center;
	gap: 18px;
	list-style: none;
	margin: 0;
	padding: 0;
}

nav.log-main-links ul li {
	margin: 0;
	padding: 0;
}

nav.log-main-links a {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .05em;
	color: var(--ink-500);
	text-transform: uppercase;
	position: relative;
	padding: 6px 0;
	transition: color .25s var(--ease);
	text-decoration: none;
}

nav.log-main-links a::after {
	content: '';
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 0;
	background: var(--gold-500);
	transition: width .3s var(--ease);
}

nav.log-main-links a:hover,
nav.log-main-links li.current-menu-item>a {
	color: var(--gold-600);
}

nav.log-main-links a:hover::after,
nav.log-main-links li.current-menu-item>a::after {
	width: 100%;
}

/* Head Actions */
.log-head-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 200px;
	justify-content: flex-end;
}

/* Desktop search */
.log-header-search-wrap {
	display: flex;
	align-items: center;
	background: var(--paper);
	border: 2px solid var(--gold-600);
	border-radius: var(--r-pill);
	/* Reference uses overflow:hidden, but the TH Advance Product Search plugin
	   renders its results dropdown as a child of this wrapper — clipping it
	   would hide every suggestion, so it stays visible here. */
	overflow: visible;
	transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
	box-shadow: 0 2px 8px rgba(212, 175, 55, .08);
}

.log-header-search-wrap:focus-within {
	border-color: var(--gold-500);
	box-shadow: 0 0 0 3px rgba(212, 175, 55, .15);
}

.log-hs-icon-pill {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	color: var(--gold-600);
}

.log-hs-icon-pill svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.log-header-search-wrap input {
	border: none;
	background: none;
	font-family: var(--body);
	font-size: 13px;
	font-weight: 500;
	color: var(--ink-900);
	padding: 9px 14px 9px 0;
	width: 200px;
	outline: none;
}

.log-header-search-wrap input::placeholder {
	color: var(--gray-light);
}

/* Cart button */
.log-cart-btn {
	position: relative;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ink-500);
	background: var(--paper);
	transition: background .25s, color .25s, transform .25s;
	text-decoration: none;
}

.log-cart-btn:hover {
	background: var(--gold-tint);
	color: var(--gold-600);
	transform: translateY(-1px);
}

.log-cart-btn svg {
	width: 19px;
	height: 19px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.log-cart-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: var(--gold-500);
	color: var(--ink-900);
	font-size: 10px;
	font-weight: 700;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	transition: transform .25s var(--ease);
	line-height: 1;
}

.log-cart-badge[data-count="0"] {
	display: none;
}

/* Burger */
.log-burger {
	display: none;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	align-items: center;
	justify-content: center;
	background: var(--paper);
	border: none;
	cursor: pointer;
	color: var(--ink-900);
}

.log-burger svg {
	width: 20px;
	height: 20px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Mobile search bar */
.log-mobile-search-bar {
	display: none;
	padding: 10px 16px 12px;
	background: var(--paper);
	border-bottom: 1px solid var(--line);
}

.log-mobile-search-inner {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--paper);
	border: 2px solid var(--gold-600);
	border-radius: var(--r-pill);
	padding: 0 16px;
	transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}

.log-mobile-search-inner:focus-within {
	border-color: var(--gold-500);
	box-shadow: 0 0 0 3px rgba(212, 175, 55, .12);
}

.log-mobile-search-inner .ms-icon {
	width: 16px;
	height: 16px;
	color: var(--gold-600);
	flex-shrink: 0;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.log-mobile-search-inner input {
	flex: 1;
	border: none;
	background: none;
	font-family: var(--body);
	font-size: 14px;
	font-weight: 500;
	color: var(--ink-900);
	padding: 12px 0;
	outline: none;
}

.log-mobile-search-inner input::placeholder {
	color: var(--gray-light);
}

/* Mobile nav panel */
.log-mobile-panel {
	display: none;
	flex-direction: column;
	gap: 4px;
	background: #fff;
	border-top: 1px solid var(--line);
	padding: 14px 24px 20px;
}

/* wp_nav_menu() always wraps each link in <li> even with no container/ul —
   the reference mockup hardcodes plain <a> tags with no <li>, so it never
   needed this reset. Without it, browsers show a bullet marker on <li>
   regardless of list-style on an ancestor. */
.log-mobile-panel li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.log-mobile-panel a {
	display: block;
	padding: 12px 4px;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--ink-500);
	border-bottom: 1px solid var(--line);
	text-decoration: none;
}

/* WP applies .current-menu-item to the <li>, not the <a> — the old
   ".log-mobile-panel a.current-menu-item" selector could never match. */
.log-mobile-panel li.current-menu-item>a,
.log-mobile-panel a:hover {
	color: var(--gold-600);
}

.log-mobile-panel.open {
	display: flex;
}

/* Responsive
   1080px, not the reference's 900px. Measured: logo + the 7-item menu +
   search + cart need ~1105px in one row, so the reference's own breakpoint
   would leave the nav overflowing between 900px and ~1105px. 1080px is the
   real fit limit here plus a small margin.
   (This was 1300px before the header adopted the reference's tighter nav
   metrics — 12px/.05em type and an 18px gap — which bought back ~220px.) */
@media (max-width: 1080px) {
	nav.log-main-links {
		display: none;
	}

	.log-burger {
		display: flex;
	}

	.log-mobile-search-bar {
		display: block;
	}

	.log-header-search-wrap {
		display: none !important;
	}

	.log-head-actions {
		margin-left: auto;
	}

	.log-nav-row {
		padding-left: 20px;
		padding-right: 20px;
	}

	/* Marquee height varies on mobile (text wraps, or plugin's own close
	   button removes it) — track the real height via JS instead of the
	   hardcoded 34px used on desktop. See log-header.js ResizeObserver. */
	body {
		padding-top: var(--marquee-h, 34px) !important;
	}

	header.log-site-header {
		top: var(--marquee-h, 34px);
	}

	/* WC Smart Sales Popup bug: in marquee mode the plugin prints
	   .wc-ssp-close as a SIBLING of .wc-ssp-marquee-bar, not a child of it
	   (see templates/notification-marquee.php + class-frontend.php). Its CSS
	   (position:absolute; top:-8px; right:-8px;) assumes it's nested inside
	   the bar, so with no positioned ancestor wrapping both it resolves
	   against body instead, hanging 8px past the true right edge — an
	   absolutely-positioned element (unlike the bar's own position:fixed)
	   does inflate the page's scrollable width, causing horizontal scroll.
	   Imperceptible on wide desktop viewports; very obvious on mobile touch-
	   drag. The adjacent-sibling selector targets only this marquee-mode
	   button, leaving the correctly-nested popup-mode .wc-ssp-close (inside
	   #wc-ssp-popup) untouched. Pinning it to the viewport like the bar
	   itself, fully inside bounds, keeps the same corner-badge look without
	   the overflow. */
	.wc-ssp-marquee-bar + .wc-ssp-close {
		position: fixed;
		top: 5px;
		right: 5px;
	}
}


/* #main-container used to be pinned to `height: calc(100vh - 188px);
   overflow-y: auto;` below 400px, turning it into its own internal scroll
   panel — a workaround for the marquee bar submerging on scroll at very
   narrow widths. In practice this trapped the entire page (everything
   between the header and the footer) inside a nested scroll container that
   real phones frequently failed to scroll all the way through via touch —
   the footer, at the very bottom of that box, became unreachable. Reverted
   to the same plain in-flow layout every other screen width already uses
   (the header's position:sticky already works correctly there); log-header.js's
   syncHeaderHeight() already guards its nested-scroll math behind
   `overflowY === 'auto'`, so it falls back to the normal calculation
   automatically now that this no longer sets it. */

/* WP admin bar (32px) + ticker bar (34px) = 66px when logged in */
.admin-bar header.log-site-header {
	top: 66px;
}