/*
 * Section 7 — the awards marquee.
 *
 * The one piece of motion on this page that is not a reveal, and the only one a still measurement
 * cannot read at all: the dump of this section recorded its cards at x=-59 and x=1929, two positions
 * no layout would ever produce. It was measured on the clock instead, and the answer is a clean one.
 *
 * 100 pixels per second, leftwards, at every width. Not a duration — a speed. A fixed duration would
 * make the phone's shorter loop run slower than the desktop's, and the design's does not: the loop is
 * 2485px at desktop and 1805px on the phone, and both move at the same 100px/s. So the duration below
 * is the loop divided by that speed, and it changes when the loop does.
 */

.as-awards {
	/*
	 * The loop is the cards, their hairlines and the gaps between them: n x (368 + 64 + 1 + 64), 2485px
	 * for the design's five. The template sets --as-award-count inline when there are not five.
	 */
	--as-award-count: 5;
	--as-award-loop: calc(var(--as-award-count, 5) * 497px);
	--as-award-duration: calc(var(--as-award-count, 5) * 4.97s);

	display: flex;
	flex-direction: column;
	gap: 120px;
	align-items: center;
	padding: 124px 32px;
}

.as-awards__intro {
	width: 100%;
	max-width: var(--as-container-narrow);
}

.as-awards__title {
	font-size: 48px;
	font-weight: 500;
	line-height: var(--as-lh-display);
	letter-spacing: -0.05em;
	color: var(--as-ink);
}

.as-awards__viewport {
	width: 100%;
	max-width: var(--as-container-narrow);
	overflow: clip;
}

.as-awards__track {
	display: flex;
	flex-direction: row;
	gap: 64px;
	align-items: flex-start;
	width: max-content;
	list-style: none;
	animation: as-awards-roll var(--as-award-duration) linear infinite;
}

@keyframes as-awards-roll {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(calc(-1 * var(--as-award-loop)));
	}
}

/*
 * A deliberate difference from the design, and the only one in this section: the design's marquee keeps
 * running when the reader has asked their system for less motion. Framer's ticker ignores the setting —
 * checked, it still moves. A block of text sliding sideways with no way to stop it is the exact case
 * the setting exists for, so ours stops and the five awards sit still and readable.
 */
@media (prefers-reduced-motion: reduce) {
	.as-awards__track {
		animation: none;
	}
}

.as-award {
	flex: 0 0 368px;
}

.as-award__inner {
	display: flex;
	flex-direction: column;
	gap: 72px;
	padding-bottom: 40px;
	overflow: hidden;
}

.as-award__head {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.as-award__figure {
	height: 128px;
}

/*
 * Contained and anchored left, not covered. These are award logos rather than photographs: cover fills
 * the 368x128 box and cuts the fine print off the bottom of the REIA crest, which is what ours did
 * until the design's own object-fit was read off it. Nothing in a text diff sees this, and nothing
 * overflows, so the box measurement agreed the whole time.
 */
.as-award__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: 0 100%;
}

/*
 * 24 and 92 are slots, not measurements of the text in them. Four of the five award names need two
 * lines and the box holds one; three of the five descriptions are taller than 92. The text overflows
 * downwards into the gap below it, which is what keeps the five cards' photographs, award names and
 * descriptions all starting at the same height. Setting these to the content's own height instead
 * would stagger every card against its neighbour.
 */
.as-award__line {
	height: 24px;
}

.as-award__line-text {
	font-size: 18px;
	font-weight: 500;
	line-height: var(--as-lh-snug);
	letter-spacing: -0.04em;
	color: var(--as-ink-50);
}

.as-award__body {
	height: 92px;
}

.as-award__body-text {
	font-size: 20px;
	font-weight: 500;
	line-height: var(--as-lh-snug);
	letter-spacing: -0.04em;
	color: var(--as-ink);
}

/* The same hairline as the dividers in the metrics band, read from the pixels in both places. */
.as-awards__rule {
	flex: 0 0 1px;
	height: 380px;
	background: var(--as-hairline);
}

@media (max-width: 1199px) {
	.as-awards__title {
		font-size: 46px;
	}
}

/* The tablet keeps the desktop card and only drops the description's type a size. */
@media (max-width: 1199px) and (min-width: 810px) {
	.as-award__body-text {
		font-size: 18px;
	}
}

@media (max-width: 809px) {
	/* n x (280 + 40 + 1 + 40), at the same 100px/s. */
	.as-awards {
		--as-award-loop: calc(var(--as-award-count, 5) * 361px);
		--as-award-duration: calc(var(--as-award-count, 5) * 3.61s);

		gap: 24px;
		padding: 80px 20px;
	}

	.as-awards__title {
		font-size: 36px;
	}

	.as-awards__track {
		gap: 40px;
	}

	/*
	 * The phone is the other way round from the desktop: the two slots are free to be the height of
	 * their text, and the card is the thing that is fixed. So the cards stay 380 tall and line up with
	 * the hairlines between them, while their contents end at five different heights.
	 */
	.as-award {
		flex-basis: 280px;
		height: 380px;
	}

	.as-award__inner {
		gap: 24px;
		padding-bottom: 24px;
	}

	.as-award__line,
	.as-award__body {
		height: auto;
	}

	.as-award__body-text {
		font-size: 16px;
	}
}
