/**
 * Mundo Medica global components.
 * Version: 0.5.2-alpha
 * Scope: opt-in classes for Divi Theme Builder global structures.
 */

/* Shared component rules */

:where(.mm-global-header, .mm-global-footer) {
	box-sizing: border-box;
	font-family: var(--mm-font-family);
	letter-spacing: 0;
}

:where(.mm-global-header, .mm-global-footer) *,
:where(.mm-global-header, .mm-global-footer) *::before,
:where(.mm-global-header, .mm-global-footer) *::after {
	box-sizing: border-box;
}

:where(.mm-global-header, .mm-global-footer) :where(a, button, input, select, textarea):focus-visible,
:where(.mm-breadcrumbs, .mm-global-notice):focus-visible {
	outline: 3px solid var(--mm-color-focus);
	outline-offset: 3px;
}

:where(.mm-global-header, .mm-global-footer) :where(a, button) {
	touch-action: manipulation;
}

/* Header */

.mm-global-header {
	background: var(--mm-color-white);
	color: var(--mm-color-text);
	position: relative;
	z-index: var(--mm-layer-sticky);
}

.mm-utility-bar {
	align-items: center;
	background: var(--mm-color-navy);
	color: var(--mm-color-white);
	display: flex;
	flex-wrap: wrap;
	font-size: var(--mm-font-size-sm);
	gap: var(--mm-space-2) var(--mm-space-4);
	justify-content: center;
	min-height: 2.75rem;
	padding: var(--mm-space-2) var(--mm-gutter-mobile);
	text-align: center;
}

.mm-utility-bar :where(a) {
	color: inherit;
	min-height: 2.75rem;
	padding-block: var(--mm-space-2);
}

.mm-header-main {
	align-items: center;
	display: grid;
	gap: var(--mm-space-3);
	grid-template-columns: minmax(0, 1fr) auto;
	margin-inline: auto;
	max-width: var(--mm-container-wide);
	padding: var(--mm-space-3) var(--mm-gutter-mobile);
	width: 100%;
}

.mm-brand {
	align-items: center;
	color: var(--mm-color-navy);
	display: inline-flex;
	font-weight: var(--mm-font-weight-bold);
	gap: var(--mm-space-2);
	min-height: 2.75rem;
	min-width: 0;
	text-decoration: none;
}

.mm-brand :where(img) {
	display: block;
	height: auto;
	max-height: 3.5rem;
	max-width: min(13rem, 100%);
	object-fit: contain;
}

.mm-global-search {
	display: flex;
	grid-column: 1 / -1;
	min-width: 0;
	position: relative;
}

.mm-global-search :where(form) {
	display: flex;
	gap: var(--mm-space-2);
	width: 100%;
}

.mm-global-search :where(input[type="search"]) {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
}

.mm-global-search :where(button, [role="button"]) {
	align-items: center;
	background: var(--mm-color-navy);
	border: var(--mm-border-width) solid var(--mm-color-navy);
	border-radius: var(--mm-radius-md);
	color: var(--mm-color-white);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: var(--mm-font-weight-bold);
	justify-content: center;
	min-height: 2.75rem;
	min-width: 2.75rem;
	padding: var(--mm-space-2) var(--mm-space-4);
}

.mm-global-search :where(button, [role="button"]):hover {
	background: var(--mm-color-primary);
	border-color: var(--mm-color-primary);
}

.mm-global-nav,
.mm-category-nav {
	background: var(--mm-color-white);
	border-block-start: var(--mm-border-width) solid var(--mm-color-border);
	color: var(--mm-color-text);
}

:where(.mm-global-nav, .mm-category-nav) :where(ul) {
	display: flex;
	flex-direction: column;
	gap: var(--mm-space-1);
	list-style: none;
	margin: 0;
	padding: var(--mm-space-2) var(--mm-gutter-mobile);
}

:where(.mm-global-nav, .mm-category-nav) :where(a, button) {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: var(--mm-radius-sm);
	color: var(--mm-color-navy);
	cursor: pointer;
	display: flex;
	font: inherit;
	font-weight: var(--mm-font-weight-semibold);
	justify-content: space-between;
	min-height: 2.75rem;
	padding: var(--mm-space-2) var(--mm-space-3);
	text-align: start;
	text-decoration: none;
	width: 100%;
}

