/**
 * MEMOT theme styles — home.
 *
 * Front page only: hero, trusted-by strip, core pillars, our reach.
 * Split out of theme.css so it loads only on the template(s) that need it —
 * see memot_enqueue_assets() in functions.php. Reuses the same
 * theme.json custom properties and memot-* class hooks as theme.css.
 */

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

.memot-hero {
	position: relative;
	color: var(--wp--preset--color--paper);
	overflow: hidden;
	background-color: var(--wp--preset--color--brand);
}

.memot-hero.wp-block-cover {
	min-height: clamp(560px, 88vh, 860px);
	display: flex;
	align-items: center;
}

/* Richer, deeper brand backdrop when no photo has been set yet. */
.memot-hero:not(:has(img)):not(:has(video))::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(90% 60% at 8% 8%, rgba(46, 158, 92, 0.55) 0%, rgba(46, 158, 92, 0) 55%),
		radial-gradient(70% 70% at 92% 100%, rgba(201, 161, 90, 0.28) 0%, rgba(201, 161, 90, 0) 60%),
		linear-gradient(150deg, #0a2416 0%, #0f3a23 45%, #123f27 100%);
}

.memot-hero .wp-block-cover__inner-container {
	position: relative;
	z-index: 2;
	max-width: 1200px;
	margin-inline: auto;
	width: 100%;
}

.memot-hero h1 {
	margin: 0;
	font-weight: 560;
	line-height: 1.04;
	color: var(--wp--preset--color--paper);
	max-width: 15ch;
}

@media (max-width: 781px) {

	.memot-hero h1 {
		max-width: 100%;
	}
}

.memot-hero .memot-hero-copy {
	max-width: 46ch;
	color: rgba(255, 255, 255, 0.9);
	font-size: var(--wp--preset--font-size--large);
}

/* -------------------------------------------------------------------------- *
 * Trusted-by logo strip
 * -------------------------------------------------------------------------- */

.memot-logos {
	background: var(--wp--preset--color--paper);
}

.memot-logos .memot-logos-label {
	text-align: center;
	font-size: 0.75rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--slate);
}

.memot-logos figure,
.memot-logos img {
	filter: grayscale(1);
	opacity: 0.55;
	transition: opacity 0.2s ease, filter 0.2s ease;
}

/* -------------------------------------------------------------------------- *
 * Core pillars — photo cards (memot-pillar-card)
 *
 * Each card is a core/cover block so editors can drop in real photography via
 * the block's own "Replace" media control — no code change needed. Until a
 * photo is set, a tinted brand-gradient (authored as customGradient on the
 * block, per the placeholder policy above) stands in; the same gradient
 * becomes a legibility scrim once a photo is added, since Cover composes an
 * overlay over its image automatically.
 * -------------------------------------------------------------------------- */

.memot-pillar-card {
	height: 100%;
	align-items: stretch;
	overflow: hidden;
	box-shadow: var(--memot-shadow-md);
	transition: transform 0.35s var(--memot-ease-out), box-shadow 0.35s var(--memot-ease-out);
}

/* !important: the scroll-reveal tween leaves an inline `transform` on this
   element permanently by design (see reveal() in memot-motion.js) — plain
   stylesheet rules, however specific, can never win against an inline style,
   so this hover lift needs it to take effect at all post-reveal. */
.memot-pillar-card:hover {
	transform: translateY(-6px) !important;
	box-shadow: var(--memot-shadow-lg);
}

/* Photo/gradient layer zooms independently of the card lift above, so an
   editor-added photo gets a Ken-Burns-style push-in on hover; harmless when
   the placeholder gradient is still showing since it tiles flat either way. */
.memot-pillar-card .wp-block-cover__background,
.memot-pillar-card .wp-block-cover__image-background {
	transition: transform 0.6s var(--memot-ease-out);
	transform: scale(1);
	will-change: transform;
}

.memot-pillar-card:hover .wp-block-cover__background,
.memot-pillar-card:hover .wp-block-cover__image-background {
	transform: scale(1.08);
}

/* Core's own inner-container is a shrink-wrapped box that Cover just centers
   or corner-anchors as a whole; stretching it here instead gives it the
   card's full height, so the index numeral (absolutely positioned against
   it) can pin to the true top-left corner while the text content below
   independently pins to the bottom via its own flex justify-content. */
.memot-pillar-card .wp-block-cover__inner-container {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
}

