/*
 * DSN Mobile Menu — Self-contained styles
 * Override CSS variables in your theme CSS to customize colors.
 * Version: 2.0.0
 */

/* ================================================================
   CSS Custom Properties (theme overrides go in your theme CSS)
   ================================================================ */
:root {
	--dsn-mm-overlay-bg:       rgba(0, 0, 0, 0.90);
	--dsn-mm-panel-bg:         var(--dealerColor, #999);
	--dsn-mm-panel-width:      85vw;
	--dsn-mm-panel-max-width:  420px;

	/* Header bar (Locate us | Call us) */
	--dsn-mm-header-bg:        #ffffff;
	--dsn-mm-header-text:      var(--dealerColor, #999);
	--dsn-mm-header-height:    60px;
	--dsn-mm-header-font-size: 15px;
	--dsn-mm-header-font-weight: 600;

	/* Menu items */
	--dsn-mm-item-text:        #ffffff;
	--dsn-mm-item-border:      color-mix(in srgb, var(--dsn-mm-panel-bg) 90%, white);
	--dsn-mm-item-hover-bg:    color-mix(in srgb, var(--dsn-mm-panel-bg) 90%, white);
	--dsn-mm-item-font-size:   16px;
	--dsn-mm-item-padding:     17px 52px 17px 20px;

	/* Top-level items */
	--dsn-mm-top-item-font-weight: 700;
	--dsn-mm-sub-item-font-weight: 400;

	/* Caret / chevron */
	--dsn-mm-caret-color:      rgba(255, 255, 255, 0.9);
	--dsn-mm-caret-bg:         rgba(255, 255, 255, 0.06);
	--dsn-mm-caret-width:      52px;

	/* Sub-menu items — auto-derived from panel-bg via color-mix().
	   Override only --dsn-mm-panel-bg in your theme; these follow automatically.
	   color-mix() supported: Chrome 111+, Firefox 113+, Safari 16.2+ */
	--dsn-mm-sub-item-bg:            color-mix(in srgb, var(--dsn-mm-panel-bg) 95%, white);
	--dsn-mm-sub-sub-item-bg:        color-mix(in srgb, var(--dsn-mm-panel-bg) 90%, white);
	--dsn-mm-sub-sub-sub-item-bg:    color-mix(in srgb, var(--dsn-mm-panel-bg) 85%, white);
	--dsn-mm-depth-4-item-bg:        color-mix(in srgb, var(--dsn-mm-panel-bg) 80%, white);
	--dsn-mm-depth-5-item-bg:        color-mix(in srgb, var(--dsn-mm-panel-bg) 75%, white);

	/* Back button (used in CTA panels) */
	--dsn-mm-back-bg:          rgba(0, 0, 0, 0.2);
	--dsn-mm-back-text:        rgba(255, 255, 255, 0.8);

	/* Trigger (hamburger) — inherits from theme by default */
	--dsn-mm-trigger-color:    inherit;

	/* Animation */
	--dsn-mm-transition:       320ms cubic-bezier(0.4, 0, 0.2, 1);
	--dsn-mm-font-family:      inherit;
}


/* ================================================================
   Overlay (full-screen container)
   ================================================================ */
.dsn-mm-overlay {
	position: fixed;
	inset: 0;
	z-index: 9999999999;
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--dsn-mm-transition);
}

.dsn-mm-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
}

.dsn-mm-overlay[aria-hidden="true"] .dsn-mm-panel {
	visibility: hidden;
	transition:
		transform var(--dsn-mm-transition),
		visibility 0s var(--dsn-mm-transition);
}
.dsn-mm-overlay.is-open .dsn-mm-panel {
	visibility: visible;
	transition:
		transform var(--dsn-mm-transition),
		visibility 0s;
}


/* ================================================================
   Backdrop (dim layer behind panel)
   ================================================================ */
.dsn-mm-backdrop {
	position: absolute;
	inset: 0;
	background: var(--dsn-mm-overlay-bg);
}


/* ================================================================
   Panel (slides in from the right)
   ================================================================ */
.dsn-mm-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--dsn-mm-panel-width);
	max-width: var(--dsn-mm-panel-max-width);

	display: flex;
	flex-direction: column;

	background: var(--dsn-mm-panel-bg);
	font-family: var(--dsn-mm-font-family);

	transform: translateX(100%);
	transition: transform var(--dsn-mm-transition);
	will-change: transform;
}

.dsn-mm-overlay.is-open .dsn-mm-panel {
	transform: translateX(0);
}


