/*
================================================================
TUTORIAL VIDEO: floating tab, footer access, dialog / bottom sheet.
Source of truth: Figma nyO6okhfumoV57zmCrkhR0, review board 2:2.
Desktop 1920/1440 dialog 7:309 / 7:500 (1088 × 880), tablet 1024
7:644 (944 × 820), mobile 424 sheet 7:166 (424 × 748), tabs 2:30
(56 × 216) and 2:40 (196 × 52), cover 7:457, footer access 8:125.

Scoped to .nios-tutorial*; colours are the theme tokens only.
Physical `left` on purpose: the tab hugs the LEFT edge in the RTL
site too (a logical inset would flip it), same reason as the cart
drawer and the footer's decorative images.
Breakpoints: the sitewide 768 / 1200 system. The vertical tab also
needs 560px of height; shorter (landscape phones) uses the
horizontal tab.
================================================================
*/

/* ---------- Icons: the Figma SVGs as masks, painted in currentColor ---------- */
.nios-tutorial-icon {
	display: block;
	flex: none;
	width: 24px;
	height: 24px;
	background-color: currentColor;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	mask-size: contain;
}
.nios-tutorial-icon--close { -webkit-mask-image: url(../icons/tutorial/close.svg); mask-image: url(../icons/tutorial/close.svg); }
.nios-tutorial-icon--play { -webkit-mask-image: url(../icons/tutorial/play.svg); mask-image: url(../icons/tutorial/play.svg); }
.nios-tutorial-icon--pause { -webkit-mask-image: url(../icons/tutorial/pause.svg); mask-image: url(../icons/tutorial/pause.svg); }
.nios-tutorial-icon--play-tab { -webkit-mask-image: url(../icons/tutorial/play-tab-mobile.svg); mask-image: url(../icons/tutorial/play-tab-mobile.svg); }
.nios-tutorial-icon--volume { -webkit-mask-image: url(../icons/tutorial/volume.svg); mask-image: url(../icons/tutorial/volume.svg); }
.nios-tutorial-icon--volume-muted { -webkit-mask-image: url(../icons/tutorial/volume-muted.svg); mask-image: url(../icons/tutorial/volume-muted.svg); }
.nios-tutorial-icon--fullscreen { -webkit-mask-image: url(../icons/tutorial/fullscreen.svg); mask-image: url(../icons/tutorial/fullscreen.svg); }
.nios-tutorial-icon--fullscreen-exit { -webkit-mask-image: url(../icons/tutorial/fullscreen-exit.svg); mask-image: url(../icons/tutorial/fullscreen-exit.svg); }
.nios-tutorial-icon--captions { -webkit-mask-image: url(../icons/tutorial/captions.svg); mask-image: url(../icons/tutorial/captions.svg); }

/* Windows high contrast replaces background colours, which would erase mask icons. */
@media (forced-colors: active) {
	.nios-tutorial-icon {
		forced-color-adjust: none;
		background-color: CanvasText;
	}
	.nios-tutorial-tab,
	.nios-tutorial__close,
	.nios-tutorial__big-play,
	.nios-tutorial__ctrl { border: 1px solid CanvasText; }
}

.nios-tutorial-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Floating tab, base: horizontal (Mobile 424, component 2:40) ---------- */
.nios-tutorial-tab {
	--nt-tab-h: 52px;
	position: fixed;
	left: 0;
	/* Figma anchor 570 / 928. Clamped under the 68px header and above the
	   bottom-left floating controls (help button, cookie banner offset). */
	top: clamp(84px, 61.4vh, calc(100vh - var(--nt-tab-h) - 96px - var(--nios-cookie-offset, 0px)));
	top: clamp(84px, 61.4dvh, calc(100dvh - var(--nt-tab-h) - 96px - var(--nios-cookie-offset, 0px)));
	z-index: 90; /* under the sticky header (100) and every overlay (cart drawer, cookie, help, a11y) */
	display: none; /* needs JavaScript: shown by the html.nios-tutorial-js class set in <head> */
	align-items: center;
	width: 196px;
	height: var(--nt-tab-h);
	padding: 0;
	overflow: hidden;
	border-radius: 0 18px 18px 0;
	background: var(--nios-ink-strong);
	color: var(--nios-bg);
	font-family: var(--nios-font);
	transition: background-color .15s ease;
}
.nios-tutorial-js .nios-tutorial-tab { display: flex; }
.nios-tutorial-js.nios-tutorial-dismissed .nios-tutorial-tab,
.nios-tutorial-js.nios-tutorial-open .nios-tutorial-tab { display: none; }
.nios-tutorial-tab:hover { background: var(--nios-ink); }

