/* Section 4 — layouts (Figma «Landing · Layouts» 1440 wide, «Mobile · Layouts» 390 wide; the seven states in
   «Landing · Layouts · States»). The café site stays put while the page scrolls; only its story bar changes.

   Computers: the words and the list of layouts on the right, the browser on the left, both sticky in one grid row
   that the spacer makes tall. Below 1024px: the words scroll away and a phone, with a seven-part progress bar over
   it, sticks. layouts.js adds .is-live (the spacer, the stacked bars) and picks the layout; without it this is the
   site with its circles. */

.layouts {
	--pin: max(calc(var(--admin-bar) + 24px), calc((100svh - var(--stage-h)) / 2)); /* The landing's nav doesn't float. */
	--screen-h: clamp(420px, calc(100svh - 230px), 560px);
	--stage-h: calc(var(--screen-h) + 64px); /* The browser and the shortcode under it. */
	--step: 70svh; /* Scroll per layout. */
	--bar-k: 0.78; /* The bars' scale: smaller than the section's own size (the hero's bar keeps it), smaller still in the phone. */
	--bar-gap: 28px; /* Between the bar and what is under it. */
	--at: 0;
	padding: 80px 0 120px; /* .sec: the frame (base.css). */
}

.layouts__inner {
	width: var(--container);
	margin: 0 auto;
	padding: 70px 40px 0;
}

.layouts__track {
	display: grid;
	grid-template-columns: minmax(280px, 360px) minmax(0, 720px);
	justify-content: space-between;
	column-gap: 40px;
	align-items: start;
}

.layouts__intro,
.layouts__stage {
	position: sticky;
	top: var(--pin);
	grid-row: 1;
}
.layouts__intro { grid-column: 1; }
.layouts__stage { grid-column: 2; }

.layouts__spacer { display: none; grid-row: 1; grid-column: 1 / -1; }
.layouts.is-live .layouts__spacer {
	display: block;
	height: calc(var(--stage-h) + (var(--count) - 1) * var(--step));
}

/* Words --------------------------------------------------------------------------------------------------------- */

.layouts__title {
	font-size: clamp(30px, 3.06vw, 44px);
	font-weight: 900;
	line-height: 1.3;
}
.layouts__title span { display: block; color: var(--subtle); }

.layouts__lead {
	margin-top: 16px;
	color: var(--muted);
	font-size: 15px;
	line-height: 1.75;
}

/* The list of layouts, with a rail at its right that fills as the page scrolls. */
.layouts__steps {
	display: flex;
	flex-direction: row-reverse; /* RTL: the rail at the right. */
	gap: 18px;
	margin-top: 36px;
}
.layouts__list { flex: 1; margin: 0; padding: 0; list-style: none; }

.layouts__step {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	height: 42px;
	padding: 0;
	border: 0;
	background: none;
	color: rgba(21, 19, 31, 0.38);
	font-size: 15px;
	font-weight: 500;
	text-align: start;
	cursor: pointer;
	transition: color 0.3s;
}
.layouts__step:hover { color: rgba(21, 19, 31, 0.7); }
.layouts__step:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: 6px; }
.layouts__num {
	color: rgba(21, 19, 31, 0.3);
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 500;
	transition: color 0.3s;
}
.layouts__step.is-active { color: var(--ink); font-size: 18px; font-weight: 700; }
.layouts__step.is-active .layouts__num { color: var(--coral); }

.layouts__rail {
	position: relative;
	flex: none;
	width: 3px;
	overflow: hidden;
	border-radius: 2px;
	background: var(--line);
}
.layouts__rail i {
	position: absolute;
	inset: 0;
	border-radius: 2px;
	background: var(--coral);
	transform: scaleY(calc((var(--at) + 1) / var(--count)));
	transform-origin: top;
	transition: transform 0.55s var(--ease-out);
}

.layouts__hint {
	margin-top: 28px;
	color: rgba(21, 19, 31, 0.45);
	font-size: 13px;
	font-weight: 500;
	white-space: pre;
}

/* The phone's progress (below 1024px) ---------------------------------------------------------------------------- */

.layouts__progress { display: none; }

/* The browser ----------------------------------------------------------------------------------------------------- */

.layouts__screen {
	position: relative;
	height: var(--screen-h);
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 24px;
	background: var(--white);
	box-shadow: 0 30px 70px rgba(21, 19, 31, 0.1);
}

