/*
Theme Name: LED B2B Lite
Author: LED Wholesale Direct
Description: Lightweight WooCommerce block theme for LED wholesale, OEM/ODM and private-label sites. Every template, template part and pattern is built from core and WooCommerce blocks, so the entire site can be edited visually in the Site Editor.
Version: 2.8.4
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: led-b2b-lite
Tags: block-theme, full-site-editing, woocommerce, e-commerce, business, one-column, two-columns
*/

/* =========================================================================
   1. Small layout helpers
      Everything else (colour, type, spacing, buttons, tables) comes from
      theme.json so it stays editable in the Site Editor's Styles panel.
   ========================================================================= */

/* Header: when a Site Logo is set, hide the text site title next to it.
   With no logo set the site-logo block renders nothing, so the title shows. */
.wp-block-site-logo + .wp-block-site-title {
	display: none;
}

/* Header row: logo left, menu truly centred, account + cart grouped right.
   WooCommerce no longer appends the account/mini-cart blocks to the nav
   (ignoredHookedBlocks), they live in .led-header-actions instead. */
.led-header-row.is-layout-flex {
	display: grid !important;
	grid-template-columns: minmax(260px, 1fr) auto minmax(110px, 1fr);
	align-items: center;
}

/* Menu: keep all items on a single line on desktop — tighter gap and a
   slightly smaller size so logo + menu + icons fit the band. */
.led-header-row > .wp-block-navigation {
	flex-wrap: nowrap !important;
	gap: 0.7rem !important;
	font-size: 0.95rem;
}

@media (max-width: 1100px) {
	.led-header-row > .wp-block-navigation {
		flex-wrap: wrap !important;
	}
}

/* Logo: render at its full 260px width regardless of container caps. */
.led-header-row .wp-block-site-logo {
	width: 260px;
}

.led-header-row .wp-block-site-logo img {
	width: 260px !important;
	height: auto !important;
	max-width: none !important;
	flex-shrink: 0;
}

.led-header-row > .wp-block-site-logo {
	justify-self: start;
}

.led-header-row > .wp-block-navigation {
	justify-self: center;
}

.led-header-row > .led-header-actions {
	justify-self: end;
}

.led-header-actions {
	align-items: center;
}

.led-header-actions .wp-block-woocommerce-customer-account {
	margin-right: 0.4rem;
}

.led-header-actions .wc-block-mini-cart__button,
.led-header-actions .wc-block-customer-account a {
	align-items: center;
	color: inherit;
}

/* Homepage hero: factory background image with a dark overlay (keeps the
   contrast fallback colour underneath), text readable on the left, product
   shots presented as white rounded cards on the right. */
/* Homepage hero: composite background — bedroom scene fading in from the
   left edge, bathroom RGB scene from the right, dark factory light in the
   middle (veil baked into the image for text contrast). */
.led-hero {
	background-image:
		linear-gradient(100deg, rgba(11, 20, 35, 0.22) 0%, rgba(11, 20, 35, 0.08) 55%, rgba(11, 20, 35, 0.22) 100%),
		url('assets/img/hero-bg.jpg');
	background-size: cover;
	/* Anchor left: with cover on tall windows the image is upscaled ~1.1x and
	   center would crop ~100px off each side, cutting off the leftmost wall
	   lamp of the bedroom scene. */
	background-position: left center;
	background-repeat: no-repeat;
}

/* Headline: keep the dark navy identity but lift it a touch so it reads
   against the scene background (theme default is #102033). */
.led-hero h1 {
	color: #2a4a74;
}

/* Keep hero content above the background layers. */
.led-hero .wp-block-columns {
	position: relative;
	z-index: 1;
}

/* Category and catalogue heroes: same compact size as the homepage hero.
   The band matches the product-grid width; both sides melt into the white
   page through colourful spotlight beams with irregular ray tails. Every
   category gets its own unique beam artwork via the body term-{slug} class
   the archive templates print. */
