/* TK Blocks — tk/mac-dictation: a Mac desktop where the notch becomes the
   microphone panel. The only thing on its page that moves.

   Moved over from the classic theme's daylight skin unchanged, so it still
   matches the design file "Bobby - Mac hero.html" frame for frame. The
   contract: four keyframes and no more (tkbl-stage-wing, -in, -tick and
   -caret); the panel is transparent when shut and the black cut-out is drawn
   on top of it; the readouts sit inside the panel and are wiped in by its
   edge; the sentence in the document never animates.

   Lengths are the design's pixel values divided by ten: .tkbl-stage is the
   query container, so at the reference width of 1000 px one cqw is ten of
   the design's pixels. The panel keyframes are the exception - they animate
   against .tkbl-stage__notch, so they are percentages of that 394 x 37 box. */

.tkbl-stage-wrap {
	--tkbl-stage-ink: #14161c;
	--tkbl-stage-green: #1f9d55;
	/* The mockup is a picture of an Apple screen, the one place the site's
	   own typeface would lie, so it uses the system stack. */
	--tkbl-stage-ui: -apple-system, "SF Pro Text", system-ui, sans-serif;
	position: relative;
	z-index: 1;
	max-width: 1000px;
	margin-inline: auto;
}

/* The design is 1000 px wide; "wide" in the theme would stretch it to 1200
   and push the document below the fold. */
.tkbl-stage-wrap.alignwide,
.is-layout-constrained > .tkbl-stage-wrap.alignwide {
	max-width: 1000px;
}

