/**
 * EMOBILITY FOR ALL - homepage sections.
 *
 * Registered alongside (and depends on) the design system stylesheet
 * (public.css) - only new component classes live here (hero banner, video
 * row, tiles, promo/welcome sections, brand cards); every color, spacing,
 * and type token comes from public.css's :root custom properties so the
 * homepage never drifts from the rest of the storefront.
 *
 * Enqueued only on the homepage (see Homepage::maybe_enqueue_assets()).
 */

/* Skip link (front-page.php owns the full document, so this plugin - not
   the theme - is responsible for one). */
.emobility-skip-link {
	position: absolute;
	top: -40px;
	left: 0;
	z-index: var(--emobility-z-toast);
	padding: var(--emobility-space-2) var(--emobility-space-4);
	background: var(--emobility-primary-600);
	color: var(--emobility-white);
	border-radius: 0 0 var(--emobility-radius-md) 0;
}

.emobility-skip-link:focus {
	top: 0;
}

.emobility-homepage section + section {
	border-top: var(--emobility-border-width) solid var(--emobility-color-border);
}

.emobility-section__header {
	margin-bottom: var(--emobility-space-8);
	max-width: 720px;
}

.emobility-section__header--with-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--emobility-space-4);
	max-width: none;
}

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

.emobility-hero-banner {
	line-height: 0;
}

.emobility-hero-banner img {
	width: 100%;
	max-height: 520px;
	object-fit: cover;
}

/* -------------------------------------------------------------------- */
/* Video row                                                            */
/* -------------------------------------------------------------------- */

/* Below the .emobility-grid--3-up breakpoint (768px) the 3 cards would
   otherwise stack in one column - on phones a horizontally swipeable rail
   (each card peeking to hint more content) reads better than a long
   vertical stack. The scrollbar is hidden since the peeking card is
   already the "more to scroll" affordance (same technique as the gallery
   thumbnail rail in product.css). */
@media (max-width: 767px) {
	.emobility-video-row__grid {
		display: flex;
		flex-wrap: nowrap;
		gap: var(--emobility-space-4);
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		margin-inline: calc(var(--emobility-container-padding) * -1);
		padding-inline: var(--emobility-container-padding);
		padding-bottom: var(--emobility-space-2);
		scrollbar-width: none; /* Firefox */
		-ms-overflow-style: none; /* legacy Edge/IE */
	}

	.emobility-video-row__grid::-webkit-scrollbar {
		display: none; /* Chrome/Safari/Edge Chromium */
	}

	.emobility-video-row__grid .emobility-video-card {
		flex: 0 0 85%;
		scroll-snap-align: start;
	}
}

.emobility-video-card {
	display: flex;
	flex-direction: column;
	width: 100%;
}

.emobility-video-card__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: var(--emobility-gray-800);
	border-radius: var(--emobility-radius-lg);
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	/* Video items with a recognized YouTube/Vimeo URL render this as a
	   <button> (see Homepage::render_video_row()) instead of an <a>, so its
	   default button chrome needs resetting to match the plain-tile look. */
	border: none;
	padding: 0;
	font: inherit;
	text-align: inherit;
}

button.emobility-video-card__media,
a.emobility-video-card__media {
	cursor: pointer;
}

.emobility-video-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.emobility-video-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 3.5rem;
	height: 3.5rem;
	border-radius: var(--emobility-radius-full);
	background: rgb(220 38 38 / 0.9);
}

.emobility-video-card__play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 55%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 0.6rem 0 0.6rem 1rem;
	border-color: transparent transparent transparent var(--emobility-white);
}

.emobility-video-card__title {
	margin-top: var(--emobility-space-3);
	font-weight: var(--emobility-font-weight-semibold);
	color: var(--emobility-color-heading);
}

.emobility-video-card__badge {
	position: absolute;
	right: var(--emobility-space-2);
	bottom: var(--emobility-space-2);
	padding: var(--emobility-space-1) var(--emobility-space-2);
	background: rgb(0 0 0 / 0.75);
	color: var(--emobility-white);
	font-size: var(--emobility-text-xs);
	font-weight: var(--emobility-font-weight-semibold);
	border-radius: var(--emobility-radius-sm);
}

