/* Free 6-photo check (/free-check/). Loaded after /assets/site.css; uses its tokens.
   The memorable element is the photo slot: a camera viewfinder whose corner brackets turn teal, and whose
   bottom-right bracket becomes a check mark, once a photo is in. Everything else stays quiet. */

/* ---------- Intro ---------- */

.fc-intro {
	padding-bottom: var(--sp-5);
}

.fc-intro__grid {
	display: grid;
	gap: var(--sp-5);
	align-items: start;
}

.fc-title {
	max-width: 18ch;
}

.fc-lead {
	max-width: 38rem;
	margin: 0;
	color: var(--ink-2);
	font-size: var(--fs-lg);
	line-height: 1.5;
}

.fc-privacy {
	padding: var(--sp-4);
	background: var(--teal-50);
	border: 1px solid var(--teal-200);
	border-left: 4px solid var(--teal-700);
	border-radius: 8px;
	color: var(--teal-900);
	font-size: var(--fs-sm);
}

.fc-privacy__title {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	margin-bottom: var(--sp-2);
	color: var(--teal-900);
	font-size: var(--fs-md);
	letter-spacing: 0;
}

.fc-privacy p {
	margin: 0;
}

@media (min-width: 56rem) {
	.fc-intro__grid {
		grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
		gap: var(--sp-7);
	}

	.fc-privacy {
		margin-top: var(--sp-2);
	}
}

/* ---------- Form ---------- */

.fc-work {
	padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.fc-form__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--sp-1) var(--sp-4);
	margin-bottom: var(--sp-4);
	padding-top: var(--sp-5);
	border-top: 1px solid var(--rule);
}

.fc-form__title {
	margin: 0;
	font-size: var(--fs-xl);
}

.fc-form__title:focus {
	outline: none;
}

.fc-form__howto {
	margin: 0;
	color: var(--muted);
	font-size: var(--fs-sm);
}

.fc-slots {
	display: grid;
	gap: var(--sp-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 40rem) {
	.fc-slots {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--sp-4);
	}
}

