/* Emma's public status page.
 *
 * The look is the website's: the same palette, the same rounded full-bleed
 * blocks that alternate page grey, purple and deep purple, the same
 * soft shadows and the same overlaps - a card that sits over the block above
 * it. Values marked "from the website" are copied from the emma-website
 * repository so both stay in step. Everything is served from this host: no
 * CDN, no web font service, no external image. */

/* The variable weights of Outfit, the website's typeface, self-hosted.
   SIL Open Font License 1.1, see fonts/OFL.txt. The latin subset covers
   Spanish, including the accented vowels and ñ. */
@font-face {
	font-family: 'Outfit Variable';
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url('/fonts/outfit-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
	/* From emma-website src/styles/palette.css */
	--emma-purple: #7c2dd1;
	--emma-deep-purple: #3f1769;
	--emma-green: #8fd02f;
	--emma-cherry: #ff2c2c;
	--emma-pale-gray: #eaeaea;
	--emma-silver: #bcbcbc;
	--emma-smoke: #f3f3f3;
	--unity-gray: #858585;
	--unity-white: #ffffff;
	--emma-page-background: #f0f0f0;

	/* Status colours. Each state has a dot, a tinted pill and a text colour
	   dark enough to read on that tint. The website has no warning colour;
	   this page needs one for "a provider is having trouble but Emma is
	   fine". */
	--ok-dot: var(--emma-green);
	--ok-tint: #eef8dc;
	--ok-text: #3f7a00;
	--fail-dot: var(--emma-cherry);
	--fail-tint: #ffe6e6;
	--fail-text: #c01616;
	--warn-dot: #e9a217;
	--warn-tint: #fdf1d8;
	--warn-text: #8a5300;
	--unknown-dot: var(--emma-silver);
	--unknown-tint: var(--emma-smoke);
	--unknown-text: var(--unity-gray);

	/* From the website: the review-note shadow, the stat-card shadow and the
	   blog-card shadow, in that order. */
	--shadow-card: 0 7px 18px rgb(63 23 105 / 9%);
	--shadow-float: 0 18px 32px rgb(63 23 105 / 22%);
	--shadow-lift: 0 24px 60px rgb(63 23 105 / 14%);

	/* From the website: 32px for a section block, 28px for a card. */
	--radius-section: 32px;
	--radius-card: 28px;
	--radius-inner: 18px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	min-width: 320px;
	min-height: 100vh;
	margin: 0;
	background: var(--emma-page-background);
	color: var(--emma-deep-purple);
	font-family: 'Outfit Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.45;
	overflow-wrap: break-word;
	text-rendering: optimizeLegibility;
}

a {
	color: inherit;
}

a:focus-visible,
.skip-link:focus-visible {
	outline: 3px solid var(--emma-green);
	outline-offset: 3px;
}

/* The website's section shell, gutters included. */
.shell {
	width: min(100% - 32px, 1024px);
	margin-inline: auto;
}

.skip-link {
	position: fixed;
	z-index: 10;
	top: 8px;
	left: 8px;
	padding: 10px 16px;
	border-radius: 999px;
	background: var(--unity-white);
	color: var(--emma-purple);
	font-weight: 700;
	text-decoration: none;
	transform: translateY(-160%);
	transition: transform 160ms ease;
}

.skip-link:focus {
	transform: translateY(0);
}

/* The website's section heading: centred, display size, brand purple, over the
   short green rule it puts under a heading. */
.section-title {
	margin: 0;
	color: var(--emma-purple);
	font-size: clamp(1.75rem, 5vw, 2.35rem);
	font-weight: 700;
	line-height: 1.08;
	text-align: center;
}

.section-title::after {
	display: block;
	width: 64px;
	height: 4px;
	margin: 14px auto 0;
	border-radius: 999px;
	background: var(--emma-green);
	content: '';
}

/* Header ------------------------------------------------------------------ */

.site-header {
	position: relative;
	overflow: hidden;
	background:
		radial-gradient(90% 70% at 82% -10%, rgb(143 208 47 / 22%), transparent 60%),
		radial-gradient(130% 110% at 12% -20%, rgb(124 45 209 / 0%), rgb(63 23 105 / 38%)),
		var(--emma-purple);
	color: var(--unity-white);
}

/* The ring the website floats behind its blog section, here in white. */
.site-header::before {
	position: absolute;
	top: -70px;
	right: -90px;
	width: 260px;
	height: 260px;
	border: 46px solid rgb(255 255 255 / 9%);
	border-radius: 50%;
	content: '';
}

.site-header > * {
	position: relative;
}

.site-header__bar {
	display: flex;
	height: 67px;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.site-header__logo {
	display: block;
	width: 132px;
	height: auto;
}

/* The website's green pill, with the deep purple label it uses whenever the
   pill is small enough that white would not read. */
.internal-link {
	display: inline-flex;
	min-height: 36px;
	align-items: center;
	padding: 7px 18px;
	border-radius: 999px;
	background: var(--emma-green);
	color: var(--emma-deep-purple);
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.internal-link:hover {
	box-shadow: 0 12px 24px rgb(20 5 35 / 22%);
	transform: translateY(-2px);
}

.site-header__intro {
	padding: 18px 0 40px;
	text-align: center;
}

.site-header__intro h1 {
	margin: 0;
	font-size: clamp(2.1rem, 8vw, 3.25rem);
	font-weight: 700;
	line-height: 1.04;
}

.site-header__lede {
	max-width: 34rem;
	margin: 14px auto 0;
	color: rgb(255 255 255 / 88%);
	font-size: clamp(1rem, 3.4vw, 1.2rem);
	line-height: 1.35;
}

.site-header__wave {
	display: block;
	width: 100%;
	height: 66px;
	margin-bottom: -1px;
}

/* The city is stretched to the viewport's width, so on a phone its buildings
   would be slivers. There it is the hill alone. */
.site-header__city {
	display: none;
}

/* Banner ------------------------------------------------------------------ */

/* Overlaps the header's wave the way the website's cards overlap the block
   above them. */
.banner {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin-top: -34px;
	overflow: hidden;
	padding: 20px 22px;
	border-radius: var(--radius-card);
	background: var(--unity-white);
	box-shadow: var(--shadow-lift);
	gap: 12px 16px;
}

/* The bar the website runs across the top of its blog card. */
.banner::before {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 7px;
	background: var(--unknown-dot);
	content: '';
}

.banner__icon {
	display: grid;
	width: 46px;
	height: 46px;
	flex: none;
	place-items: center;
	border-radius: 50%;
	background: var(--unknown-tint);
}

.banner__dot {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--unknown-dot);
}

.banner__text {
	min-width: 0;
	/* Small enough that the message still fits beside the icon at 320px. */
	flex: 1 1 10rem;
	margin: 0;
	font-size: clamp(1.05rem, 3.8vw, 1.3rem);
	font-weight: 600;
	line-height: 1.25;
}

/* On a phone it drops under the message; from tablet up it sits at the far
   end of the card, so the banner reads across its whole width. */
.banner__meta {
	flex: none;
	/* Lines up with the message when it wraps under it: the icon is 46px and
	   the gap 16px. */
	margin: 0 0 0 62px;
	padding: 7px 14px;
	border-radius: 999px;
	background: var(--emma-smoke);
	color: var(--unity-gray);
	font-size: 0.82rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.banner--ok::before {
	background: var(--ok-dot);
}

.banner--ok .banner__icon {
	background: var(--ok-tint);
}

.banner--ok .banner__dot {
	background: var(--ok-dot);
}

.banner--warn::before {
	background: var(--warn-dot);
}

.banner--warn .banner__icon {
	background: var(--warn-tint);
}

.banner--warn .banner__dot {
	background: var(--warn-dot);
}

.banner--fail::before {
	background: var(--fail-dot);
}

.banner--fail .banner__icon {
	background: var(--fail-tint);
}

.banner--fail .banner__dot {
	background: var(--fail-dot);
}

/* Sections and items ------------------------------------------------------ */

.group {
	padding-block: 44px 8px;
}

.group__items {
	display: grid;
	gap: 16px;
	margin-top: 26px;
}

.item {
	padding: 20px;
	border-radius: var(--radius-card);
	background: var(--unity-white);
	box-shadow: var(--shadow-card);
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.item:hover {
	box-shadow: 0 14px 30px rgb(63 23 105 / 15%);
	transform: translateY(-2px);
}

/* Somebody else's service: the same card, lighter, so the eye reads Emma's own
   services first and this one as context. */
.item--info {
	border: 1px solid var(--emma-pale-gray);
	background: rgb(255 255 255 / 62%);
	box-shadow: none;
}

.item--info:hover {
	box-shadow: 0 8px 18px rgb(63 23 105 / 8%);
}

.item__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 6px 14px;
}

.item__titles {
	min-width: 0;
	flex: 1 1 14rem;
}

.item__name {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.2;
}

/* Sits under the name on its own line, small and quiet: this card is
   information, not one of Emma's own services. Always its own line, so the
   informational cards look alike whether the name fits beside it or not. */
.item__tag {
	display: block;
	width: fit-content;
	margin-top: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--emma-smoke);
	color: var(--unity-gray);
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.item__description {
	margin: 3px 0 0;
	color: var(--unity-gray);
	font-size: 0.9rem;
	line-height: 1.35;
}

/* The state, as a word in a tinted pill - the website's eyebrow pill. */
.item__state {
	display: inline-flex;
	align-items: center;
	margin: 0;
	padding: 5px 13px 5px 10px;
	border-radius: 999px;
	background: var(--unknown-tint);
	color: var(--unknown-text);
	font-size: 0.82rem;
	font-weight: 700;
	white-space: nowrap;
	gap: 7px;
}

.item__dot {
	width: 9px;
	height: 9px;
	flex: none;
	border-radius: 50%;
	background: var(--unknown-dot);
}

.item--ok .item__state {
	background: var(--ok-tint);
	color: var(--ok-text);
}

.item--ok .item__dot {
	background: var(--ok-dot);
}

.item--fail .item__state {
	background: var(--fail-tint);
	color: var(--fail-text);
}

.item--degraded .item__state {
	background: var(--warn-tint);
	color: var(--warn-text);
}

.item--degraded .item__dot {
	background: var(--warn-dot);
}

.item--fail .item__dot {
	background: var(--fail-dot);
}

/* What a degraded service means for whoever is reading, in the card that is
   degraded. */
.item__note {
	margin: 16px 0 0;
	padding: 11px 15px;
	border-radius: var(--radius-inner);
	background: var(--warn-tint);
	color: var(--warn-text);
	font-size: 0.88rem;
	font-weight: 600;
	line-height: 1.35;
}

/* The paths inside a multi-route card, each one an inner block in the page
   grey, the way the website's white sections hold their step cards. */
.routes {
	display: grid;
	margin-top: 16px;
	gap: 8px;
}

.route {
	padding: 11px 15px 13px;
	border-radius: var(--radius-inner);
	background: var(--emma-smoke);
}

/* On a phone the path's name and its figures stack, so all three rows read
   the same way; from tablet up they share one line. */
.route__name {
	display: flex;
	min-width: 0;
	align-items: baseline;
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	gap: 8px;
}

.route__dot {
	width: 9px;
	height: 9px;
	flex: none;
	border-radius: 50%;
	background: var(--unknown-dot);
}

.route__meta {
	display: flex;
	align-items: baseline;
	margin: 2px 0 0;
	font-size: 0.82rem;
	white-space: nowrap;
	gap: 10px;
}

.route__state {
	color: var(--unknown-text);
	font-weight: 700;
}

.route__time {
	color: var(--unity-gray);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.route--ok .route__dot {
	background: var(--ok-dot);
}

.route--ok .route__state {
	color: var(--ok-text);
}

.route--fail .route__dot {
	background: var(--fail-dot);
}

.route--fail .route__state {
	color: var(--fail-text);
}

.strip {
	display: flex;
	height: 30px;
	align-items: stretch;
	margin-top: 18px;
	gap: 3px;
}

.strip__bar {
	min-width: 3px;
	max-width: 16px;
	flex: 1 1 4px;
	border-radius: 3px;
	background: var(--unknown-dot);
	transition: transform 120ms ease, filter 120ms ease;
}

.strip__bar:hover {
	filter: brightness(1.08);
	transform: scaleY(1.12);
}

.strip__bar--ok {
	background: var(--ok-dot);
}

.strip__bar--fail {
	background: var(--fail-dot);
}

/* One strip per path, so three of them share a card: shorter and tighter, and
   its bars are allowed to be a little wider, because the card that holds them
   takes a whole row of the grid. */
.strip--compact {
	height: 15px;
	margin-top: 9px;
	gap: 2px;
}

.strip--compact .strip__bar {
	max-width: 18px;
	border-radius: 2px;
}

.strip__legend {
	display: flex;
	justify-content: space-between;
	margin-top: 7px;
	color: var(--unity-gray);
	font-size: 0.75rem;
	font-weight: 600;
}

/* Uptime over the two windows the page shows and the average response time,
   as inner blocks in the page grey. */
.metrics {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 16px 0 0;
	gap: 8px;
}

.metrics__cell {
	padding: 10px 12px;
	border-radius: var(--radius-inner);
	background: var(--emma-smoke);
}

/* On a phone the response time takes the whole row: a third of a card at
   320px is not wide enough for its label, and it would break in two. */
.metrics__cell:last-child {
	grid-column: 1 / -1;
}

.metrics dt {
	color: var(--unity-gray);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.metrics dd {
	margin: 2px 0 0;
	color: var(--emma-purple);
	font-size: 1.05rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* Incidents --------------------------------------------------------------- */

/* The page's full-bleed purple block, the way the website presents "who is
   emma for". The services above it sit on the page grey, so the purple lands
   once, on the history, and carries the composition down into the footer. */
.incidents {
	position: relative;
	overflow: hidden;
	margin-top: 44px;
	padding-block: 44px 52px;
	border-radius: var(--radius-section);
	background:
		radial-gradient(80% 60% at 90% 0%, rgb(143 208 47 / 18%), transparent 60%),
		var(--emma-purple);
}

/* The ring the website floats behind its blog section. */
.incidents::before {
	position: absolute;
	bottom: -130px;
	left: -80px;
	width: 240px;
	height: 240px;
	border: 44px solid rgb(255 255 255 / 9%);
	border-radius: 50%;
	content: '';
}

.incidents > .shell {
	position: relative;
}

.incidents .section-title {
	color: var(--unity-white);
}

.incidents__list {
	max-width: 48rem;
	margin: 26px auto 0;
	padding: 0;
	list-style: none;
}

.incidents__item {
	display: flex;
	align-items: flex-start;
	padding: 14px 18px;
	border-radius: var(--radius-inner);
	background: var(--unity-white);
	box-shadow: var(--shadow-float);
	font-size: 0.95rem;
	gap: 12px;
}

.incidents__item + .incidents__item {
	margin-top: 10px;
}

/* Green once the service came back, red while it is still down. */
.incidents__mark {
	width: 10px;
	height: 10px;
	flex: none;
	margin-top: 7px;
	border-radius: 50%;
	background: var(--ok-dot);
}

.incidents__item--ongoing .incidents__mark {
	background: var(--fail-dot);
}

.incidents__name {
	margin: 0;
	font-weight: 700;
}

.incidents__detail {
	margin: 2px 0 0;
	color: var(--unity-gray);
	line-height: 1.4;
}

.incidents__ongoing {
	color: var(--fail-text);
	font-weight: 700;
}

.incidents__empty {
	padding: 18px;
	border-radius: var(--radius-inner);
	background: var(--unity-white);
	box-shadow: var(--shadow-float);
	color: var(--unity-gray);
	font-size: 0.98rem;
	font-weight: 600;
	text-align: center;
}

/* "Nothing to report" is good news, so it gets the same green as an
   operational service. The load error keeps the neutral tint. */
.incidents__empty--ok {
	background: var(--ok-tint);
	color: var(--ok-text);
}

/* Footer ------------------------------------------------------------------ */

/* Deep purple, rounded over the block above it, with the brand mark sitting
   on the seam - the website's brand bridge. */
.site-footer {
	position: relative;
	margin-top: 76px;
	padding: 66px 0 40px;
	border-radius: var(--radius-section) var(--radius-section) 0 0;
	background: var(--emma-deep-purple);
	color: rgb(255 255 255 / 84%);
	font-size: 0.95rem;
	text-align: center;
}

.site-footer__badge {
	position: absolute;
	top: -34px;
	left: 50%;
	display: grid;
	width: 68px;
	height: 68px;
	place-items: center;
	border-radius: 21px;
	background: var(--unity-white);
	box-shadow: 0 14px 28px rgb(20 5 35 / 28%);
	transform: translateX(-50%);
}

.site-footer__badge svg {
	display: block;
	width: 44px;
	height: 45px;
}

.site-footer p {
	max-width: 46rem;
	margin: 0 auto 10px;
	line-height: 1.5;
}

.site-footer a {
	text-decoration-color: var(--emma-green);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.site-footer a:hover {
	color: var(--emma-green);
}

/* Wider screens ----------------------------------------------------------- */

@media (min-width: 640px) {
	.site-header__logo {
		width: 155px;
	}

	.site-header__intro {
		padding: 22px 0 52px;
	}

	.site-header__wave {
		height: 120px;
	}

	.site-header__city {
		display: block;
	}

	.banner {
		margin-top: -48px;
		padding: 26px 30px;
		gap: 20px;
	}

	.banner__icon {
		width: 54px;
		height: 54px;
	}

	.banner__dot {
		width: 19px;
		height: 19px;
	}

	.banner__meta {
		margin-left: auto;
	}

	.item {
		padding: 24px 26px;
	}

	.strip {
		height: 34px;
	}

	.strip--compact {
		height: 17px;
	}

	.route__head {
		display: flex;
		flex-wrap: wrap;
		align-items: baseline;
		justify-content: space-between;
		gap: 2px 14px;
	}

	.route__meta {
		margin-top: 0;
	}

	.metrics {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.metrics__cell {
		padding: 10px 14px;
	}

	.metrics__cell:last-child {
		grid-column: auto;
	}

	.incidents__item {
		padding: 16px 22px;
	}
}

@media (min-width: 860px) {
	.group {
		padding-block: 54px 8px;
	}

	.group__items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px;
	}

	/* Room for a two-line description, so the strips and the figures of two
	   cards sitting side by side line up. */
	.item__head {
		min-height: 58px;
	}

	/* The card with the paths inside it is taller than the rest, so it takes
	   the whole row instead of stretching whatever sits beside it. */
	.item--routes {
		grid-column: 1 / -1;
	}

	.incidents {
		padding-block: 52px 60px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.skip-link,
	.internal-link,
	.item,
	.strip__bar {
		transition: none;
	}

	.item:hover,
	.strip__bar:hover {
		transform: none;
	}
}
