/**
 * Catalog home discovery page.
 */

.myc-view-home .myc-page {
	max-width: var(--ps-content-discovery);
	padding-top: var(--ps-space-8);
	padding-bottom: var(--ps-space-8);
}

body.myc-layout-full.myc-view-home .myc-page {
	max-width: none;
}

.myc-home-page .myc-featured-section {
	width: 100%;
	min-width: 0;
	padding-top: var(--ps-space-2);
}

/*
 * Keep the first banner at the same distance from the element above it whether
 * that element is the header or a topbar block. With a topbar, the banner's
 * own margin supplies the gap; without one, the page and section padding used
 * to add up to 72px. Move that responsibility to the page when the banner is
 * first, while leaving every other opening block on the normal page rhythm.
 */
.myc-view-home .myc-page:has(> .myc-featured-section > .ps-cover:first-child) {
	padding-top: 50px;
}

.myc-home-page > .myc-featured-section:has(> .ps-cover:first-child) {
	padding-top: 0;
}

/*
 * The editor places every homepage block directly in this content region.
 *
 * A slider is intentionally wider than its visible window, but its scrolling
 * must remain local to that window. WebKit can use a flex-track intrinsic
 * width for an auto-sized block and then hand that width back to the document.
 * Give each direct block the definite width of the content region so a tab row
 * or product slider cannot turn into page-level horizontal scrolling.
 */
.myc-home-page .myc-featured-section > .wp-block {
	width: 100%;
	min-width: 0;
	max-width: 100%;
}

/*
 * The step from one category to the next.
 *
 * Sixty-four pixels was the measure when a category was four rows of a grid: a
 * tall block needs a wide gap to read as finished. A category is now one row of
 * a slider, and the same gap left more space between two categories than either
 * of them occupied.
 *
 * The gap follows the block, so it narrows with the screen.
 */
.myc-home-page .myc-category-preview + .myc-category-preview {
	margin-top: var(--ps-space-7);
}

/* The outer margin is the page's rhythm, set for every block in base.css. It
   used to be a `+` rule here, giving a gap between two of these and none
   anywhere else, which is why a page mixing block types came out uneven. */

@media (max-width: 1080px) {
	.myc-view-home .myc-page:has(> .myc-featured-section > .ps-cover:first-child) {
		padding-top: 35px;
	}

	.myc-home-page .myc-category-preview + .myc-category-preview {
		margin-top: var(--ps-space-6);
	}
}

@media (max-width: 760px) {
	.myc-home-page .myc-category-preview + .myc-category-preview {
		margin-top: var(--ps-space-5);
	}
}

@media (max-width: 760px) {
	.myc-view-home .myc-page {
		padding-top: var(--ps-space-6);
		padding-bottom: var(--ps-space-7);
	}

					}

/*
 * The category preview headings.
 *
 * These lived in the category stylesheet, which is why the home page used to
 * load it — .myc-preview-title is drawn here and on no other screen, measured
 * against the rendered markup. Left there, either the home page pulled in a
 * sheet for a page it is not, or it lost sixteen pixels of spacing.
 */
/*
 * The category name as a link.
 *
 * Styled to look exactly like the heading it replaces — the colour and weight
 * come from the h3 — so the row reads as a title, not as a line of link text.
 * What marks it as one is that it answers to the pointer.
 */
.myc-preview-title .myc-preview-heading .myc-preview-heading-link {
	/*
	 * `font: inherit` before anything else. The theme styles the row's other
	 * link — «Ver categoría» — with `.myc-preview-title a { font-size: 14px }`,
	 * and that rule caught the name the moment it was wrapped in an anchor: the
	 * headings dropped from 27 and 40px to 14. Inheriting the whole font shape
	 * from the h3 keeps the name a heading no matter what is done to the links
	 * around it.
	 */
	font: inherit;
	letter-spacing: inherit;
	color: inherit;
	text-decoration: none !important;
	transition: color var(--ps-transition-fast);

	/*
	 * iOS paints a grey block over whatever was tapped, and over a heading that
	 * spans most of the row it is a slab of grey across the screen. The colour
	 * change on press is the feedback; this is the default getting in its way.
	 */
	-webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
	.myc-preview-title .myc-preview-heading .myc-preview-heading-link:hover {
		color: var(--ps-color-brand-600);
	}
}

.myc-app-body .myc-preview-title .myc-preview-heading .myc-preview-heading-link:focus-visible {
	color: var(--ps-color-brand-600);
}

