/* ==========================================================================
   Ecommerce Layout 2 — layout styles
   Enqueued from functions.php. Colours, type and spacing come from theme.json
   presets (var(--wp--preset--*)), so Global Styles edits flow through here.
   ========================================================================== */

/* --- Announcement bar -------------------------------------------------- */
.el2-announcement p { margin: 0; }

/* --- Header ------------------------------------------------------------ */
.el2-header-top { padding-bottom: 28px; }

.el2-header-nav {
	border-top: 1px solid var(--wp--preset--color--accent-6);
	border-bottom: 1px solid var(--wp--preset--color--accent-6);
	padding-block: 14px;
}

.el2-header .wp-block-site-title,
.el2-footer .wp-block-site-title { margin: 0; white-space: nowrap; }

.el2-header .wp-block-site-title a,
.el2-footer .wp-block-site-title a {
	color: inherit;
	text-decoration: none;
}

/* Shortcode blocks arrive wrapped in <p> by wpautop — neutralise it. */
.el2-header-nav > p,
.el2-footer-brand > p,
.el2-footer-meta > p { margin: 0; }

/* --- Navigation -------------------------------------------------------- */
.el2-nav .wp-block-navigation-item__content { text-underline-offset: 4px; }
.el2-nav .current-menu-item > .wp-block-navigation-item__content,
.el2-nav .current_page_item > .wp-block-navigation-item__content { text-decoration: underline; }

.el2-nav .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

/* --- Cart link --------------------------------------------------------- */
.el2-cart-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: inherit;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
}
.el2-cart-link:hover { text-decoration: none; }
.el2-cart-link:hover .el2-cart-label { text-decoration: underline; text-underline-offset: 4px; }
.el2-cart-icon { fill: currentColor; flex: 0 0 auto; }

/* --- Hero -------------------------------------------------------------- */
.el2-hero.wp-block-cover { margin-top: 0; }

/* --- Product grid ------------------------------------------------------ */
/* Defined here rather than trusting the layout CSS WordPress generates:
   when a Grid group has both a column count and a minimum column width, WP
   splices the block gap into a calc(). A two-value gap ("64px 20px") makes
   that calc invalid, the browser discards grid-template-columns, and every
   product stacks in one column. `body` lifts specificity above WP's
   generated .wp-container-* selector. */
body .wp-block-group.el2-product-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	column-gap: 20px;
	row-gap: 64px;
}

@media (max-width: 1024px) {
	body .wp-block-group.el2-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 781px) {
	body .wp-block-group.el2-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 44px; }
}
@media (max-width: 480px) {
	body .wp-block-group.el2-product-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Grid items are block-level groups — cancel flow-layout margins between them. */
body .wp-block-group.el2-product-grid > * { margin: 0; }

.el2-product-media.wp-block-cover {
	min-height: 0;
	aspect-ratio: 6 / 7;
	padding: 0;
	overflow: hidden;
}
.el2-product-media .wp-block-cover__image-background { object-fit: cover; }

/* The grey overlay is a placeholder. Once a real product photo is added to
   the Cover, hide the overlay automatically — otherwise the 100% overlay
   would sit on top of the photo and hide it. */
.el2-product-media:has(.wp-block-cover__image-background) .wp-block-cover__background {
	opacity: 0 !important;
}

.el2-product-media { transition: opacity .2s ease; }
.el2-product:hover .el2-product-media { opacity: .92; }

.el2-product-title {
	margin: 14px 0 0;
	line-height: 1.4;
	letter-spacing: .5px;
	text-transform: uppercase;
}
.el2-product-title a { color: inherit; }
.el2-product-price {
	margin: 4px 0 0;
	letter-spacing: .5px;
}

/* --- Footer ------------------------------------------------------------ */
.el2-footer { border-top: 1px solid var(--wp--preset--color--accent-6); }

.el2-footer-meta {
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 1px;
	text-transform: uppercase;
}
.el2-copyright { white-space: nowrap; }

/* The comp fits on one row because "LOGO" is ~120px. A typed site name is
   much wider, so the row can wrap — when it does, keep the meta group
   anchored right as in the comp instead of dropping it under the logo. */
.el2-footer-meta { margin-left: auto; justify-content: flex-end; }

/* --- Subscribe form ---------------------------------------------------- */
.el2-subscribe {
	display: flex;
	align-items: stretch;
	margin: 0;
}
.el2-subscribe input[type="email"] {
	width: 190px;
	min-width: 0;
	padding: 6px 10px;
	border: 1px solid var(--wp--preset--color--accent-4);
	border-right: 0;
	border-radius: 0;
	background: var(--wp--preset--color--base);
	color: inherit;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
}
.el2-subscribe input[type="email"]::placeholder { color: var(--wp--preset--color--accent-3); }
.el2-subscribe input[type="email"]:focus {
	outline: 1px solid var(--wp--preset--color--contrast);
	outline-offset: -1px;
}
.el2-subscribe .wp-element-button { white-space: nowrap; cursor: pointer; }

/* Block themes don't guarantee this utility on the front end. */
.el2-subscribe .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --- Small screens ----------------------------------------------------- */
@media (max-width: 781px) {
	.el2-header-top { justify-content: center; gap: 16px; }
	.el2-nav-utility { display: none; }          /* main nav + overlay covers it */
	/* A real site name is far longer than the comp's "LOGO" — let it wrap and
	   shrink rather than force horizontal scrolling on phones. */
	.el2-header .wp-block-site-title,
	.el2-footer .wp-block-site-title {
		white-space: normal;
		text-align: center;
		font-size: var(--wp--preset--font-size--x-large) !important;
	}
	.el2-hero.wp-block-cover { min-height: 280px !important; }
	.el2-footer-row,
	.el2-footer-brand,
	.el2-footer-meta { justify-content: center; text-align: center; }
	.el2-footer-meta { margin-left: 0; }
}