:where(.mm-global-nav, .mm-category-nav) :where(a, button):hover,
:where(.mm-global-nav, .mm-category-nav) :where(a[aria-current="page"], button[aria-expanded="true"]) {
	background: var(--mm-color-background-soft);
	color: var(--mm-color-primary);
}

.mm-category-nav {
	border-block-end: var(--mm-border-width) solid var(--mm-color-border);
}

.mm-category-nav :where([aria-expanded="true"]) {
	box-shadow: inset 0 -3px 0 var(--mm-color-cyan);
}

.mm-header-actions {
	align-items: center;
	display: flex;
	gap: var(--mm-space-1);
	justify-content: flex-end;
}

:where(.mm-action-account, .mm-action-quote, .mm-action-cart) {
	align-items: center;
	background: var(--mm-color-white);
	border: var(--mm-border-width) solid transparent;
	border-radius: var(--mm-radius-md);
	color: var(--mm-color-navy);
	display: inline-flex;
	font-weight: var(--mm-font-weight-semibold);
	gap: var(--mm-space-2);
	justify-content: center;
	min-height: 2.75rem;
	min-width: 2.75rem;
	padding: var(--mm-space-2);
	position: relative;
	text-decoration: none;
}

:where(.mm-action-account, .mm-action-quote, .mm-action-cart):hover,
:where(.mm-action-account, .mm-action-quote, .mm-action-cart)[aria-current="page"] {
	background: var(--mm-color-background-soft);
	border-color: var(--mm-color-border);
	color: var(--mm-color-primary);
}

.mm-action-quote {
	border-color: var(--mm-color-cyan);
}

.mm-action-cart {
	border-color: var(--mm-color-primary);
}

:where(.mm-action-quote, .mm-action-cart) :where([data-count]) {
	align-items: center;
	background: var(--mm-color-navy);
	border-radius: var(--mm-radius-pill);
	color: var(--mm-color-white);
	display: inline-flex;
	font-size: var(--mm-font-size-xs);
	font-weight: var(--mm-font-weight-bold);
	justify-content: center;
	line-height: 1;
	min-height: 1.25rem;
	min-width: 1.25rem;
	padding: 0.2rem;
}

/* Context and notices */

.mm-breadcrumbs {
	color: var(--mm-color-text-muted);
	font-family: var(--mm-font-family);
	font-size: var(--mm-font-size-sm);
	margin-inline: auto;
	max-width: var(--mm-container-wide);
	padding: var(--mm-space-3) var(--mm-gutter-mobile);
}

