/* ==========================================================================
   Cubive Sports — Main Stylesheet
   Brand palette: Primary #2c2d3f, Accent #d32f2f, Borders/muted #d2d2d2.
   ========================================================================== */

:root {
	--cubive-primary: #2c2d3f;
	--cubive-accent: #d32f2f;
	--cubive-bg: #ffffff;
	--cubive-bg-alt: #f2f2f2;
	--cubive-text: #1a1a1a;
	--cubive-text-muted: #6b6b6b;
	--cubive-border: #d2d2d2;
	--cubive-radius: 6px;
	--cubive-font-heading: 'Poppins', sans-serif;
	--cubive-font-body: 'Inter', sans-serif;
	--cubive-container: 1240px;
}

/* ---------- Reset-ish basics ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
	scroll-behavior: smooth;
	overflow-x: hidden;
	max-width: 100%;
}
body {
	margin: 0;
	font-family: var(--cubive-font-body);
	color: var(--cubive-text);
	background: var(--cubive-bg);
	line-height: 1.6;
	/* NOTE: overflow-x is intentionally NOT set here. Setting overflow on
	   body (a direct ancestor of the sticky header) breaks position:sticky
	   in several browsers, which is what caused the header to overlap page
	   content. The overflow-x:hidden on <html> above already prevents
	   horizontal scroll site-wide without this side effect. */
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { -webkit-tap-highlight-color: transparent; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6 {
	font-family: var(--cubive-font-heading);
	line-height: 1.2;
	margin: 0 0 0.5em;
	color: var(--cubive-primary);
}
.container {
	max-width: var(--cubive-container);
	margin: 0 auto;
	padding: 0 24px;
}
.screen-reader-text {
	position: absolute;
	left: -9999px;
}
.skip-link:focus {
	left: 12px;
	top: 12px;
	position: fixed;
	background: var(--cubive-primary);
	color: #fff;
	padding: 10px 16px;
	z-index: 9999;
	border-radius: var(--cubive-radius);
}

/* ---------- Buttons ---------- */
.button,
a.button,
button,
input[type="submit"],
.woocommerce a.button,
.woocommerce button.button,
.woocommerce #respond input#submit {
	display: inline-block;
	background: var(--cubive-accent);
	color: #fff !important;
	border: none;
	padding: 13px 28px;
	border-radius: 999px;
	font-weight: 600;
	cursor: pointer;
	min-height: 44px;
	transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.button:hover,
a.button:hover,
button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover {
	filter: brightness(0.9);
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.button:active,
a.button:active,
button:active,
.woocommerce a.button:active,
.woocommerce button.button:active {
	transform: translateY(0);
	filter: brightness(0.85);
	box-shadow: none;
}
.button:focus-visible,
a.button:focus-visible,
button:focus-visible,
input[type="submit"]:focus-visible {
	outline: 2px solid var(--cubive-primary);
	outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--cubive-bg);
	border-bottom: 1px solid var(--cubive-border);
	transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

/* Scrolling down past the settle zone: slide the whole header out of view. */
.site-header.is-hidden {
	transform: translateY(-100%);
}

/*
 * ONE set of elements throughout — hamburger, nav-left, logo, nav-right,
 * Get Quote, search. Nothing is duplicated or swapped for a different
 * chunk of markup; CSS Grid named areas reassign their position between
 * the expanded (2-row) and compact (1-row) layouts.
 *
 * The hamburger+nav-left are wrapped in one "left group", and nav-right+
 * Get Quote in a "right group" — both groups are given EQUAL (1fr) grid
 * width. This is what guarantees the logo sits at the true center of the
 * header, regardless of how much nav text is on the left vs. right (e.g.
 * a 6-item left menu with an empty right menu would otherwise pull the
 * logo visually off-center if each side were just sized to its own
 * content).
 *
 * Expanded (default, top of page):
 *   "leftgroup logo rightgroup"    <- row 1, leftgroup/rightgroup = 1fr each
 *   "search    search  search"      <- row 2 (full width)
 *
 * Compact (.is-scrolled), single row:
 *   "leftgroup logo search rightgroup"
 */
.site-header-inner {
	max-width: var(--cubive-container);
	margin: 0 auto;
	padding: 20px 24px;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	grid-template-areas:
		"leftgroup logo rightgroup"
		"search search search";
	align-items: center;
	column-gap: 20px;
	row-gap: 16px;
	transition: padding 0.32s ease, column-gap 0.32s ease, row-gap 0.32s ease, grid-template-columns 0.32s ease;
}
.site-header.is-scrolled .site-header-inner {
	grid-template-columns: auto auto 1fr auto;
	grid-template-areas: "leftgroup logo search rightgroup";
	padding: 8px 24px;
	row-gap: 0;
	column-gap: 14px;
}

/* Left/right groups — each a flex row, each given equal grid width above. */
.site-header-group {
	display: flex;
	align-items: center;
	gap: 20px;
	min-width: 0;
}
.site-header-group--left { grid-area: leftgroup; justify-content: flex-start; }
.site-header-group--right { grid-area: rightgroup; justify-content: flex-end; }

/* Hamburger — zero-width/invisible until scrolled, when it fades in
   where the left nav menu used to be. */
.menu-toggle {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	overflow: hidden;
	opacity: 0;
	max-width: 0;
	pointer-events: none;
	-webkit-tap-highlight-color: transparent;
	transition: opacity 0.2s ease, max-width 0.2s ease;
}
.site-header.is-scrolled .menu-toggle {
	opacity: 1;
	max-width: 40px;
	pointer-events: auto;
}
.menu-toggle-bar {
	height: 2px;
	background: var(--cubive-primary);
	flex-shrink: 0;
	border-radius: 1px;
}
.menu-toggle-bar:nth-child(1) { width: 22px; }
.menu-toggle-bar:nth-child(2) { width: 16px; }
.menu-toggle-bar:nth-child(3) { width: 10px; }

/* Left/right nav menus — visible when expanded, removed from layout
   entirely on scroll (display:none — not just faded — so they can never
   leave behind invisible reserved space). */
.header-nav--left,
.header-nav--right {
	overflow: hidden;
	opacity: 1;
	min-width: 0;
	transition: opacity 0.2s ease;
}
.header-nav--left ul,
.header-nav--right ul {
	display: flex;
	gap: 30px;
	align-items: center;
	flex-wrap: nowrap;
}
.header-nav--left a,
.header-nav--right a {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--cubive-text);
	white-space: nowrap;
}
.header-nav--left a:hover,
.header-nav--right a:hover { color: var(--cubive-accent); }
.site-header.is-scrolled .header-nav--left,
.site-header.is-scrolled .header-nav--right {
	display: none;
}

/* Logo — same element throughout, centered when expanded, shrinks + moves
   left when compact (grid-area reassignment handles the position). */
.site-branding {
	grid-area: logo;
	justify-self: center;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
}
.site-header.is-scrolled .site-branding { justify-self: start; }
.site-branding img {
	max-height: 40px;
	width: auto;
	height: auto;
	display: block;
	transition: max-height 0.32s ease;
}
.site-header.is-scrolled .site-branding img {
	max-height: 30px;
}
.site-title-link {
	font-family: var(--cubive-font-heading);
	font-weight: 800;
	font-size: 1.3rem;
	color: var(--cubive-primary);
	transition: font-size 0.32s ease;
}
.site-header.is-scrolled .site-title-link {
	font-size: 1.05rem;
}

/* Get Quote — plain bold text in the expanded header (matching Products/
   Catalogue styling), becomes an outlined pill once scrolled that fills
   solid on hover. Same single element throughout. */
.get-quote-btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: none;
	border: 1.5px solid transparent;
	color: var(--cubive-primary) !important;
	padding: 0;
	border-radius: 999px;
	font-size: 0.95rem;
	font-weight: 700;
	white-space: nowrap;
	transition: background 0.15s ease, border-color 0.2s ease, color 0.15s ease, padding 0.32s ease;
}
.get-quote-btn:hover { color: var(--cubive-accent) !important; }
.site-header.is-scrolled .get-quote-btn {
	border-color: var(--cubive-primary);
	padding: 7px 18px;
}
.site-header.is-scrolled .get-quote-btn:hover {
	background: var(--cubive-primary);
	color: #fff !important;
}
.get-quote-icon { display: inline-flex; }

