/*
 * Home hero control bar (the commcentre/hero-scene block): the Show control, four topic tabs, a thin progress line and
 * one panel per tab (a plain sentence and its links). Loads after base.css and is scoped to .cc-scene, so it only acts
 * inside that block. Tokens only: no hex colours, no shadows, no gradients.
 *
 * Widths: under 48em the tabs are a 2 by 2 grid and the Show button is full width; 48em and up the tabs are one row;
 * 70em and up the bar is the glass strip docked to the bottom of the picture (as base.css). Every tab and link is at
 * least 44px tall. The four panels share one grid cell, so the bar keeps its height whichever tab is chosen.
 *
 * The selected tab is white with an orange top edge and the other three are dimmer. In a panel the first link (the
 * matching page) is white with the orange underline and the others are quieter. The status line under the tabs keeps a
 * line of text from the click on (see view.js), so the bar does not change height while the scene runs.
 *
 * With no script the tab list, progress line and buttons are hidden by base.css and the four panels show one under
 * the other, each with its heading. With script the headings stay in the page for screen readers (the tab names them)
 * and are hidden from sight, as the selected tab already says the same thing.
 */

/* ------------------------------------------------------------------ the bar */

.cc-home .cc-scene .cc-scene__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0;
	max-width: none;
	overflow: hidden;
	background: var(--cc-color-canvas);
	border: 1px solid color-mix(in srgb, var(--cc-color-white) 14%, transparent);
	border-radius: var(--cc-radius-s);
}

.cc-home .cc-scene .cc-scene__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--cc-space-s);
	padding: var(--cc-space-m);
	border: 0;
}

.cc-home .cc-scene .cc-scene__btn {
	flex: 1 1 100%;
	justify-content: center;
	min-height: var(--cc-target-min);
	white-space: nowrap;
}

/* ------------------------------------------------------------------ tabs */

.cc-home .cc-scene .cc-scene__focus {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1px;
	background: color-mix(in srgb, var(--cc-color-white) 10%, var(--cc-color-canvas));
	border-top: 1px solid color-mix(in srgb, var(--cc-color-white) 10%, var(--cc-color-canvas));
}

.cc-home .cc-scene .cc-scene__chip {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	margin: 0;
	padding: var(--cc-space-s) var(--cc-space-xs);
	border: 0;
	border-top: 2px solid transparent;
	border-radius: 0;
	background: var(--cc-color-canvas);
	color: color-mix(in srgb, var(--cc-color-white) 72%, var(--cc-color-canvas));
	font-size: var(--cc-font-size-xs);
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.25;
	text-align: center;
	text-transform: uppercase;
	white-space: normal;
	cursor: pointer;
	transition: background-color var(--cc-transition-fast), color var(--cc-transition-fast);
}

.cc-home .cc-scene .cc-scene__chip:hover {
	background: color-mix(in srgb, var(--cc-color-white) 5%, var(--cc-color-canvas));
	color: var(--cc-color-white);
}

.cc-home .cc-scene .cc-scene__chip[aria-selected="true"] {
	background: color-mix(in srgb, var(--cc-color-white) 7%, var(--cc-color-canvas));
	border-top-color: var(--cc-color-action);
	color: var(--cc-color-white);
}

/* Inside the cell: the bar clips anything drawn outside it. */
.cc-home .cc-scene .cc-scene__chip:focus-visible {
	outline: var(--cc-focus-width) solid var(--cc-color-focus);
	outline-offset: calc(-1 * var(--cc-focus-width) - 2px);
}

/* ------------------------------------------------------------------ progress line and status */

.cc-home .cc-scene .cc-scene__meter {
	position: relative;
	grid-column: 1 / -1;
	height: 2px;
	overflow: hidden;
	background: color-mix(in srgb, var(--cc-color-white) 10%, var(--cc-color-canvas));
}

.cc-home .cc-scene .cc-scene__meter-fill {
	position: absolute;
	inset: 0;
	background: var(--cc-color-action);
	transform: scaleX(0);
	transform-origin: 0 50%;
}

/* Settled or stopped: the line fades away and leaves only the quiet track. */
.cc-home .cc-scene .cc-scene__meter[data-done] .cc-scene__meter-fill {
	opacity: 0;
	transition: opacity var(--cc-transition-base) ease 600ms;
}

/* While the files load there is nothing to measure, so a short segment passes along the track. */
@keyframes cc-scene-sweep {
	from {
		transform: translateX(-100%) scaleX(0.25);
	}

	to {
		transform: translateX(100%) scaleX(0.25);
	}
}

@media (prefers-reduced-motion: no-preference) {
	.cc-home .cc-scene[data-scene-state="requested"] .cc-scene__meter-fill,
	.cc-home .cc-scene[data-scene-state="loading"] .cc-scene__meter-fill {
		animation: cc-scene-sweep 1.4s ease-in-out infinite;
	}
}

