/*
 * Alternative front page template styles (templates/front-page-2.php).
 *
 * Hero, category cards, hand-picked products and the brand/trust panel.
 * Enqueued only on that template (see includes/core.php), so it never loads
 * next to front-page.css and the two can share class names.
 *
 * Colours come from the semantic layer in global/colors.css and never from the
 * palette directly. The hero sits on --color-brand-surface, so its text uses
 * the --color-on-brand-* family; the category cards use the numbered
 * --color-surface-tint-* rotation, which exists to tell siblings apart rather
 * than to mean anything.
 *
 * Type follows global/tokens.css wherever a token lands on the intended size
 * (16px --text-body-s, 17px --text-ui-l, 15px --text-body-xs, 19px
 * --heading-s). Explicit rem values are only used for the display sizes and
 * the 13px kickers, which have no token.
 */

/* ========================================
   Section scaffolding
======================================== */

.front-page-2 {
	padding-block: 12px clamp(3rem, 5vw, 4.75rem);
}

.front-page-2 a {
	color: inherit;
	text-decoration: none;
}

.front-page-2 a:focus-visible {
	outline: 3px solid var(--color-focus);
	outline-offset: 5px;
}

.front-page-2 :is(h1, h2, h3) {
	color: inherit;
}

.front-page-2 img {
	display: block;
	max-width: 100%;
}

.front-section {
	padding-top: clamp(2.7rem, 4.5vw, 4.4rem);
}

.front-section__header {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 1.5rem;
	margin-bottom: 1.8rem;
}

/*
 * .front-section__title used to live here: --heading-xl, tighter tracking,
 * no margin. It is .h1 now (global/typography.css already has this exact
 * size under that name); the tracking is the one thing worth keeping as a
 * local exception, since .h1 does not carry it and large display type reads
 * better tightened.
 */
.front-section__header .h1 {
	letter-spacing: -0.03em;
}

.front-section__note {
	max-width: 20rem;
	font-size: var(--text-body-xs);
	color: var(--color-text-muted);
}

/*
 * .front-eyebrow used to live here: font-size, weight, tracking, colour and
 * margin all identical to what .eyebrow (global/typography.css) declares now
 * -- 0.55rem was 8.8px, .eyebrow's own default is 8px. It is .eyebrow, plain,
 * everywhere on this page except the hero, which needs a real exception (see
 * below).
 */

/* ========================================
   Icons

   Single-colour SVGs from assets/images/icons/, masked so they take the
   current text colour. Same technique as the header and cart drawer.
======================================== */

.front-icon {
	display: inline-block;
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	background-color: currentColor;
	pointer-events: none;
	mask-repeat: no-repeat;
	mask-size: contain;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	-webkit-mask-position: center;
}

/*
 * The directional arrow used to live here as .front-icon--arrow, on
 * arrow-thin.svg. It is now the shared .icon-arrow in bc-icon.css, used by
 * every button, link and badge on the site that points somewhere, so
 * .front-button, .front-link and .front-categories__arrow reference that
 * class directly instead of a variant of this one. check-circle, leaf and
 * heart below are content icons, not directional, and were never part of
 * that system.
 */

.front-icon--check-circle {
	mask-image: url(../../../images/icons/check-circle.svg);
	-webkit-mask-image: url(../../../images/icons/check-circle.svg);
}

.front-icon--leaf {
	mask-image: url(../../../images/icons/leaf.svg);
	-webkit-mask-image: url(../../../images/icons/leaf.svg);
}

.front-icon--heart {
	mask-image: url(../../../images/icons/heart.svg);
	-webkit-mask-image: url(../../../images/icons/heart.svg);
}

/* ========================================
   Buttons and text links
======================================== */

/* Scoped past the ".front-page-2 a { color: inherit }" reset above, which
   would otherwise leave the label white on the white button. */
/*
 * .front-button used to live here: a white pill, 50px min-height, 15px text,
 * scoped to this one template. It was never a "front page button" -- it was
 * a button on a dark surface that happened to only exist here -- so it is now
 * .btn.btn--inverse.btn--mid (bc-button.css), the same class any other page
 * can reach for. 48px / 16px is the closest step on the button size scale to
 * the 50px / 15px this used to be.
 */