/* Search — full-width row when expanded, shrinks into the single row
   (grows to fill whatever space nav/hamburger free up) when compact. */
.site-header-search-wrap {
	grid-area: search;
	min-width: 0;
}
.cubive-search-form {
	position: relative;
	display: flex;
	align-items: center;
	border: 1px solid var(--cubive-border);
	border-radius: var(--cubive-radius);
	padding: 4px 4px 4px 16px;
	min-width: 0;
	transition: padding 0.32s ease;
}
.site-header.is-scrolled .cubive-search-form {
	padding: 2px 4px 2px 14px;
}
.cubive-search-icon {
	display: inline-flex;
	color: var(--cubive-text-muted);
	margin-right: 10px;
	flex-shrink: 0;
}
.cubive-search-input {
	border: none;
	outline: none;
	flex: 1;
	min-width: 0;
	width: 100%;
	font-size: 0.95rem;
	padding: 10px 0;
	font-family: var(--cubive-font-body);
	background: transparent;
	transition: padding 0.32s ease, font-size 0.32s ease;
}
.site-header.is-scrolled .cubive-search-input {
	padding: 5px 0;
	font-size: 0.9rem;
}

.header-cart {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	position: relative;
}
.cart-count {
	background: var(--cubive-accent);
	color: #fff;
	font-size: 0.7rem;
	min-width: 18px;
	height: 18px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}