/* ================================================================
   Header bar — FIXED (never scrolls)
   Dual CTA buttons side-by-side with a vertical divider + close
   ================================================================ */
.dsn-mm-header {
	display: flex;
	align-items: stretch;
	height: var(--dsn-mm-header-height);
	background: var(--dsn-mm-header-bg);
	color: var(--dsn-mm-header-text);
	flex-shrink: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.dsn-mm-cta-btn {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 12px;
	margin: 0 !important;
	background: transparent;
	border: none;
	color: var(--dsn-mm-header-text) !important;
	font-size: var(--dsn-mm-header-font-size);
	font-weight: var(--dsn-mm-header-font-weight);
	font-family: var(--dsn-mm-font-family);
	cursor: pointer;
	transition: background 150ms;
	line-height: 1.2;
}

.dsn-mm-cta-btn:hover {
	background: rgba(0, 0, 0, 0.05);
}

.dsn-mm-cta-btn.is-active {
	background: rgba(0, 0, 0, 0.08);
}

.dsn-mm-header-sep {
	width: 1px;
	background: rgba(0, 0, 0, 0.12);
	flex-shrink: 0;
}

button.dsn-mm-close {
	width: var(--dsn-mm-caret-width);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0 !important;
	border: none;
	border-left: 1px solid rgba(0, 0, 0, 0.08);
	background: transparent;
	cursor: pointer;
	color: var(--dsn-mm-header-text) !important;
	transition: background 150ms;
}

.dsn-mm-close:hover {
	background: rgba(0, 0, 0, 0.07);
}


/* ================================================================
   Scrollable nav area — ONLY this region scrolls
   ================================================================ */
.dsn-mm-scroll {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	position: relative;
}

.dsn-mm-scroll::-webkit-scrollbar {
	width: 4px;
}
.dsn-mm-scroll::-webkit-scrollbar-track {
	background: transparent;
}
.dsn-mm-scroll::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 2px;
}


/* ================================================================
   Panels track + CTA panel slide system
   ================================================================ */
.dsn-mm-panels-track {
	position: relative;
	min-height: 100%;
}

.dsn-mm-panel-level {
	width: 100%;
}

/* CTA panels (Locate us / Call us) — slide in from right */
.dsn-mm-cta-panel {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	min-height: 100%;
	background: var(--dsn-mm-panel-bg);
	transform: translateX(100%);
	transition: transform var(--dsn-mm-transition);
	z-index: 2;
}

.dsn-mm-cta-panel.is-active {
	transform: translateX(0);
}


/* ================================================================
   Back button (top of CTA panels)
   ================================================================ */
button.dsn-mm-back {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 20px 20px;
	margin:0 !important;
	background: var(--dsn-mm-back-bg);
	color: var(--dsn-mm-back-text);
	border: none;
	border-bottom: 1px solid var(--dsn-mm-item-border);
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	transition: background 150ms;
}

.dsn-mm-back:hover {
	background: rgba(0, 0, 0, 0.35);
}

.dsn-mm-back svg {
	flex-shrink: 0;
	stroke: var(--dsn-mm-back-text);
}


/* ================================================================
   Nav items
   ================================================================ */
.dsn-mm-nav,
.dsn-mm-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Separator between consecutive menu groups (primary / utility-left / utility-right) */
.dsn-mm-nav + .dsn-mm-nav {
	border-top: 4px solid var(--dsn-mm-item-border);
}

/* Row wrapper injected by JS around link + caret.
   Caret is position:absolute within this div only — never covers the sub-menu. */
.dsn-mm-item-row {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
}

/* Sub-menus collapsed by default; JS adds .is-open to expand */
.dsn-mm-nav .sub-menu {
	display: none;
	width: 100%;
}

.dsn-mm-nav .sub-menu.is-open {
	display: block;
	width: 100%;
}

.dsn-mm-nav li {
	position: relative;
	border-bottom: 1px solid var(--dsn-mm-item-border);
	margin-bottom: 0;
}

.dsn-mm-nav li:last-child {
	border-bottom: none;
}

.dsn-mm-nav li a {
	display: block;
	flex: 1 1 0; /* fills available width inside .dsn-mm-item-row */
	min-width: 0;
	padding: var(--dsn-mm-item-padding);
	color: var(--dsn-mm-item-text);
	text-decoration: none;
	font-size: var(--dsn-mm-item-font-size);
	font-weight: var(--dsn-mm-sub-item-font-weight);
	line-height: 1.35;
	transition: background 150ms;
}