.memot-pillar-card__index {
	position: absolute;
	top: 0;
	left: 0;
	margin: 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(2.75rem, 5vw, 3.75rem);
	font-weight: 700;
	line-height: 1;
	color: color-mix(in srgb, var(--wp--preset--color--paper) 32%, transparent);
}

.memot-pillar-card .wp-block-heading {
	color: var(--wp--preset--color--paper);
}

.memot-pillar-card__desc {
	color: color-mix(in srgb, var(--wp--preset--color--paper) 82%, transparent);
}

/* Core pillars — supporting "Grow / Process / Innovate" step row. */
.memot-pillars-steps {
	align-items: center;
	justify-content: center;
	gap: var(--wp--preset--spacing--50);
}

.memot-pillars-steps__item {
	align-items: center;
	gap: var(--wp--preset--spacing--30);
	text-align: center;
}

.memot-pillars-steps__item .memot-icon-chip {
	width: 56px;
	height: 56px;
	background: var(--wp--preset--color--paper);
	box-shadow: var(--memot-shadow-sm);
}

.memot-pillars-steps__label {
	margin: 0;
	font-weight: 600;
	color: var(--wp--preset--color--ink);
}

.memot-pillars-steps__line {
	width: clamp(2.5rem, 6vw, 5rem);
	height: 2px;
	background: var(--wp--preset--color--harvest);
}

@media (max-width: 600px) {

	.memot-pillars-steps__line {
		display: none;
	}
}

/* -------------------------------------------------------------------------- *
 * Our Reach
 * -------------------------------------------------------------------------- */

.memot-reach-map img {
	border-radius: var(--memot-radius);
	width: 100%;
	background: var(--wp--preset--color--sand);
}

.memot-reach-item {
	border-top: 1px solid var(--wp--preset--color--line);
	padding-top: 1.25rem;
}

.memot-reach-item .memot-reach-index {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 800;
	color: var(--memot-harvest);
	font-size: 0.875rem;
	letter-spacing: 0.08em;
}

/* -------------------------------------------------------------------------- *
 * Hero — the signature "living latex flow" field
 * -------------------------------------------------------------------------- */

/* Slowly drifting light — the ambient "flow". GPU-cheap, pure CSS. */
.memot-hero-flow {
	position: absolute;
	inset: -20%;
	z-index: 0;
	pointer-events: none;
	background:
		radial-gradient(38% 42% at 25% 30%, rgba(96, 214, 148, 0.42) 0%, rgba(96, 214, 148, 0) 70%),
		radial-gradient(34% 40% at 78% 62%, rgba(201, 161, 90, 0.3) 0%, rgba(201, 161, 90, 0) 70%),
		radial-gradient(30% 34% at 60% 18%, rgba(46, 158, 92, 0.3) 0%, rgba(46, 158, 92, 0) 70%);
	filter: blur(18px);
	animation: memot-flow 22s ease-in-out infinite alternate;
}

@keyframes memot-flow {

	0% {
		transform: translate3d(-3%, -2%, 0) scale(1.05);
	}

	50% {
		transform: translate3d(3%, 2%, 0) scale(1.12);
	}

	100% {
		transform: translate3d(-1%, 4%, 0) scale(1.06);
	}
}

/* Fine grain so the flat gradient reads as a surface, not a swatch. */
.memot-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	opacity: 0.5;
	mix-blend-mode: soft-light;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.memot-hero-eyebrow {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	margin: 0 0 1.25rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.82);
}

.memot-hero-eyebrow::before {
	content: "";
	width: 2.25rem;
	height: 2px;
	background: var(--memot-harvest);
	flex: none;
}

/* Line-clip reveal wrappers. */
.memot-hero h1 .memot-line {
	display: block;
	overflow: hidden;
	padding-bottom: 0.06em;
}

.memot-hero h1 .memot-line-inner {
	display: block;
}

.memot-hero h1 .memot-accent {
	color: #7fe0a6;
	font-style: italic;
}

/* Hero buttons: primary keeps the brand pill; the outline reads on dark. */
.memot-hero .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	align-items: center;
}

.memot-hero .wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--paper);
	border: 1.5px solid rgba(255, 255, 255, 0.45);
}

.memot-hero .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: var(--wp--preset--color--paper);
}

.memot-hero-cue {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin-top: var(--wp--preset--spacing--70);
	font-size: 0.75rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.75);
}