/* Nothing lingers after a tap, as with the arrow beside it. */
.myc-preview-title .myc-preview-heading .myc-preview-heading-link.is-pressed {
	color: var(--ps-color-brand-600);
	transition: none;
}

.myc-preview-title {
	/*
	 * Sixteen pixels held the name and the cards close enough to read as one
	 * block, which was the point when the name sat over a grid. Over a slider —
	 * a single row with a link on the same line as the name — the two ran into
	 * each other, so the row gets a little more air under it.
	 */
	margin-bottom: var(--ps-space-5);
}

@media (min-width: 1081px) {
	.myc-preview-title {
		margin-bottom: var(--ps-space-6);
	}
}

/*
 * Gated on a device that hovers. A touch screen reports a hover the moment it
 * is tapped and keeps reporting it afterwards, so a hover style there is a
 * colour that arrives on tap and never leaves — on the arrow it showed as a
 * dark red stroke left behind after the finger had gone.
 */
@media (hover: hover) and (pointer: fine) {
	.myc-preview-title a:hover {
		color: var(--ps-color-brand-700);
	}
}

.myc-app-body .myc-preview-title a:focus-visible {
	color: var(--ps-color-brand-700);
}

/*
 * Below the desktop breakpoint each category is a slider, not a grid.
 *
 * A category of eight products laid out two across is four rows tall on a
 * phone, and six categories of those is a front page nobody reaches the end
 * of. As a row that scrolls sideways, a category costs one row of height
 * whatever it holds.
 *
 * Built on scroll-snap rather than on a carousel script: the movement is the
 * browser's own, so it has real momentum, it can be flung, it respects the
 * platform's scrolling feel, and it works before any script runs. The script
 * that comes with it only draws the dots.
 */
@media (max-width: 1080px) {
	/*
	 * The shell lays its sections out in a flex column, where the horizontal
	 * axis is the cross axis — so a child's width resolves to its content
	 * rather than to the container, and a track of eight cards took the front
	 * page to 763px inside a 375px phone. The page scrolled sideways instead of
	 * the row scrolling inside it.
	 *
	 * `min-width: 0` is the usual remedy and does nothing here: that rule
	 * governs the main axis, which in a column is the vertical one. An explicit
	 * width is what ties the page to the shell.
	 */
	.myc-home-page {
		width: 100%;
	}

	.ps-category-row .myc-album-grid {
		--myc-slider-gap: var(--ps-space-4);

		/*
		 * Positioned, and this is load-bearing.
		 *
		 * The cards carry `.screen-reader-text` spans set to `position:
		 * absolute`. A scroll container clips its content, but not a descendant
		 * whose containing block lies outside it — and with a static track the
		 * nearest positioned ancestor is `.myc-album-viewport`, the wrapper the
		 * arrows hang on. Twenty of those labels then sat up to 3400px into a
		 * 2181px page and took the document with them: the row scrolled
		 * correctly and the whole site scrolled sideways behind it.
		 *
		 * `min-width: 0` cannot help — the track was never the thing
		 * overflowing. The same failure, with the same cure, is written into
		 * components/latest-products-tabs.css.
		 */
		position: relative;

		display: flex;
		gap: var(--myc-slider-gap);
		overflow-x: auto;

		/*
		 * Without this the track never scrolls: its automatic minimum size is
		 * the width of all the cards laid end to end, and that measurement is
		 * handed up to every ancestor — the whole front page grew to 763px
		 * inside a 375px phone instead of the row scrolling inside it.
		 */
		min-width: 0;
		scroll-snap-type: x mandatory;
		scroll-behavior: smooth;
		overscroll-behavior-x: contain;

		/*
		 * The track is the page's full width; the scrollbar is not part of the
		 * design and every touch platform hides its own anyway.
		 */
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.ps-category-row .myc-album-grid::-webkit-scrollbar {
		display: none;
	}

	.ps-category-row .myc-album-card {
		flex: 0 0 calc((100% - var(--myc-slider-gap)) / 2);
	}

	/*
	 * Two cards to a screen, so the snap points are every other card. Snapping
	 * on each one instead would leave a page half-turned whenever the finger
	 * stopped between them, and the dots below would have nothing to point at.
	 */
	.ps-category-row .myc-album-card:nth-child(odd) {
		scroll-snap-align: start;

		/*
		 * One page per swipe. Without this the momentum of a hard flick carries
		 * straight past a snap point and lands two or three pages along, which
		 * on a row of six products means the visitor never sees the middle of
		 * it. `always` makes each page a stop the scroll cannot be thrown over.
		 *
		 * It binds momentum, not scripts: the dots still jump as many pages as
		 * they need to, because a scroll asked for in code is not a fling.
		 */
		scroll-snap-stop: always;
	}
}

/*
 * How the arrow is painted, at any width.
 *
 * These lived inside the compact media query, because the arrow was shown at no
 * other width. The desktop pill brought it back up there and the paint did not
 * come with it: the path is drawn as a stroke, so with `fill` left at its
 * default it rendered as a solid black blob — which on hover, against the navy
 * fill, is a mark nobody can read. The size stays per breakpoint; only the
 * painting is shared.
 *
 * `display: block` because an inline SVG sits on a text baseline and the line
 * box keeps room for a descender under it, which put the glyph 1.5px above the
 * circle's centre.
 */
.ps-category-row .myc-preview-link svg {
	display: block;
	fill: none;
	stroke: currentcolor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/*
 * The arrows, beside the end cards.
 *
 * They exist only for a desktop slider, and only there is there anything for
 * them to do — below 1081px the finger moves the track. Laid over the ends of
 * the row rather than under it: at the edge of the first and last card is where
 * a hand reaches to push a row along, and a control placed anywhere else has to
 * be found first.
 *
 * Opaque, not translucent. They sit on product photographs whose colour is
 * whatever the shoe is, and a glassy button over a white sole disappears.
 */
.myc-album-viewport {
	position: relative;
}

.myc-preview-arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: none;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--ps-color-border);
	border-radius: 50%;
	background: var(--ps-color-surface);
	box-shadow: 0 2px 10px rgb(17 20 26 / 12%);
	color: var(--ps-color-text);
	cursor: pointer;
	place-items: center;
	transform: translateY(-50%);

	-webkit-tap-highlight-color: transparent;
}