/* ---------- Off-canvas mobile nav ---------- */
.mobile-nav {
	position: fixed;
	top: 0;
	left: 0;
	width: min(300px, 85vw);
	height: 100vh;   /* fallback for browsers without dvh support */
	height: 100dvh;  /* matches the real visible viewport on mobile */
	background: #fff;
	z-index: 210;
	padding: 24px;
	box-shadow: 8px 0 24px rgba(0,0,0,0.1);
	transform: translateX(-100%);
	transition: transform 0.28s ease;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}
.mobile-nav.is-open { transform: translateX(0); }
.mobile-nav-header {
	display: flex;
	justify-content: flex-end;
	margin: -8px -8px 8px;
}
.mobile-nav-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	background: var(--cubive-bg-alt);
	border: none;
	border-radius: 50%;
	color: var(--cubive-primary);
	cursor: pointer;
	padding: 0;
	transition: background 0.15s ease, color 0.15s ease;
}
.mobile-nav-close:hover {
	background: var(--cubive-accent);
	color: #fff;
}
.mobile-nav ul { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.mobile-nav a {
	display: block;
	padding: 12px 4px;
	font-weight: 600;
	border-bottom: 1px solid var(--cubive-border);
}
.mobile-nav .get-quote-btn {
	display: inline-flex;
	margin-top: 16px;
	background: var(--cubive-primary);
	color: #fff !important;
	padding: 10px 22px;
	border: 1.5px solid transparent;
	border-radius: 999px;
}
.mobile-nav .get-quote-btn:hover {
	background: var(--cubive-accent);
	color: #fff !important;
}
.mobile-nav-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.4);
	z-index: 200;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}
.mobile-nav-overlay.is-open { opacity: 1; pointer-events: auto; }

/* ---------- Footer ---------- */
.site-footer {
	background: var(--cubive-bg);
	color: var(--cubive-text);
	margin-top: 64px;
	border-top: 1px solid var(--cubive-border);
}

.site-footer-top {
	padding: 56px 24px 40px;
}

.site-footer-columns {
	max-width: var(--cubive-container);
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1fr 1.4fr 1fr;
	gap: 40px;
	text-align: center;
}
.site-footer-col-title {
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--cubive-primary);
	margin-bottom: 18px;
}
.site-footer-col--about .site-footer-col-title {
	font-size: 1.1rem;
	letter-spacing: 0.02em;
	text-transform: none;
	font-family: var(--cubive-font-heading);
}

.footer-nav ul {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}
.footer-nav a {
	font-size: 0.9rem;
	color: var(--cubive-text-muted);
}
.footer-nav a:hover { color: var(--cubive-accent); }

.footer-nav--social ul { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 20px; }

.site-footer-about {
	font-size: 0.88rem;
	line-height: 1.7;
	color: var(--cubive-text-muted);
	max-width: 340px;
	margin: 0 auto;
}

.site-footer-bottom {
	border-top: 1px solid var(--cubive-border);
}
.site-footer-bottom-inner {
	max-width: var(--cubive-container);
	margin: 0 auto;
	padding: 18px 24px;
	text-align: center;
}
.footer-credit {
	margin: 0;
	font-size: 0.85rem;
	color: var(--cubive-text-muted);
}
.footer-credit-heart {
	color: var(--cubive-accent);
	margin: 0 3px;
}
.footer-credit-name {
	font-weight: 700;
	color: var(--cubive-primary);
}

