/* ==========================================================================
   Simi Pacific header navigation — scoped entirely to .sp-* classes.
   Breakpoint note: the theme's own nav collapses to the mobile/hamburger
   menu at max-width: 979px (Bootstrap 2's default), so these rules use the
   same breakpoint to stay in sync with it.
   ========================================================================== */

/* ---- Top info strip: keep phone + hours, drop the email line ---- */
#nav_info li:first-child {
	display: none;
}

/* ==========================================================================
   Light header (per request) — the header/nav background moves from black
   to an off-white matching the page, with nav text flipped to a dark
   charcoal for contrast. The logo keeps its own dark "plate" behind it
   (its wordmark art was designed for a dark backdrop), so it still pops
   the way it did on the black header instead of washing out on white.
   ========================================================================== */
header#header.hinner,
#nav#nav .navbar-inverse,
#nav#nav .navbar-inner {
	background: #faf7f2 !important;
	border-bottom: 1px solid #e5dbc9;
}

#nav_info,
#nav_info a,
#nav_info li {
	color: #6b6b6b !important;
}

#nav_info a:hover {
	color: #851515 !important;
}

#logo {
	background: #1c1414;
	border-radius: 10px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* ---- Base nav item spacing (desktop) ---- */
#nav .navbar-inner {
	position: relative; /* anchors the Products mega-panel */
}

#nav .navbar .nav {
	display: flex;
	align-items: center;
}

#nav .navbar .nav > li.sp-nav-item {
	float: none;
	display: flex;
	align-items: center;
	position: relative;
}

#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link,
#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link-static {
	padding: 17px 10px 15px;
	margin: 0;
	white-space: nowrap;
}

#nav#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link,
#nav#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link-static {
	color: #2b2320 !important;
}

#nav#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link:hover,
#nav#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link-static:hover {
	color: #851515 !important;
}

#nav .navbar .nav > li.sp-nav-item:first-child > a.sp-nav-link {
	margin-left: 0;
}

/* Keep the core nav links (Products/Project Help/Delivery/Visit Our Yard/About)
   at their natural width so their labels never wrap mid-word; the search field
   is the one item allowed to compress if space is ever tight. */
#nav .navbar .nav > li.sp-nav-item:not(.sp-header-search-item):not(.sp-cta-item) {
	flex-shrink: 0;
}

/* ---- Dropdown toggle caret (click target for touch, decorative on hover-capable desktop) ---- */
.sp-dropdown-toggle {
	background: transparent;
	border: 0;
	padding: 17px 6px 15px 0;
	margin: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
}

.sp-caret {
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid rgba(43, 35, 32, 0.55);
	transition: transform 0.15s ease, border-top-color 0.15s ease;
}

.sp-has-dropdown:hover .sp-caret,
.sp-has-dropdown.sp-open .sp-caret {
	border-top-color: #851515;
	transform: rotate(180deg);
}

/* ---- Dropdown panels (shared) ---- */
.sp-dropdown {
	position: absolute;
	top: 100%;
	background: #ffffff;
	border-top: 3px solid #851515;
	box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 700;
}

.sp-has-dropdown:not(.sp-mega) {
	position: relative;
}

.sp-has-dropdown:not(.sp-mega) .sp-dropdown {
	left: 0;
	transform: translateY(6px);
}

.sp-has-dropdown:not(.sp-mega):hover .sp-dropdown,
.sp-has-dropdown:not(.sp-mega).sp-open .sp-dropdown {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0);
}

.sp-mega-panel {
	left: 50%;
	width: min(860px, 94vw);
	transform: translateX(-50%) translateY(6px);
}

.sp-mega.sp-has-dropdown:hover .sp-mega-panel,
.sp-mega.sp-has-dropdown.sp-open .sp-mega-panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

/* ---- Simple dropdown (Project Help) ---- */
.sp-simple-panel ul {
	list-style: none;
	margin: 0;
	padding: 10px 0;
	min-width: 240px;
}

.sp-simple-panel li a {
	display: block;
	padding: 10px 22px;
	color: #2b2b2b;
	font-size: 13px;
	white-space: nowrap;
}

.sp-simple-panel li a:hover {
	background: #f5f1ea;
	color: #851515;
}

/* ---- Mega dropdown (Products) ---- */
.sp-mega-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 24px;
	padding: 26px 30px 10px;
}

.sp-mega-col ul {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
}

.sp-mega-heading {
	display: block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #851515;
	border-bottom: 1px solid #eee2d6;
	padding-bottom: 8px;
}

.sp-mega-col li a {
	display: block;
	padding: 6px 0;
	color: #2b2b2b;
	font-size: 13px;
	line-height: 1.35;
}

.sp-mega-col li a:hover {
	color: #851515;
}

.sp-mega-footer {
	border-top: 1px solid #eee2d6;
	padding: 12px 30px;
	text-align: right;
}

