/* Lab page bridge layer.
 *
 * The look comes from assets/vendor/pdso/pdso-skin.css, which is the course
 * repository's stylesheet shipped unchanged. This file only covers the pieces that
 * skin has no rules for, because they do not exist in the repository's version of
 * the page: the live xterm terminal, the step cards, the check button results and
 * the copy button on command blocks. Colours are taken from the skin's own
 * variables so the two never drift apart.
 */

/* The terminal itself. In the repository this slot holds an iframe, so it is sized
   the same way: fill the stage under the tab strip. */
.pdso-term-host {
	flex: 1 1 auto;
	width: 100%;
	min-height: 0;
	padding: 10px 12px;
	background: var(--pdso-terminal-bg);
}
.pdso-term-host .xterm {
	height: 100%;
}
.pdso-terminal [hidden] {
	display: none !important;
}

/* Step cards inside the content card. */
.asf-rail {
	list-style: none;
	margin: 18px 0 0;
	padding: 0;
}
.asf-step {
	margin: 0;
}
.asf-step-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}
.asf-step-head h2 {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	color: var(--pdso-text-strong);
	border: 0;
	padding: 0;
}
.asf-step-dot {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 700;
	background: var(--pdso-accent-soft);
	color: var(--pdso-accent-strong);
}
.asf-step.is-passed .asf-step-dot {
	background: var(--pdso-connected-bg);
	color: var(--pdso-connected);
}
.asf-step.is-passed .asf-step-dot::after {
	content: "\2713";
}
.asf-step.is-passed .asf-step-dot {
	font-size: 0;
}
.asf-step.is-passed .asf-step-dot::after {
	font-size: 15px;
}

.asf-hint {
	margin: 16px 0;
	border: 1px solid var(--pdso-border);
	border-radius: 10px;
	background: var(--pdso-card-soft);
	padding: 12px 14px;
}
.asf-hint summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--pdso-accent-strong);
}
.asf-hint[open] summary {
	margin-bottom: 8px;
}

.asf-step-check {
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid var(--pdso-border);
}
.asf-step-result {
	margin: 14px 0 0;
	padding: 12px 14px;
	border-radius: 10px;
	white-space: pre-wrap;
	font-family: ui-monospace, "JetBrains Mono", monospace;
	font-size: 13px;
	line-height: 1.6;
}
.asf-step-result.is-ok {
	background: var(--pdso-connected-bg);
	color: #0f7344;
}
.asf-step-result.is-err {
	background: #fdeeea;
	color: #a8331f;
}

.asf-finish {
	margin-top: 26px;
	padding: 20px;
	border-radius: 12px;
	background: var(--pdso-accent-tint);
	border: 1px solid var(--pdso-accent-soft);
	text-align: center;
}
.asf-finish p {
	margin: 0 0 12px;
	font-weight: 600;
	color: var(--pdso-text-strong);
}

.asf-access-note {
	color: var(--pdso-muted);
	font-size: 13px;
}

/* Copy button on command blocks. */
.asf-step-body pre {
	position: relative;
}
.asf-copy {
	position: absolute;
	top: 8px;
	right: 8px;
	font: inherit;
	font-size: 12px;
	padding: 4px 10px;
	border-radius: 6px;
	border: 1px solid var(--pdso-border-strong);
	background: var(--pdso-card);
	color: var(--pdso-muted);
	cursor: pointer;
}
.asf-copy:hover {
	color: var(--pdso-accent-strong);
	border-color: var(--pdso-accent);
}

/* The countdown turns red in the last five minutes. */
.pdso-timer.is-low {
	color: #c2341f;
	font-weight: 700;
}

/* The logo slot falls back to the site name when no mark is set. */
.md-logo .asf-logo-text {
	font-weight: 700;
	font-size: 15px;
	color: var(--pdso-text-strong);
	white-space: nowrap;
}

/* A Back or Next with nowhere left to go stays in place and goes flat. */
.pdso-pagination .md-footer__link.is-idle {
	opacity: .45;
	pointer-events: none;
}

/* The filter box under the sidebar chrome. */
.asf-nav-filter {
	width: calc(100% - 32px);
	margin: 0 16px 10px;
	padding: 7px 10px;
	font: inherit;
	font-size: 13px;
	border: 1px solid var(--pdso-border-strong);
	border-radius: 8px;
	background: var(--pdso-card);
	color: var(--pdso-text);
}

/* Folded sidebar. */
.asf-nav-closed .md-sidebar--primary {
	display: none;
}
.asf-nav-closed .md-content {
	margin-left: 0;
}

/* Anything hidden stays hidden, whatever the skin sets on the element. */
.asf-lab-page [hidden] {
	display: none !important;
}

/* Narrow screens.
 *
 * The repository's skin removes the terminal below 1100px, because its pages are
 * reading material with the terminal as a companion. A lab is not usable without a
 * terminal, so here the pane comes back underneath the lesson instead of vanishing,
 * and the curriculum folds away to give the lesson the full width. Everything above
 * 1100px is left to the skin untouched.
 */
@media (max-width: 1100px) {
	.md-sidebar--primary {
		display: none;
	}
	/* The card is pinned to the viewport on wide screens. Down here it goes back
	   into normal flow so the lesson and the terminal can sit one above the other. */
	.md-content {
		position: static !important;
		inset: auto !important;
		margin: 14px !important;
		height: auto;
		max-height: 72vh;
	}
	.md-main__inner,
	.md-grid {
		margin-left: 0;
		margin-right: 0;
		max-width: 100%;
	}
	.md-container {
		width: 100% !important;
		max-width: 100% !important;
		height: auto;
	}
	.md-content__inner {
		padding: 20px 20px 26px !important;
	}
	.pdso-terminal {
		display: flex !important;
		position: static;
		width: auto;
		margin: 0 14px 14px;
		height: 60vh;
		min-height: 360px;
	}
	.pdso-splitter,
	.pdso-toolstrip {
		display: none !important;
	}
	.pdso-term-host {
		min-height: 300px;
	}
	.pdso-status-row .pdso-theme-toggle {
		display: none;
	}
}
