/**
 * The public scan widget.
 *
 * Colours come from the theme's palette rather than being restated here, so
 * the widget follows the page rather than sitting on top of it.
 */

.crk-scan {
	--crk-scan-ink: var(--wp--preset--color--ink, #122948);
	--crk-scan-brand: var(--wp--preset--color--brand, #48769e);
	--crk-scan-paper: var(--wp--preset--color--paper, #fff);
	--crk-scan-line: rgba(18, 41, 72, .14);

	max-width: 720px;
	margin: 0 auto;
	text-align: center;
}

.crk-scan__cta {
	appearance: none;
	display: inline-block;
	border: 0;
	border-radius: 10px;
	background: var(--crk-scan-ink);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	padding: 15px 30px;
	cursor: pointer;
	text-decoration: none;
	transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
	box-shadow: 0 6px 20px rgba(18, 41, 72, .18);
}

.crk-scan__cta:hover,
.crk-scan__cta:focus {
	background: var(--crk-scan-brand);
	transform: translateY(-1px);
	box-shadow: 0 10px 26px rgba(18, 41, 72, .24);
	color: #fff;
}

.crk-scan__note {
	margin: 12px 0 0;
	font-size: .85rem;
	opacity: .7;
}

/* ------------------------------------------------------------------ form */

.crk-scan__form {
	margin: 0 auto;
	max-width: 560px;
	text-align: left;
}

.crk-scan__form.is-open {
	animation: crk-scan-in .28s ease both;
}

@keyframes crk-scan-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

.crk-scan__label {
	display: block;
	font-size: .8rem;
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: uppercase;
	opacity: .65;
	margin-bottom: 8px;
}

.crk-scan__row {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.crk-scan__input {
	flex: 1 1 260px;
	min-width: 0;
	padding: 14px 16px;
	font-size: 1rem;
	border-radius: 10px;
	border: 1px solid var(--crk-scan-line);
	background: var(--crk-scan-paper);
	color: var(--crk-scan-ink);
	transition: border-color .16s ease, box-shadow .16s ease;
}

.crk-scan__input:focus {
	outline: 0;
	border-color: var(--crk-scan-brand);
	box-shadow: 0 0 0 3px rgba(72, 118, 158, .18);
}

.crk-scan__input.is-empty {
	border-color: #c0392b;
	animation: crk-shake .3s ease;
}

@keyframes crk-shake {
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}

.crk-scan__go {
	appearance: none;
	border: 0;
	border-radius: 10px;
	background: var(--crk-scan-ink);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	padding: 14px 26px;
	cursor: pointer;
	transition: background .16s ease;
}

.crk-scan__go:hover:not(:disabled) {
	background: var(--crk-scan-brand);
}

.crk-scan__go:disabled {
	opacity: .55;
	cursor: default;
}

.crk-scan__small {
	margin: 12px 0 0;
	font-size: .8rem;
	opacity: .6;
	line-height: 1.6;
}

/* Off-screen, not display:none — a hidden field a bot cannot see is the point. */
.crk-scan__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* -------------------------------------------------------------- progress */

.crk-scan__progress {
	max-width: 560px;
	margin: 0 auto;
	padding: 28px 0 8px;
	text-align: center;
}

/*
 * A radar sweep rather than a spinner. Forty seconds of a spinner reads as a
 * hung page; something that visibly searches reads as work being done.
 */
.crk-scan__radar {
	position: relative;
	width: 96px;
	height: 96px;
	margin: 0 auto 20px;
}

.crk-scan__radar span {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--crk-scan-brand);
	opacity: 0;
	animation: crk-ping 2.4s cubic-bezier(0, .3, .5, 1) infinite;
}

.crk-scan__radar span:nth-child(2) { animation-delay: .8s; }
.crk-scan__radar span:nth-child(3) { animation-delay: 1.6s; }

.crk-scan__radar::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 12px;
	height: 12px;
	margin: -6px 0 0 -6px;
	border-radius: 50%;
	background: var(--crk-scan-ink);
}

@keyframes crk-ping {
	0%   { transform: scale(.18); opacity: .9; }
	80%  { opacity: .05; }
	100% { transform: scale(1); opacity: 0; }
}

.crk-scan__stage {
	margin: 0 0 16px;
	font-size: 1rem;
	font-weight: 600;
	color: var(--crk-scan-ink);
	transition: opacity .18s ease;
	min-height: 1.5em;
}

.crk-scan__bar {
	height: 6px;
	border-radius: 3px;
	background: rgba(18, 41, 72, .1);
	overflow: hidden;
	max-width: 360px;
	margin: 0 auto;
}

.crk-scan__bar span {
	display: block;
	height: 100%;
	width: 4%;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--crk-scan-brand), var(--crk-scan-ink));
	transition: width .5s ease;
}