.memot-hero-cue::before {
	content: "";
	width: 1px;
	height: 2.5rem;
	background: linear-gradient(180deg, var(--memot-harvest), rgba(201, 161, 90, 0));
	animation: memot-cue 1.9s ease-in-out infinite;
	transform-origin: top;
}

@keyframes memot-cue {

	0%,
	100% {
		transform: scaleY(0.4);
		opacity: 0.4;
	}

	50% {
		transform: scaleY(1);
		opacity: 1;
	}
}

/* -------------------------------------------------------------------------- *
 * Trusted-by marquee
 * -------------------------------------------------------------------------- */

.wp-block-gallery.is-style-memot-marquee {
	margin-top: var(--wp--preset--spacing--50);
	overflow: hidden;
}

/* The Gallery block nests figure > figure > img; reset the outer two levels
 * so the grayscale/opacity treatment above only applies once, at the img. */
.wp-block-gallery.is-style-memot-marquee,
.wp-block-gallery.is-style-memot-marquee .wp-block-image {
	filter: none;
	opacity: 1;
}

/* Core Gallery sizes each figure as a grid column via a selector that carries
 * an ID (`:not(#individual-image)`), and — when "Crop images" is on — forces
 * the image to `object-fit: cover` its column. Neither can be beaten by
 * specificity alone, so every logo gets `!important` overrides for a fixed,
 * uniform tile regardless of the image's size/aspect or the block's own
 * crop setting. */
.wp-block-gallery.is-style-memot-marquee .wp-block-image {
	display: flex !important;
	flex: none !important;
	align-items: center;
	justify-content: center;
	width: var(--wp--preset--spacing--100) !important;
	height: var(--wp--preset--spacing--70) !important;
	margin: 0 !important;
}

.wp-block-gallery.is-style-memot-marquee figure.wp-block-image img {
	display: block;
	width: auto !important;
	height: auto !important;
	max-width: 100% !important;
	max-height: 100% !important;
	object-fit: contain !important;
	flex: none !important;
	filter: grayscale(1);
	opacity: 0.55;
	transition: opacity 0.2s ease, filter 0.2s ease;
}

.wp-block-gallery.is-style-memot-marquee .wp-block-image:hover img {
	filter: grayscale(0);
	opacity: 1;
}

/* memot-marquee-inner is the animated track; memot-marquee-clone (injected
 * server-side by memot_render_marquee_gallery() in functions.php) is an
 * aria-hidden duplicate of the same figures so the loop below closes without
 * a visible seam, regardless of how many logos an editor adds. */
.memot-marquee-inner,
.memot-marquee-clone {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
}

.memot-marquee-inner {
	width: max-content;
	animation: memot-marquee 34s linear infinite;
}

.wp-block-gallery.is-style-memot-marquee:hover .memot-marquee-inner {
	animation-play-state: paused;
}

.wp-block-gallery.is-style-memot-marquee .memot-marquee-inner .wp-block-image,
.memot-marquee-clone {
	flex: none;
	margin: 0;
}

@keyframes memot-marquee {

	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-50%);
	}
}

/* -------------------------------------------------------------------------- *
 * Hero split layout + image carousel
 *
 * The hero cover holds two columns: the headline stack (left) and an
 * auto-playing image carousel (right). The carousel is a "Sliding carousel"
 * Gallery block enhanced by assets/js/memot-carousel.js — the .memot-carousel-
 * ready class is added by that script, so the stacked (no-JS) fallback stays
 * fully visible per the progressive-enhancement contract.
 * -------------------------------------------------------------------------- */

.memot-hero-columns {
	gap: clamp(2rem, 4vw, 4rem);
	width: 100%;
}

/* Keep the headline stack tight; its children keep their own max-widths. */
.memot-hero-text > * {
	margin-block: 0;
}

.memot-hero-text > * + * {
	margin-top: var(--wp--preset--spacing--50);
}

/* Base (pre-enhancement / no-JS): a plain gallery, capped so it never runs
 * away vertically before the carousel script upgrades it. */
.memot-hero-media .wp-block-gallery.is-style-memot-hero-carousel {
	gap: var(--wp--preset--spacing--30);
}