.cc-home .cc-scene .cc-scene__status {
	grid-column: 1 / -1;
	margin: 0;
	padding: var(--cc-space-xs) var(--cc-space-m);
	border: 0;
	border-bottom: 1px solid color-mix(in srgb, var(--cc-color-white) 10%, var(--cc-color-canvas));
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-xs);
	line-height: 1.4;
}

.cc-home .cc-scene .cc-scene__status:empty {
	padding: 0;
	border: 0;
}

/* ------------------------------------------------------------------ panels */

.cc-home .cc-scene .cc-scene__panels {
	display: block;
	grid-column: 1 / -1;
	margin: 0;
	padding: 0;
	border: 0;
}

.cc-home .cc-scene .cc-scene__item {
	display: grid;
	align-content: start;
	gap: var(--cc-space-xs);
	min-width: 0;
	margin: 0;
	padding: var(--cc-space-m);
}

.cc-home .cc-scene .cc-scene__item + .cc-scene__item {
	border-top: 1px solid color-mix(in srgb, var(--cc-color-white) 10%, var(--cc-color-canvas));
}

.cc-home .cc-scene .cc-scene__heading {
	margin: 0;
	color: var(--cc-color-white);
	font-size: var(--cc-font-size-xs);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.cc-home .cc-scene .cc-scene__text {
	min-width: 0;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	line-height: 1.5;
}

.cc-home .cc-scene .cc-scene__summary {
	margin: 0;
	color: inherit;
}

.cc-home .cc-scene .cc-scene__summary + .cc-scene__summary {
	margin-top: var(--cc-space-xxs);
}

/* Phones: the links are full-width rows with a chevron, each a comfortable tap target, flush with the bar's edges. */
.cc-home .cc-scene .cc-scene__links {
	display: grid;
	gap: 0;
	margin: var(--cc-space-xs) calc(-1 * var(--cc-space-m)) calc(-1 * var(--cc-space-m));
}

.cc-home .cc-scene .cc-scene__links a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 3rem;
	padding: 0 var(--cc-space-m);
	border-top: 1px solid color-mix(in srgb, var(--cc-color-white) 10%, var(--cc-color-canvas));
	color: var(--cc-color-white);
	font-size: var(--cc-font-size-xs);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-decoration: none;
	text-transform: uppercase;
}

.cc-home .cc-scene .cc-scene__links a::after {
	content: "";
	flex: none;
	width: 0.5rem;
	height: 0.5rem;
	margin-left: var(--cc-space-s);
	border-top: 2px solid var(--cc-color-action);
	border-right: 2px solid var(--cc-color-action);
	transform: rotate(45deg);
}

.cc-home .cc-scene .cc-scene__links a:hover {
	background: color-mix(in srgb, var(--cc-color-white) 5%, var(--cc-color-canvas));
	color: var(--cc-color-white);
}

.cc-home .cc-scene .cc-scene__links a:focus-visible {
	outline-offset: calc(-1 * var(--cc-focus-width) - 2px);
}

/* The first link of a panel is the main way on (the matching page); the others are quieter. */
.cc-home .cc-scene .cc-scene__links a:not(.cc-scene__link--primary) {
	color: color-mix(in srgb, var(--cc-color-white) 72%, var(--cc-color-canvas));
}

.cc-home .cc-scene .cc-scene__links a:not(.cc-scene__link--primary)::after {
	border-color: var(--cc-color-line-strong);
}

.cc-home .cc-scene .cc-scene__links a:not(.cc-scene__link--primary):hover {
	color: var(--cc-color-white);
}

/* With script: the four panels share one cell (the tallest sets the height), the others are out of sight and out of the
   keyboard order, and the heading is for screen readers only. The same cell is used before view.js starts, so nothing
   moves when it does. If view.js fails (data-scene-failed) this block stops applying and every panel shows. */
.cc-js .cc-scene:not([data-scene-failed]) .cc-scene__panels {
	display: grid;
}

.cc-js .cc-scene:not([data-scene-failed]) .cc-scene__item {
	grid-area: 1 / 1;
	border-top: 0;
}

.cc-js .cc-scene .cc-scene__item[data-active="false"],
.cc-js .cc-scene:not([data-scene-ready]):not([data-scene-failed]) .cc-scene__item:not([data-scene-panel="overview"]) {
	display: grid;
	visibility: hidden;
}

