/*
Theme Name: Intertronics
Template: Impreza
Version: 1.0.0
Author:	Red Box Web
Author URI: https://www.redboxweb.co.uk/
*/

/* ==========================================================
   Partials
   The files in /css (helpers, tables, meganav-tweaks, sections,
   products, formidable, megamenu-widgets) are enqueued as separate,
   versioned stylesheets that load just before this one. sections.css
   only loads where Sections render. See inc/enqueue.php.
   ========================================================== */


/* ==========================================================
   Base elements
   ========================================================== */
html {
	scroll-behavior: smooth;
}

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

::selection {
	background-color: var(--color-content-primary);
	color: #fff;
}

em {
	color: var(--color-content-primary);
	font-style: normal;
	font-weight: 700;
}

img {
	max-width: 100% !important;
	height: auto;
}

h1, h2, h3, h4, h5, h6, a {
	overflow-wrap: break-word;
	word-wrap: break-word;
	word-break: break-word;
}

/*
 * Underline text links on hover, focus and active. Limited to class-less links
 * in running text inside the main content, outside any nav, so buttons (.w-btn),
 * menu items, tiles and other styled components keep their own hover states.
 */
#page-content :where(p, li, dd, td, th, blockquote, figcaption) a:not([class], nav a):is(:hover, :focus, :active) {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/*
 * Blockquotes in the page content (an [itx_acf_sections] Content block, a
 * post's editor content): a quiet inline quote with an ITX Yellow rule (the testimonials' colour) down the
 * left, in place of Impreza's indented, enlarged quote with its big serif
 * mark. An optional <cite> sits underneath in small caps.
 */
#page-content blockquote {
	margin: 0 0 1.5rem;
	padding: 0.125rem 0 0.125rem 1.25rem;
	border-left: 3px solid var(--color-itx-yellow, #ffe066);
	font-size: inherit;
	font-style: italic;
	line-height: inherit;
	color: var(--color-content-heading, #303030);
}

#page-content blockquote:last-child {
	margin-bottom: 0;
}

#page-content blockquote::before {
	content: none;
}

#page-content blockquote :is(p, ul, ol) {
	margin-bottom: 0.75em;
}

#page-content blockquote > :last-child {
	margin-bottom: 0;
}

#page-content blockquote cite {
	display: block;
	margin-top: 0.5rem;
	font-size: 0.8125rem;
	font-style: normal;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}


/* ==========================================================
   Layout
   ========================================================== */
main#page-content > section {
	padding-top: 0;
}

/*
 * Impreza adds 1.5rem padding to grid columns that have a background colour
 * or image (common/css/base/columns.css). Increased here to 3rem.
 */
.g-cols.via_grid.type_default > .has_bg_color {
	padding: 3rem;
}


/* ==========================================================
   Header
   ========================================================== */
header#page-header {
	background: linear-gradient(180deg, var(--color-content-bg) 0%, var(--color-content-bg) 80%, transparent 100%);
}

#page-header .l-subheader.at_middle .l-subheader-cell.at_left {
	width: 100%;
	align-items: center;
}

#page-header .l-subheader.at_middle .l-subheader-cell.at_center,
#page-header .l-subheader.at_middle .l-subheader-cell.at_right {
	display: none;
}

#primaryMegaNavContainer {
	width: 100%;
}


/* ==========================================================
   Title bar
   ========================================================== */
.title-bar-block--overlay {
	position: relative;
	min-height: min(50vh, 480px);
  	max-height: 480px;
	overflow-y: auto;
}

/* The gradient keeps the white title readable over photos. Without an image
   (title-bar-block--no-image, inc/title-bar.php) the plain brand colour shows. */
.title-bar-block--overlay:not(.title-bar-block--no-image)::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.25) 25%, #58585a 100%);
}



/* ==========================================================
   Components
   ========================================================== */

/* Card */
.card {
	padding: 3rem;
	background-color: white;
	border-radius: var(--site-border-radius);
	box-shadow: 0 8px 24px 0 var(--color-content-bg);
}

/* Impreza tablets and mobiles breakpoint */
@media (max-width: 1024px) {
	.card {
		padding: 1.5rem;
	}
}