/*
 * .front-link used to live here: border-bottom under the whole flex row
 * (icon included), 15px, its own hover colour. It is .link.link--small now
 * (components/bc-link.css), the same class front-page.css's bestsellers link
 * and the footer's card links use.
 */

/* ========================================
   Hero
======================================== */

.front-hero__inner {
	--inset-floor: clamp(1.25rem, 4vw, 2rem);
	display: grid;
	grid-template-columns: 1fr 1fr;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--color-brand-surface);
	color: var(--color-on-brand-strong);
}

.front-hero__content {
	position: relative;

	/*
	 * Own stacking context, so ::before's negative z-index below only has to
	 * beat this element's own text/buttons -- without it, that z-index would
	 * compare against .front-hero__inner's other children too, and could
	 * just as easily end up behind the photo column instead.
	 */
	isolation: isolate;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	padding-block: clamp(2rem, 4.3vw, 4.75rem);
	padding-right: clamp(1.5rem, 3vw, 3.5rem);

	/*
	 * Puts the copy on the content track, the same line .container-inset gives
	 * the sections below. The inset has to live on this column, not on the
	 * grid: padding on the grid would shrink the copy column while the photo
	 * column kept its width, and the two halves would stop matching.
	 *
	 * A grid item resolves percentages against its own area, which is half the
	 * panel, so the track is halved to match. The floor keeps the copy off the
	 * rounded edge once the panel is too narrow for any offset, and the photo
	 * is a separate item so it still bleeds to both panel edges.
	 */
	padding-left: max(var(--inset-floor), calc(100% - min(100%, calc(var(--width-track) / 2))));
}

/*
 * Decorative topographic pattern, moved off .front-hero__content's own
 * background onto a pseudo-element so its opacity can be tuned
 * (--hero-bg-pattern-opacity) without fading the copy sitting on top of it --
 * opacity on the element itself would have taken the text down with it.
 * background-size: cover keeps it scaling with the panel exactly like an img
 * with object-fit: cover would, without needing this to be a real image
 * element for content that is purely decorative.
 */
.front-hero__content::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image: url(../../../images/front-page-hero-bg-2.png);
	background-repeat: no-repeat;
	background-position: right top;
	background-size: cover;
	opacity: var(--hero-bg-pattern-opacity, .2);
	pointer-events: none;
}

.front-hero .eyebrow {
	color: var(--color-on-brand-muted);
	margin-bottom: 1.8rem;
}

.front-hero__title {
	font-size: var(--heading-hero);
	font-weight: var(--font-medium);
	line-height: 1.04;
	letter-spacing: -0.055em;
}

.front-hero__title span {
	display: block;
	color: var(--color-on-brand-accent);
}

.front-hero__lead {
	max-width: 27rem;
	margin-top: 1.7rem;
	font-size: var(--text-ui-l);
	line-height: var(--leading-large);
	color: var(--color-on-brand);
}

.front-hero__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.5rem;
	margin-top: 2rem;
}

/*
 * .btn grows to fill a flex row by default (bc-button.css), which this row
 * does not want: it would stretch the button and push .front-link along with
 * it. Same override .front-about__content .btn--ghost already uses in
 * front-page.css for the same reason.
 */
.front-hero__actions .btn {
	flex: 0 1 auto;
}

/* .link's own hover colour (--color-action) reads poorly on this dark surface. */
.front-hero .link:hover {
	color: var(--color-on-brand-muted);
}

.front-hero__note {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	margin-top: 2.5rem;
	font-size: var(--text-meta);
	color: var(--color-on-brand-muted);
}

.front-hero__note .front-icon {
	flex-basis: 17px;
	width: 17px;
	height: 17px;
}

.front-hero__media {
	position: relative;
	min-height: 550px;
}

.front-hero__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 67% center;
}

/* Keeps the caption legible over the lighter parts of the photo. */
.front-hero__media::after {
	content: "";
	position: absolute;
	inset: 55% 0 0;
	background: linear-gradient(transparent, var(--color-scrim));
	pointer-events: none;
}

.front-hero__caption {
	position: absolute;
	z-index: 1;
	right: 1.6rem;
	bottom: 1.6rem;
	left: 1.8rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-top: 0.95rem;
	border-top: var(--border-width) solid var(--color-border-on-brand);
	font-size: var(--text-body-xs);
	font-weight: var(--font-medium);
}