.cc-js .cc-scene:not([data-scene-failed]) .cc-scene__heading {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ------------------------------------------------------------------ 48em: one row of tabs, the Show button its own width */

@media (min-width: 48em) {
	.cc-home .cc-scene .cc-scene__btn {
		flex: 0 1 auto;
	}

	.cc-home .cc-scene .cc-scene__chip {
		padding-inline: var(--cc-space-s);
		letter-spacing: 0.1em;
	}

	.cc-home .cc-scene .cc-scene__focus {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	/* Wider than a phone the links are underlined words in a row. */
	.cc-home .cc-scene .cc-scene__links {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 0 var(--cc-space-l);
		margin: 0;
	}

	.cc-home .cc-scene .cc-scene__links a {
		display: inline-flex;
		min-height: var(--cc-target-min);
		padding: 0;
		border-top: 0;
		text-decoration: underline;
		text-decoration-color: var(--cc-color-action);
		text-decoration-thickness: 2px;
		text-underline-offset: 0.3em;
	}

	.cc-home .cc-scene .cc-scene__links a::after {
		content: none;
	}

	.cc-home .cc-scene .cc-scene__links a:hover {
		background: transparent;
		color: var(--cc-color-action-hover);
		text-decoration-color: var(--cc-color-action-hover);
	}

	.cc-home .cc-scene .cc-scene__links a:focus-visible {
		outline-offset: var(--cc-focus-offset);
	}

	.cc-home .cc-scene .cc-scene__links a:not(.cc-scene__link--primary) {
		text-decoration-color: var(--cc-color-line-strong);
		text-decoration-thickness: 1px;
	}

	.cc-home .cc-scene .cc-scene__links a:not(.cc-scene__link--primary):hover {
		color: var(--cc-color-white);
		text-decoration-color: var(--cc-color-action);
	}
}

/* ------------------------------------------------------------------ 70em: the glass strip over the picture */

@media (min-width: 70em) {
	.cc-home .cc-scene .cc-scene__inner {
		grid-template-columns: 17.5rem minmax(0, 1fr);
		background: color-mix(in srgb, var(--cc-color-canvas) 70%, transparent);
		-webkit-backdrop-filter: blur(14px);
		backdrop-filter: blur(14px);
	}

	/* The Show, Stop and Replay controls take the same cell, so the tabs never move when the control changes. */
	.cc-home .cc-scene .cc-scene__actions {
		flex-wrap: nowrap;
		padding: var(--cc-space-xs) var(--cc-space-m);
		border-right: 1px solid color-mix(in srgb, var(--cc-color-white) 10%, transparent);
	}

	.cc-home .cc-scene .cc-scene__btn {
		flex: 1 1 auto;
	}

	.cc-home .cc-scene .cc-scene__focus {
		gap: 0;
		background: transparent;
		border-top: 0;
	}

	.cc-home .cc-scene .cc-scene__chip {
		padding-inline: var(--cc-space-m);
		border-right: 1px solid color-mix(in srgb, var(--cc-color-white) 8%, transparent);
		background: transparent;
		white-space: nowrap;
	}

	.cc-home .cc-scene .cc-scene__chip:last-child {
		border-right: 0;
	}

	.cc-home .cc-scene .cc-scene__chip:hover {
		background: color-mix(in srgb, var(--cc-color-white) 4%, transparent);
	}

	.cc-home .cc-scene .cc-scene__chip[aria-selected="true"] {
		background: color-mix(in srgb, var(--cc-color-white) 7%, transparent);
	}

	.cc-home .cc-scene .cc-scene__meter {
		background: color-mix(in srgb, var(--cc-color-white) 10%, transparent);
	}

	.cc-home .cc-scene .cc-scene__status {
		border-bottom-color: color-mix(in srgb, var(--cc-color-white) 10%, transparent);
	}

	/* A panel is one row: the sentence, then the links on the right. */
	.cc-home .cc-scene .cc-scene__item {
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		column-gap: var(--cc-space-xl);
		padding: var(--cc-space-xs) var(--cc-space-m);
	}

	.cc-home .cc-scene .cc-scene__item + .cc-scene__item {
		border-top-color: color-mix(in srgb, var(--cc-color-white) 10%, transparent);
	}

	.cc-home .cc-scene .cc-scene__heading {
		grid-column: 1 / -1;
	}

	.cc-home .cc-scene .cc-scene__links {
		justify-content: flex-end;
	}
}

/* ------------------------------------------------------------------ small things */

/* On a touch screen the finger is still over the spot where Show was when Stop takes its place, so the hover fill would
   stick on it. Keep the resting look there. */
@media (hover: none) {
	.cc-home .cc-scene .cc-scene__btn:hover {
		background-color: transparent;
		border-color: var(--cc-color-secondary);
		color: var(--cc-color-white);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cc-home .cc-scene .cc-scene__chip,
	.cc-home .cc-scene .cc-scene__meter[data-done] .cc-scene__meter-fill {
		transition: none;
	}
}

@media (forced-colors: active) {
	.cc-home .cc-scene .cc-scene__chip[aria-selected="true"] {
		background: Highlight;
		color: HighlightText;
	}

	.cc-home .cc-scene .cc-scene__meter-fill {
		background: Highlight;
	}
}