.nios-tutorial-tab__watch,
.nios-tutorial-tab__hide {
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.nios-tutorial-tab__watch {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex: none;
	width: 152px;
	height: 52px;
	border-radius: 0 18px 18px 0;
}
.nios-tutorial-tab__label-slot { display: flex; }
.nios-tutorial-tab__label {
	font: 500 16px/24px var(--nios-font);
	white-space: nowrap;
}
.nios-tutorial-tab__play { order: -1; display: flex; } /* RTL row: play icon on the right of the label */
.nios-tutorial-tab__hide {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: 22px;
	transition: background-color .15s ease;
}
.nios-tutorial-tab__hide:hover { background: color-mix(in srgb, var(--nios-bg) 14%, transparent); }
.nios-tutorial-tab__watch:active > *,
.nios-tutorial-tab__hide:active > * { transform: scale(.94); }

/* Keyboard focus (Figma 2:54): a 3px accent ring around the whole tab for
   the watch area, around the circle for the hide button. */
.nios-tutorial-tab:has(.nios-tutorial-tab__watch:focus-visible) { box-shadow: inset 0 0 0 3px var(--nios-accent); }
.nios-tutorial-tab__watch:focus-visible { outline: none; }
.nios-tutorial-tab__hide:focus-visible { outline: 3px solid var(--nios-accent); outline-offset: -3px; }
@supports not selector(:has(*)) {
	.nios-tutorial-tab__watch:focus-visible { outline: 3px solid var(--nios-accent); outline-offset: -3px; }
}

/* ---------- Floating tab, vertical (Desktop, component 2:30) ---------- */
@media (min-width: 768px) and (min-height: 560px) {
	.nios-tutorial-tab {
		--nt-tab-h: 216px;
		/* Figma anchor 572 / 1080, under the 78px header. */
		top: clamp(94px, 52.96vh, calc(100vh - var(--nt-tab-h) - 96px - var(--nios-cookie-offset, 0px)));
		top: clamp(94px, 52.96dvh, calc(100dvh - var(--nt-tab-h) - 96px - var(--nios-cookie-offset, 0px)));
		flex-direction: column-reverse; /* the hide button sits on top */
		justify-content: center;
		width: 56px;
	}
	.nios-tutorial-tab__watch {
		flex-direction: column;
		gap: 0;
		width: 56px;
		height: 164px;
		border-radius: 0 0 18px 0;
	}
	.nios-tutorial-tab__label-slot {
		align-items: center;
		justify-content: center;
		width: 24px;
		height: 116px;
	}
	.nios-tutorial-tab__label {
		flex: none;
		width: 116px;
		text-align: center;
		transform: rotate(-90deg);
	}
	.nios-tutorial-tab__play {
		order: 0;
		align-items: center;
		justify-content: center;
		width: 30px;
		height: 30px;
		border: 1px solid var(--nios-border);
		border-radius: 15px;
	}
	.nios-tutorial-tab__play .nios-tutorial-icon {
		width: 22px;
		height: 22px;
		-webkit-mask-image: url(../icons/tutorial/play-tab-desktop.svg);
		mask-image: url(../icons/tutorial/play-tab-desktop.svg);
	}
}

/* ---------- Footer access (component 8:125, adapted to the footer) ---------- */
.nios-tutorial-footer { display: none; }
.nios-tutorial-js .nios-tutorial-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	column-gap: 16px;
	row-gap: 0;
	margin-top: 40px;
	padding: 4px 20px;
	min-height: 52px;
	border-radius: 12px;
	background: var(--nios-bg-panel);
	font: 400 16px/23px var(--nios-font);
	text-align: center;
}
.nios-tutorial-footer__question { margin: 0; color: var(--nios-ink); }
.nios-tutorial-footer__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin: 0;
	padding: 0 4px;
	border: 0;
	background: none;
	color: var(--nios-accent);
	font: 500 16px/23px var(--nios-font);
	cursor: pointer;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 4px;
	transition: text-decoration-color .15s ease;
}
.nios-tutorial-footer__link:hover { text-decoration-color: currentColor; }
.nios-tutorial-footer__link:focus-visible { outline: 2px solid var(--nios-accent); outline-offset: 2px; border-radius: 4px; }
@media (min-width: 768px) {
	.nios-tutorial-js .nios-tutorial-footer { justify-content: flex-start; text-align: start; }
}