/* ---------- Post / product card grid ---------- */
.post-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 28px;
	margin: 32px 0;
}
.post-card {
	border: 1px solid var(--cubive-border);
	border-radius: var(--cubive-radius);
	overflow: hidden;
	transition: box-shadow 0.2s ease;
}
.post-card:hover { box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.post-card-thumb-placeholder {
	background: var(--cubive-bg-alt);
	aspect-ratio: 1 / 1;
}
.post-card-body { padding: 16px; }
.post-card-title { font-size: 1.05rem; margin-bottom: 6px; }
.post-card-meta { font-size: 0.8rem; color: var(--cubive-text-muted); margin-bottom: 8px; }

/* ---------- Page / single ---------- */
.site-main { padding: 40px 24px; }
.site-main--full-width { padding: 0; max-width: none; }
.page-hero-image { margin-bottom: 24px; border-radius: var(--cubive-radius); overflow: hidden; }
.cubive-export-note {
	font-size: 0.85rem;
	color: var(--cubive-text-muted);
	margin-top: 12px;
}

/* ---------- WooCommerce grid tweaks ---------- */
.woocommerce ul.products {
	display: grid !important;
	grid-template-columns: repeat(4, 1fr);
	gap: 28px;
}
.woocommerce ul.products li.product {
	width: 100% !important;
	margin: 0 !important;
	float: none !important;
}
.woocommerce span.onsale {
	background: var(--cubive-accent) !important;
	border-radius: var(--cubive-radius);
}

/* ---------- Wholesale / quote CTA ---------- */
.cubive-wholesale-price-note {
	font-weight: 600;
	color: var(--cubive-text-muted);
	font-size: 0.95rem;
}
.cubive-wholesale-cta { margin: 16px 0; }
.cubive-quote-btn { background: var(--cubive-primary); }
.cubive-quote-btn:hover { background: #000; }
.cubive-moq {
	margin-top: 10px;
	font-size: 0.85rem;
	color: var(--cubive-text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
	.site-footer-columns {
		grid-template-columns: 1fr;
		gap: 32px;
	}
	.site-footer-top { padding: 40px 24px; }
	.post-grid { grid-template-columns: repeat(2, 1fr); }
	.woocommerce ul.products { grid-template-columns: repeat(2, 1fr); }
	.header-nav--left ul,
	.header-nav--right ul { gap: 18px; }
}

@media (max-width: 780px) {
	/* Below this width, always use the compact single-row layout
	   (hamburger, no inline nav links) regardless of scroll position —
	   a row with both full nav AND a search bar gets too cramped on
	   tablets/phones. This forces the exact same grid-area layout the
	   scroll handler switches to via .is-scrolled, just permanently. */
	.site-header-inner {
		grid-template-columns: auto auto 1fr auto;
		grid-template-areas: "leftgroup logo search rightgroup";
		padding: 8px 24px;
		row-gap: 0;
		column-gap: 14px;
	}
	.menu-toggle { opacity: 1; max-width: 40px; pointer-events: auto; }
	.header-nav--left,
	.header-nav--right { display: none; }
	.site-branding { justify-self: start; }
	.site-branding img { max-height: 30px; }
	.get-quote-btn {
		border-color: var(--cubive-primary);
		padding: 7px 18px;
	}
	.get-quote-btn:hover {
		background: var(--cubive-primary);
		color: #fff !important;
	}
}

@media (max-width: 700px) {
	.post-grid { grid-template-columns: 1fr; }
	.woocommerce ul.products { grid-template-columns: 1fr; }
	.site-main { padding: 28px 16px; }
	.container { padding: 0 16px; }
}

@media (max-width: 480px) {
	.site-header-inner { padding: 8px 14px; gap: 10px; }
	.site-branding img { max-height: 30px; }
	.site-header.is-scrolled .site-branding img { max-height: 26px; }
	.cubive-search-input { font-size: 0.85rem; }
	.mobile-nav { padding: 20px 16px; }
	.mobile-nav-header { margin: -6px -6px 6px; }
	.site-footer-top { padding: 32px 16px; }
	.site-footer-columns { gap: 28px; }
	.site-footer-bottom-inner { padding: 16px; }
	.post-card-body { padding: 12px; }

	/* Get Quote collapses to an icon-only circular button in the header
	   specifically (not the larger footer version) so it never competes
	   for space with the search box on small phones. */
	.site-header .get-quote-btn {
		padding: 10px;
		width: 38px;
		height: 38px;
		justify-content: center;
		gap: 0;
	}
	.site-header .get-quote-btn .get-quote-text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}
}