.front-hero__caption small {
	font-size: var(--text-label);
	font-weight: var(--font-normal);
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

/*
 * Slider variant of .front-hero__media. Keeps the base rules above
 * (position, min-height, the ::after scrim, .front-hero__caption) and only
 * adds what the track/slides/arrows need. See partials/front-page-2/hero.php
 * and assets/js/frontend/bc-front-hero-slider.js.
 */
.front-hero__slider-viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.front-hero__slider-container {
	display: flex;
	height: 100%;
}

.front-hero__slider-slide {
	position: relative;
	flex: 0 0 100%;
	min-width: 0;
	height: 100%;
}

.front-hero__slider-nav {
	display: flex;
	align-items: center;
}

.front-hero__slider-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.4rem;
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	transition: color 0.2s;
}

.front-hero__slider-arrow:hover,
.front-hero__slider-arrow:focus-visible {
	color: var(--color-on-brand-muted);
}

/* Loop off: the boundary arrow goes inert instead of silently doing nothing. */
.front-hero__slider-arrow:disabled {
	color: var(--color-on-brand-muted);
	opacity: 0.4;
	cursor: default;
}

/*
 * One dash per slide, sitting between the two arrows, clickable (hero.php,
 * bc-front-hero-slider.js: embla.scrollTo()). The active one grows and
 * brightens, both animated as a real inline-size change, not a fixed-width
 * slot with a transform inside it (an earlier version of this did that
 * specifically to keep the arrows from moving) -- with exactly one dash
 * active and the rest at the same inactive size at all times, the row's
 * total width is constant at every point of the transition: whatever the
 * active dash grows by, the one it replaces shrinks by, in lockstep (same
 * duration, same easing). The fixed-slot version was solving a problem that
 * can't actually happen here, at the cost of dead space around every
 * inactive dash that this real-width version does not have. Same technique
 * (and gap) as https://ibrewmyown.coffee/interviews/fatih-arslan's carousel
 * dots, scaled to this theme's dash shape instead of their filled circles.
 */
.front-hero__slider-dots {
	display: flex;
	align-items: center;
	gap: 6px;
}

.front-hero__slider-dot {
	position: relative;
	inline-size: 4px;
	block-size: 3px;
	border-radius: 999px;
	background: var(--color-on-brand-strong);
	opacity: 0.4;
	flex: 0 0 auto;
	padding: 0;
	border: none;
	cursor: pointer;
	transition: inline-size 0.4s ease, opacity 0.4s ease;
}

/*
 * The dash itself is deliberately tiny -- 4x2px, same reasoning applies once
 * it grows to 10px active -- so the actual hit target is this invisible
 * square centred on it instead, same trick as the ibrewmyown.coffee dots
 * above. 20px is short of the usual 44px touch-target guideline, but this
 * row sits between two 33px arrows (padding included) with only 6px of gap
 * between dashes; going larger would make adjacent hit areas overlap.
 */
.front-hero__slider-dot::before {
	content: "";
	position: absolute;
	inset-block: -9px;
	inset-inline: -8px;
}

.front-hero__slider-dot:hover,
.front-hero__slider-dot:focus-visible {
	opacity: 0.7;
}

.front-hero__slider-dot.is-active {
	inline-size: 10px;
	opacity: 0.8;
}

.front-hero__slider-dot.is-active:hover,
.front-hero__slider-dot.is-active:focus-visible {
	opacity: 1;
}

.slider-caption {
	opacity: .95;
}

/*
 * Autoplay countdown to the next slide, drawn right on .front-hero__caption's
 * own border-top -- a second, thicker line that fills over that one rather
 * than a separate element elsewhere. Only in the DOM when autoplay is on
 * (hero.php); bc-front-hero-slider.js drives it from Embla Autoplay's own
 * autoplay:timerset / autoplay:timerstopped events, not a timer of its own.
 */
.front-hero__caption-progress {
	position: absolute;
	inset-block-start: -1px;
	inset-inline: 0;
	block-size: var(--border-width);
	background: var(--color-on-brand-strong);
	transform: scaleX(0);
	transform-origin: left;
	pointer-events: none;
	opacity: .35;
}

.front-hero__caption-progress.is-animating {
	animation: bc-hero-progress-fill linear forwards;
}

