/*
Theme Name: MedDev
Theme URI: https://wp1.test/
Author: Medpaid
Description: A calm, clinical-clean block theme for a vitamin and supplement store. Ocean blues and sea greens, soft surfaces, and WooCommerce templates built from blocks. Derived from Organic Store by Titan Themes (GPL).
Requires at least: 7.1
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.2.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: meddev
Tags: e-commerce, block-patterns, block-styles, full-site-editing, wide-blocks, style-variations, custom-colors, editor-style
*/

/* Only what theme.json cannot express lives here. Colours, type and spacing come from theme.json presets. */

:root {
	--meddev-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--meddev-header-offset: var(--wp-admin--admin-bar--height, 0px);
}

html {
	scroll-behavior: smooth;
}

/* Anchored sections clear the sticky header when jumped to. */
.wp-site-blocks [id] {
	scroll-margin-top: calc(var(--meddev-header-offset) + 130px);
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

a {
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
}

:where(a, button, input, select, textarea, summary, .wp-element-button):focus-visible {
	outline: 2px solid var(--wp--preset--color--sea-glass);
	outline-offset: 3px;
}

::selection {
	background: var(--wp--preset--color--seafoam);
	color: var(--wp--preset--color--contrast);
}

/* ---------- Header ---------- */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--meddev-header-offset);
	z-index: 100;
}

/*
 * The header's z-index makes it a stacking context, which caps the open phone menu at 100.
 * While the menu is open, lift the header so the overlay covers fixed page furniture such
 * as WooCommerce's store notice (z-index 99998). Core adds has-modal-open to <html> then.
 */
html.has-modal-open .wp-site-blocks > header.wp-block-template-part {
	z-index: 100000;
}

/*
 * The frosted background lives on a pseudo-element: backdrop-filter on the header
 * itself would make it the containing block for the fixed mobile menu overlay and
 * clip the overlay to the header's height.
 */
.meddev-header {
	position: relative;
	isolation: isolate;
}

.meddev-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-color: rgb(255 255 255 / 0.94);
	backdrop-filter: saturate(160%) blur(10px);
	-webkit-backdrop-filter: saturate(160%) blur(10px);
}

.meddev-header .wp-block-site-logo img {
	display: block;
}

.meddev-header__actions {
	line-height: 1;
}

.meddev-header__actions .wc-block-mini-cart__badge {
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--base);
	border: 0;
}

.meddev-header__actions .wc-block-mini-cart__button,
.meddev-header__actions .wc-block-customer-account a {
	padding: 0.4rem;
	border-radius: var(--wp--custom--radius--pill);
	transition: background-color 0.2s var(--meddev-ease);
}

.meddev-header__actions .wc-block-mini-cart__button:hover,
.meddev-header__actions .wc-block-customer-account a:hover {
	background: var(--wp--preset--color--mist);
}

.meddev-header .wp-block-search__button {
	border-radius: var(--wp--custom--radius--pill);
	background: transparent;
	color: var(--wp--preset--color--contrast);
	padding: 0.4rem;
	margin-left: 0;
}

.meddev-header .wp-block-search__button:hover {
	background: var(--wp--preset--color--mist);
}

.meddev-header .wp-block-search__input {
	border-radius: var(--wp--custom--radius--pill);
	border: 1px solid var(--wp--preset--color--haze);
	padding-inline: 1rem;
}

.meddev-header .wp-block-search.wp-block-search__searchfield-hidden .wp-block-search__input {
	border-width: 0;
}

.wp-block-navigation .wp-block-navigation__submenu-container {
	border: 1px solid var(--wp--preset--color--haze) !important;
	border-radius: var(--wp--custom--radius--md);
	box-shadow: var(--wp--preset--shadow--soft);
	padding: 0.5rem 0;
	min-width: 220px !important;
}

.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.45rem 1.1rem;
}

/*
 * Shop menu: every product category, two columns wide, centred under "Shop" so it stays
 * on screen at tablet widths. Long category lists (--wide) get three columns where they fit.
 * The mobile overlay keeps one column.
 */
@media (min-width: 600px) {
	.wp-block-navigation .meddev-shop-menu > .wp-block-navigation__submenu-container {
		display: block;
		columns: 2;
		column-gap: 0;
		min-width: 480px !important;
		padding: 0.6rem 0.4rem;
		left: 50%;
		translate: -50% 0;
	}

	.wp-block-navigation .meddev-shop-menu > .wp-block-navigation__submenu-container > li {
		break-inside: avoid;
	}
}

@media (min-width: 900px) {
	.wp-block-navigation .meddev-shop-menu--wide > .wp-block-navigation__submenu-container {
		columns: 3;
		min-width: 640px !important;
	}
}

