/**
 * Styles for the cover panel block (soto/portada).
 *
 * A tall panel and, under it, two optional cards. Each surface can carry a
 * colour, a gradient or a photograph, so nothing here fixes a background: the
 * block writes one custom property per surface and these rules only place
 * things on top of it.
 */

/* The outer margin is the page's rhythm, set for every block in base.css. */
.ps-cover {
	width: 100%;
}

/*
 * The panel paints its background on a layer of its own rather than on itself,
 * so a photograph can be dimmed without dimming the words over it.
 */
.ps-cover__panel {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--ps-space-5);
	overflow: hidden;
	min-height: clamp(320px, 42vw, 520px);
	justify-content: center;
	padding: clamp(var(--ps-space-6), 5vw, var(--ps-space-8));
	border: 1px solid var(--ps-color-brand-800);
	border-radius: var(--ps-radius-lg);
	background: var(--ps-cover-bg, var(--ps-color-brand-950));
	color: #fff;
}

.ps-cover__media {
	position: absolute;
	inset: 0;
	z-index: -2;
	background-image: var(--ps-cover-image);
	background-position: var(--ps-cover-focus, 50% 50%);
	background-size: cover;
	background-repeat: no-repeat;
}

/*
 * The scrim is what keeps text legible over an arbitrary photograph. Two
 * layers, because one is not enough:
 *
 * The flat dim is the editor's to choose — only they can see the image, and a
 * bright photograph needs more of it than a dark one.
 *
 * The gradient over it is not adjustable and leans left, because that is where
 * the words are and a photograph is under no obligation to be dark there. It
 * fades out well before the far edge, so the picture is still a picture.
 */
.ps-cover__scrim {
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(90deg, rgb(8 16 28 / 62%) 0%, rgb(8 16 28 / 30%) 48%, rgb(8 16 28 / 0%) 78%),
		rgb(8 16 28 / var(--ps-cover-dim, 45%));
}

/* Narrow screens leave no far edge to fade towards: the text spans the panel,
   so the scrim does too. */
@media (max-width: 760px) {
	.ps-cover__scrim {
		background:
			linear-gradient(180deg, rgb(8 16 28 / 30%) 0%, rgb(8 16 28 / 55%) 100%),
			rgb(8 16 28 / var(--ps-cover-dim, 45%));
	}
}

.ps-cover__kicker {
	margin: 0;
	color: rgb(255 255 255 / 68%);
	font-family: var(--ps-font-display);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .18em;
	text-transform: uppercase;
}

.ps-cover__title {
	max-width: 18ch;
	margin: 0;
	font-family: var(--ps-font-display);
	font-size: clamp(38px, 6.1vw, 76px);
	font-weight: 700;
	line-height: .98;
	overflow-wrap: anywhere;
}

.ps-cover__text {
	max-width: 56ch;
	margin: 0;
	color: rgb(255 255 255 / 78%);
	font-size: clamp(15px, 1.3vw, 17px);
	line-height: 1.55;
}

/*
 * A photographic cover keeps its copy inside the deliberately quiet side of
 * the frame. The image can still carry detail on the right without a title
 * losing contrast as the viewport widens.
 */
.ps-cover__panel:has(.ps-cover__media) .ps-cover__title {
	max-width: 15ch;
}

.ps-cover__panel:has(.ps-cover__media) .ps-cover__text {
	max-width: 46ch;
}

/* Left with everything else, not pushed to the far edge: the panel reads as one
   column the eye follows down, and the action sits where the reading stops. */
.ps-cover__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	margin-top: var(--ps-space-2);
	padding: 0 var(--ps-space-6);
	border-radius: var(--ps-radius-md);
	background: #fff;
	color: var(--ps-color-brand-800);
	font-family: var(--ps-font-display);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .04em;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color var(--ps-transition-fast), color var(--ps-transition-fast);
}

.ps-cover__action:hover,
.ps-cover__action:focus-visible {
	background: var(--ps-color-brand-50);
	color: var(--ps-color-brand-900);
}

@media (max-width: 760px) {
	.ps-cover__panel {
		min-height: clamp(280px, 62vw, 420px);
		gap: var(--ps-space-4);
	}

	.ps-cover__panel.has-marquee {
		padding-bottom: calc(clamp(var(--ps-space-6), 5vw, var(--ps-space-8)) + 40px);
	}

	.ps-cover__marquee {
		mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
	}

	.ps-cover__marquee-item {
		font-size: 12px;
		gap: var(--ps-space-4);
		padding-inline-end: var(--ps-space-4);
	}

	.ps-cover__action {
		width: fit-content;
	}

	/* Crop into the sneaker group on a narrow panel while the vertical scrim
	   keeps the whole copy column clear. */
	.ps-cover__panel:has(.ps-cover__media) .ps-cover__media {
		background-position: 76% 54%;
	}
}

/*
 * The marquee along the panel's bottom edge.
 *
 * The track holds the phrase sequence twice and slides exactly half its own
 * width, so the second copy arrives where the first began and the loop has no
 * seam. Nothing here depends on how many phrases there are or how long they
 * run: whatever the sequence is, half of double it is one full turn.
 */
.ps-cover__marquee {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 1;
	overflow: hidden;
	padding-block: 11px;
	border-top: 1px solid rgb(255 255 255 / 12%);
	background: rgb(8 16 28 / 55%);
	mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
}

.ps-cover__marquee-track {
	display: flex;
	width: max-content;
	animation: ps-cover-marquee var(--ps-marquee-duration, 30s) linear infinite;
}

.ps-cover__marquee-group {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
}

.ps-cover__marquee-item {
	display: inline-flex;
	align-items: center;
	gap: var(--ps-space-5);
	padding-inline-end: var(--ps-space-5);
	color: rgb(255 255 255 / 88%);
	font-family: var(--ps-font-display);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	white-space: nowrap;
}

.ps-cover__marquee-sep {
	color: rgb(255 255 255 / 45%);
}

@keyframes ps-cover-marquee {
	from { transform: translate3d(0, 0, 0); }
	to   { transform: translate3d(-50%, 0, 0); }
}

/* The panel keeps room for the strip so the button never sits under it. */
.ps-cover__panel.has-marquee {
	padding-bottom: calc(clamp(var(--ps-space-6), 5vw, var(--ps-space-8)) + 44px);
}

/*
 * Movement is the whole point of a marquee, so there is nothing to soften: it
 * stops. The phrases stay, wrapped and centred, because they are the shop's
 * promises and are worth reading whether or not they slide.
 */
@media (prefers-reduced-motion: reduce) {
	.ps-cover__marquee {
		mask-image: none;
	}

	.ps-cover__marquee-track {
		width: 100%;
		animation: none;
		flex-wrap: wrap;
		justify-content: center;
	}

	.ps-cover__marquee-group:nth-child(2) {
		display: none;
	}

	.ps-cover__marquee-group {
		flex-wrap: wrap;
		justify-content: center;
	}

	.ps-cover__marquee-item {
		white-space: normal;
	}
}