@keyframes bc-hero-progress-fill {
	from {
		transform: scaleX(0);
	}

	to {
		transform: scaleX(1);
	}
}

/* ========================================
   Categories
======================================== */

.front-categories__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1.1rem;
}

.front-categories__card {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	min-height: 330px;
	padding: 1.5rem;
	border-radius: var(--radius-s);
	background: var(--color-surface-tint-1);
	overflow: hidden;
}

/* Four tints, one per card, so the row reads as a set rather than a grid of
   identical boxes. Assumes the four hardcoded cards. */
.front-categories__card:nth-child(2) {
	background: var(--color-surface-tint-2);
}

.front-categories__card:nth-child(3) {
	background: var(--color-surface-tint-3);
}

.front-categories__card:nth-child(4) {
	background: var(--color-surface-tint-4);
}

/* Kept in the flow rather than absolutely positioned, so a kicker that wraps
   to two lines pushes the image down instead of sitting on top of it. */
.front-categories__kicker {
	font-size: var(--text-label);
	font-weight: var(--font-medium);
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.front-categories__media {
	display: flex;
	flex: 0 0 auto; /* The card is a flex column; without this the fixed height collapses. */
	align-items: center;
	justify-content: center;
	height: 217px;
	margin-top: 0.75rem;
}

/* Product shots are on a white background, so multiply drops it into the
   card tint. Dedicated category artwork has to keep that white background. */
.front-categories__media img {
	width: 198px;
	height: 198px;
	object-fit: contain;
	mix-blend-mode: multiply;
	transition: transform 0.4s;
}

.front-categories__card:hover .front-categories__media img {
	transform: translateY(-5px) rotate(-3deg) scale(1.04);
}

.front-categories__name {
	max-width: 14rem;
	margin-top: 0.25rem;
	padding-right: 1.5rem;
	font-size: var(--heading-s);
	font-weight: var(--font-mild);
	line-height: var(--leading-short);
	letter-spacing: -0.035em;
}

.front-categories__description {
	margin-top: 0.4rem;
	font-size: var(--text-body-s);
	line-height: var(--leading);
	color: var(--color-text-muted);
}

.front-categories__arrow {
	position: absolute;
	right: 1.2rem;
	bottom: 2.9rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 29px;
	height: 29px;
	border-radius: 50%;
	background: var(--color-surface-veil);
	transition: transform 0.2s;
}


.front-categories__card:hover .front-categories__arrow {
	transform: translateX(3px);
}

/* ========================================
   Products

   The cards are WooCommerce's own loop markup, so this only adjusts the
   pieces the design changes: a framed image, and the second tagline line.
======================================== */

/* Specificity has to clear the WooCommerce fork's own ".woocommerce ul.products"
   rules, which set the grid gap and an 80px bottom margin. Section rhythm is
   handled by .front-section padding here, so that margin goes. */
.front-products .woocommerce ul.products {
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1.45rem;
	margin-bottom: 0;
}

/*
 * Brand, title and tagline run to different line counts from card to card, so
 * without this the price lands at a different height in every column. The
 * link is already a full-height flex column; the meta block just has to grow
 * into the leftover space and push the price to the bottom of it.
 */
.front-products .woocommerce ul.products li.product .product-loop-meta {
	flex: 1;
}

.front-products .woocommerce ul.products li.product .price {
	margin-top: auto;
}

.front-products .woocommerce ul.products li.product .woocommerce-loop-product__link img {
	padding: 7%;
	border: var(--border-width) solid var(--color-border-subtle);
	border-radius: var(--radius-s);
	background: var(--color-surface-raised);
}

.front-products .product-loop-tagline {
	margin-bottom: 0.5rem;
	font-size: var(--text-body-s);
	line-height: var(--leading);
	color: var(--color-text-muted);
}

/* ========================================
   About
======================================== */

/* Wide track like the hero and the footer; .container-inset on the panel
   puts the text back on the content track. */
.front-about__panel {
	--inset-floor: clamp(1.25rem, 4vw, 2rem);
	padding-block: clamp(1.9rem, 4.5vw, 4.5rem);
	border-radius: var(--radius);
	background: var(--color-surface-tint-1);
}

.front-about__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(2rem, 6vw, 6.25rem);
}

