/**
 * Sticky QR - hosted page editor.
 *
 * Layered on top of sqr-builder.css so the accordion, buttons, inputs and
 * drop zones are shared. Only what is specific to the page editor lives here.
 */

.sqr-pageui .sqr-loading {
	padding: 40px;
	text-align: center;
	color: var(--sqr-muted);
}

/* ----------------------------------------------------------- Start screen */

.sqr-pg__h {
	margin: 24px 0 14px;
	font-size: 17px;
	font-weight: 800;
}

.sqr-pg__hero {
	background: var(--sqr-surface);
	border: 1px solid var(--sqr-line);
	border-radius: var(--sqr-radius);
	padding: 28px 24px;
	text-align: center;
	box-shadow: var(--sqr-shadow);
}

.sqr-pg__hero h3 {
	margin: 0 0 8px;
	font-size: 21px;
	font-weight: 800;
}

.sqr-pg__hero p {
	margin: 0 auto 18px;
	max-width: 46ch;
	color: var(--sqr-muted);
}

.sqr-pg__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 12px;
}

.sqr-pg__card {
	display: grid;
	gap: 5px;
	justify-items: start;
	text-align: left;
	padding: 16px 17px;
	border: 1px solid var(--sqr-line);
	border-radius: var(--sqr-radius);
	background: var(--sqr-surface);
	cursor: pointer;
	transition: border-color 130ms ease, transform 90ms ease, box-shadow 130ms ease;
}

.sqr-pg__card:hover {
	border-color: var(--sqr-brand);
	transform: translateY(-2px);
	box-shadow: var(--sqr-shadow);
}

.sqr-pg__card strong {
	font-size: 15.5px;
}

.sqr-pg__desc {
	font-size: 13px;
	line-height: 1.45;
	color: var(--sqr-muted);
}

/* A simple glyph per template, drawn in CSS so there are no icon assets. */
.sqr-pg__ic {
	width: 34px;
	height: 34px;
	border-radius: 9px;
	background: color-mix(in srgb, var(--sqr-brand) 12%, transparent);
	position: relative;
	margin-bottom: 4px;
}

.sqr-pg__ic::before {
	content: "";
	position: absolute;
	inset: 9px;
	border: 2px solid var(--sqr-brand);
	border-radius: 3px;
}

.sqr-pg__ic[data-ic="leaf"]::before,
.sqr-pg__ic[data-ic="shield"]::before {
	border-radius: 50% 4px 50% 4px;
}

.sqr-pg__ic[data-ic="link"]::before,
.sqr-pg__ic[data-ic="recycle"]::before {
	border-radius: 50%;
}

.sqr-pg__ic[data-ic="warning"]::before {
	border-radius: 2px;
	transform: rotate(45deg);
	inset: 10px;
}

/* --------------------------------------------------------------- Page list */

.sqr-pg__list {
	display: grid;
	gap: 10px;
}

.sqr-pg__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	padding: 14px 16px;
	border: 1px solid var(--sqr-line);
	border-radius: var(--sqr-radius);
	background: var(--sqr-surface);
}

.sqr-pg__rowmain {
	display: grid;
	gap: 2px;
	min-width: 0;
}

.sqr-pg__meta {
	font-size: 12.5px;
	color: var(--sqr-muted);
}

.sqr-pg__url {
	font-size: 12.5px;
	color: var(--sqr-brand);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sqr-pg__rowacts {
	display: flex;
	gap: 7px;
}

.sqr-pg__wall {
	text-align: center;
	padding: 40px 24px;
	border: 1px dashed var(--sqr-line);
	border-radius: var(--sqr-radius);
	background: var(--sqr-surface);
}

.sqr-pg__wall h3 {
	margin: 0 0 8px;
}

.sqr-pg__wall p {
	max-width: 52ch;
	margin: 0 auto 18px;
	color: var(--sqr-muted);
}

/* ------------------------------------------------------------------ Editor */

.sqr-pg__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}

.sqr-pg__baracts {
	display: flex;
	align-items: center;
	gap: 9px;
	flex-wrap: wrap;
}