.wp-block-navigation .meddev-shop-menu__all > .wp-block-navigation-item__content {
	font-weight: 600;
	color: var(--wp--preset--color--primary);
}

.wp-block-navigation .wp-block-navigation-item__content:hover {
	text-decoration: none;
}

/* The demo notice has a short form for phones; only one is ever displayed. */
.meddev-notice-short {
	display: none;
}

/* Below the navigation breakpoint: brand left, actions then the menu toggle on the right. */
@media (max-width: 599px) {
	.meddev-header .wp-block-group.alignwide {
		gap: 0.25rem;
	}

	.meddev-header .wp-block-group.alignwide > :first-child {
		margin-right: auto;
	}

	.meddev-header .wp-block-navigation {
		order: 3;
	}

	.meddev-notice-full {
		display: none;
	}

	.meddev-notice-short {
		display: block;
	}
}

/* Pill search field with the button inside (search template, 404). */
.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	border: 1px solid var(--wp--preset--color--haze);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--base);
	padding: 0.3rem;
}

.wp-block-search__button-inside .wp-block-search__input {
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	padding-inline: 1rem;
	background: transparent;
}

.wp-block-search__button-inside .wp-block-search__button {
	border-radius: var(--wp--custom--radius--pill);
}

/* ---------- Paragraph and list styles ---------- */

.is-style-pill {
	display: inline-flex;
	width: fit-content;
	align-items: center;
	gap: 0.5em;
	padding: 0.35em 0.9em;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--haze);
	color: var(--wp--preset--color--secondary);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.02em;
}

ul.is-style-checklist {
	list-style: none;
	padding-left: 0;
}

ul.is-style-checklist li {
	position: relative;
	padding-left: 1.9em;
}

ul.is-style-checklist li + li {
	margin-top: 0.55em;
}

ul.is-style-checklist li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.2em;
	width: 1.25em;
	height: 1.25em;
	border-radius: 50%;
	background-color: var(--wp--preset--color--base);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--haze);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231F7A63' d='M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z'/%3E%3C/svg%3E");
	background-size: 100% 100%;
}

/* ---------- Hero ---------- */

.meddev-hero {
	position: relative;
	overflow: hidden;
}

.meddev-hero::after {
	content: "";
	position: absolute;
	inset: auto 0 0;
	height: clamp(28px, 4vw, 56px);
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 60' preserveAspectRatio='none'%3E%3Cpath fill='%23FFFFFF' d='M0 32c120-18 240-26 360-18s240 30 360 30 240-22 360-30 240 0 360 14v32H0z'/%3E%3C/svg%3E") no-repeat bottom / 100% 100%;
	pointer-events: none;
}

.meddev-hero__media {
	position: relative;
}

.meddev-hero__media .wp-block-image img {
	aspect-ratio: 1;
	object-fit: cover;
	width: 100%;
}

.meddev-hero__badge {
	position: absolute;
	left: clamp(-1.5rem, -2vw, -0.5rem);
	bottom: clamp(1.5rem, 4vw, 2.5rem);
	max-width: 300px;
	z-index: 2;
}

@media (max-width: 781px) {
	.meddev-hero__badge {
		left: 1rem;
		bottom: 1rem;
	}
}

/* ---------- Cards and tiles ---------- */

.meddev-tile {
	position: relative;
	transition: transform 0.25s var(--meddev-ease), box-shadow 0.25s var(--meddev-ease), border-color 0.25s var(--meddev-ease);
}

.meddev-tile:hover {
	transform: translateY(-3px);
	box-shadow: var(--wp--preset--shadow--lift);
	border-color: var(--wp--preset--color--sea-glass) !important;
}

/* Whole tile is clickable through its heading link. */
.meddev-tile :where(h2, h3, h4) a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.meddev-tile :where(h2, h3, h4) a {
	text-decoration: none;
	color: inherit;
}

.meddev-promo {
	transition: transform 0.35s var(--meddev-ease);
}

.meddev-promo .wp-block-cover__image-background {
	transition: transform 0.6s var(--meddev-ease);
}

.meddev-promo:hover .wp-block-cover__image-background {
	transform: scale(1.04);
}

/* Full-width sections stacked in page content sit flush, as they do in templates. */
.wp-block-post-content > .alignfull + .alignfull {
	margin-block-start: 0;
}

/* Cards on the dark ocean section. */
.meddev-glass-card {
	background: rgb(255 255 255 / 0.07);
	border: 1px solid rgb(255 255 255 / 0.16);
}

/* ---------- Product cards (Product Collection) ---------- */