.layouts__chrome {
	position: relative;
	height: 42px;
	background: var(--sand);
}
.layouts__lights { position: absolute; top: 16px; left: 16px; display: flex; gap: 6px; direction: ltr; }
.layouts__lights i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.layouts__lights i:nth-child(2) { background: #febc2e; }
.layouts__lights i:nth-child(3) { background: #28c840; }
.layouts__url {
	position: absolute;
	top: 9px;
	right: 14px;
	left: 70px;
	height: 24px;
	border-radius: 8px;
	background: var(--white);
	color: var(--muted);
	font-size: 11px;
	line-height: 24px;
	text-align: center;
}
.layouts__island { display: none; }

.layouts__site {
	--bar-h: 0px;
	position: relative;
	padding: 20px 32px 0;
}

.layouts__cafe {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 32px;
}
.layouts__brand { font-size: 17px; font-weight: 900; }
.layouts__links {
	display: flex;
	align-items: center;
	gap: 18px;
	color: var(--muted);
	font-size: 12px;
	font-weight: 500;
}
.layouts__links b {
	padding: 6px 14px;
	border-radius: 999px;
	background: var(--ink);
	color: var(--white);
	font-weight: 600;
}
.layouts__menu { display: none; }

.layouts__bars { position: relative; margin-top: 22px; }

/* Without layouts.js: the circles only. */
.layouts__bar:not(.is-active) { display: none; }

/* Live: all seven stacked. The next one comes in from the right (a wipe, so its cards seem to arrive one after
   another) as the last one fades; only opacity, transform and clip-path move. The insets leave room for what
   Pelk draws outside a bar's box (pins, the nav buttons' shadows). */
.layouts.is-live .layouts__bars { height: 0; }
.layouts.is-live .layouts__bar {
	position: absolute;
	top: 0;
	right: 0;
	display: block;
	width: calc(100% / var(--bar-k)); /* Drawn wider, then scaled down to fit. */
	visibility: hidden;
	opacity: 0;
	transform: translateY(14px) scale(var(--bar-k));
	transform-origin: top right;
	clip-path: inset(-24px -24px -24px 100%);
	pointer-events: none;
	transition:
		opacity 0.3s ease,
		transform 0.55s var(--ease-out),
		clip-path 0.6s var(--ease-out),
		visibility 0s linear 0.6s;
}
.layouts.is-live .layouts__bar.is-active {
	visibility: visible;
	opacity: 1;
	transform: scale(var(--bar-k));
	clip-path: inset(-24px -24px -24px -24px);
	pointer-events: auto;
	transition-delay: 0s;
}

/* What is under the bar moves with it, by transform; the browser's height never changes. */
.layouts__below {
	display: block;
	margin-top: 24px;
}
/* The bars' box has no height when live, so the gap goes into the transform (a margin would fold into the box's). */
.layouts.is-live .layouts__below {
	margin-top: 0;
	transform: translateY(calc(var(--bar-h) + var(--bar-gap)));
	transition: transform 0.55s var(--ease-out);
}
.layouts.is-instant .layouts__bar,
.layouts.is-instant .layouts__below,
.layouts.is-instant .layouts__rail i { transition: none; }

.layouts__heading { display: none; }
.layouts__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 200px;
	grid-template-areas: "main side"; /* RTL: the big block at the right. */
	gap: 24px;
	margin-bottom: 24px;
}
.layouts__main { grid-area: main; display: flex; flex-direction: column; gap: 10px; }
.layouts__side { grid-area: side; display: flex; flex-direction: column; gap: 12px; }
.layouts__side i { height: 58px; border-radius: 14px; background: var(--sand); }
.layouts__block { height: 134px; border-radius: 16px; background: var(--sand); }
.layouts__line { width: 100%; height: 6px; border-radius: 3px; background: var(--sand-line); opacity: 0.7; }
.layouts__line:nth-child(2) { width: 60%; height: 10px; }
.layouts__line--short { width: 70%; }

/* The shortcode of the layout on screen, under the browser. */
.layouts__code {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 44px;
	margin-top: 20px;
}
.layouts__code code {
	padding: 8px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: #faf7f5;
	color: rgba(21, 19, 31, 0.7);
	font-size: 12px;
	line-height: 18px;
}
.layouts__code code b { color: var(--coral); font-weight: 400; }
.layouts__copy {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: var(--white);
	color: var(--muted);
	cursor: pointer;
	transition: color 0.2s, border-color 0.2s;
}
.layouts__copy:hover { color: var(--ink); border-color: rgba(21, 19, 31, 0.2); }
.layouts__copy .icon { width: 15px; height: 15px; }
.layouts__copy .icon + .icon,
.layouts__copy.is-copied .icon:first-child { display: none; }
.layouts__copy.is-copied .icon + .icon { display: block; color: var(--coral); }

@media (max-width: 1180px) {
	.layouts__inner { padding-inline: 0; }
}

/* Tablets and phones: the words scroll away, the phone sticks ---------------------------------------------------- */

@media (max-width: 1023px) {
	.layouts {
		--pin: calc(var(--admin-bar) + 16px);
		--screen-h: clamp(400px, calc(100svh - var(--pin) - 92px), 560px);
		--step: 60svh;
		--bar-k: 0.64;
		--bar-gap: 18px;
		padding: 36px 0 40px;
	}
	.layouts__inner { padding-top: 48px; }

	.layouts__track { display: block; }
	.layouts__intro { position: static; }
	.layouts__title { font-size: 26px; line-height: 1.4; }
	.layouts__title span { display: inline; }
	.layouts__lead { margin-top: 10px; font-size: 14px; line-height: 1.7; }
	.layouts__steps,
	.layouts__hint,
	.layouts__code { display: none; }

	.layouts__stage {
		width: 300px;
		margin: 28px auto 0;
	}
	.layouts.is-live .layouts__spacer { height: calc((var(--count) - 1) * var(--step)); }

	.layouts__progress { display: block; margin-bottom: 16px; }
	.layouts__now {
		display: flex;
		align-items: center;
		justify-content: space-between;
		flex-direction: row-reverse; /* RTL: the name at the right, the count at the left. */
		height: 26px;
	}
	.layouts__count {
		color: rgba(21, 19, 31, 0.4);
		font-family: var(--mono);
		font-size: 11px;
	}
	.layouts__count b { color: var(--ink); font-weight: 500; }
	.layouts__label { display: flex; align-items: baseline; gap: 8px; }
	.layouts__label code { color: var(--coral); font-size: 11px; }
	.layouts__label b { font-size: 17px; font-weight: 700; }
	.layouts__segs { display: flex; gap: 4px; margin-top: 10px; }
	.layouts__segs i {
		flex: 1;
		height: 3px;
		border-radius: 2px;
		background: rgba(21, 19, 31, 0.1);
		transition: background-color 0.3s;
	}
	.layouts__segs i.is-on { background: var(--coral); }
	.layouts__segs i:first-child { background: var(--coral); } /* Before layouts.js: the first. */

	/* The phone. */
	.layouts__screen {
		border: 8px solid var(--ink);
		border-radius: 44px;
		box-shadow: 0 24px 50px rgba(21, 19, 31, 0.12);
	}
	.layouts__chrome { height: 40px; background: var(--white); }
	.layouts__lights,
	.layouts__url { display: none; }
	.layouts__island {
		position: absolute;
		top: 8px;
		left: 50%;
		display: block;
		width: 84px;
		height: 24px;
		border-radius: 999px;
		background: var(--ink);
		transform: translateX(-50%);
	}
	.layouts__site { padding: 8px 14px 0; }
	.layouts__brand { font-size: 15px; }
	.layouts__links { display: none; }
	.layouts__menu { display: grid; color: var(--ink); }
	.layouts__menu .icon { width: 20px; height: 20px; }
	.layouts__bars { margin-top: 12px; }

	.layouts__below { margin-top: 18px; }
	.layouts__heading { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 700; }
	.layouts__row { display: block; margin-bottom: 14px; }
	.layouts__side { display: none; }
	.layouts__main {
		display: grid;
		grid-template-columns: 64px minmax(0, 1fr);
		grid-template-rows: auto auto;
		align-content: center;
		column-gap: 12px;
		row-gap: 8px;
		height: 64px;
	}
	.layouts__block { grid-row: 1 / 4; height: 64px; border-radius: 14px; }
	.layouts__line { grid-column: 2; height: 6px; }
	.layouts__line:nth-child(2) { width: 75%; height: 8px; }
	.layouts__line--short { display: none; }
}

@media (max-width: 767px) {
	.layouts__inner { padding-top: 48px; }
}