.tkbl-stage {
	container-type: inline-size;
	position: relative;
	/* .tk-hero centres its text. A screenshot of a document must not inherit
	   that: nothing on a real Mac is centre-aligned inside a mail window. */
	text-align: left;
	aspect-ratio: 1000 / 520;
	border-radius: 14px 14px 0 0;
	overflow: hidden;
	background: linear-gradient(160deg, #dfe6f1, #f3f1ec);
	box-shadow: 0 30px 60px rgba(20, 24, 34, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
	font-family: var(--tkbl-stage-ui);
	color: var(--tkbl-stage-ink);
}

/* Menu bar */
.tkbl-stage__bar {
	position: absolute;
	inset: 0 0 auto 0;
	height: 3cqw;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 1.6cqw;
	background: rgba(255, 255, 255, 0.5);
	font-size: 1.2cqw;
	font-weight: 500;
	color: rgba(20, 22, 28, 0.72);
}

.tkbl-stage__menu {
	display: flex;
	align-items: center;
	gap: 1.8cqw;
}

.tkbl-stage__status {
	display: flex;
	align-items: center;
	gap: 1.4cqw;
}

.tkbl-stage__menu b {
	font-weight: 700;
}

/* Bobby sits in the menu bar the way any running app does, ringed in green
   because the app is listening. */
.tkbl-stage__mbicon {
	display: block;
	flex: none;
	width: 1.7cqw;
	height: 1.7cqw;
	border-radius: 50%;
	overflow: hidden;
	box-shadow: 0 0 0 0.15cqw rgba(31, 157, 85, 0.9);
}

.tkbl-stage__mbicon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* No portrait set: the ring on its own still reads as a status light. */
.tkbl-stage__mbicon--dot {
	background: rgba(31, 157, 85, 0.16);
}

/* Notch: the black hardware cut-out never moves. What grows out from behind
   it, to both sides, is the panel. */
.tkbl-stage__notch {
	position: absolute;
	left: 50%;
	top: 0;
	transform: translateX(-50%);
	width: 39.4cqw;
	height: 3.7cqw;
	pointer-events: none;
}

.tkbl-stage__wing {
	position: absolute;
	left: 50%;
	top: 0;
	transform: translateX(-50%);
	/* Open: the whole 394 x 37. tkbl-stage-wing shrinks it from here. */
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	border-radius: 0 0 1.5cqw 1.5cqw;
	/* Clips both readouts, so they are wiped in by the widening panel instead
	   of fading in over bare desktop. */
	overflow: hidden;
	background: rgba(255, 255, 255, 0.66);
	box-shadow: inset 0 -0.1cqw 0 rgba(255, 255, 255, 0.7);
	animation: tkbl-stage-wing 3.6s cubic-bezier(0.3, 1.1, 0.4, 1) infinite;
}

/* Drawn over the panel, because the cut-out is hardware and nothing overlaps
   it. Its two top corners curve outwards into the menu bar, which no
   border-radius can express - hence the path. */
.tkbl-stage__cut {
	position: absolute;
	left: 50%;
	top: 0;
	transform: translateX(-50%);
	width: 48.223%;
	height: auto;
	display: block;
}

.tkbl-stage__hud {
	position: absolute;
	top: 0;
	/* Sized against the notch rather than the panel it sits in: the panel's
	   width is what animates, and the readouts must not stretch with it. */
	width: 11.2cqw;
	height: 3cqw;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 0.9cqw;
	animation: tkbl-stage-in 3.6s ease-out infinite;
}

.tkbl-stage__hud--left {
	left: 0;
	padding-left: 0.5cqw;
}

/* Anchored to the panel's right edge, so it travels outwards as it opens. */
.tkbl-stage__hud--right {
	right: 0;
	justify-content: flex-end;
	padding-right: 0.8cqw;
}

.tkbl-stage__label {
	font-size: 1.25cqw;
	font-weight: 600;
	letter-spacing: -0.012em;
	white-space: nowrap;
	color: var(--tkbl-stage-ink);
}

.tkbl-stage__pip {
	display: block;
	flex: none;
	width: 2.2cqw;
	height: 2.2cqw;
	border-radius: 50%;
	overflow: hidden;
	background: #e6eaf1;
	box-shadow: inset 0 0 0 0.1cqw rgba(255, 255, 255, 0.9);
}

.tkbl-stage__pip img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tkbl-stage__pip--dot {
	position: relative;
	background: rgba(31, 157, 85, 0.18);
}

.tkbl-stage__pip--dot::after {
	content: '';
	position: absolute;
	inset: 32%;
	border-radius: 50%;
	background: var(--tkbl-stage-green);
}

.tkbl-stage__wave {
	display: flex;
	align-items: center;
	gap: 0.25cqw;
	height: 1.2cqw;
}

.tkbl-stage__wave i {
	display: block;
	width: 0.25cqw;
	height: 100%;
	border-radius: 0.2cqw;
	background: var(--tkbl-stage-green);
	animation: tkbl-stage-tick 0.78s ease-in-out infinite;
}

.tkbl-stage__wave i:nth-child(2) { animation-delay: 0.08s; }
.tkbl-stage__wave i:nth-child(3) { animation-delay: 0.16s; }
.tkbl-stage__wave i:nth-child(4) { animation-delay: 0.24s; }
.tkbl-stage__wave i:nth-child(5) { animation-delay: 0.32s; }
.tkbl-stage__wave i:nth-child(6) { animation-delay: 0.4s; }
.tkbl-stage__wave i:nth-child(7) { animation-delay: 0.48s; }
.tkbl-stage__wave i:nth-child(8) { animation-delay: 0.56s; }

.tkbl-stage__stop {
	flex: none;
	width: 0.5cqw;
	height: 0.5cqw;
	border-radius: 50%;
	background: rgba(12, 14, 18, 0.4);
	box-shadow: inset 0 0 0 0.05cqw rgba(255, 255, 255, 0.35);
}

/* The document the text lands in. It does not animate: the sentence is the
   one thing on the page a reader is meant to be able to finish. */
.tkbl-stage__doc {
	position: absolute;
	left: 11cqw;
	right: 11cqw;
	top: 11.2cqw;
	bottom: 0;
	padding: 3.4cqw 4cqw;
	border-radius: 1.4cqw 1.4cqw 0 0;
	background: #fff;
	box-shadow: 0 2.4cqw 5.4cqw rgba(28, 34, 48, 0.2), inset 0 0 0 1px rgba(20, 22, 28, 0.08);
	overflow: hidden;
}

.tkbl-stage__to {
	margin: 0 0 1.8cqw;
	font-size: 1.05cqw;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(20, 22, 28, 0.35);
}

.tkbl-stage__text {
	margin: 0;
	max-width: 56cqw;
	font-size: 1.9cqw;
	line-height: 1.75;
	color: var(--tkbl-stage-ink);
	text-wrap: pretty;
}

.tkbl-stage__caret {
	display: inline-block;
	width: 0.25cqw;
	height: 2cqw;
	margin-left: 0.3cqw;
	vertical-align: -0.4cqw;
	background: var(--tkbl-stage-green);
	animation: tkbl-stage-caret 1s steps(1, end) infinite;
}

/* 190 x 30 shut, 394 x 37 open, as percentages of .tkbl-stage__notch. The panel
   is transparent when shut, so the cut-out is all that is left of it. */
@keyframes tkbl-stage-wing {
	0%, 5%    { width: 48.223%; height: 81.081%; background: rgba(255, 255, 255, 0); }
	11%       { width: 83.756%; height: 94.595%; background: rgba(255, 255, 255, 0.5); }
	15%, 86%  { width: 100%;    height: 100%;    background: rgba(255, 255, 255, 0.66); }
	94%       { width: 63.452%; height: 86.486%; background: rgba(255, 255, 255, 0.24); }
	100%      { width: 48.223%; height: 81.081%; background: rgba(255, 255, 255, 0); }
}

@keyframes tkbl-stage-in {
	0%, 12%   { opacity: 0; }
	20%, 88%  { opacity: 1; }
	94%, 100% { opacity: 0; }
}

@keyframes tkbl-stage-tick {
	0%, 100% { transform: scaleY(0.28); }
	50%      { transform: scaleY(1); }
}

@keyframes tkbl-stage-caret {
	0%, 49%   { opacity: 1; }
	50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.tkbl-stage__wing,
	.tkbl-stage__hud,
	.tkbl-stage__caret,
	.tkbl-stage__wave i {
		animation: none !important;
	}

	/* Frozen mid-dictation, which is the state the picture is about anyway:
	   panel open, both readouts lit. */
	.tkbl-stage__wing {
		width: 100%;
		height: 100%;
		background: rgba(255, 255, 255, 0.66);
	}

	.tkbl-stage__hud {
		opacity: 1;
	}
}

/* Below this the mockup stops being readable as a screen; it becomes a
   texture. Keeping the notch and the document, dropping the body copy, is
   more honest than shrinking 11px type to 5px. */
@media (max-width: 560px) {
	.tkbl-stage {
		aspect-ratio: 1000 / 620;
	}

	/* The panel has to grow faster than the stage shrinks - at 390 px an
	   unscaled 394/1000 notch would set "Lytter" in 5 px type - so everything
	   inside it is scaled by the same 580/394. */
	.tkbl-stage__notch {
		width: 58cqw;
		height: 5.4cqw;
	}

	.tkbl-stage__hud {
		width: 16.5cqw;
		height: 4.4cqw;
		gap: 1.3cqw;
	}

	.tkbl-stage__hud--left {
		padding-left: 0.75cqw;
	}

	.tkbl-stage__hud--right {
		padding-right: 1.2cqw;
	}

	.tkbl-stage__pip {
		width: 3.2cqw;
		height: 3.2cqw;
	}

	.tkbl-stage__wave {
		height: 1.8cqw;
		gap: 0.37cqw;
	}

	.tkbl-stage__wave i {
		width: 0.37cqw;
	}

	.tkbl-stage__stop {
		width: 0.74cqw;
		height: 0.74cqw;
	}

	.tkbl-stage__bar {
		height: 4.4cqw;
	}

	.tkbl-stage__mbicon {
		width: 2.5cqw;
		height: 2.5cqw;
	}

	/* The wider panel now reaches where "Arkiv" and "Redigér" used to sit. A
	   real menu bar drops what will not fit too, so only the app name stays. */
	.tkbl-stage__menu span {
		display: none;
	}

	.tkbl-stage__doc {
		left: 6cqw;
		right: 6cqw;
		top: 16cqw;
		padding: 5cqw 5cqw;
	}

	.tkbl-stage__text {
		font-size: 3.1cqw;
		max-width: none;
	}

	.tkbl-stage__to {
		font-size: 2cqw;
		margin-bottom: 3cqw;
	}

	.tkbl-stage__label {
		font-size: 2cqw;
	}

	.tkbl-stage__bar {
		font-size: 2cqw;
	}

	.tkbl-stage__caret {
		width: 0.4cqw;
		height: 3.2cqw;
		vertical-align: -0.6cqw;
	}
}