.myc-preview-arrow--prev {
	left: 6px;
}

.myc-preview-arrow--next {
	right: 6px;
}

.myc-preview-arrow[hidden] {
	display: none;
}

.myc-preview-arrow svg {
	display: block;
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentcolor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/*
 * At an end the arrow goes, rather than sitting greyed over a photograph it has
 * nothing left to do for. Nothing shifts when it does: the track is where it
 * was and the other arrow is at the far side.
 */
.myc-preview-arrow:disabled {
	visibility: hidden;
}

@media (min-width: 1081px) {
	.ps-category-row--desktop-slider .myc-preview-arrow:not([hidden]) {
		display: grid;
	}
}

@media (hover: hover) and (pointer: fine) {
	.myc-preview-arrow {
		transition: border-color var(--ps-transition-fast), background-color var(--ps-transition-fast), color var(--ps-transition-fast);
	}

	.myc-preview-arrow:not(:disabled):hover {
		border-color: var(--ps-color-brand-600);
		background: var(--ps-color-brand-600);
		color: var(--ps-color-surface);
	}
}

.myc-app-body .myc-preview-arrow:focus-visible {
	outline: 2px solid var(--ps-color-brand-border);
	outline-offset: 2px;
}

/*
 * Dragging the track with a mouse.
 *
 * `grabbing` while the button is down, and snapping suspended for the length of
 * the drag: scroll-snap fights a pointer-driven scroll, pulling the track back
 * to the nearest page on every frame the cursor moves. It is restored on
 * release, which is what makes the track settle on a page afterwards.
 */
@media (min-width: 1081px) {
	/*
	 * The ordinary arrow over the track, and the pointing hand over the links.
	 *
	 * `grab` was here first — it is the convention for a draggable surface —
	 * but a palm over a shop's photographs is a lot of cursor for an affordance
	 * the arrows beside the end cards already offer in plain sight. Dragging
	 * still works; it is no longer advertised.
	 *
	 * Only the track is stated. Everything inside it is a link and the browser
	 * gives those the pointing hand on its own, which is the truth of the card:
	 * the photograph, the name and the button all open the product. Overriding
	 * that made the row read as one draggable surface, which it also is — but
	 * of the two things a card does, opening is the one a visitor is looking
	 * for.
	 */
	.ps-category-row--desktop-slider .myc-album-grid {
		cursor: default;

		/*
		 * The standard card hover rises 4px and casts a soft 44px shadow. A
		 * horizontal scroller also clips vertically, so reserve transparent room
		 * inside it for that paint and cancel the room in layout with margins.
		 * The row keeps its original rhythm while the complete hover remains
		 * visible, matching the latest-products block.
		 */
		padding-block: 8px 48px;
		margin-block: -8px -48px;
	}
}

/*
 * A photograph inside a link is two native drags waiting to happen: the browser
 * will pick up the image, or the link, the moment the pointer moves — and it
 * takes over from the pointer events that would otherwise have scrolled the
 * track. It is why dragging worked over the gaps between cards and nowhere
 * else. `dragstart` is cancelled in the script as well, for the browsers that
 * ignore this.
 */
.ps-category-row--desktop-slider .myc-album-grid a,
.ps-category-row--desktop-slider .myc-album-grid img {
	-webkit-user-drag: none;
}

/*
 * Not scoped to the desktop slider: a mouse at a narrow window drags the
 * compact track too, and snap has to yield there for the same reason.
 */
.ps-category-row .myc-album-grid.is-dragging {
	scroll-snap-type: none;
	scroll-behavior: auto;
	user-select: none;
}

/*
 * The dots, at any width.
 *
 * They used to live inside the compact media query, because that was the only
 * width the row slid at. The category block can now ask for a slider on
 * desktop too, and rules locked to one breakpoint would have left those dots
 * drawn as bare buttons. Nothing renders them unhidden except the script, and
 * the script only unhides them for a row that is actually sliding, so letting
 * the rules apply everywhere costs nothing and repeats nothing.
 */
.myc-preview-dots {
	display: flex;
	justify-content: center;
	gap: var(--ps-space-2);
	margin-top: var(--ps-space-4);
}

.myc-preview-dots[hidden] {
	display: none;
}

/*
 * The dot is small; the button around it is not. A 6px target is unusable
 * with a thumb, so the button keeps a 24px reach and the dot is drawn
 * inside it.
 */
.myc-preview-dot {
	display: grid;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	place-items: center;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.myc-preview-dot::before {
	width: 6px;
	height: 6px;
	border-radius: 999px;
	background: var(--ps-color-border-strong, #c9c1c3);
	transition: width var(--ps-transition-base), background-color var(--ps-transition-base);
	content: "";
}

/* The current page reads as a bar rather than a bigger dot: it says «you are
   here» without the row of dots changing height as it moves. */
.myc-preview-dot[aria-current="true"]::before {
	width: 18px;
	background: var(--ps-color-brand-600);
}

.myc-app-body .myc-preview-dot:focus-visible {
	outline: 2px solid var(--ps-color-brand-border);
	outline-offset: -2px;
	border-radius: var(--ps-radius-sm);
}

/*
 * The category's name and its link on one line.
 *
 * Below 760px the shared heading rule stacks them, which was right when the
 * heading sat over a grid: the link had a whole block underneath it and needed
 * no help being found. Over a slider it is one more row of height on the screen
 * where height is scarcest, and «Ver categoría» reads as a stray line of text
 * rather than as the action for the row beneath it.
 *
 * Aligned on the baseline, not on the box: the name is 27px and the link 14px,
 * so matching their boxes sits the link low. The baseline is the line the
 * reader is already following.
 */
@media (max-width: 1080px) {
	/*
	 * Centred, not baseline-aligned.
	 *
	 * A baseline aligns the two texts, which is right when both are text. Once
	 * the link became a 34px circle there was no text in it to align, and
	 * `align-self: center` centres within the flex line — a line whose height
	 * baseline alignment had already decided. The circle sat 4px low on every
	 * one-line title.
	 */
	.ps-category-row .myc-preview-title {
		flex-direction: row;
		align-items: center;
		gap: var(--ps-space-4);
	}

	/* The name yields; the link keeps its width and never breaks in two. */
	.ps-category-row .myc-preview-title .myc-preview-heading {
		min-width: 0;
	}

	.ps-category-row .myc-preview-title a {
		flex: 0 0 auto;
		white-space: nowrap;
	}

	/*
	 * The link becomes an arrow.
	 *
	 * «Ver categoría» took 106px of a 360px screen and pushed the longer names
	 * onto a second line — «Club Atlético de Madrid» and «Real Betis Balompié»
	 * both wrapped. The arrow says the same in 34px, and the wording stays in
	 * the markup for anything that reads the page aloud.
	 */
	.ps-category-row .myc-preview-link-text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.ps-category-row .myc-preview-link {
		display: grid;
		width: 34px;
		height: 34px;
		border: 1px solid var(--ps-color-border);
		border-radius: 50%;
		place-items: center;

		-webkit-tap-highlight-color: transparent;
	}

	/* The size; how it is painted is decided once, outside this breakpoint. */
	.ps-category-row .myc-preview-link svg {
		width: 17px;
		height: 17px;
	}

	/*
	 * Filled on a real pointer, and on a tap — but never faded between the two.
	 *
	 * The fill used to arrive over 160ms, and on iOS the finger is on the
	 * circle for less than that: the tap showed a half-mixed red with the arrow
	 * caught grey somewhere between its two colours. iOS then leaves :hover
	 * stuck on the element it was tapped, so the muddy state stayed.
	 *
	 * So the hover is gated on a device that actually hovers, and touch gets
	 * :active with no transition at all — the fill is either there or it is not.
	 */
	@media (hover: hover) and (pointer: fine) {
		.ps-category-row .myc-preview-link {
			transition: border-color var(--ps-transition-fast), background-color var(--ps-transition-fast), color var(--ps-transition-fast);
		}

		.ps-category-row .myc-preview-link:hover {
			border-color: var(--ps-color-brand-600);
			background: var(--ps-color-brand-600);
			color: var(--ps-color-surface);
		}
	}

	/*
	 * `is-pressed` is set from pointer events by category-slider.js, because
	 * :active alone is not delivered reliably on iOS. Both are listed so the
	 * press still shows if the script never runs.
	 */
	.ps-category-row .myc-preview-link:active,
	.ps-category-row .myc-preview-link.is-pressed,
	.myc-app-body .ps-category-row .myc-preview-link:focus-visible {
		border-color: var(--ps-color-brand-600);
		background: var(--ps-color-brand-600);
		color: var(--ps-color-surface);
		transition: none;
	}
}

@media (max-width: 760px) {
	.ps-category-row .myc-album-grid {
		--myc-slider-gap: var(--ps-space-3);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ps-category-row .myc-album-grid {
		scroll-behavior: auto;
	}

	.myc-preview-dot::before {
		transition: none;
	}
}

/*
 * The same track on desktop, for a block that asked for it.
 *
 * Every declaration below is the compact rule's, and the reasoning for each is
 * written there once — the automatic minimum size that has to be overridden,
 * the snap type, the hidden scrollbar. Repeated rather than shared because the
 * two live in different media queries and CSS has no way to lend a declaration
 * block across one.
 *
 * The card widths and the snap points are not here: they depend on how many
 * cards the shop chose, so they arrive per instance from
 * soto_catalog_block_category_css().
 */
@media (min-width: 1081px) {
	.ps-category-row--desktop-slider .myc-album-grid {
		--myc-slider-gap: var(--ps-space-4);

		/* Positioned for the same reason as the compact track above: the
		   screen-reader labels inside the cards are absolute, and anchored
		   outside the scroller they escape its clipping and widen the page. */
		position: relative;

		display: flex;
		gap: var(--myc-slider-gap);
		overflow-x: auto;
		min-width: 0;
		scroll-snap-type: x mandatory;
		scroll-behavior: smooth;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
	}

	.ps-category-row--desktop-slider .myc-album-grid::-webkit-scrollbar {
		display: none;
	}
}

/*
 * Desktop keeps the words: there is room for them and they read better. The
 * arrow comes with them here — the same one the compact circle uses, at text
 * size — so the link reads as a way onward rather than as a bold word that
 * happens to be clickable. It is the compact circle's treatment stretched into
 * a pill: same border, same fill on hover, same idea.
 */
@media (min-width: 1081px) {
	.myc-preview-link-arrow {
		display: none;
	}

	.ps-category-row .myc-preview-link {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 9px 18px;
		border: 1px solid var(--ps-color-border);
		border-radius: 999px;
		line-height: 1;
		white-space: nowrap;

		-webkit-tap-highlight-color: transparent;
	}

	.ps-category-row .myc-preview-link-arrow {
		display: block;
	}

	.ps-category-row .myc-preview-link-arrow svg {
		width: 16px;
		height: 16px;
	}

	@media (hover: hover) and (pointer: fine) {
		.ps-category-row .myc-preview-link {
			transition: border-color var(--ps-transition-fast), background-color var(--ps-transition-fast), color var(--ps-transition-fast);
		}

		.ps-category-row .myc-preview-link-arrow svg {
			transition: transform var(--ps-transition-fast);
		}

		.ps-category-row .myc-preview-link:hover {
			border-color: var(--ps-color-brand-600);
			background: var(--ps-color-brand-600);
			color: var(--ps-color-surface);
		}

		/* Two pixels. Enough to read as movement towards the category, not
		   enough to make the pill look like it is coming apart. */
		.ps-category-row .myc-preview-link:hover .myc-preview-link-arrow svg {
			transform: translateX(2px);
		}
	}
}
