/* WPO Mega Menu — front-end styles
   Tokens are set inline on .wmm from plugin settings:
   --wmm-accent, --wmm-text, --wmm-bg, --wmm-font-size, --wmm-transform */

.wmm {
	--wmm-font: inherit;
	--wmm-muted: #6b6b6b;
	--wmm-border: #e8e8e8;
	--wmm-thumb: 48px;
	--wmm-panel-w: 1100px;
	--wmm-radius: 2px;
	--wmm-shadow: 0 18px 40px rgba(0, 0, 0, .12);
	position: relative;
	font-family: var(--wmm-font);
	font-size: var(--wmm-font-size, 13px);
	color: var(--wmm-text, #1a1a1a);
	line-height: 1.3;
	z-index: 100;
}
/* Drawer portal container (moved to <body> by JS in drawer mode): must NOT create a
   stacking context, so the fixed drawer/backdrop sit in the root context. */
.wmm.wmm--portal { position: static; z-index: auto; }

/* Body scroll lock while the drawer is open (works on iOS Safari too) */
html.wmm-lock, html.wmm-lock body { overflow: hidden; }
html.wmm-lock body { position: fixed; left: 0; right: 0; width: 100%; }

.wmm *, .wmm *::before, .wmm *::after { box-sizing: border-box; }
.wmm ul { list-style: none; margin: 0; padding: 0; }
.wmm a { color: inherit; text-decoration: none; }
/* Theme resets (Hello Elementor reset.css etc.) style bare `button` / `[type=button]`
   with display, pink hover/focus backgrounds, borders and padding at specificity
   0,1,0–0,2,0. Everything below is scoped under .wmm to out-rank them. */
.wmm button {
	font: inherit; color: inherit; background: none; border: 0; border-radius: 0;
	box-shadow: none; cursor: pointer; padding: 0;
}
/* state rules: colours only — never box-model, so they can't fight .wmm .wmm__top etc. */
.wmm button:hover,
.wmm button:focus,
.wmm button:active {
	color: inherit; background: none; background-color: transparent;
	border-color: transparent; box-shadow: none; text-decoration: none;
}
.wmm button:focus-visible { outline: 2px solid var(--wmm-accent, currentColor); outline-offset: 2px; }
.wmm img { display: block; max-width: 100%; }

/* ---------- desktop bar ---------- */
/* 0,2,0 so a theme's `[type=button] { display:inline-block }` can't reveal these.
   The .wmm--mobile rules below share this specificity and come later, so they win. */
.wmm .wmm__burger, .wmm .wmm__drawer-head, .wmm .wmm__backdrop, .wmm .wmm__toggle { display: none; }

.wmm__bar {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: nowrap;
}
.wmm--align-center .wmm__bar { justify-content: center; }
.wmm--align-right  .wmm__bar { justify-content: flex-end; }
.wmm--align-left   .wmm__bar { justify-content: flex-start; }

.wmm__item { position: static; }

.wmm .wmm__top {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 14px 12px;
	text-transform: var(--wmm-transform, uppercase);
	letter-spacing: .04em;
	font-weight: 500;
	white-space: nowrap;
	position: relative;
	transition: color .15s;
}
.wmm__top::after {
	content: "";
	position: absolute;
	left: 12px; right: 12px; bottom: 8px;
	height: 2px;
	background: var(--wmm-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .18s ease;
}
.wmm__item.is-open > .wmm__top::after,
.wmm__top:hover::after { transform: scaleX(1); }
.wmm__chev { transition: transform .18s; flex: none; }
.wmm__item.is-open > .wmm__top .wmm__chev { transform: rotate(180deg); }

/* ---------- panel ---------- */
.wmm__panel {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(6px);
	width: min(var(--wmm-panel-w), calc(100vw - 32px));
	background: var(--wmm-bg, #fff);
	color: var(--wmm-text);
	box-shadow: var(--wmm-shadow);
	border-radius: var(--wmm-radius);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
	z-index: 101;
}
.wmm__item.is-open > .wmm__panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
	transition-delay: 0s;
}
/* Switching between items: the outgoing panel disappears at once instead of
   cross-fading under the incoming one. */
.wmm__bar:has(> .wmm__item.is-open) > .wmm__item:not(.is-open) > .wmm__panel { transition: none; }

/* Compact dropdown: a short text-only link list sits under its own item. */
.wmm__item--compact { position: relative; }
.wmm__item--compact > .wmm__panel {
	left: 0;
	width: max-content;
	min-width: 240px;
	max-width: calc(100vw - 32px);
	transform: translateY(6px);
}
.wmm__item--compact.is-open > .wmm__panel { transform: translateY(0); }
.wmm__item--compact .wmm__panel-inner { padding: 22px 26px 20px; }
.wmm__item--compact .wmm__col { min-width: 0; }
.wmm__item--compact .wmm__links { gap: 2px; }

/* JS sets --wmm-shift to keep panel inside the viewport */
.wmm__panel { margin-left: var(--wmm-shift, 0px); }

.wmm__panel-inner {
	display: flex;
	gap: 36px;
	padding: 36px 40px 32px;
	max-height: calc(100vh - 140px);
	overflow: auto;
}
.wmm__panel-inner--columns,
.wmm__panel-inner--grid { flex-wrap: wrap; } /* heading is flex-basis 100%: without wrap it pushed the grid out of the panel */
.wmm__panel-heading {
	flex: 0 0 100%;
	font-weight: 700;
	font-size: 1.1em;
	margin: -8px 0 8px;
}
.wmm__cols {
	display: flex;
	gap: 0;
	flex: 1 1 auto;
	min-width: 0;
}
.wmm__col {
	flex: 1 1 0;
	min-width: 180px;
	padding: 0 32px 0 0;
	margin-right: 32px;
	border-right: 1px solid var(--wmm-border);
	display: flex;
	flex-direction: column;
}
.wmm__col:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.wmm__col-heading {
	font-weight: 700;
	font-size: 1.08em;
	margin: 0 0 18px;
}
.wmm__col-heading--muted {
	font-weight: 400;
	font-style: italic;
	color: var(--wmm-muted);
	font-size: .92em;
	margin-bottom: 12px;
}
.wmm__links { display: flex; flex-direction: column; gap: 4px; }
.wmm__link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 4px 0;
	font-size: 1.05em;
	transition: color .15s;
}
.wmm__link:hover .wmm__link-label { text-decoration: underline; text-underline-offset: 3px; }
.wmm__link--static { cursor: default; }
.wmm__link--static:hover .wmm__link-label { text-decoration: none; }

/* shortcode column (e.g. a colour filter) */
.wmm__col--shortcode { flex: 1.6 1 0; min-width: 280px; }
/* wallpaper-ai-search colour filter inside a panel: chips wrap to the column, no loading gap */
.wmm .was-color-filter { font-size: 1em; }
.wmm .was-cf-chips { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.wmm .was-cf-label { overflow-wrap: normal; word-break: normal; hyphens: manual; } /* "Turquoise" was splitting mid-word */
/* The panel / column heading already labels the filter: drop its own accordion header
   (a <button>, so it was also picking up theme button styles) and keep the chips open. */
.wmm .was-cf-accordion-toggle { display: none; }
.wmm .was-cf-body { display: block; margin-top: 0; }
.wmm__sc { min-width: 0; }
.wmm__sc--full { grid-column: 1 / -1; width: 100%; }
.wmm__sc form, .wmm__sc ul { margin: 0; }
.wmm__thumb {
	flex: none;
	width: var(--wmm-thumb);
	height: var(--wmm-thumb);
	border-radius: 50%;
	overflow: hidden;
	background: #f0f0f0;
	border: 1px solid rgba(0,0,0,.06);
}
.wmm--thumb-rounded .wmm__thumb { border-radius: 8px; }
.wmm--thumb-square  .wmm__thumb { border-radius: 0; }
.wmm__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.wmm__link:hover .wmm__thumb img { transform: scale(1.08); }
.wmm__thumb--empty { background: transparent; border-color: transparent; } /* keeps labels aligned when a sibling has a thumbnail */
.wmm__thumb--swatch { width: calc(var(--wmm-thumb) * .75); height: calc(var(--wmm-thumb) * .75); }
.wmm__viewall {
	margin-top: auto;
	padding-top: 18px;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
	font-size: 1em;
	align-self: flex-start;
}

/* featured card (right of columns) */
.wmm__featured {
	flex: 0 0 300px;
	max-width: 300px;
}
.wmm__featured-link {
	display: block;
	position: relative;
	border-radius: var(--wmm-radius);
	overflow: hidden;
	aspect-ratio: 1 / 1;
	background: #f0f0f0;
}
.wmm__featured-link img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.wmm__featured-link:hover img { transform: scale(1.04); }
.wmm__cta {
	position: absolute;
	left: 50%; bottom: 20px;
	transform: translateX(-50%);
	background: var(--wmm-accent);
	color: #fff;
	padding: 12px 22px;
	border-radius: 999px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	font-size: .92em;
	white-space: nowrap;
}

/* grid layout (image cards) */
.wmm__panel-inner--grid { padding: 24px 28px; }
.wmm__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 20px;
	width: 100%;
}
.wmm__card { display: block; text-align: center; }
.wmm__card-media {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--wmm-radius);
	background: #f0f0f0;
	margin-bottom: 10px;
}
.wmm__card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.wmm__card:hover .wmm__card-media img { transform: scale(1.05); }
.wmm__card-label { font-size: 1.05em; }
.wmm__card:hover .wmm__card-label { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- mobile / drawer (class set by JS from breakpoint) ---------- */
.wmm--mobile .wmm__burger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px; height: 44px;
}
.wmm__burger-lines { display: block; width: 22px; }
.wmm__burger-lines span {
	display: block; height: 2px; background: currentColor; margin: 5px 0; border-radius: 2px;
}
.wmm--mobile .wmm__drawer {
	position: fixed;
	top: 0; left: 0; bottom: 0;
	width: min(400px, 88vw);
	background: var(--wmm-bg, #fff);
	z-index: 100000;
	transform: translateX(-100%);
	transition: transform .25s ease;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 40px;
}
.wmm--mobile.wmm--open .wmm__drawer { transform: translateX(0); }
.wmm--mobile .wmm__backdrop {
	display: block;
	position: fixed; inset: 0;
	background: rgba(0,0,0,.45);
	opacity: 0; pointer-events: none;
	transition: opacity .25s;
	z-index: 99999;
}
.wmm--mobile.wmm--open .wmm__backdrop { opacity: 1; pointer-events: auto; }
.wmm--mobile .wmm__drawer-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 16px 14px 20px;
	border-bottom: 1px solid var(--wmm-border);
}
.wmm__drawer-title { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.wmm__close { font-size: 28px; line-height: 1; width: 40px; height: 40px; }

.wmm--mobile .wmm__bar { display: block; }
.wmm--mobile .wmm__item {
	position: relative;
	border-bottom: 1px solid var(--wmm-border);
}
.wmm--mobile .wmm .wmm__top,
.wmm--mobile .wmm__top {
	display: flex;
	width: 100%;
	padding: 16px 20px;
	font-size: max(15px, 1.05em); /* 13px read too small in the drawer */
	justify-content: space-between;
}
.wmm--mobile .wmm__top::after { display: none; }
.wmm--mobile .wmm__item--mega .wmm__top { padding-right: 56px; }
.wmm--mobile .wmm__item--mega .wmm__top .wmm__chev { display: none; }
.wmm--mobile .wmm__toggle {
	display: flex; align-items: center; justify-content: center;
	position: absolute; top: 0; right: 0;
	width: 52px; height: 52px;
}
.wmm--mobile .wmm__toggle svg { width: 14px; height: 14px; transition: transform .2s; }
.wmm--mobile .wmm__item.is-open .wmm__toggle svg,
.wmm--mobile .wmm__item.is-open > button.wmm__top .wmm__chev { transform: rotate(180deg); }
.wmm--mobile .wmm__item--mega > button.wmm__top .wmm__chev { display: block; }

.wmm--mobile .wmm__panel {
	position: static;
	transform: none;
	width: auto;
	box-shadow: none;
	border-radius: 0;
	margin: 0;
	display: none;
	opacity: 1; visibility: visible; pointer-events: auto;
	transition: none;
	background: #fafafa;
}
.wmm--mobile .wmm__item.is-open > .wmm__panel { display: block; transform: none; width: auto; }
.wmm--mobile .wmm__panel-inner { flex-direction: column; gap: 20px; padding: 8px 20px 20px; max-height: none; }
.wmm--mobile .wmm__cols { flex-direction: column; gap: 18px; }
.wmm--mobile .wmm__col { border: 0; margin: 0; padding: 0; min-width: 0; }
.wmm--mobile .wmm__col-heading { margin: 10px 0 8px; }
.wmm--mobile .wmm__link { padding: 6px 0; min-height: 44px; font-size: max(15px, 1.05em); }   /* 44px tap target even without a thumbnail */
.wmm--mobile .wmm__viewall { padding-top: 8px; min-height: 44px; display: inline-flex; align-items: center; }
.wmm--mobile .wmm__col--shortcode { padding: 4px 0; }
.wmm--mobile .wmm__featured { flex: none; max-width: none; }
.wmm--mobile .wmm__featured-link { aspect-ratio: 16 / 9; }
.wmm--mobile .wmm__grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
.wmm--mobile .wmm__item--compact { position: relative; }
.wmm--mobile .wmm__item--compact > .wmm__panel { width: auto; min-width: 0; max-width: none; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
	.wmm *, .wmm *::before, .wmm *::after { transition: none !important; }
}