.front-about__title {
	max-width: 31rem;
	font-size: var(--heading-xxl);
	font-weight: var(--font-medium);
	line-height: 1.13;
	letter-spacing: -0.045em;
}

.front-about__text {
	max-width: 29rem;
	margin-top: 1.4rem;
}

@media (min-width: 800px) {
	.front-about__text {
		line-height: var(--leading-large);
	}
}

.front-about__intro .link {
	margin-top: 1.5rem;
}

.front-about__values {
	align-self: center;
	list-style: none;
	margin: 0;
	padding: 0;
}

.front-about__value {
	display: grid;
	grid-template-columns: 32px 1fr;
	gap: 1.2rem;
	padding-block: 1.45rem;
	border-bottom: var(--border-width) solid var(--color-border-tint);
}

.front-about__value:first-child {
	padding-top: 0;
}

.front-about__value:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.front-about__value .front-icon {
	flex-basis: 28px;
	width: 28px;
	height: 28px;
	margin-top: 2px;
	color: var(--color-brand-accent);
}

.front-about__value-title {
	font-size: var(--heading-s);
	font-weight: var(--font-mild);
	line-height: var(--leading-short);
}

.front-about__value-text {
	max-width: 26rem;
	margin-top: 0.35rem;
	font-size: var(--text-body-m);
	line-height: var(--leading);
	color: var(--color-text-muted);
}

/* ========================================
   Responsive
======================================== */

@media (min-width: 1800px) {
	.front-hero__media {
		min-height: 620px;
	}
}

@media (max-width: 1100px) {
	.front-hero__content {
		padding-block: 2.25rem;
	}

	.front-hero__actions {
		gap: 1.1rem;
	}

	.front-hero__note {
		margin-top: 1.75rem;
	}

	.front-hero__media {
		min-height: 520px;
	}

	.front-hero__caption small {
		display: none;
	}

	.front-categories__grid {
		gap: 0.75rem;
	}

	.front-categories__card {
		min-height: 310px;
		padding: 1.1rem;
	}

	.front-categories__media {
		height: 195px;
	}

	.front-categories__media img {
		width: 173px;
		height: 173px;
	}

	.front-categories__arrow {
		right: 0.75rem;
		bottom: 3.3rem;
	}

	.front-products .woocommerce ul.products {
		gap: 1.05rem;
	}
}

/*
 * The hero headline scales with the viewport while its column is only half
 * of it, so in the two-column range the type outgrows the space and "Dobra
 * forma." breaks across two lines. Stacking earlier keeps the intended
 * two-line headline.
 */
@media (max-width: 900px) {
	.front-hero__inner {
		grid-template-columns: 1fr;
	}

	/* Single column here, so the copy area is the full panel and the formula
	   above falls through to the floor on its own. Only the other three sides
	   need adjusting. */
	.front-hero__content {
		padding-block: 2.1rem 2rem;
		padding-right: var(--inset-floor);
	}

	.front-hero .eyebrow {
		margin-bottom: 1.45rem;
		letter-spacing: 0.09em;
	}

	.front-hero__lead {
		margin-top: 1.4rem;
		font-size: var(--text-body-s);
	}

	.front-hero__actions {
		margin-top: 1.55rem;
		gap: 1.1rem;
	}

	.front-hero__note {
		margin-top: 1.55rem;
	}

	.front-hero__media {
		min-height: 0;
		aspect-ratio: 1.3;
	}

	.front-hero__media img {
		object-position: 67% 56%;
	}

	.front-hero__caption {
		right: 1.5rem;
		bottom: 1.3rem;
		left: 1.5rem;
	}
}

@media (max-width: 767px) {
	.front-page-2 {
		padding-block: 8px 3rem;
	}

	.front-section {
		padding-top: 2.7rem;
	}

	.front-section__header {
		flex-wrap: wrap;
		align-items: flex-start;
		gap: 0.75rem;
		margin-bottom: 1.45rem;
	}

	.front-categories__grid,
	.front-products .woocommerce ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.front-categories__card {
		min-height: 250px;
	}

	.front-categories__media {
		height: 145px;
	}

	.front-categories__media img {
		width: 130px;
		height: 130px;
	}

	.front-categories__arrow {
		display: none;
	}

	.front-about__grid {
		grid-template-columns: 1fr;
		gap: 2rem;
	}
}