/* ---------- Dialog shell ---------- */
html.nios-tutorial-open { overflow: hidden; }
/* Only when the page had a classic scrollbar (tutorial.js measures it): keep its
   space so nothing reflows, and paint that strip like the dimmed page. With
   overlay scrollbars (phones, macOS) a reserved gutter would itself narrow the
   page and shift it. */
html.nios-tutorial-open.nios-tutorial-gutter {
	scrollbar-gutter: stable;
	background: color-mix(in srgb, var(--nios-ink-strong) 72%, var(--nios-bg));
}

.nios-tutorial {
	position: fixed;
	inset: 0;
	z-index: 10030; /* above the help button (9980) and cookie/a11y layers, under the help dialog (10040) */
	display: flex;
	align-items: flex-end; /* mobile: bottom sheet */
	justify-content: center;
	font-family: var(--nios-font);
	color: var(--nios-ink);
	direction: rtl;
}
.nios-tutorial[hidden] { display: none; }

.nios-tutorial__backdrop {
	position: absolute;
	inset: 0;
	background: var(--nios-ink-strong);
	opacity: 0;
	transition: opacity .22s ease;
}
.nios-tutorial.is-visible .nios-tutorial__backdrop { opacity: .72; }

.nios-tutorial__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	/* Mobile 424 × 928 reference: 748 tall. Shorter screens scroll inside. */
	height: min(748px, calc(100vh - 24px));
	height: min(748px, calc(100dvh - 24px - env(safe-area-inset-top, 0px)));
	overflow: hidden;
	border-radius: 24px 24px 0 0;
	background: var(--nios-bg);
	box-shadow: 0 16px 60px rgba(0, 0, 0, .18);
	transform: translateY(100%);
	transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.nios-tutorial.is-visible .nios-tutorial__dialog { transform: none; }
.nios-tutorial__dialog:focus { outline: none; }

.nios-tutorial__handle {
	position: absolute;
	top: 10px;
	left: 50%;
	width: 40px;
	height: 4px;
	margin-left: -20px;
	border-radius: 2px;
	background: var(--nios-border);
}

.nios-tutorial__close {
	position: absolute;
	top: 26px;
	left: 16px;
	z-index: 2; /* stays reachable while the body scrolls under it */
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 22px;
	background: var(--nios-bg);
	color: var(--nios-ink);
	cursor: pointer;
	transition: background-color .15s ease;
}
.nios-tutorial__close:hover { background: var(--nios-bg-panel); }
.nios-tutorial__close:focus-visible { outline: 2px solid var(--nios-accent); outline-offset: 0; }

.nios-tutorial__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 26px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Head ---------- */
.nios-tutorial__head {
	position: relative;
	flex: none;
	padding: 62px 4px 0;
	text-align: right;
}
.nios-tutorial__logo {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 80px;
	height: auto;
}
.nios-tutorial__title {
	margin: 0;
	font: 700 24px/35px var(--nios-font);
	color: var(--nios-ink-strong);
}
.nios-tutorial__intro {
	margin: 5px 0 0;
	font: 400 14px/20px var(--nios-font);
	color: var(--nios-ink);
}

/* ---------- Media: 16:9 cover + video + controls ---------- */
.nios-tutorial__media {
	position: relative;
	flex: none;
	width: 100%;
	aspect-ratio: 16 / 9;
	margin-top: 26px;
	overflow: hidden;
	border-radius: 12px;
	background: var(--nios-bg-panel);
	container-type: inline-size;
	isolation: isolate;
}
.nios-tutorial__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: var(--nios-ink-strong);
}
.nios-tutorial__video[hidden] { display: none; }