.led-cat-hero {
	background-image: url('assets/img/spot-shop.jpg');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* The archive H1 inherits the theme's dark heading colour, which is
   invisible on the dark band — keep it white here. */
.led-cat-hero h1 {
	color: #fff;
}

.led-cat-hero .wp-block-query-title,
.led-cat-hero .wp-block-heading {
	font-size: var(--wp--preset--font-size--x-large);
}

.led-cat-hero .wp-block-term-description {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.led-cat-hero .wp-block-term-description > p {
	margin: 0;
}

.term-rechargeable-led-bulbs .led-cat-hero {
	background-image: url('assets/img/spot-bulbs.jpg');
}

.term-table-lamps-night-lights .led-cat-hero {
	background-image: url('assets/img/spot-lamps.jpg');
}

.term-wall-sconces .led-cat-hero {
	background-image: url('assets/img/spot-sconces.jpg');
}

.term-emergency-outdoor-lighting .led-cat-hero {
	background-image: url('assets/img/spot-emergency.jpg');
}

.term-bluetooth-audio-lighting .led-cat-hero {
	background-image: url('assets/img/spot-audio.jpg');
}

.term-bathroom-ceiling-lights .led-cat-hero {
	background-image: url('assets/img/spot-bathroom.jpg');
}

.term-magnetic-corn-bulbs .led-cat-hero {
	background-image: url('assets/img/spot-corn.jpg');
}

.term-rgb-smart-bulbs .led-cat-hero {
	background-image: url('assets/img/spot-rgb.jpg');
}

.term-oem-lamp-components .led-cat-hero {
	background-image: url('assets/img/spot-oem.jpg');
}

@media (max-width: 900px) {
	.led-cat-hero .wp-block-term-description {
		-webkit-line-clamp: 3;
	}
}

/* "Shop by range" gallery: product shots as clean white rounded cards that
   link to their product-category pages. */
.range-shot {
	margin-bottom: 12px;
}

.range-shot a {
	display: block;
}

.range-shot img {
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: contain;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 14px;
	background: #fff;
	transition: box-shadow 0.2s ease;
}

.range-shot a:hover img {
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

/* Sticky purchase panel on single-product pages (desktop only). */
@media (min-width: 900px) {
	.led-buy-panel {
		position: sticky;
		top: 96px;
	}
}

/* =========================================================================
   2. WooCommerce product gallery
      WooCommerce ships its own slider markup and hides the gallery until its
      script takes over. The rules below are only the pre-init safety net so
      the images can never be invisible and never stack in one long column.
      Once the slider has built .flex-viewport they stop applying.
   ========================================================================= */
.woocommerce-product-gallery {
	opacity: 1;
}

.woocommerce-product-gallery:not(:has(.flex-viewport)) .woocommerce-product-gallery__wrapper {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
}

.woocommerce-product-gallery:not(:has(.flex-viewport)) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
	grid-column: 1 / -1;
}

.woocommerce-product-gallery:not(:has(.flex-viewport)) .woocommerce-product-gallery__wrapper img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	background: #fff;
}



/* =========================================================================
   3. Product grids (shop, category and related-product collections)
   ========================================================================= */
.wc-block-product-template,
ul.products {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1.5rem;
	margin: 1.5rem 0;
	padding: 0;
	list-style: none;
}

ul.products li.product {
	overflow: hidden;
	margin: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 14px;
	background: #fff;
}

ul.products li.product img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

ul.products li.product .woocommerce-loop-product__title,
ul.products li.product .price {
	padding-right: 14px;
	padding-left: 14px;
}

/* Equal-height cards: stretch every card in a row and let the title grow,
   so the price + Add-to-cart button always sit on the same bottom line.
   Applies to both the Product Collection block and the classic loop. */
.wc-block-product-template > li,
ul.products li.product {
	display: flex;
	flex-direction: column;
}

.wc-block-product-template > li > *,
ul.products li.product > * {
	width: 100%;
}

.wc-block-product-template > li .wp-block-post-title,
.wc-block-product-template > li .wc-block-components-product-price,
ul.products li.product .woocommerce-loop-product__title {
	flex-grow: 1;
}

ul.products li.product form.cart,
ul.products li.product a.button,
ul.products li.product .button.add_to_cart_button {
	margin-top: auto;
}

@media (max-width: 900px) {
	.wc-block-product-template,
	ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.woocommerce-product-gallery:not(:has(.flex-viewport)) .woocommerce-product-gallery__wrapper {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.wc-block-product-template,
	ul.products {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* =========================================================================
   4. RFQ form
      Markup is produced by the LED B2B Core plugin shortcode [led_rfq_form];
      only the minimum styling is added here so the form matches the theme.
   ========================================================================= */
.led-form {
	display: grid;
	gap: 1rem;
}

.led-form .full {
	grid-column: 1 / -1;
}

.led-form label {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
}

.led-form input,
.led-form select,
.led-form textarea {
	box-sizing: border-box;
	width: 100%;
	margin-top: 0.35rem;
	padding: 0.65rem 0.8rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	background: #fff;
	color: var(--wp--preset--color--contrast);
	font: inherit;
	font-weight: 400;
}

.led-form textarea {
	min-height: 120px;
	resize: vertical;
}

.led-form .led-btn {
	display: inline-block;
	padding: 0.7rem 1.5rem;
	border: 0;
	border-radius: 8px;
	background: var(--wp--preset--color--accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.led-form .led-btn:hover {
	background: var(--wp--preset--color--contrast);
}

.led-rfq-notice {
	margin-bottom: 1.25rem;
	padding: 16px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
}

@media (min-width: 700px) {
	.led-form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