.sqr-pg__badge {
	font-size: 12.5px;
	font-weight: 700;
	padding: 5px 11px;
	border-radius: 999px;
	background: #f1f5f9;
	color: #475569;
}

.sqr-pg__badge.is-saved {
	background: #ecfdf5;
	color: #047857;
}

.sqr-pg__badge.is-saving {
	background: #fffbeb;
	color: #92400e;
}

.sqr-pg__badge.is-dirty {
	background: #fef2f2;
	color: #b91c1c;
}

.sqr-pg__cols {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 18px;
	align-items: start;
}

@media (min-width: 960px) {
	.sqr-pg__cols {
		grid-template-columns: minmax(0, 1fr) 390px;
		gap: 24px;
	}
}

.sqr-pg__preview {
	position: sticky;
	top: 20px;
	text-align: center;
}

/* A phone shell, so the customer understands the shape of what they are
   making before they print anything. */
.sqr-pg__phone {
	width: 100%;
	max-width: 372px;
	margin: 0 auto;
	aspect-ratio: 390 / 720;
	background: #0f172a;
	border-radius: 34px;
	padding: 11px;
	box-shadow: 0 18px 44px rgba(15, 23, 42, .22);
}

.sqr-pg__frame {
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 24px;
	background: #fff;
	display: block;
}

/* --------------------------------------------------------------- Repeaters */

.sqr-pg__rep {
	display: grid;
	gap: 9px;
}

.sqr-pg__reprow {
	display: flex;
	gap: 7px;
	align-items: center;
}

.sqr-pg__reprow .sqr-b__input {
	flex: 1 1 0;
	min-width: 0;
}

.sqr-pg__del {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 9px;
	border: 1px solid var(--sqr-line);
	background: var(--sqr-surface);
	color: #b91c1c;
	font-size: 19px;
	line-height: 1;
	cursor: pointer;
}

.sqr-pg__del:hover {
	background: #fef2f2;
	border-color: #fecaca;
}

.sqr-pg__step {
	display: flex;
	gap: 11px;
	padding: 13px;
	border: 1px solid var(--sqr-line);
	border-radius: 12px;
	background: var(--sqr-sunken);
}

.sqr-pg__stepnum {
	flex: 0 0 auto;
	width: 27px;
	height: 27px;
	border-radius: 50%;
	background: var(--sqr-brand);
	color: #fff;
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: 13.5px;
}

.sqr-pg__stepbody {
	display: grid;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
}

.sqr-pg__stepimg {
	width: 54px;
	height: 54px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid var(--sqr-line);
}

/* ------------------------------------------------------------------- Files */

.sqr-pg__files {
	display: grid;
	gap: 8px;
	margin-bottom: 10px;
}

.sqr-pg__file {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 10px 12px;
	border: 1px solid var(--sqr-line);
	border-radius: 11px;
	background: var(--sqr-surface);
}

.sqr-pg__fileic {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 9px;
	background: #fee2e2;
	color: #b91c1c;
	display: grid;
	place-items: center;
	font-size: 10.5px;
	font-weight: 800;
}

.sqr-pg__filetx {
	display: grid;
	min-width: 0;
	flex: 1 1 auto;
}

.sqr-pg__filetx strong {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 14px;
}

.sqr-pg__filetx em {
	font-style: normal;
	font-size: 12px;
	color: var(--sqr-muted);
}

/* ------------------------------------------------------------ Guest mode */

.sqr-pg__badge.is-guest {
	background: #eff6ff;
	color: #1d4ed8;
}

/* Sits under the editor, not in front of it: build first, sign up after. */
.sqr-pg__publish {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	margin-top: 20px;
	padding: 20px 24px;
	border-radius: var(--sqr-radius);
	background: color-mix(in srgb, var(--sqr-brand) 7%, var(--sqr-surface));
	border: 1px solid color-mix(in srgb, var(--sqr-brand) 26%, var(--sqr-line));
}

.sqr-pg__publish strong {
	display: block;
	font-size: 16px;
	margin-bottom: 4px;
}

.sqr-pg__publish p {
	margin: 0;
	max-width: 70ch;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--sqr-muted);
}