.dsn-mm-nav li a:hover {
	background: var(--dsn-mm-item-hover-bg);
}

/* Top-level items get bolder weight (covers both leaf links and wrapped links) */
.dsn-mm-panel-main > .dsn-mm-nav > li > a,
.dsn-mm-panel-main > .dsn-mm-nav > li > .dsn-mm-item-row > a {
	font-weight: var(--dsn-mm-top-item-font-weight);
	text-align: left;
}

/* Sub-menu items: indented + slightly lighter blue */
.dsn-mm-nav .sub-menu > li > a,
.dsn-mm-nav .sub-menu > li > .dsn-mm-item-row > a {
	background: var(--dsn-mm-sub-item-bg);
	padding-left: 36px;
}

.dsn-mm-nav .sub-menu > li > a:hover {
	background: color-mix(in srgb, var(--dsn-mm-panel-bg) 90%, white);
}

/* Second level of nesting: even lighter + more indented */
.dsn-mm-nav .sub-menu .sub-menu > li > a,
.dsn-mm-nav .sub-menu .sub-menu > li > .dsn-mm-item-row > a {
	background: var(--dsn-mm-sub-sub-item-bg);
	padding-left: 52px;
}

/* Third level of nesting */
.dsn-mm-nav .sub-menu .sub-menu .sub-menu > li > a,
.dsn-mm-nav .sub-menu .sub-menu .sub-menu > li > .dsn-mm-item-row > a {
	background: var(--dsn-mm-sub-sub-sub-item-bg);
	padding-left: 68px;
}

/* Fourth level of nesting */
.dsn-mm-nav .sub-menu .sub-menu .sub-menu .sub-menu > li > a,
.dsn-mm-nav .sub-menu .sub-menu .sub-menu .sub-menu > li > .dsn-mm-item-row > a {
	background: var(--dsn-mm-depth-4-item-bg);
	padding-left: 84px;
}

/* Fifth level of nesting */
.dsn-mm-nav .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu > li > a,
.dsn-mm-nav .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu > li > .dsn-mm-item-row > a {
	background: var(--dsn-mm-depth-5-item-bg);
	padding-left: 100px;
}

.dsn-mm-nav .sub-menu .sub-menu > li > a:hover {
	background: color-mix(in srgb, var(--dsn-mm-panel-bg) 76%, white);
}

/* Current / active page */
.dsn-mm-nav li.current-menu-item > a,
.dsn-mm-nav li.current-menu-item > .dsn-mm-item-row > a,
.dsn-mm-nav li.current-page-ancestor > a,
.dsn-mm-nav li.current-page-ancestor > .dsn-mm-item-row > a {
	opacity: 0.75;
}


/* ================================================================
   Caret button (items with children)
   Slightly lighter background to visually separate from item link
   ================================================================ */
.dsn-mm-caret {
	position: absolute;
	right: 0;
	top: 0;
	height: 100%;
	width: var(--dsn-mm-caret-width);
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--dsn-mm-caret-bg);
	border: none;
	border-left: 1px solid var(--dsn-mm-item-border);
	color: var(--dsn-mm-caret-color);
	cursor: pointer;
	transition: background 150ms, color 150ms;
}

.dsn-mm-caret:hover {
	background: color-mix(in srgb, var(--dsn-mm-panel-bg) 90%, white);
	color: var(--dsn-mm-item-text);
}

/* Rotate chevron when expanded */
.dsn-mm-caret svg {
	transition: transform var(--dsn-mm-transition);
	flex-shrink: 0;
}

.dsn-mm-caret[aria-expanded="true"] svg {
	transform: rotate(90deg);
}


/* ================================================================
   Location cards (Locate us panel)
   ================================================================ */
.dsn-mm-location-card {
	border-bottom: 1px solid var(--dsn-mm-item-border);
}

.dsn-mm-location-card:last-child {
	border-bottom: none;
}

.dsn-mm-location-img {
	display: block;
	width: 100%;
	height: 150px;
	object-fit: cover;
	padding:20px;
}

.dsn-mm-location-body {
	padding: 16px 20px 18px;
}

.dsn-mm-location-name {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 700;
	color: var(--dsn-mm-item-text);
	line-height: 1.3;
}

.dsn-mm-location-address {
	margin: 0 0 8px;
	font-size: 13px;
	color: rgba(255, 255, 255, 0.72);
	line-height: 1.55;
}

.dsn-mm-location-hours {
	margin: 0 0 8px;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.60);
}

