/**
 * Home page refinements.
 * Loaded only on the front page. Uses the theme's existing tokens.
 */

/* ---------- hero ---------- */

/* Search moved out: the header already opens a full-screen search, and a
   second box here made the first screen a form rather than an answer to
   "what is this site". What is left is the claim, one line explaining it,
   two ways in, and the topics. */
.em-hero {
	padding-top: 5rem;
	padding-bottom: 3.5rem;
}

/* The faint grid overlay was drawn with gradients. Flat ground instead. */
.em-hero::before {
	display: none;
}

.em-hero-title {
	font-size: clamp(2.1rem, 5.2vw, 3.4rem);
	line-height: 1.08;
	letter-spacing: -0.025em;
	margin: 0 0 1rem;
	max-width: 18ch;
	text-wrap: balance;
}

.em-hero-sub {
	font-size: 1.1rem;
	line-height: 1.6;
	max-width: 46ch;
	margin: 0 0 2rem;
}

.em-hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 0 0 2.5rem;
}

.em-hero-actions .em-btn {
	padding-inline: 1.5rem;
	padding-block: 0.7rem;
}

/* Two columns once there is room: the copy keeps its reading measure and the
   terminal takes the space that measure leaves over, instead of the page
   ending in a blank half. */
@media (min-width: 900px) {
	.em-hero-inner {
		display: grid;
		grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
		gap: 3rem;
		align-items: center;
	}
}

.em-hero-copy {
	min-width: 0;
}

.em-hero-terminal {
	display: none;
	border: 1px solid var(--em-border);
	border-radius: 0.6rem;
	background: var(--em-code-bg);
	overflow: hidden;
}

@media (min-width: 900px) {
	.em-hero-terminal {
		display: block;
	}
}

.em-hero-terminal-bar {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.6rem 0.9rem;
	border-bottom: 1px solid var(--em-border);
	background: rgba(255, 255, 255, 0.04);
}

.em-hero-terminal-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
}

.em-hero-terminal-name {
	margin-inline-start: auto;
	font-family: 'JetBrains Mono', ui-monospace, monospace;
	font-size: 0.68rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #98A6BC;
}

.em-hero-terminal-body {
	margin: 0;
	padding: 1.1rem 1.2rem;
	font-family: 'JetBrains Mono', ui-monospace, monospace;
	font-size: 0.82rem;
	line-height: 1.85;
	color: #E8EDF5;
	overflow-x: auto;
	white-space: pre;
}

.em-hero-terminal-body .t-p { color: #79A4E2; }
.em-hero-terminal-body .t-c { color: #6B7C96; font-style: italic; }
.em-hero-terminal-body .t-s { color: #F5A524; }

/* ---------- hero topics: a way in, not another call to action ----------
   Nine pills under two solid buttons read as eleven buttons and flattened the
   hierarchy the buttons were there to create. Set as text, the row stays
   available without competing. */
.em-hero-topics {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.45rem 0.8rem;
	margin-top: 1.75rem;
}

.em-hero-topics-label {
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.11em;
	text-transform: uppercase;
	color: var(--em-muted);
}

.em-hero-topics-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem 0.55rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.em-hero-topics-list li {
	display: inline-flex;
	align-items: center;
}

/* A dot between entries, never before the first or after a wrap. */
.em-hero-topics-list li + li::before {
	content: "";
	flex: 0 0 auto;
	width: 3px;
	height: 3px;
	margin-right: 0.55rem;
	border-radius: 50%;
	background: var(--em-border);
}

.em-hero-topics-list a {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--em-muted);
	text-decoration: none;
	transition: color 0.15s;
}

.em-hero-topics-list a:hover,
.em-hero-topics-list a:focus-visible {
	color: var(--em-primary);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.em-hero-topics-all {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	color: var(--em-primary);
}

/* ---------- stats: four cards, not four numbers in a fence ----------
   The figures used to sit between two hairlines, centred, saying nothing
   until each label was read. Now each is a card: the icon of the thing it
   counts, the figure, and -- where that thing has a page -- the card itself
   is the way there. */
.em-stats-bar {
	display: grid;
	align-items: stretch;
	grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
	gap: 0.75rem;
	margin-top: 2.75rem;
	padding: 0;
	border: 0;
	background: none;
}

.em-stats-item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	padding: 1.15rem 1.15rem 1.1rem;
	border: 1px solid var(--em-border);
	border-radius: 16px;
	background: var(--em-bg-card);
	text-align: left;
	text-decoration: none;
	color: inherit;
	overflow: hidden;
}

/* A hairline of the brand along the top edge, fading out -- enough to tie
   the row together without another block of colour. */
.em-stats-item::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 2px;
	background: linear-gradient(90deg, var(--em-primary), transparent 72%);
	opacity: 0.5;
}

.em-stats-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.9rem;
}