/* -------------------------------------------------------------------- */
/* Inline video playback (video row + welcome section)                  */
/* homepage.js swaps a `.js-emobility-video-trigger` button for one of  */
/* these on click, keeping the button's own classes so the iframe fills */
/* the exact same box the thumbnail occupied - no full-screen takeover. */
/* -------------------------------------------------------------------- */

.emobility-video-inline-frame {
	position: relative;
}

.emobility-video-inline-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.emobility-video-inline-frame__close {
	position: absolute;
	top: var(--emobility-space-2);
	right: var(--emobility-space-2);
	z-index: 1;
	width: 2rem;
	height: 2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: var(--emobility-radius-full);
	background: rgb(0 0 0 / 0.75);
	color: var(--emobility-white);
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}

/* -------------------------------------------------------------------- */
/* Tiles (bicycle lifestyle tiles / trailing "shop more" card)          */
/* -------------------------------------------------------------------- */

.emobility-tile {
	display: flex;
	flex-direction: column;
	border-radius: var(--emobility-radius-lg);
	overflow: hidden;
	text-decoration: none;
	color: var(--emobility-color-text);
	background: var(--emobility-color-surface);
	border: var(--emobility-border-width) solid var(--emobility-color-border);
	transition: box-shadow var(--emobility-transition-base), border-color var(--emobility-transition-base);
}

.emobility-tile:hover {
	box-shadow: var(--emobility-shadow-md);
	border-color: transparent;
	color: var(--emobility-color-text);
	text-decoration: none;
}

.emobility-tile__media {
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--emobility-gray-800);
}

.emobility-tile__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.emobility-tile__body {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--emobility-space-2);
	padding: var(--emobility-space-4);
}

.emobility-tile__title {
	font-weight: var(--emobility-font-weight-bold);
}

.emobility-tile__cta {
	font-size: var(--emobility-text-sm);
	font-weight: var(--emobility-font-weight-semibold);
	color: var(--emobility-primary-600);
	white-space: nowrap;
}

/* The trailing "Shop {category}" tile at the end of a product grid: a
   plain dark card (no image) matching the grid's own card proportions. */
.emobility-tile--shop-more {
	align-items: center;
	justify-content: center;
	gap: var(--emobility-space-2);
	background: var(--emobility-primary-900);
	border-color: var(--emobility-primary-900);
	color: var(--emobility-white);
	text-align: center;
	padding: var(--emobility-space-6);
	min-height: 100%;
}

.emobility-tile--shop-more:hover {
	background: var(--emobility-primary-800);
	color: var(--emobility-white);
}

.emobility-tile--shop-more .emobility-tile__title {
	font-size: var(--emobility-text-lg);
}

.emobility-tile--shop-more .emobility-tile__cta {
	font-size: var(--emobility-text-2xl);
	color: var(--emobility-accent-400);
}

/* Admin-uploaded variant: the same card with a photo behind it instead of
   the flat dark fill, plus a dark scrim so the title/arrow stay readable
   over any image. */
.emobility-tile--shop-more--has-image {
	position: relative;
	background-size: cover;
	background-position: center;
	background-color: var(--emobility-primary-900);
}

.emobility-tile--shop-more--has-image::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.emobility-tile--shop-more--has-image:hover::before {
	background: rgba(0, 0, 0, 0.6);
}

.emobility-tile--shop-more--has-image .emobility-tile__title,
.emobility-tile--shop-more--has-image .emobility-tile__cta {
	position: relative;
	z-index: 1;
}

/* Below the 3-up/4-up grid breakpoints (768px), the Electric Bicycles /
   Motorcycles / Dirt Bikes / Mobility Scooters product sections would
   otherwise stack their cards in one column - same horizontally
   swipeable rail treatment as the video row above (each card peeking to
   hint more content, scrollbar hidden since the peek is the "more to
   scroll" affordance). */
@media (max-width: 767px) {
	.emobility-product-section__grid {
		display: flex;
		flex-wrap: nowrap;
		gap: var(--emobility-space-4);
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		margin-inline: calc(var(--emobility-container-padding) * -1);
		padding-inline: var(--emobility-container-padding);
		padding-bottom: var(--emobility-space-2);
		scrollbar-width: none; /* Firefox */
		-ms-overflow-style: none; /* legacy Edge/IE */
	}

	.emobility-product-section__grid::-webkit-scrollbar {
		display: none; /* Chrome/Safari/Edge Chromium */
	}

	.emobility-product-section__grid > * {
		flex: 0 0 85%;
		scroll-snap-align: start;
	}
}