.mm-breadcrumbs :where(ol, ul) {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mm-space-1) var(--mm-space-2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.mm-breadcrumbs :where(a) {
	color: var(--mm-color-primary);
	min-height: 2.75rem;
	padding-block: var(--mm-space-2);
}

.mm-breadcrumbs :where([aria-current="page"]) {
	color: var(--mm-color-text);
	font-weight: var(--mm-font-weight-semibold);
}

.mm-global-notice {
	background: var(--mm-color-info-soft);
	border: var(--mm-border-width) solid var(--mm-color-cyan);
	border-radius: var(--mm-radius-md);
	color: var(--mm-color-text);
	font-family: var(--mm-font-family);
	margin-block: var(--mm-space-3);
	padding: var(--mm-space-3) var(--mm-space-4);
}

.mm-global-notice[data-state="success"] {
	background: var(--mm-color-success-soft);
	border-color: var(--mm-color-success);
}

.mm-global-notice[data-state="warning"] {
	background: var(--mm-color-warning-soft);
	border-color: var(--mm-color-warning);
}

.mm-global-notice[data-state="error"] {
	background: var(--mm-color-error-soft);
	border-color: var(--mm-color-error);
}

/* Footer */

.mm-global-footer {
	background: var(--mm-color-navy);
	color: var(--mm-color-white);
	padding-block: var(--mm-space-7) var(--mm-space-4);
}

.mm-global-footer :where(a) {
	color: var(--mm-color-white);
	text-decoration-color: var(--mm-color-cyan);
}

.mm-footer-grid {
	display: grid;
	gap: var(--mm-space-5);
	grid-template-columns: minmax(0, 1fr);
	margin-inline: auto;
	max-width: var(--mm-container);
	padding-inline: var(--mm-gutter-mobile);
}

.mm-footer-column {
	border-block-end: var(--mm-border-width) solid rgb(255 255 255 / 24%);
	min-width: 0;
	padding-block-end: var(--mm-space-4);
}

.mm-footer-column :where(h2, h3, h4) {
	color: var(--mm-color-white);
	font-size: var(--mm-font-size-base);
	font-weight: var(--mm-font-weight-bold);
	margin-block: 0 var(--mm-space-3);
}

.mm-footer-column :where(ul) {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mm-footer-column :where(a, button) {
	align-items: center;
	background: transparent;
	border: 0;
	color: var(--mm-color-white);
	display: inline-flex;
	font: inherit;
	min-height: 2.75rem;
	padding-block: var(--mm-space-2);
	text-align: start;
}

/* Reserved contract: the approved footer does not currently include a newsletter. */
.mm-footer-newsletter {
	display: grid;
	gap: var(--mm-space-3);
	grid-template-columns: minmax(0, 1fr);
}

.mm-footer-newsletter :where(form) {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mm-space-2);
}

.mm-footer-newsletter :where(input) {
	flex: 1 1 14rem;
	min-width: 0;
}

.mm-footer-newsletter :where(button) {
	background: var(--mm-color-cyan);
	border: var(--mm-border-width) solid var(--mm-color-cyan);
	border-radius: var(--mm-radius-md);
	color: var(--mm-color-navy);
	font: inherit;
	font-weight: var(--mm-font-weight-bold);
	min-height: 2.75rem;
	padding: var(--mm-space-2) var(--mm-space-4);
}

.mm-footer-legal {
	align-items: center;
	border-block-start: var(--mm-border-width) solid rgb(255 255 255 / 24%);
	display: flex;
	flex-direction: column;
	font-size: var(--mm-font-size-sm);
	gap: var(--mm-space-2) var(--mm-space-4);
	margin: var(--mm-space-5) auto 0;
	max-width: var(--mm-container);
	padding: var(--mm-space-4) var(--mm-gutter-mobile) 0;
	text-align: center;
}

/* Responsive enhancement */

@media (min-width: 48rem) {
	.mm-utility-bar {
		justify-content: space-between;
		padding-inline: var(--mm-gutter-tablet);
		text-align: start;
	}

	.mm-header-main {
		grid-template-columns: auto minmax(14rem, 1fr) auto;
		padding-inline: var(--mm-gutter-tablet);
	}

	.mm-global-search {
		grid-column: auto;
	}

	:where(.mm-global-nav, .mm-category-nav) :where(ul) {
		align-items: center;
		flex-direction: row;
		flex-wrap: wrap;
		margin-inline: auto;
		max-width: var(--mm-container-wide);
		padding-inline: var(--mm-gutter-tablet);
	}

	:where(.mm-global-nav, .mm-category-nav) :where(a, button) {
		width: auto;
	}

	.mm-footer-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		padding-inline: var(--mm-gutter-tablet);
	}

	.mm-footer-column {
		border-block-end: 0;
		padding-block-end: 0;
	}

	.mm-footer-legal {
		flex-direction: row;
		justify-content: space-between;
		padding-inline: var(--mm-gutter-tablet);
		text-align: start;
	}
}

@media (min-width: 61.3125rem) {
	.mm-header-main,
	:where(.mm-global-nav, .mm-category-nav) :where(ul),
	.mm-breadcrumbs,
	.mm-footer-grid,
	.mm-footer-legal {
		padding-inline: var(--mm-gutter-desktop);
	}

	.mm-footer-grid {
		grid-template-columns: minmax(14rem, 1.4fr) repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 24.375rem) {
	.mm-header-main {
		padding-inline: var(--mm-space-3);
	}

	.mm-header-actions {
		gap: 0;
	}

	:where(.mm-action-account, .mm-action-quote, .mm-action-cart) {
		padding-inline: var(--mm-space-1);
	}
}

@media (prefers-reduced-motion: reduce) {
	:where(.mm-global-header, .mm-global-footer, .mm-breadcrumbs, .mm-global-notice),
	:where(.mm-global-header, .mm-global-footer, .mm-breadcrumbs, .mm-global-notice) * {
		animation-duration: 0.01ms;
		animation-iteration-count: 1;
		scroll-behavior: auto;
		transition-duration: 0.01ms;
	}
}