@media (min-width: 64rem) {
	.fc-slots {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* ---------- Photo slot ---------- */

/* Phone and tablet: the frame sits beside the title and hint; status and buttons run the full card width below.
   (.fc-slot__body uses display: contents so its children join the slot's grid.) From 64rem the card stacks. */
.fc-slot {
	display: grid;
	grid-template-columns: 5.75rem minmax(0, 1fr);
	grid-template-areas:
		"frame title"
		"frame hint"
		"status status"
		"actions actions";
	grid-template-rows: auto 1fr auto auto;
	column-gap: var(--sp-4);
	align-content: start;
	align-items: start;
	padding: var(--sp-3);
	background: var(--surface);
	border: 1px solid var(--rule-strong);
	border-radius: var(--radius-card);
	scroll-margin-top: var(--sp-5);
	transition: border-color 0.15s ease;
}

.fc-slot.is-filled {
	border-color: var(--teal-700);
}

.fc-slot.is-error {
	border-color: var(--sev-lt);
}

.fc-slot__body {
	display: contents;
}

.fc-slot .fc-frame {
	grid-area: frame;
}

.fc-slot__title {
	grid-area: title;
	margin: 0 0 var(--sp-1);
	font-size: var(--fs-lg);
	letter-spacing: 0;
}

.fc-slot__hint {
	grid-area: hint;
	margin: 0;
	color: var(--ink-2);
	font-size: var(--fs-sm);
	line-height: 1.5;
}

.fc-slot__status {
	grid-area: status;
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	min-height: 1.5rem;
	margin: var(--sp-3) 0 var(--sp-2);
	color: var(--muted);
	font-size: var(--fs-xs);
	font-weight: 650;
}

@media (min-width: 64rem) {
	.fc-slot {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		padding: var(--sp-4);
	}

	.fc-slot .fc-frame {
		margin-bottom: var(--sp-4);
	}

	/* Push status and buttons to the bottom so the buttons line up across a row of cards. */
	.fc-slot__status {
		margin-top: auto;
		padding-top: var(--sp-3);
	}
}

.fc-slot__status.is-ok {
	color: var(--teal-800);
}

.fc-slot__status.is-error {
	color: var(--sev-lt);
}

.fc-slot__status.is-busy {
	color: var(--ink-2);
}

.fc-slot__status.is-busy::before {
	content: "";
	width: 0.875rem;
	height: 0.875rem;
	border: 2px solid var(--rule-strong);
	border-top-color: var(--teal-700);
	border-radius: 50%;
	animation: fc-spin 0.8s linear infinite;
}

.fc-slot__actions {
	grid-area: actions;
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
}

.fc-pick {
	position: relative;
	display: inline-flex;
}

/* The real file inputs stay focusable for keyboards and screen readers; their labels are the visible buttons. */
.fc-file {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
	opacity: 0;
}

.fc-file:focus-visible + label {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}

.fc-pick label {
	cursor: pointer;
}

/* On a desktop the camera input already opens the file picker, so the second button would repeat it. */
@media (hover: hover) and (pointer: fine) {
	.fc-pick--library {
		display: none;
	}
}

.fc-remove[hidden] {
	display: none;
}

/* ---------- Viewfinder ---------- */

.fc-frame {
	--bracket: var(--line);
	--bracket-size: 1.05rem;
	--bracket-inset: 0.45rem;
	position: relative;
	display: grid;
	place-items: center;
	aspect-ratio: 1;
	overflow: hidden;
	background:
		linear-gradient(var(--rule) 0 0) center / 1px 30% no-repeat,
		linear-gradient(var(--rule) 0 0) center / 30% 1px no-repeat,
		var(--wash);
	border-radius: 8px;
	color: var(--line);
}

@media (min-width: 64rem) {
	.fc-frame {
		aspect-ratio: 3 / 2;
		--bracket-size: 1.5rem;
		--bracket-inset: 0.75rem;
	}
}

.fc-frame__icon {
	position: relative;
	z-index: 1;
	width: 1.75rem;
	height: 1.75rem;
	padding: 0.35rem;
	background: var(--wash);
	border-radius: 50%;
	box-sizing: content-box;
}

.fc-frame__img {
	position: absolute;
	inset: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fc-frame__corner {
	position: absolute;
	z-index: 2;
	width: var(--bracket-size);
	height: var(--bracket-size);
	border: 0 solid var(--bracket);
	transition: border-color 0.15s ease;
}

.fc-frame__corner--tl {
	top: var(--bracket-inset);
	left: var(--bracket-inset);
	border-top-width: 3px;
	border-left-width: 3px;
	border-top-left-radius: 4px;
}

.fc-frame__corner--tr {
	top: var(--bracket-inset);
	right: var(--bracket-inset);
	border-top-width: 3px;
	border-right-width: 3px;
	border-top-right-radius: 4px;
}

.fc-frame__corner--bl {
	bottom: var(--bracket-inset);
	left: var(--bracket-inset);
	border-bottom-width: 3px;
	border-left-width: 3px;
	border-bottom-left-radius: 4px;
}

.fc-frame__corner--br {
	right: var(--bracket-inset);
	bottom: var(--bracket-inset);
	border-right-width: 3px;
	border-bottom-width: 3px;
	border-bottom-right-radius: 4px;
}

.fc-frame__check {
	position: absolute;
	right: calc(var(--bracket-inset) - 0.2rem);
	bottom: calc(var(--bracket-inset) - 0.2rem);
	z-index: 3;
	display: grid;
	place-items: center;
	width: 1.6rem;
	height: 1.6rem;
	background: var(--teal-700);
	border: 2px solid #fff;
	border-radius: 50%;
	color: #fff;
	opacity: 0;
	transform: scale(0.6);
	transition:
		opacity 0.15s ease,
		transform 0.2s cubic-bezier(0.3, 1.4, 0.6, 1);
}

.fc-frame__check .icon {
	width: 0.95rem;
	height: 0.95rem;
	stroke-width: 3;
}

.is-filled .fc-frame {
	--bracket: #fff;
}

.is-filled .fc-frame__corner {
	filter: drop-shadow(0 0 1px rgb(15 23 42 / 0.7));
}

.is-filled .fc-frame__corner--br {
	opacity: 0;
}

.is-filled .fc-frame__icon {
	display: none;
}

.is-filled .fc-frame__check {
	opacity: 1;
	transform: none;
}

.is-error .fc-frame {
	--bracket: var(--sev-lt);
}

/* ---------- Submit ---------- */

.fc-submit {
	display: grid;
	gap: var(--sp-3);
	max-width: 40rem;
	margin-top: var(--sp-5);
}

.fc-submit__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-3) var(--sp-4);
}

.fc-count {
	margin: 0;
	color: var(--ink-2);
	font-size: var(--fs-sm);
	font-weight: 650;
	font-variant-numeric: tabular-nums;
}

.fc-wait {
	margin: 0;
	color: var(--muted);
	font-size: var(--fs-sm);
}

.fc-error:empty {
	display: none;
}

.fc-error:focus {
	outline: none;
}

.fc-error__box p {
	margin: 0;
}

.fc-error__box .alert__title {
	margin-bottom: var(--sp-1);
}

@media (max-width: 30rem) {
	.fc-submit__row .btn {
		width: 100%;
	}
}

/* ---------- Progress ---------- */

.fc-progress {
	display: grid;
	gap: var(--sp-4);
	max-width: 36rem;
	margin-top: var(--sp-2);
	padding: var(--sp-5);
	border: 1px solid var(--rule-strong);
	border-radius: var(--radius-card);
}

.fc-progress[hidden] {
	display: none;
}

.fc-progress__title {
	margin: 0;
	color: var(--ink);
	font-size: var(--fs-xl);
	font-weight: 700;
	line-height: 1.25;
}

.fc-progress__title:focus {
	outline: none;
}

/* While the AI works the bar has no value: show a slow sweep instead of a stuck 100%. */
.fc-progress .progress__bar:indeterminate {
	background: linear-gradient(90deg, var(--wash) 0 30%, var(--teal-700) 50%, var(--wash) 70% 100%) 0
		0 / 250% 100% var(--wash);
	animation: fc-sweep 1.6s ease-in-out infinite;
}

.fc-progress .progress__bar:indeterminate::-webkit-progress-bar {
	background: transparent;
}

.fc-progress .progress__bar:indeterminate::-moz-progress-bar {
	background: transparent;
}

/* ---------- Results ---------- */

.fc-results {
	max-width: 60rem;
	padding-top: var(--sp-5);
	border-top: 1px solid var(--rule);
}

.fc-results[hidden] {
	display: none;
}

.fc-results__title:focus {
	outline: none;
}

.fc-results__intro {
	max-width: 44rem;
	color: var(--ink-2);
}

.fc-results__summary {
	max-width: 44rem;
	margin-bottom: var(--sp-5);
	color: var(--ink);
	font-size: var(--fs-lg);
	font-weight: 650;
	line-height: 1.4;
}

.fc-results__list {
	display: grid;
	gap: var(--sp-6);
	margin: 0 0 var(--sp-6);
	padding: 0;
	list-style: none;
}

.fc-result__head {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
	margin-bottom: var(--sp-4);
}

.fc-result__img {
	flex: none;
	width: 4.5rem;
	height: 4.5rem;
	object-fit: cover;
	border: 1px solid var(--rule-strong);
	border-radius: 8px;
}

.fc-result__heading {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2) var(--sp-3);
	min-width: 0;
}