/* -------------------------------------------------------------------- */
/* Promo / financing banner                                              */
/* -------------------------------------------------------------------- */

.emobility-promo-section {
	position: relative;
	background: var(--emobility-primary-900);
	color: var(--emobility-white);
	overflow: hidden;
}

.emobility-promo-section--has-media {
	min-height: 28rem;
	display: flex;
	align-items: center;
}

.emobility-promo-section__media {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.emobility-promo-section__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.emobility-promo-section--has-media .emobility-promo-section__media::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to right,
		rgb(15 23 42 / 0.9) 0%,
		rgb(15 23 42 / 0.75) 45%,
		rgb(15 23 42 / 0.35) 100%
	);
}

.emobility-promo-section__inner {
	position: relative;
	z-index: 1;
	width: 100%;
}

.emobility-promo-section--has-media .emobility-promo-section__content {
	max-width: 40rem;
}

.emobility-promo-section .emobility-eyebrow {
	color: var(--emobility-accent-400);
}

.emobility-promo-section__content h2 {
	color: var(--emobility-white);
	margin-top: var(--emobility-space-2);
	font-size: var(--emobility-text-3xl);
	line-height: var(--emobility-leading-tight);
}

.emobility-promo-section__content p {
	color: rgb(255 255 255 / 0.85);
}

@media (min-width: 768px) {
	.emobility-promo-section--has-media {
		min-height: 40rem;
		display: flex;
		align-items: center;
	}

	.emobility-promo-section__content h2 {
		font-size: var(--emobility-text-4xl);
	}
}

/* -------------------------------------------------------------------- */
/* Welcome section                                                      */
/* -------------------------------------------------------------------- */

.emobility-welcome-section__inner {
	display: grid;
	gap: var(--emobility-space-8);
	align-items: center;
}

@media (min-width: 768px) {
	.emobility-welcome-section__inner {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.emobility-welcome-section__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	border-radius: var(--emobility-radius-lg);
	overflow: hidden;
	background: var(--emobility-gray-800);
}

.emobility-welcome-section__media-inner {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	text-decoration: none;
	color: inherit;
	/* A recognized YouTube/Vimeo video_url renders this as a <button> (see
	   Homepage::render_welcome_section()) instead of an <a>, so its default
	   button chrome needs resetting to match the plain-tile look. */
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	text-align: inherit;
}

button.emobility-welcome-section__media-inner,
a.emobility-welcome-section__media-inner {
	cursor: pointer;
}

.emobility-welcome-section__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.emobility-welcome-section__caption {
	position: absolute;
	inset: auto 0 0 0;
	padding: var(--emobility-space-4);
	background: linear-gradient(0deg, rgb(0 0 0 / 0.7), transparent);
	color: var(--emobility-white);
	font-weight: var(--emobility-font-weight-semibold);
}

/* -------------------------------------------------------------------- */
/* Brands                                                                */
/* -------------------------------------------------------------------- */

.emobility-brand-grid {
	display: grid;
	gap: var(--emobility-space-4);
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 576px) {
	.emobility-brand-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 992px) {
	.emobility-brand-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

.emobility-brand-card {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 96px;
	padding: var(--emobility-space-4);
	border: var(--emobility-border-width) solid var(--emobility-color-border);
	border-radius: var(--emobility-radius-md);
	background: var(--emobility-color-surface);
	filter: grayscale(1);
	opacity: 0.75;
	transition: filter var(--emobility-transition-base), opacity var(--emobility-transition-base);
}

.emobility-brand-card:hover {
	filter: none;
	opacity: 1;
}

.emobility-brand-card img {
	max-width: 100%;
	max-height: 48px;
	width: auto;
	height: auto;
}

.emobility-brand-card__name {
	font-weight: var(--emobility-font-weight-semibold);
	color: var(--emobility-color-text);
	text-align: center;
}

/* -------------------------------------------------------------------- */
/* Blog - `.emobility-blog-card`/`.emobility-blog-section` styles now live */
/* in blog.css, shared with the /news/ routes; homepage.css enqueues it as */
/* a dependency (see Homepage::maybe_enqueue_assets()).                    */
/* -------------------------------------------------------------------- */