.dsn-mm-location-hours > div {
	display: flex;
	gap: 10px;
	margin-bottom: 3px;
}

.dsn-mm-location-hours > div:last-child {
	margin-bottom: 0;
}

.dsn-mm-location-hours dt {
	min-width: 72px;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.78);
}

.dsn-mm-location-hours dd {
	margin: 0;
}

.dsn-mm-location-phone,
.dsn-mm-location-directions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	margin-top: 10px;
	padding: 11px 16px;
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	color: #ffffff;
	text-decoration: none;
	box-sizing: border-box;
	transition: background 150ms, border-color 150ms;
}

.dsn-mm-location-phone:hover,
.dsn-mm-location-directions:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: #ffffff;
}

.dsn-mm-location-phone + .dsn-mm-location-phone {
	margin-top: 8px;
}


/* WYSIWYG content block (dealer child themes) */
.dsn-mm-location-content {
	font-size: 0.85rem;
	line-height: 1.55;
	color: var(--dsn-mm-item-text);
	opacity: 0.9;
}
.dsn-mm-location-content p {
	margin: 0 0 6px;
}
.dsn-mm-location-content a {
	color: var(--dsn-mm-item-text);
	opacity: 0.7;
}
.dsn-mm-location-content a:hover {
	opacity: 1;
}

/* Social media links */
.dsn-mm-location-social {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
}
.dsn-mm-social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: var(--dsn-mm-item-text);
	text-decoration: none;
	transition: background 0.2s;
}
.dsn-mm-social-link svg {
	width: 16px;
	height: 16px;
}
.dsn-mm-social-link:hover {
	background: rgba(255, 255, 255, 0.25);
}

/* ================================================================
   Phone list (Call us panel)
   ================================================================ */
.dsn-mm-cta-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.dsn-mm-cta-list a[href^="tel"]{
	color:var(--dsn-mm-item-text);
}

.dsn-mm-cta-list li {
	border-bottom: 1px solid var(--dsn-mm-item-border);
}

.dsn-mm-cta-list li:last-child {
	border-bottom: none;
}

.dsn-mm-cta-list-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 20px;
	color: var(--dsn-mm-item-text);
	text-decoration: none;
	font-size: var(--dsn-mm-item-font-size);
	font-weight: 600;
	line-height: 1.3;
	transition: background 150ms;
}

.dsn-mm-cta-list-item:hover {
	background: var(--dsn-mm-item-hover-bg);
}

.dsn-mm-cta-list-item svg {
	flex-shrink: 0;
}


/* ================================================================
   Trigger (hamburger button) — rendered by dsn_mobile_menu_trigger()
   ================================================================ */
button.dsn-mm-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	padding: 8px;
	cursor: pointer;
	color: var(--dsn-mm-trigger-color) !important;
	border-radius: 4px;
	line-height: 0;
}

.dsn-mm-trigger:hover {
	opacity: 0.75;
}


/* ================================================================
   dealer-theme mobile header integration
   Fixes layout when dsn-mm-trigger replaces the old #nav-toggle.
   Scoped to header.mobile so it doesn't affect other themes.
   ================================================================ */
.wp-theme-dealer-theme div.mobile.nav header.mobile:has(.dsn-mm-trigger) {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	height: 80px !important;
	padding: 0 5% !important;
	box-sizing: border-box;
}

.wp-theme-dealer-theme div.mobile.nav header.mobile:has(.dsn-mm-trigger) h1 {
	margin: 0 !important;
	height: 50px !important;
	flex-shrink: 0;
	overflow: hidden;
	align-self: center;
}

.wp-theme-dealer-theme div.mobile.nav header.mobile .dsn-mm-trigger {
	flex-shrink: 0;
	align-self: center;
	margin: 0 !important;
}


/* ================================================================
   syndified-theme-main mobile header integration
   Restores padding/height stripped by #dsShowcaseHeader's mobile
   override (padding: 0). Scoped via .dsw-sticky-header so it
   doesn't affect any other theme.
   ================================================================ */
.dsw-sticky-header:has(.dsn-mm-trigger) > div {
	padding-top: 14px !important;
	padding-bottom: 14px !important;
	padding-left: 5% !important;
	padding-right: 5% !important;
}

/* ================================================================
   Body scroll lock (applied when menu is open)
   ================================================================ */
body.dsn-mm-open {
	overflow: hidden;
	padding-right: var(--dsn-mm-scrollbar-width, 0px);
}