/*
 * Site tagline ([itx_site_tagline]), added in the page builder as a Text
 * Block with these classes. Brand grey rather than the faded colour, which
 * is too light on the page background for small text (WCAG AA).
 */
.itx-site-tagline {
	color: var(--color-intertronics-grey);
	line-height: 1.5;
	text-wrap: balance;
}

/*
 * Home: the page's h1, left-aligned with the cards below and about as wide as
 * the 3/5 carousel column, so it reads as the intro to that row rather than a
 * standalone banner.
 */
.itx-site-tagline--home h1 {
	max-width: 24em;
	margin: 0;
	padding: 0;
	color: var(--color-content-heading);
	font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.5rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

/*
 * Home: the header's bottom row only holds breadcrumbs, which the home page
 * doesn't show, so it was an empty 50px strip (bordered on tablets and
 * phones) above the content. Hide it and pull the content up by the same
 * 50px (the row's height in Main Header #48 at every breakpoint), leaving
 * the card gap between the header and the tagline.
 */
.home .l-header .l-subheader.at_bottom {
	display: none;
}

.home.header_hor .l-header.pos_fixed ~ .l-main > .l-section:first-of-type > .l-section-h {
	padding-top: calc( var(--header-height) - 50px + 1.5rem );
}

/* Footer: a strapline under the logo, wrapped to two lines to sit with it */
.itx-site-tagline--footer {
	max-width: 22rem;
	margin-top: 0.75rem;
}

/*
 * Horizontal Wrapper with a button (e.g. heading + "View all").
 * A following Carousel/Grid pulls itself up by its gap with a negative
 * margin, so when the button is taller than the heading the cards paint
 * over the bottom of it. Lift the wrapper above the next element; the
 * carousel list (.owl-carousel) is itself z-index 1, hence 2.
 */
.w-hwrapper:has(> .w-btn-wrapper) {
	position: relative;
	z-index: 2;
}

/*
 * Round icon badge, shared by the Product Gallery expand icon, every
 * carousel's prev/next arrows, whatever Arrows Style the element has set,
 * and the lightbox close and prev/next buttons (see "Lightbox controls").
 * The :not(#itx-arrow) adds ID weight so this beats Impreza's navstyle_*
 * and button style rules (up to five classes deep on hover) without
 * resorting to !important. The arrow glyph's size is read from
 * --arrows-size, which Impreza applies with !important.
 */
.itx-product-gallery__expand,
.owl-carousel > .owl-nav button:not(#itx-arrow),
.mfp-wrap > .mfp-close:not(#itx-arrow),
.mfp-wrap .mfp-arrow:not(#itx-arrow) {
	--arrows-size: 1.25rem;
	--btn-border-width: 0px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	min-width: 0;
	padding: 0;
	font-size: 1rem;
	line-height: 1;
	color: var(--color-content-heading, #1a1a1a);
	text-shadow: none;
	background: rgba(255, 255, 255, 0.85);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
	transition: background-color 0.2s, color 0.2s, opacity 0.2s, transform 0.3s;
}

/*
 * Inset the arrows from the carousel's sides by the same 0.75rem as the
 * expand icon. Impreza sets --arrows-hor-offset inline on the carousel and
 * reads it on .owl-nav, so declaring it here overrides the element setting.
 */
.owl-carousel > .owl-nav {
	--arrows-hor-offset: 0.75rem;
}

.itx-product-gallery__link:hover .itx-product-gallery__expand,
.itx-product-gallery__link:focus-visible .itx-product-gallery__expand,
.no-touch .owl-carousel > .owl-nav button:not(#itx-arrow):hover,
.owl-carousel > .owl-nav button:not(#itx-arrow):focus-visible,
.no-touch .mfp-wrap > .mfp-close:not(#itx-arrow):hover,
.mfp-wrap > .mfp-close:not(#itx-arrow):focus-visible,
.no-touch .mfp-wrap .mfp-arrow:not(#itx-arrow):hover,
.mfp-wrap .mfp-arrow:not(#itx-arrow):focus-visible {
	color: #fff;
	background: var(--color-content-primary);
}

/*
 * Lightbox controls (Magnific Popup): the close and prev/next buttons use the
 * round icon badge above, pinned to the same places whatever the size of the
 * image or video: close at the top right, the arrows halfway down either side.
 * On wide screens they sit at the edges of the site content width rather than
 * the screen edges. The popup content is padded to keep clear of them.
 * js/lightbox-controls.js puts the close button in .mfp-wrap, next to the
 * arrows' container, rather than inside the content. The admin bar covers
 * the top of the popup, so it pushes everything down (0 for visitors).
 */
.mfp-wrap {
	--itx-mfp-btn: 2.5rem;
	--itx-mfp-gap: 0.75rem;
	--itx-mfp-lane: calc(var(--itx-mfp-btn) + var(--itx-mfp-gap) * 2);
	--itx-mfp-inset: calc(max(0px, (100% - var(--site-content-width, 1340px)) / 2) + var(--itx-mfp-gap));
	--itx-mfp-admin-bar: var(--wp-admin--admin-bar--height, 0px);
}

/* Impreza draws a decorative close on the container and hides the real button */
.mfp-wrap .mfp-container::after {
	content: none;
}

.mfp-wrap > .mfp-close:not(#itx-arrow) {
	display: flex !important;
	position: absolute;
	top: calc(var(--itx-mfp-gap) + var(--itx-mfp-admin-bar));
	right: var(--itx-mfp-inset);
	opacity: 1;
	cursor: pointer;
}

.mfp-wrap .mfp-container {
	padding-left: calc(var(--itx-mfp-inset) + var(--itx-mfp-btn) + var(--itx-mfp-gap));
	padding-right: calc(var(--itx-mfp-inset) + var(--itx-mfp-btn) + var(--itx-mfp-gap));
}

/* Images: room above and below for the close button and the caption bar */
.mfp-wrap img.mfp-img {
	padding-top: calc(var(--itx-mfp-lane) + var(--itx-mfp-admin-bar));
	padding-bottom: var(--itx-mfp-lane);
}

.mfp-wrap .mfp-figure::after {
	top: calc(var(--itx-mfp-lane) + var(--itx-mfp-admin-bar));
	bottom: var(--itx-mfp-lane);
}

.mfp-wrap .mfp-iframe-holder {
	padding-top: calc(var(--itx-mfp-lane) + var(--itx-mfp-admin-bar));
	padding-bottom: var(--itx-mfp-lane);
}

.mfp-wrap .mfp-arrow:not(#itx-arrow) {
	position: absolute;
	top: calc(50% + var(--itx-mfp-admin-bar) / 2);
	margin: calc(var(--itx-mfp-btn) / -2) 0 0;
	transform: none;
	opacity: 1;
}

.mfp-wrap .mfp-arrow-left:not(#itx-arrow) {
	left: var(--itx-mfp-inset);
	right: auto;
}

.mfp-wrap .mfp-arrow-right:not(#itx-arrow) {
	left: auto;
	right: var(--itx-mfp-inset);
}

.mfp-wrap .mfp-arrow:not(#itx-arrow)::before {
	position: static;
	width: auto;
	height: auto;
	margin: 0;
	font-size: var(--arrows-size);
	line-height: 1;
	color: inherit;
	opacity: 1;
}

/* Fade the close button with the popup, as Impreza does the arrows. Impreza
   fades the arrows in to 66% only, too faint for the badges */
.mfp-fade.mfp-wrap > .mfp-close:not(#itx-arrow) {
	opacity: 0;
}

.mfp-fade.mfp-wrap.mfp-ready:not(.mfp-removing) > .mfp-close:not(#itx-arrow) {
	opacity: 1;
}

.mfp-fade.mfp-wrap.mfp-ready:not(.mfp-removing) .mfp-arrow {
	opacity: 1 !important;
}

/* Up to 900px, touch screens swipe between images and Impreza hides the arrows */
@media (max-width: 900px) {
	html.touch .mfp-wrap .mfp-container,
	html.ios-touch .mfp-wrap .mfp-container {
		padding-left: 6px;
		padding-right: 6px;
	}

	html.touch .mfp-fade.mfp-wrap.mfp-ready:not(.mfp-removing) .mfp-arrow,
	html.ios-touch .mfp-fade.mfp-wrap.mfp-ready:not(.mfp-removing) .mfp-arrow {
		opacity: 0 !important;
	}
}

/* Category grid */
.category-grid-layout .w-grid-item {
	background-color: white;
	border-radius: var(--site-border-radius);
	overflow: hidden;
}

/* Images & Video */
.w-image {
	border-radius: var(--site-border-radius);
	overflow: hidden;
}
.w-video {
	border-radius: var(--site-border-radius);
	overflow: hidden;
}

/* Company logo */
.itx-company__logo {
	aspect-ratio: 16 / 9;
	margin: 0 0 2rem;
	padding: 1rem;
	background-color: white;
	border-radius: var(--site-border-radius);
}

.itx-company__logo img {
	width: 100%;
	object-fit: contain;
}


/* ==========================================================
   ITX Tile – reusable card/tile
   ========================================================== */
.itx-tile {
	--itx-tile-bg: var(--color-content-bg-alt);
	--itx-tile-bg-hover: color-mix(in srgb, var(--color-content-primary) 8%, white);
	--itx-tile-accent: var(--color-content-primary);
	--itx-tile-radius: calc(var(--site-border-radius) * 0.75);
	--itx-tile-padding: 1.25rem 1.25rem 1.5rem;
	--itx-tile-title-color: var(--color-content-heading);
	--itx-tile-text-color: #4a4f5c;

	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: var(--itx-tile-padding);
	overflow: hidden;
	background: var(--itx-tile-bg);
	border: 1px solid rgba(17, 17, 17, 0.07);
	border-radius: var(--itx-tile-radius);
	color: inherit;
	text-decoration: none;
}

a.itx-tile {
	color: inherit !important;
}

/* :where() keeps this at single-class specificity, so any image rule can override it */
.itx-tile :where(img) {
	border-radius: var(--site-border-radius);
}

/* The tile provides its own background, border and radius, so a grid item wrapping it shouldn't clip or paint over it */
.w-grid .w-grid-item:has(.itx-tile) {
	overflow: visible;
	background-color: transparent;
	border-radius: 0;
}

/* Interactive: all hover and focus behaviour lives here */
.itx-tile--interactive {
	transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.2s, border-color 0.2s;
}

.itx-tile--interactive:hover,
.itx-tile--interactive:focus-within {
	border-color: color-mix(in srgb, var(--itx-tile-accent) 35%, transparent);
	background: var(--itx-tile-bg-hover);
	transform: translateY(-3px);
	box-shadow: 0 14px 28px -16px rgba(17, 17, 17, 0.28);
}

.itx-tile--interactive::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 3px;
	z-index: 3;
	background: var(--itx-tile-accent);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.3s ease;
}

.itx-tile--interactive:hover::before,
.itx-tile--interactive:focus-within::before {
	transform: scaleX(1);
}

/* The wrapper clips the zoomed image, so it needs the same radius to keep the corners rounded.
   isolation stops Safari drawing square corners while the image transforms. */
.itx-tile--interactive .post_image {
	overflow: hidden;
	border-radius: var(--site-border-radius);
	isolation: isolate;
}

.itx-tile--interactive .post_image img {
	transition: transform 0.5s ease;
}

.itx-tile--interactive:hover .post_image img {
	transform: scale(1.04);
}

.itx-tile--interactive .post_title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.itx-tile--interactive .post_title a:focus-visible {
	outline: none;
}

.itx-tile--interactive .post_title a:focus-visible::after {
	outline: 2px solid var(--itx-tile-accent);
	outline-offset: -3px;
	border-radius: var(--itx-tile-radius);
}

.itx-tile--interactive .w-btn {
	position: relative;
	z-index: 2;
}

.itx-tile--interactive .w-btn i {
	transition: transform 0.25s ease;
}

.itx-tile--interactive:hover .w-btn i {
	transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
	.itx-tile--interactive,
	.itx-tile--interactive *,
	.itx-tile--interactive::before {
		transition: none !important;
		transform: none !important;
	}
}

/*
 * Logged-in phones (≤600px): WordPress lets the admin bar scroll away, but
 * Impreza keeps the fixed header 46px down for it, leaving an empty strip
 * above the header that page content shows through. Keeping the admin bar
 * fixed, as it already is on wider screens, closes the gap. Visitors never
 * see the admin bar, so this only affects logged-in users.
 */
@media screen and (max-width: 600px) {
	html #wpadminbar {
		position: fixed;
	}
}