.em-stats-icon {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 11px;
	background: var(--em-bg-2);
	background: color-mix(in srgb, var(--em-primary) 12%, transparent);
	color: var(--em-primary);
}

/* The arrow marks the cards that go somewhere, and only appears when the
   pointer or focus is on one -- a hint, not a fifth thing to read. */
.em-stats-go {
	display: grid;
	place-items: center;
	color: var(--em-primary);
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity 0.18s, transform 0.18s;
}

.em-stats-item.is-link {
	transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.em-stats-item.is-link:hover,
.em-stats-item.is-link:focus-visible {
	transform: translateY(-2px);
	border-color: var(--em-primary);
	box-shadow: 0 10px 24px rgba(12, 18, 32, 0.1);
	outline: none;
}

.em-stats-item.is-link:focus-visible {
	outline: 2px solid var(--em-primary);
	outline-offset: 3px;
}

.em-stats-item.is-link:hover .em-stats-go,
.em-stats-item.is-link:focus-visible .em-stats-go {
	opacity: 1;
	transform: none;
}

/* Tabular figures so 134 and 100% sit on the same rhythm across the row. */
.em-stats-item-num {
	font-size: clamp(1.65rem, 3.2vw, 2.05rem);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.em-stats-item-label {
	margin-top: 0.4rem;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--em-muted);
}

.em-stats-item-label:not(:last-child) {
	margin-bottom: 0.9rem;
}

/* A figure on its own is a claim. The line under it says what the figure is
   made of, and auto margin keeps those lines level across the row however
   tall the labels above them wrap. */
.em-stats-item-sub {
	margin-top: auto;
	padding-top: 0.7rem;
	border-top: 1px solid var(--em-border);
	font-size: 0.75rem;
	line-height: 1.35;
	color: var(--em-muted);
}

@media (prefers-reduced-motion: reduce) {
	.em-stats-item.is-link,
	.em-stats-go {
		transition: none;
	}

	.em-stats-item.is-link:hover,
	.em-stats-item.is-link:focus-visible {
		transform: none;
	}
}

/* ---------- cards: a clearer lift, and a real focus ring ---------- */
.em-card:focus-visible,
.em-cat-tile:focus-visible,
.em-cs-card:focus-visible {
	outline: 2px solid var(--em-primary);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.em-card,
	.em-cat-tile,
	.em-cs-card,
	.em-card-thumb img {
		transition: none;
	}
}

/* ---------- newsletter: the form should not feel like an afterthought ---------- */
@media (max-width: 560px) {
	.em-hero {
		padding-top: 3rem;
		padding-bottom: 2.5rem;
	}

	.em-hero-title {
		max-width: none;
	}

	.em-hero-sub {
		font-size: 1.02rem;
		margin-bottom: 1.5rem;
	}

	.em-hero-actions {
		margin-bottom: 2rem;
	}

	.em-newsletter {
		padding: 1.5rem 1.25rem;
	}

	.em-hero-actions .em-btn {
		flex: 1 1 auto;
		justify-content: center;
	}
}

/* ---------- section rhythm ---------- */

/* Sections alternate ground and card so the page reads as parts rather than
   one long scroll, and each gets the same breathing room. */
.em-section {
	padding-block: 3.5rem;
}

@media (min-width: 900px) {
	.em-section {
		padding-block: 4.5rem;
	}
}