.sp-mega-footer a {
	color: #851515;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}

/* ---- Search field: visible input + labeled red button, like a compact
   version of the ACE Building Materials search bar, in Simi Pacific's own
   dark/red palette. Kept as a real, always-visible field per feedback —
   never collapsed behind an icon. ---- */
.sp-header-search-item {
	margin: 0 4px 0 12px;
}

.sp-header-search-form {
	display: flex;
	align-items: stretch;
	margin: 0;
	line-height: 0;
}

.sp-header-search-input {
	background: #ffffff;
	border: 1px solid #d9cfc0;
	border-right: none;
	border-radius: 3px 0 0 3px;
	color: #2b2320;
	font-size: 12.5px;
	height: 34px;
	line-height: 34px;
	padding: 0 12px;
	width: 160px;
	max-width: 22vw;
	box-sizing: border-box;
	transition: border-color 0.2s ease, background-color 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.sp-header-search-input::placeholder {
	color: #9c9082;
	opacity: 1;
}

.sp-header-search-input:focus {
	outline: none;
	border-color: #851515;
	background: #ffffff;
}

.sp-header-search-submit {
	position: static;
	flex: 0 0 auto;
	height: 34px;
	background: #851515;
	border: 1px solid #851515;
	border-radius: 0 3px 3px 0;
	color: #ffffff;
	cursor: pointer;
	padding: 0 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sp-search-submit-label {
	display: none;
}

.sp-header-search-submit:hover,
.sp-header-search-submit:focus {
	background: #6c1010;
	border-color: #6c1010;
	outline: none;
}

@media (min-width: 1180px) {
	.sp-search-submit-label {
		display: inline;
	}

	.sp-header-search-submit {
		padding: 0 16px;
	}
}

/* ---- Contact Us CTA ---- */
.sp-cta-item {
	margin: 0 0 0 6px;
}

.sp-cta-button {
	display: inline-block;
	background: #851515;
	border: 2px solid #851515;
	color: #ffffff !important;
	font-family: 'Lato', sans-serif;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	padding: 9px 18px;
	border-radius: 4px;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sp-cta-button:hover,
.sp-cta-button:focus {
	background: #6c1010;
	border-color: #6c1010;
	color: #ffffff;
	text-decoration: none;
}

/* ==========================================================================
   Narrow desktop safety net (980px–1199px) — the theme's own boxed layout
   grid does not scale smoothly between the mobile collapse (979px) and its
   large-desktop width, so this tier tightens spacing further and, as a last
   resort, lets nav items wrap onto a second line as whole words/labels
   (never mid-word) rather than crowd or overflow.
   ========================================================================== */
@media (min-width: 980px) and (max-width: 1199px) {
	#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link,
	#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link-static {
		padding: 15px 7px 13px;
	}

	.sp-dropdown-toggle {
		padding: 15px 3px 13px 0;
	}

	.sp-header-search-item {
		margin: 0 2px 0 8px;
	}

	.sp-header-search-input {
		width: 90px;
		max-width: 14vw;
	}

	.sp-cta-item {
		margin: 0 0 0 3px;
	}

	.sp-cta-button {
		padding: 8px 12px;
		font-size: 12px;
	}

	#nav .navbar .nav {
		flex-wrap: wrap;
		justify-content: flex-end;
		row-gap: 4px;
	}
}

/* ==========================================================================
   Mobile / tablet — matches the theme's own collapse breakpoint (979px)
   ========================================================================== */
@media (max-width: 979px) {
	#nav .navbar .nav {
		display: block;
	}

	#nav .navbar .nav > li.sp-nav-item {
		float: none;
		display: block;
		width: 100%;
	}

	#nav .navbar .nav > li.sp-nav-item > a.sp-nav-link {
		padding: 12px 15px;
		margin: 0;
	}

	/* Dropdowns are always expanded inline on mobile; no click-toggle needed */
	.sp-dropdown-toggle {
		display: none;
	}

	.sp-dropdown {
		position: static;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: none;
		box-shadow: none;
		border-top: none;
		background: rgba(43, 35, 32, 0.05);
		width: 100% !important;
		left: auto;
	}

	.sp-mega-grid {
		display: block;
		padding: 6px 15px 6px 28px;
	}

	.sp-mega-col {
		padding: 10px 0;
	}

	.sp-mega-heading {
		color: #851515;
		border-bottom-color: rgba(43, 35, 32, 0.15);
	}

	.sp-mega-col li a,
	.sp-simple-panel li a {
		color: rgba(43, 35, 32, 0.85);
		padding: 8px 0;
	}

	.sp-simple-panel ul {
		padding: 6px 15px 6px 28px;
		min-width: 0;
	}

	.sp-mega-footer {
		display: none;
	}

	.sp-header-search-item {
		margin: 14px 15px;
		width: calc(100% - 30px);
	}

	.sp-header-search-form {
		width: 100%;
	}

	.sp-header-search-input {
		width: 100%;
		max-width: 100%;
	}

	.sp-cta-item {
		margin: 0 15px 15px;
	}

	.sp-cta-button {
		display: block;
		text-align: center;
	}
}