.nios-tutorial__cover {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: 46% 54%; /* Figma: copy 471 / photo 553 of 1024, same ratio on every frame */
	direction: ltr;
	background: var(--nios-bg-panel); /* opaque: a paused video can sit behind it */
}
.nios-tutorial__cover-copy {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(12px, 2.73cqw, 24px);
	min-width: 0;
	padding: 20px;
	direction: rtl;
	text-align: center;
	overflow: hidden;
}
.nios-tutorial__cover-logo { width: clamp(80px, 11.6cqw, 102px); height: auto; }
.nios-tutorial__cover-eyebrow,
.nios-tutorial__cover-title,
.nios-tutorial__cover-text { margin: 0; }
.nios-tutorial__cover-eyebrow { font: 500 15px/22px var(--nios-font); color: var(--nios-accent); }
.nios-tutorial__cover-title { font: 700 clamp(28px, 4.78cqw, 42px)/1.45 var(--nios-font); color: var(--nios-ink-strong); }
.nios-tutorial__cover-text { font: 400 16px/23px var(--nios-font); color: var(--nios-ink); }
.nios-tutorial__cover-photo {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Mobile cover (7:242, 392 wide): top-aligned copy, sizes follow the media width. */
@container (max-width: 599px) {
	.nios-tutorial__cover-copy {
		justify-content: flex-start;
		gap: 2.04cqw;
		padding: 3.06cqw 5.1cqw 0;
	}
	.nios-tutorial__cover-logo { width: 18.37cqw; }
	.nios-tutorial__cover-eyebrow { font-size: max(9px, 2.55cqw); line-height: 1.5; }
	.nios-tutorial__cover-title { font-size: 5.1cqw; line-height: 1.45; }
	.nios-tutorial__cover-text { font-size: max(9px, 2.55cqw); line-height: 1.5; }
}
@container (max-width: 339px) {
	.nios-tutorial__cover-text { display: none; }
	.nios-tutorial__cover-copy { padding-right: 32px; padding-left: 8px; }
}

.nios-tutorial__big-play {
	position: absolute;
	top: calc(50% - 32px);
	left: calc(46% - 32px); /* centred on the seam between copy and photo */
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--nios-border);
	border-radius: 32px;
	background: var(--nios-bg);
	color: var(--nios-ink-strong);
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
}
.nios-tutorial__big-play[hidden] { display: none; }
.nios-tutorial__big-play:hover { transform: scale(1.06); box-shadow: 0 6px 18px rgba(0, 0, 0, .16); }
.nios-tutorial__big-play:active { transform: scale(.97); }
.nios-tutorial__big-play:focus-visible { outline: 3px solid var(--nios-accent); outline-offset: 3px; }

.nios-tutorial__media.is-started .nios-tutorial__cover,
.nios-tutorial__media.is-started .nios-tutorial__big-play { display: none; }

/* Captions, drawn from the WebVTT cues so they never sit under the controls. */
.nios-tutorial__caption {
	position: absolute;
	left: 50%;
	bottom: 60px;
	z-index: 1;
	max-width: 88%;
	padding: .3em .8em;
	border-radius: 10px;
	background: var(--nios-ink-strong);
	color: var(--nios-bg);
	font: 600 clamp(13px, 2.2cqw, 24px)/1.4 var(--nios-font);
	text-align: center;
	white-space: pre-line;
	direction: rtl;
	transform: translateX(-50%);
	transition: bottom .2s ease;
	pointer-events: none;
}
.nios-tutorial__caption[hidden] { display: none; }
.nios-tutorial__media.is-idle .nios-tutorial__caption { bottom: 12px; }

.nios-tutorial__controls {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	height: 48px;
	padding: 0 4px;
	background: var(--nios-ink-strong);
	color: var(--nios-bg);
	transition: opacity .2s ease, transform .2s ease;
}
.nios-tutorial__media.is-idle .nios-tutorial__controls {
	opacity: 0;
	transform: translateY(100%);
	pointer-events: none;
}
.nios-tutorial__media.is-idle { cursor: none; }