.fc-result__title {
	margin: 0;
	font-size: var(--fs-xl);
}

.fc-result__flags {
	margin: 0;
	padding: 0;
	list-style: none;
}

.fc-flag .finding__title {
	font-size: var(--fs-lg);
}

.fc-result__note {
	max-width: 44rem;
	margin: 0;
	color: var(--ink-2);
}

.fc-result__note--retake {
	padding: var(--sp-3) var(--sp-4);
	background: #fffbeb;
	border: 1px dashed #b45309;
	border-radius: var(--radius-control);
	color: #78350f;
}

.fc-result__note--retake p {
	margin: 0 0 var(--sp-2);
}

.fc-result__note--retake p:last-child {
	margin-bottom: 0;
}

.fc-result__lead {
	font-weight: 700;
}

@media (min-width: 40rem) {
	.fc-result__img {
		width: 5.5rem;
		height: 5.5rem;
	}
}

.fc-results__reminder,
.fc-results__disclaimer {
	max-width: 44rem;
	margin-bottom: var(--sp-4);
}

.fc-next {
	max-width: 44rem;
	margin-top: var(--sp-6);
	padding-top: var(--sp-5);
	border-top: 1px solid var(--rule);
}

.fc-next__title {
	font-size: var(--fs-xl);
}

/* ---------- Below the form ---------- */

.fc-more__grid {
	display: grid;
	gap: var(--sp-6);
}

.fc-more__title {
	font-size: var(--fs-xl);
}

.fc-more__sub {
	margin-top: var(--sp-5);
	font-size: var(--fs-lg);
	letter-spacing: 0;
}

.fc-more__col p {
	max-width: 36rem;
}

.fc-more__links {
	display: grid;
	gap: var(--sp-2);
	margin: 0;
	padding: 0;
	list-style: none;
	font-weight: 650;
}

@media (min-width: 56rem) {
	.fc-more__grid {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
		gap: var(--sp-7);
	}
}

/* ---------- Motion ---------- */

@keyframes fc-spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes fc-sweep {
	from {
		background-position: 100% 0;
	}

	to {
		background-position: 0 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fc-slot,
	.fc-frame__corner,
	.fc-frame__check {
		transition: none;
	}

	.fc-slot__status.is-busy::before {
		animation: none;
	}

	.fc-progress .progress__bar:indeterminate {
		animation: none;
		background: repeating-linear-gradient(
			135deg,
			var(--teal-200) 0 0.5rem,
			var(--teal-100) 0.5rem 1rem
		);
	}
}