/* ------------------------------------------------------------------- Hero
 *
 * A real rendered sample beside a real code. Nothing here is an image, so it
 * can never become a screenshot of a design we no longer ship.
 */

.sqr-hero {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 26px;
	align-items: center;
	padding: 34px 0 30px;
}

@media (min-width: 900px) {
	.sqr-hero {
		grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
		gap: 44px;
		padding: 46px 0 40px;
	}
}

/* Collapses away, rather than vanishing, once building begins. */
.sqr-hero.is-done {
	display: none;
}

.sqr-hero__title {
	margin: 0 0 10px;
	font-size: clamp(1.75rem, 4.4vw, 2.6rem);
	line-height: 1.12;
	font-weight: 800;
	letter-spacing: -0.025em;
}

.sqr-hero__sub {
	margin: 0 0 20px;
	font-size: clamp(1rem, 2.3vw, 1.14rem);
	line-height: 1.55;
	color: var(--sqr-muted);
	max-width: 52ch;
}

.sqr-hero__points {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	display: grid;
	gap: 9px;
}

.sqr-hero__points li {
	position: relative;
	padding-left: 28px;
	font-size: 14.5px;
	font-weight: 600;
}

.sqr-hero__points li::before {
	content: "";
	position: absolute;
	left: 6px;
	top: 5px;
	width: 6px;
	height: 11px;
	border: solid var(--sqr-brand);
	border-width: 0 2px 2px 0;
	transform: rotate(42deg);
}

.sqr-hero__cta {
	padding: 14px 26px;
	font-size: 16px;
}

/* ------------------------------------------------------------- Showcase */

.sqr-hero__show {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 18px;
}

.sqr-hero__phone {
	flex: 0 0 auto;
	width: min(258px, 62vw);
	aspect-ratio: 390 / 760;
	background: #0f172a;
	border-radius: 32px;
	padding: 9px;
	box-shadow: 0 22px 50px rgba(15, 23, 42, .26);
	position: relative;
}

/* The notch, which is what makes it read as a phone at a glance. */
.sqr-hero__phone::before {
	content: "";
	position: absolute;
	top: 15px;
	left: 50%;
	transform: translateX(-50%);
	width: 62px;
	height: 5px;
	border-radius: 4px;
	background: rgba(255, 255, 255, .25);
	z-index: 2;
}

.sqr-hero__frame {
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 24px;
	background: #fff;
	display: block;
	pointer-events: none;   /* it is a sample, not a thing to click */
}

.sqr-hero__code {
	flex: 0 0 auto;
	display: grid;
	justify-items: center;
	gap: 8px;
	padding: 14px 14px 16px;
	border-radius: 16px;
	background: var(--sqr-surface);
	border: 1px solid var(--sqr-line);
	box-shadow: var(--sqr-shadow);
	width: 148px;
	margin-bottom: 26px;
}

.sqr-hero__qr {
	display: grid;
	place-items: center;
	width: 112px;
	height: 112px;
}

.sqr-hero__qrcanvas {
	width: 100% !important;
	height: auto !important;
	display: block;
}

.sqr-hero__caption {
	display: grid;
	gap: 2px;
	text-align: center;
}