.wc-block-product-template .wc-block-product {
	display: flex;
	flex-direction: column;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--haze);
	border-radius: var(--wp--custom--radius--lg);
	padding: 0.75rem 0.75rem 1.25rem;
	transition: transform 0.25s var(--meddev-ease), box-shadow 0.25s var(--meddev-ease);
}

.wc-block-product-template .wc-block-product:hover {
	transform: translateY(-3px);
	box-shadow: var(--wp--preset--shadow--lift);
}

.wc-block-product-template .wc-block-components-product-image {
	border-radius: var(--wp--custom--radius--md);
	overflow: hidden;
	background: var(--wp--preset--color--base);
}

.wc-block-product-template .wc-block-components-product-image img {
	aspect-ratio: 1;
	object-fit: contain;
}

.wc-block-product-template .wp-block-post-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
}

.wc-block-product-template .wp-block-woocommerce-product-button {
	margin-top: auto;
}

.wc-block-product-template .wp-block-button__link,
.wc-block-product-template .wc-block-components-product-button__button {
	width: 100%;
	justify-content: center;
}

.wc-block-components-product-sale-badge {
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--base);
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 0.3em 0.75em;
}

.wc-block-components-product-price del,
.wc-block-components-product-price .wc-block-components-product-price__regular {
	color: var(--wp--preset--color--slate);
	font-weight: 400;
	opacity: 0.8;
}

.wc-block-components-product-price ins {
	text-decoration: none;
}

.wc-block-components-product-rating__stars span::before,
.wc-block-components-product-rating-stars__stars span::before {
	color: #E2A93B;
}

/* ---------- Single product ---------- */

.meddev-product__gallery .woocommerce-product-gallery {
	border-radius: var(--wp--custom--radius--lg);
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--haze);
	background: var(--wp--preset--color--base);
}

.meddev-product__summary .wc-block-add-to-cart-form .quantity .qty {
	border-radius: var(--wp--custom--radius--pill);
	border: 1px solid var(--wp--preset--color--haze);
	min-height: 2.9rem;
}

.meddev-product__summary .wc-block-add-to-cart-form .single_add_to_cart_button {
	border-radius: var(--wp--custom--radius--pill);
}

.wp-block-woocommerce-product-details .wc-tabs {
	border-bottom: 1px solid var(--wp--preset--color--haze);
}

/* ---------- Store chrome ---------- */

.wp-block-woocommerce-breadcrumbs,
.wp-block-breadcrumbs {
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--slate);
}

.wp-block-woocommerce-breadcrumbs a,
.wp-block-breadcrumbs a {
	color: inherit;
	text-decoration: none;
}

.wp-block-woocommerce-breadcrumbs a:hover,
.wp-block-breadcrumbs a:hover {
	color: var(--wp--preset--color--primary);
}

.wc-block-catalog-sorting select,
.woocommerce-ordering select {
	border: 1px solid var(--wp--preset--color--haze);
	border-radius: var(--wp--custom--radius--pill);
	padding: 0.5rem 2rem 0.5rem 1rem;
	background-color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-woocommerce-product-categories ul {
	list-style: none;
	padding-left: 0;
	margin: 0;
}

.wp-block-woocommerce-product-categories li {
	padding: 0.35rem 0;
	border-bottom: 1px solid var(--wp--preset--color--haze);
}

.wp-block-woocommerce-product-categories li:last-child {
	border-bottom: 0;
}

.wp-block-woocommerce-product-categories a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.wp-block-woocommerce-product-categories a:hover {
	color: var(--wp--preset--color--primary);
}

.wp-block-query-pagination .page-numbers.current {
	display: inline-grid;
	place-items: center;
	min-width: 2.2em;
	height: 2.2em;
	border-radius: 50%;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

/* ---------- Sections ---------- */

/* Outline buttons on the dark ocean section: a block style nested inside a section style does not cascade from theme.json. */
.is-style-section-ocean .wp-block-button.is-style-outline > .wp-block-button__link {
	color: var(--wp--preset--color--base);
	border-color: currentColor;
	background: transparent;
}

.is-style-section-ocean .wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: rgb(255 255 255 / 0.12);
}

.wp-site-blocks > footer.wp-block-template-part {
	margin-block-start: 0;
}

/* ---------- Footer ---------- */

ul.meddev-footer__links {
	list-style: none;
	padding-left: 0;
	margin-top: 1rem;
}

ul.meddev-footer__links li + li {
	margin-top: 0.5rem;
}

.meddev-footer__links a {
	text-decoration: none;
}

.meddev-footer__links a:hover {
	text-decoration: underline;
}

.meddev-footer__legal {
	opacity: 0.85;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}

	.meddev-tile:hover,
	.wc-block-product-template .wc-block-product:hover,
	.meddev-promo:hover .wp-block-cover__image-background {
		transform: none;
	}
}