@media (prefers-reduced-motion: reduce) {
	.crk-scan__radar span { animation: none; opacity: .25; }
	.crk-scan__form.is-open { animation: none; }
}

/* ---------------------------------------------------------------- report */

.crk-report {
	text-align: left;
	background: var(--crk-scan-paper);
	border: 1px solid var(--crk-scan-line);
	border-radius: 14px;
	padding: 26px 28px;
	box-shadow: 0 10px 40px rgba(18, 41, 72, .08);
	animation: crk-scan-in .3s ease both;
}

.crk-report--empty {
	text-align: center;
}

.crk-report__stamp {
	font-size: .78rem;
	opacity: .6;
	margin: 0 0 14px;
}

.crk-report__counts {
	display: flex;
	gap: 30px;
	flex-wrap: wrap;
	padding-bottom: 18px;
	margin-bottom: 18px;
	border-bottom: 1px solid var(--crk-scan-line);
}

.crk-report__counts strong {
	display: block;
	font-size: 2rem;
	line-height: 1.1;
	color: var(--crk-scan-ink);
}

.crk-report__counts span {
	font-size: .78rem;
	opacity: .65;
}

.crk-report__note {
	font-size: .85rem;
	opacity: .75;
	line-height: 1.65;
	margin: 0 0 16px;
}

.crk-report__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin-bottom: 18px;
}

.crk-chip {
	font-size: .78rem;
	padding: 4px 11px;
	border-radius: 999px;
	border: 1px solid var(--crk-scan-line);
	opacity: .85;
}

.crk-report__prose p {
	margin: 0 0 12px;
	line-height: 1.7;
}

.crk-report__findings {
	list-style: none;
	margin: 18px 0 0;
	padding: 0;
	display: grid;
	gap: 10px;
}

.crk-finding {
	padding: 12px 14px;
	border-radius: 9px;
	background: rgba(18, 41, 72, .04);
	border-left: 3px solid var(--crk-scan-brand);
}

.crk-finding strong {
	display: block;
	margin-bottom: 3px;
}

.crk-finding span {
	font-size: .85rem;
	opacity: .75;
	line-height: 1.6;
}

.crk-finding--high   { border-left-color: #c0693a; }
.crk-finding--medium { border-left-color: #a37c1c; }
.crk-finding--low    { border-left-color: #48769e; }
.crk-finding--info   { border-left-color: #7d8fa3; }

.crk-report__gap {
	margin-top: 26px;
	padding: 22px 24px;
	border-radius: 12px;
	background: var(--crk-scan-ink);
	color: #fff;
	text-align: center;
}

.crk-report__gap h3 {
	margin: 0 0 10px;
	color: #fff;
	font-size: 1.1rem;
}

.crk-report__gap p {
	margin: 0 0 18px;
	opacity: .85;
	line-height: 1.7;
	font-size: .92rem;
}

.crk-report__gap .crk-scan__cta {
	background: #fff;
	color: var(--crk-scan-ink);
	box-shadow: none;
}

.crk-report__gap .crk-scan__cta:hover {
	background: rgba(255, 255, 255, .88);
	color: var(--crk-scan-ink);
}

.crk-report__again {
	appearance: none;
	background: none;
	border: 0;
	margin-top: 18px;
	padding: 0;
	font-size: .85rem;
	color: var(--crk-scan-brand);
	cursor: pointer;
	text-decoration: underline;
}

/*
 * Block themes routinely set `display` on generic elements, which beats the
 * user-agent rule for [hidden] and leaves "hidden" elements on screen. The
 * widget swaps between four panels using that attribute, so it has to win.
 */
.crk-scan [hidden] {
	display: none !important;
}

/*
 * The product shot.
 *
 * Named `crk-pshot`, not `crk-shot`: the theme already owns `.crk-shot` for its
 * placeholder frame, and reusing the name put the theme's fixed-height browser
 * chrome around a differently-sized element — which is why the real screenshot
 * arrived floating in white space.
 */

.crk-pshot {
	height: var(--crk-pshot-h, 620px);
	margin: 0 auto;
	max-width: 1360px;
	overflow: hidden;
	border-radius: 12px;
	background: #0b1522;
}

.crk-pshot__stage {
	width: 1360px;
	/*
	 * Tall enough for the region worth showing, in the shot's own coordinate
	 * space. The container then crops whatever the scale leaves over.
	 */
	height: 1100px;
	transform: scale(var(--crk-pshot-scale, 1));
	transform-origin: 0 0;
}

.crk-pshot__frame {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #0b1522;
}