.sqr-hero__caption strong {
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.sqr-hero__caption span {
	font-size: 11px;
	line-height: 1.35;
	color: var(--sqr-muted);
}

@media (max-width: 560px) {
	.sqr-hero__show {
		flex-direction: column;
		align-items: center;
		gap: 14px;
	}

	.sqr-hero__code {
		margin-bottom: 0;
		width: 100%;
		max-width: 258px;
		grid-template-columns: auto minmax(0, 1fr);
		justify-items: start;
		align-items: center;
		gap: 14px;
	}

	.sqr-hero__qr {
		width: 84px;
		height: 84px;
	}

	.sqr-hero__caption {
		text-align: left;
	}
}

/* The preview caption changes meaning depending on whose content is showing. */
.sqr-pg__note {
	transition: color 160ms ease;
}

.sqr-pg__note.is-example {
	color: var(--sqr-brand);
	font-weight: 600;
}

/* The compact hero: pitch and a real code, with the phone left to the
   editor's own simulator so the page never shows two of them. */
.sqr-hero--compact {
	grid-template-columns: minmax(0, 1fr);
	gap: 20px;
	padding: 30px 0 6px;
}

@media (min-width: 820px) {
	.sqr-hero--compact {
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		gap: 40px;
	}
}

.sqr-hero--compact .sqr-hero__points {
	margin-bottom: 0;
	grid-auto-flow: row;
}

@media (min-width: 620px) {
	.sqr-hero--compact .sqr-hero__points {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.sqr-hero--compact .sqr-hero__code {
	margin-bottom: 0;
	justify-self: start;
}

@media (min-width: 820px) {
	.sqr-hero--compact .sqr-hero__code {
		justify-self: end;
	}
}

/* ------------------------------------------------- Simulator scrolling
 *
 * The native scrollbar is hidden inside the frame, because a phone does not
 * have one. This slim indicator sits on the bezel instead, driven by the
 * frame reporting its position out by postMessage.
 */

.sqr-pg__phone {
	position: relative;
}

.sqr-pg__scroll {
	position: absolute;
	top: 20px;
	bottom: 20px;
	right: 4px;
	width: 3px;
	border-radius: 3px;
	background: rgba(255, 255, 255, .1);
	opacity: 1;
	transition: opacity 220ms ease;
	pointer-events: none;
}

/* Nothing to scroll: get out of the way. */
.sqr-pg__scroll.is-idle {
	opacity: 0;
}

.sqr-pg__thumb {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 30%;
	border-radius: 3px;
	background: rgba(255, 255, 255, .55);
	transition: top 90ms linear, height 160ms ease;
}

/* A hint that the screen is draggable, without a permanent label. */
.sqr-pg__phone::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	width: 84px;
	height: 4px;
	border-radius: 4px;
	background: rgba(255, 255, 255, .22);
	pointer-events: none;
}

/* The step after publishing: branding the code that points at the page. */
.sqr-pg__next {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	margin-top: 18px;
	padding: 20px 24px;
	border-radius: var(--sqr-radius);
	background: var(--sqr-surface);
	border: 1px solid var(--sqr-line);
	box-shadow: var(--sqr-shadow);
}

.sqr-pg__next strong {
	display: block;
	font-size: 16px;
	margin-bottom: 4px;
}

.sqr-pg__next p {
	margin: 0 0 8px;
	max-width: 68ch;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--sqr-muted);
}

.sqr-pg__nexturl {
	font-size: 12.5px;
	color: var(--sqr-muted);
}

.sqr-pg__nexturl code {
	background: var(--sqr-sunken);
	padding: 2px 7px;
	border-radius: 6px;
	font-size: 12.5px;
	word-break: break-all;
}

/* --------------------------------------------------------------- Steps
 *
 * The deal, stated before anybody scrolls: we host the page, you style the
 * code, you print it, and you change it later.
 */

.sqr-steps {
	margin: 4px 0 26px;
}

.sqr-steps__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 10px;
	counter-reset: none;
}

@media (min-width: 700px) {
	.sqr-steps__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
}

@media (min-width: 1080px) {
	.sqr-steps__list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.sqr-steps__item {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	margin: 0;
	padding: 15px 16px;
	border: 1px solid var(--sqr-line);
	border-radius: 13px;
	background: var(--sqr-surface);
	position: relative;
}

/* A faint rail joining the steps on wide screens. */
@media (min-width: 1080px) {
	.sqr-steps__item:not(:last-child)::after {
		content: "";
		position: absolute;
		top: 30px;
		right: -7px;
		width: 6px;
		height: 2px;
		background: var(--sqr-line);
	}
}

.sqr-steps__num {
	flex: 0 0 auto;
	width: 27px;
	height: 27px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--sqr-brand) 13%, transparent);
	color: var(--sqr-brand);
	display: grid;
	place-items: center;
	font-size: 13.5px;
	font-weight: 800;
}

.sqr-steps__tx {
	display: grid;
	gap: 3px;
	min-width: 0;
}

.sqr-steps__tx strong {
	font-size: 14.5px;
	line-height: 1.3;
}

.sqr-steps__tx span {
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--sqr-muted);
}