.nios-tutorial__ctrl {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
.nios-tutorial__ctrl[hidden] { display: none; }
.nios-tutorial__ctrl:hover { background: color-mix(in srgb, var(--nios-bg) 12%, transparent); }
.nios-tutorial__ctrl:focus-visible { outline: 2px solid var(--nios-gold-soft); outline-offset: -2px; }
.nios-tutorial__ctrl:disabled { opacity: .4; cursor: default; background: transparent; }
.nios-tutorial__ctrl[aria-pressed="false"] { opacity: .55; }

/* Two-state buttons carry both icons; the state class picks one. */
[data-tutorial-toggle] .nios-tutorial-icon--pause,
.nios-tutorial__media.is-playing [data-tutorial-toggle] .nios-tutorial-icon--play,
[data-tutorial-mute] .nios-tutorial-icon--volume-muted,
.nios-tutorial__media.is-muted [data-tutorial-mute] .nios-tutorial-icon--volume,
[data-tutorial-fullscreen] .nios-tutorial-icon--fullscreen-exit,
.nios-tutorial__media.is-fullscreen [data-tutorial-fullscreen] .nios-tutorial-icon--fullscreen { display: none; }
.nios-tutorial__media.is-playing [data-tutorial-toggle] .nios-tutorial-icon--pause,
.nios-tutorial__media.is-muted [data-tutorial-mute] .nios-tutorial-icon--volume-muted,
.nios-tutorial__media.is-fullscreen [data-tutorial-fullscreen] .nios-tutorial-icon--fullscreen-exit { display: block; }

.nios-tutorial__time {
	flex: none;
	min-width: 62px;
	margin: 0 12px 0 8px;
	font: 400 14px/20px var(--nios-font);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.nios-tutorial__notice {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0 8px;
	font: 500 14px/20px var(--nios-font);
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.nios-tutorial__notice[hidden] { display: none; }
.nios-tutorial__media.is-unconfigured .nios-tutorial__time,
.nios-tutorial__media.is-unconfigured .nios-tutorial__seek,
.nios-tutorial__media.is-unconfigured .nios-tutorial__volume,
.nios-tutorial__media.has-error .nios-tutorial__time,
.nios-tutorial__media.has-error .nios-tutorial__seek { display: none; }

/* Range inputs: a 3px rail on a 44px hit area; the played part is filled by --nt-fill. */
.nios-tutorial__range {
	--nt-fill: 0%;
	-webkit-appearance: none;
	appearance: none;
	height: 44px;
	margin: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
	direction: ltr;
}
.nios-tutorial__seek { flex: 1 1 auto; min-width: 48px; margin-inline-end: 8px; }
.nios-tutorial__volume { display: none; flex: none; width: 64px; margin: 0 4px; }
.nios-tutorial__range::-webkit-slider-runnable-track {
	height: 3px;
	border-radius: 2px;
	background: linear-gradient(to right, var(--nios-bg) var(--nt-fill), color-mix(in srgb, var(--nios-bg) 30%, transparent) var(--nt-fill));
}
.nios-tutorial__range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 12px;
	height: 12px;
	margin-top: -4.5px;
	border: 0;
	border-radius: 50%;
	background: var(--nios-bg);
}
.nios-tutorial__range::-moz-range-track {
	height: 3px;
	border-radius: 2px;
	background: color-mix(in srgb, var(--nios-bg) 30%, transparent);
}
.nios-tutorial__range::-moz-range-progress {
	height: 3px;
	border-radius: 2px;
	background: var(--nios-bg);
}
.nios-tutorial__range::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border: 0;
	border-radius: 50%;
	background: var(--nios-bg);
}
.nios-tutorial__range:focus-visible { outline: 2px solid var(--nios-gold-soft); outline-offset: -10px; border-radius: 4px; }
.nios-tutorial__range:disabled { opacity: .4; cursor: default; }

/* Fullscreen: the whole media box (so the custom controls and captions come along). */
.nios-tutorial__media:fullscreen {
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	border-radius: 0;
	background: var(--nios-ink-strong);
}
.nios-tutorial__media:-webkit-full-screen {
	width: 100%;
	height: 100%;
	border-radius: 0;
	background: var(--nios-ink-strong);
}

/* Phone held upright (tutorial.js, `is-theater`): the vertical 9:16 video on the
   whole screen, like a story, with the same controls and a way back to the sheet. */
.nios-tutorial__media.is-theater {
	position: fixed;
	inset: 0;
	z-index: 5; /* above the sheet's own close button (2) */
	width: 100%;
	height: 100vh;
	height: 100dvh;
	margin: 0;
	aspect-ratio: auto;
	border-radius: 0;
	background: var(--nios-ink-strong);
}
.nios-tutorial__media.is-theater .nios-tutorial__controls {
	height: calc(48px + env(safe-area-inset-bottom, 0px));
	padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nios-tutorial__theater-close {
	position: absolute;
	top: calc(12px + env(safe-area-inset-top, 0px));
	left: 12px;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 22px;
	background: color-mix(in srgb, var(--nios-ink-strong) 72%, transparent);
	color: var(--nios-bg);
	cursor: pointer;
}
.nios-tutorial__theater-close[hidden] { display: none; }
.nios-tutorial__theater-close:focus-visible { outline: 2px solid var(--nios-gold-soft); outline-offset: 2px; }

/* 320px phones (media about 288 wide): keep every control inside the bar and the
   play button clear of the cover copy. The time shows the current position only,
   as in the Figma frames; the full "x of y" stays in the seek bar's aria-valuetext.
   Placed after the base rules on purpose (same specificity, later wins). */
@container (max-width: 339px) {
	.nios-tutorial__big-play { top: calc(50% - 26px); left: calc(46% - 26px); width: 52px; height: 52px; border-radius: 26px; }
	.nios-tutorial__time { min-width: 0; margin: 0 8px 0 4px; }
	.nios-tutorial__time [data-tutorial-duration-wrap] { display: none; }
}

/* ---------- Steps ---------- */
.nios-tutorial__steps {
	display: grid;
	gap: 10px;
	flex: none;
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
}
.nios-tutorial__step {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 46px;
	padding: 0 7px;
}
.nios-tutorial__step-num {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	border: 1px solid var(--nios-border);
	border-radius: 16px;
	background: var(--nios-bg-panel);
	color: var(--nios-accent);
	font: 500 14px/20px var(--nios-font);
}
.nios-tutorial__step-copy {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	text-align: right;
	color: var(--nios-ink);
}
.nios-tutorial__step-title { font: 500 15px/22px var(--nios-font); }
.nios-tutorial__step-text { font: 400 12px/17px var(--nios-font); }

/* ---------- Actions ---------- */
.nios-tutorial__actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	flex: none;
	margin-top: auto; /* pinned to the bottom of the sheet */
	padding-top: 24px;
}
.nios-tutorial__primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 52px;
	padding: 0 16px;
	border-radius: 8px;
	background: var(--nios-ink-strong);
	color: var(--nios-white);
	font: 500 16px/24px var(--nios-font);
	text-align: center;
	text-decoration: none;
	transition: background-color .15s ease;
}
.nios-tutorial__primary:hover { background: var(--nios-ink); color: var(--nios-white); }
.nios-tutorial__primary:active { transform: translateY(1px); }
.nios-tutorial__primary:focus-visible { outline: 2px solid var(--nios-accent); outline-offset: 2px; }
.nios-tutorial__secondary {
	min-height: 44px;
	margin: 4px 0 0;
	padding: 0 8px;
	border: 0;
	background: none;
	color: var(--nios-ink);
	font: 500 14px/20px var(--nios-font);
	cursor: pointer;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 4px;
	transition: text-decoration-color .15s ease;
}
.nios-tutorial__secondary:hover { text-decoration-color: currentColor; }
.nios-tutorial__secondary:focus-visible { outline: 2px solid var(--nios-accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Tablet 768–1199 (reference 1024: 944 × 820) ---------- */
@media (min-width: 768px) {
	.nios-tutorial {
		--nt-gap: 40px;
		--nt-chrome: 325px; /* everything in the dialog except the 16:9 media */
		align-items: center;
		padding: var(--nt-gap);
	}
	.nios-tutorial__dialog {
		/* As wide as the frame allows, but never so tall that a common laptop
		   screen has to scroll: the media shrinks with the viewport height. */
		width: min(944px, 100%, max(560px, calc((100vh - 2 * var(--nt-gap) - var(--nt-chrome)) * 16 / 9 + 64px)));
		width: min(944px, 100%, max(560px, calc((100dvh - 2 * var(--nt-gap) - var(--nt-chrome)) * 16 / 9 + 64px)));
		height: auto;
		max-height: 100%;
		border-radius: 20px;
		opacity: 0;
		transform: scale(.97);
		transition: opacity .2s ease, transform .2s ease;
	}
	.nios-tutorial.is-visible .nios-tutorial__dialog { opacity: 1; transform: none; }
	.nios-tutorial__handle { display: none; }
	.nios-tutorial__close { top: 20px; }
	.nios-tutorial__body { padding: 22px 32px 20px; }

	.nios-tutorial__head {
		min-height: 64px;
		/* Figma: the title box runs from 148 (close side) to 172 (logo side). */
		padding: 0 140px 0 116px;
		text-align: center;
	}
	.nios-tutorial__logo { top: 2px; right: 0; width: 112px; }
	.nios-tutorial__title { font-size: 28px; line-height: 41px; }
	.nios-tutorial__intro { margin-top: 1px; font-size: 15px; line-height: 22px; }

	.nios-tutorial__media { border-radius: 14px; }
	.nios-tutorial__volume { display: block; }
	.nios-tutorial__time { margin-inline: 8px 16px; }

	.nios-tutorial__steps {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 16px;
		margin-top: 18px;
	}
	.nios-tutorial__step { justify-content: center; min-height: 74px; }

	.nios-tutorial__actions {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		padding-top: 49px;
	}
	.nios-tutorial__primary { width: 240px; }
	.nios-tutorial__secondary { margin: 0; padding: 0; }
}

/* ---------- Desktop 1200+ (reference 1920 and 1440: 1088 × 880) ---------- */
@media (min-width: 1200px) {
	.nios-tutorial { --nt-gap: 24px; --nt-chrome: 304px; }
	.nios-tutorial__dialog {
		width: min(1088px, 100%, max(640px, calc((100vh - 2 * var(--nt-gap) - var(--nt-chrome)) * 16 / 9 + 64px)));
		width: min(1088px, 100%, max(640px, calc((100dvh - 2 * var(--nt-gap) - var(--nt-chrome)) * 16 / 9 + 64px)));
	}
	.nios-tutorial__actions { padding-top: 28px; }
}

/* ---------- Small phones in landscape (sheet mode, short): the whole video visible at once ---------- */
@media (max-width: 767px) and (max-height: 500px) {
	.nios-tutorial__dialog {
		height: calc(100vh - 8px);
		height: calc(100dvh - 8px);
	}
	.nios-tutorial__handle { display: none; }
	.nios-tutorial__close { top: 8px; }
	.nios-tutorial__body { padding-top: 12px; }
	.nios-tutorial__head { padding: 2px 92px 0 52px; text-align: center; }
	.nios-tutorial__logo { top: 0; right: 0; width: 72px; }
	.nios-tutorial__title { font-size: 20px; line-height: 28px; }
	.nios-tutorial__intro { margin-top: 2px; font-size: 13px; line-height: 18px; }
	.nios-tutorial__media {
		width: min(100%, calc((100vh - 100px) * 16 / 9));
		width: min(100%, calc((100dvh - 100px) * 16 / 9));
		margin: 10px auto 0;
	}
}

/* ---------- Short screens 768+ wide (landscape phones): the whole video visible at once ---------- */
@media (min-width: 768px) and (max-height: 559px) {
	.nios-tutorial { --nt-gap: 8px; }
	.nios-tutorial__dialog {
		/* 116px = gap, compact head and bottom margin, so the media and its controls fit the first view */
		width: min(100%, max(420px, calc((100vh - 116px) * 16 / 9 + 64px)));
		width: min(100%, max(420px, calc((100dvh - 116px) * 16 / 9 + 64px)));
		border-radius: 16px;
	}
	.nios-tutorial__close { top: 10px; }
	.nios-tutorial__body { padding-top: 14px; }
	.nios-tutorial__head { min-height: 0; padding: 0 92px 0 52px; }
	.nios-tutorial__logo { top: 2px; width: 80px; }
	.nios-tutorial__title { font-size: 22px; line-height: 30px; }
	.nios-tutorial__intro { font-size: 14px; line-height: 20px; }
	.nios-tutorial__media { margin-top: 12px; }
	.nios-tutorial__actions { padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
	.nios-tutorial-tab,
	.nios-tutorial-tab__hide,
	.nios-tutorial__backdrop,
	.nios-tutorial__dialog,
	.nios-tutorial__big-play,
	.nios-tutorial__controls,
	.nios-tutorial__caption,
	.nios-tutorial__primary,
	.nios-tutorial-footer__link,
	.nios-tutorial__secondary { transition: none; }
	.nios-tutorial__big-play:hover { transform: none; }
}
