/*
 * Section 4 — the navy block.
 *
 * The four cards are a grid of four equal columns with a 64px gutter, not four boxes with padding.
 * Both readings give the same picture at 1440 and only one of them survives: the design's content
 * columns are all 252px wide while its outer boxes are 284, 316, 316 and 284, because the gutters at
 * the two ends are only half there. Four equal tracks with a gap put the text in exactly the right
 * place at every width; four equal boxes with padding would make the first and last columns wider
 * than the middle two.
 *
 * The hairlines then fall in the middle of the gutter rather than on a card edge — measured at x403
 * where the second card starts at x404 — so they are drawn as pseudo-elements rather than borders.
 */

.as-services {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100vh;
	padding: 96px 11.5px;
	background: var(--as-navy-text);
	color: var(--as-paper);
}

.as-services__inner {
	width: 100%;
	max-width: var(--as-container);
	padding: 0 40px;
}

/* The design's empty eyebrow. See the note in the template: it is 17px of deliberate space. */
.as-services__slot {
	height: 17px;
}

/* ── Heading and link ────────────────────────────────────────────────────── */

.as-services__head {
	display: flex;
	gap: 96px;
	align-items: flex-end;
	padding-bottom: 40px;
}

.as-services__title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 48px;
	font-weight: 500;
	line-height: var(--as-lh-display);
	letter-spacing: -0.05em;
	/* Pure white here, where the rest of the section is --as-paper. The design has both. */
	color: var(--as-white);
}

/*
 * 201 by 48 exactly. The outline is an inset shadow because a real border would add two pixels to
 * each dimension — the design draws it outside the box model altogether.
 */
.as-services__link {
	display: flex;
	flex: 0 0 auto;
	gap: 8px;
	align-items: center;
	padding: 14px 24px;
	box-shadow: inset 0 0 0 1px var(--as-paper-40);
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
	color: var(--as-paper);
	text-decoration: none;
}

/* ── The four cards ──────────────────────────────────────────────────────── */

.as-services__grid {
	display: grid;
	/*
	 * minmax(0, 1fr) rather than 1fr. A plain 1fr track will not go narrower than its own content,
	 * and the title inside it is a fixed 235px — so at 1200, where the column should be 226, every
	 * track grew to 235 and the whole row of cards slid 9px to the right. The design lets that title
	 * overflow its column; the track has to be allowed to be smaller than what is in it.
	 */
	grid-template-columns: repeat(4, minmax(0, 1fr));
	column-gap: 64px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * A fixed height, with the body copy taking the slack. That is the design's own arrangement: the
 * card is 364px at every width and in every column, while the body block measures 146 at 1440 and
 * 144 at 390 — it is the one part that gives, which is what keeps the four arrows on one line.
 */
.as-service {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 16px;
	align-items: flex-start;
	height: 364px;
	/* 37.25 is the design's own number, not a rounding of 37. */
	padding: 37.25px 0 16px;
}

.as-service:not(:last-child)::after {
	position: absolute;
	top: 0;
	right: -32px;
	bottom: 0;
	width: 1px;
	background: var(--as-paper-15);
	content: '';
}

.as-service__number {
	font-size: 11px;
	font-weight: 600;
	line-height: 1.5;
	/* 3.3 ÷ 11. */
	letter-spacing: 0.3em;
	color: var(--as-paper-50);
}

/*
 * Two lines tall whichever card it is. Only the third title needs the second line, and without this
 * the other three cards would pull their body copy 32px up.
 */
.as-service__title {
	/*
	 * 88, not 64: box-sizing is border-box, so a min-height of 64 would be satisfied by the 32px
	 * line plus this padding and the block would come out 24px short — which pulled the body copy of
	 * every card up by exactly that much.
	 */
	align-self: stretch;
	min-height: 88px;
	padding-bottom: 24px;
}

.as-service__title-line {
	/*
	 * A fixed 235 at desktop and on the phone, which is narrower than the 252px column at 1440 and
	 * wider than the 226px one at 1200 — so it overflows there, and that is the design's own
	 * behaviour rather than a mistake to correct. The tablet variant is the odd one out: there the
	 * box fills its 163px column instead. Three variants authored separately, not one rule.
	 */
	width: 235px;
	font-size: 24px;
	font-weight: 600;
	line-height: 32px;
	letter-spacing: -0.02em;
	color: var(--as-paper);
}

.as-service__body {
	flex: 1 1 auto;
	align-self: stretch;
	font-size: 14px;
	font-weight: 400;
	line-height: var(--as-lh-loose);
	letter-spacing: normal;
	color: var(--as-paper-70);
}

.as-service__more {
	color: var(--as-paper);
}

/* ── Tablet: 810 to 1199 ─────────────────────────────────────────────────── */

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

}

@media (max-width: 1199px) and (min-width: 810px) {
	/* The container loses its 40px inset below 1200, and the gutter halves with it. */
	.as-services__inner {
		padding: 0;
	}

	.as-services {
		padding: 96px 32px;
	}

	.as-services__grid {
		column-gap: 32px;
	}

	.as-service:not(:last-child)::after {
		right: -16px;
	}

	/* The tablet variant alone drops the fixed width and fills the column. */
	.as-service__title-line {
		width: 100%;
	}
}

/*
 * 1200 to 1199 is not a typo: at exactly 1200 the design is still on its desktop variant, where the
 * container keeps its 40px inset but the section padding stays at 11.5. Only the heading shrinks.
 */

/* ── Phone: below 810 ────────────────────────────────────────────────────── */

@media (max-width: 809px) {
	/*
	 * Content height, and much the tallest section on the phone: four cards of 364 stacked. The
	 * section padding drops from 96 to 24.
	 */
	.as-services {
		height: auto;
		padding: 24px 16px;
	}

	.as-services__inner {
		padding: 0;
	}

	.as-services__head {
		flex-direction: column;
		gap: 17px;
		align-items: flex-start;
	}

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

	.as-services__grid {
		grid-template-columns: 1fr;
	}

	.as-service {
		padding-top: 40px;
	}

	/*
	 * The hairline moves to the bottom and is two pixels rather than one, and reads a little
	 * stronger than the vertical ones: rgb(53,62,78) against the navy, where the desktop line is
	 * rgb(42,53,73). Measured at the first boundary only, since the others sit below the window.
	 */
	.as-service:not(:last-child)::after {
		top: auto;
		right: 0;
		bottom: -2px;
		width: auto;
		height: 2px;
		left: 0;
		background: rgb(250 251 253 / 0.19);
	}
}