.memot-hero-media .wp-block-gallery.is-style-memot-hero-carousel .wp-block-image img {
	border-radius: var(--memot-radius-lg);
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Enhanced state: overlap slides in a fixed-ratio frame and cross-fade. */
.wp-block-gallery.is-style-memot-hero-carousel.memot-carousel-ready {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	max-height: min(72vh, 620px);
	margin: 0 auto;
	border-radius: var(--memot-radius-lg);
	overflow: hidden;
	box-shadow: var(--memot-shadow-lg);
	background: rgba(10, 26, 16, 0.4);
}

/* Core Gallery's `:not(#individual-image)` rules carry ID-level specificity
 * (see DESIGN.md §4) and otherwise pin each slide to `position: relative` and a
 * flex column width — so the overlap/stretch below must use `!important`. */
.wp-block-gallery.is-style-memot-hero-carousel.memot-carousel-ready .wp-block-image {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	opacity: 0;
	transform: scale(1.04);
	transition:
		opacity 0.8s var(--memot-ease-out),
		transform 1.2s var(--memot-ease-out);
	pointer-events: none;
}

.wp-block-gallery.is-style-memot-hero-carousel.memot-carousel-ready .wp-block-image.is-active {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

.wp-block-gallery.is-style-memot-hero-carousel.memot-carousel-ready .wp-block-image img {
	width: 100% !important;
	height: 100% !important;
	border-radius: 0;
	display: block;
	object-fit: cover;
}

/* A soft scrim so pager controls stay legible over any photo. */
.memot-carousel-ready::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 2;
	background: linear-gradient(180deg, rgba(10, 26, 16, 0) 55%, rgba(10, 26, 16, 0.5) 100%);
}

/* Prev / next arrows. */
.memot-carousel-arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 999px;
	background: rgba(10, 26, 16, 0.35);
	backdrop-filter: blur(6px);
	color: var(--wp--preset--color--paper);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}

.memot-carousel-ready:hover .memot-carousel-arrow,
.memot-carousel-ready .memot-carousel-arrow:focus-visible {
	opacity: 1;
}

.memot-carousel-ready .memot-carousel-arrow:hover {
	background: rgba(10, 26, 16, 0.6);
	border-color: var(--wp--preset--color--paper);
}

.memot-carousel-prev {
	left: 0.9rem;
}

.memot-carousel-next {
	right: 0.9rem;
}

/* Pager dots. */
.memot-carousel-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 1rem;
	z-index: 3;
	display: flex;
	justify-content: center;
	gap: 0.5rem;
}

.memot-carousel-dot {
	width: 0.5rem;
	height: 0.5rem;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	transition: width 0.3s var(--memot-ease-out), background 0.2s ease;
}

.memot-carousel-dot.is-active {
	width: 1.5rem;
	background: var(--wp--preset--color--paper);
}

.memot-carousel-dot:focus-visible {
	outline: 2px solid var(--memot-harvest);
	outline-offset: 2px;
}

@media (max-width: 781px) {

	/* Stacked columns: carousel drops below the copy, a touch shorter. */
	.wp-block-gallery.is-style-memot-hero-carousel.memot-carousel-ready {
		aspect-ratio: 3 / 2;
		max-height: 60vh;
	}

	.memot-carousel-arrow {
		opacity: 1;
	}
}

/* Reduced-motion overrides for this file's own animated elements. Kept here
   rather than in theme.css's shared reduced-motion block so the override
   always shares a stylesheet — and therefore cascade order — with the
   animation it disables; theme.css loads as this file's dependency, so a
   base-file override of equal specificity would otherwise lose the tie. */
@media (prefers-reduced-motion: reduce) {

	.memot-hero-flow,
	.memot-hero-cue::before,
	.memot-marquee-inner {
		animation: none;
	}

	.memot-marquee-inner {
		flex-wrap: wrap;
		justify-content: center;
		width: auto;
		padding-right: 0;
		gap: var(--wp--preset--spacing--60) var(--wp--preset--spacing--80);
	}

	/* Fully remove the aria-hidden duplicate from layout — otherwise a
	 * reduced-motion visitor sees every logo twice in the wrapped, static row. */
	.memot-marquee-clone {
		display: none;
	}

	/* Carousel slides swap instantly (no cross-fade) for reduced-motion. */
	.wp-block-gallery.is-style-memot-hero-carousel.memot-carousel-ready .wp-block-image {
		transition: none;
		transform: none;
	}

	.memot-pillar-card:hover {
		transform: none !important;
	}

	.memot-pillar-card:hover .wp-block-cover__background,
	.memot-pillar-card:hover .wp-block-cover__image-background {
		transform: none;
	}
}
