/* AB Toolkit — quizzes, checklists, lead forms.
   Mirrors the theme's DESIGN.md system: Primary #1E5A8A / Accent #F2A93B,
   Playfair Display headings over Inter body, 8px radii.

   The `-ink` variants are deepened for WCAG AA: the spec's Success, Error and
   Accent hues are fine as fills under dark text, but fail 4.5:1 as small text
   on white (or under white text), so text and chips use the ink variants. */

.ab-tool {
	--ab-primary: #1e5a8a;
	--ab-primary-deep: #123c5e;
	--ab-primary-tint: #e9f1f7;
	--ab-primary-line: #c8dcea;
	--ab-accent: #f2a93b;
	--ab-accent-deep: #c9821b;
	--ab-accent-ink: #9a6410;
	--ab-accent-tint: #fdf3e3;
	--ab-accent-line: #f2ddb8;
	--ab-ink: #1c2530;
	--ab-muted: #5a6b7c;
	--ab-line: #dde4ea;
	--ab-canvas: #f5f8fa;
	--ab-card: #ffffff;
	--ab-good: #2e9e6b;
	--ab-good-ink: #1f7a50;
	--ab-good-tint: #eef7f2;
	--ab-bad: #d64545;
	--ab-bad-ink: #b93232;
	--ab-bad-tint: #fbeeee;
	--ab-shadow: 0 10px 30px rgba(28, 37, 48, 0.12);
	--ab-serif: "Playfair Display", Georgia, "Times New Roman", serif;
	--ab-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-family: var(--ab-sans);
	color: var(--ab-ink);
	line-height: 1.6;
}

.ab-tool *, .ab-tool *::before, .ab-tool *::after { box-sizing: border-box; }

.ab-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Shared card ---------- */
.ab-t-card {
	background: var(--ab-card);
	border: 1px solid var(--ab-line);
	border-radius: 0.5rem;
	padding: clamp(1.5rem, 4vw, 2.5rem);
}

.ab-t-eyebrow {
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.4;
	text-transform: uppercase;
	color: var(--ab-primary);
	margin: 0 0 0.5rem;
}

.ab-t-title {
	font-family: var(--ab-serif);
	font-weight: 700;
	font-size: clamp(1.75rem, 4vw, 2.25rem);
	line-height: 1.15;
	margin: 0 0 0.75rem;
}

.ab-t-sub { color: var(--ab-muted); font-size: 1.125rem; margin: 0 0 1rem; }

.ab-t-fine { color: var(--ab-muted); font-size: 0.875rem; margin-top: 0.875rem; }

/* ---------- Buttons ---------- */
.ab-t-btn {
	display: inline-block;
	font-family: var(--ab-sans);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1;
	color: #ffffff;
	background: var(--ab-primary);
	border: 1px solid var(--ab-primary);
	border-radius: 0.5rem;
	padding: 0.875rem 1.75rem;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.15s ease;
	text-decoration: none;
}

.ab-t-btn:hover { background: var(--ab-primary-deep); border-color: var(--ab-primary-deep); transform: translateY(-1px); }
.ab-t-btn:disabled { opacity: 0.45; cursor: default; transform: none; }

/* Accent CTA — gold fill under ink text; gold never carries text itself. */
.ab-t-btn--accent { background: var(--ab-accent); border-color: var(--ab-accent); color: var(--ab-ink); }
.ab-t-btn--accent:hover { background: var(--ab-accent-deep); border-color: var(--ab-accent-deep); color: var(--ab-ink); }

/* Secondary — transparent, 2px Primary border, Primary text. */
.ab-t-btn--ghost {
	background: transparent;
	color: var(--ab-primary);
	border: 2px solid var(--ab-primary);
}
.ab-t-btn--ghost:hover { background: var(--ab-primary-tint); border-color: var(--ab-primary-deep); color: var(--ab-primary-deep); }

.ab-t-btn--bare {
	background: none;
	border: none;
	color: var(--ab-muted);
	font: inherit;
	font-size: 1rem;
	cursor: pointer;
	padding: 0.5rem;
}
.ab-t-btn--bare:hover { color: var(--ab-ink); }
.ab-t-btn--bare:disabled { opacity: 0.35; cursor: default; }

/* ---------- Quiz ---------- */
.ab-quiz { max-width: 760px; margin: 0 auto; }

.ab-q-progress {
	height: 6px;
	background: var(--ab-line);
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 0.375rem;
}

.ab-q-progress .ab-q-bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--ab-primary), var(--ab-accent));
	transition: width 0.35s ease;
}

.ab-q-count {
	font-size: 0.875rem;
	color: var(--ab-muted);
	text-align: right;
	margin-bottom: 1.25rem;
}

.ab-q-question {
	font-family: var(--ab-serif);
	font-size: clamp(1.375rem, 3vw, 1.5rem);
	font-weight: 600;
	line-height: 1.3;
	margin: 0.375rem 0 0.5rem;
}

.ab-q-hint { font-size: 1rem; color: var(--ab-muted); margin: 0 0 1rem; }

.ab-q-opt {
	display: block;
	width: 100%;
	text-align: left;
	font: inherit;
	font-size: 1rem;
	color: var(--ab-ink);
	background: var(--ab-canvas);
	border: 1px solid var(--ab-line);
	border-radius: 0.5rem;
	padding: 0.9375rem 1.125rem;
	margin-bottom: 0.625rem;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.ab-q-opt:hover {
	border-color: var(--ab-primary);
	background: #ffffff;
	transform: translateY(-1px);
}

.ab-q-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 0.75rem; }

/* Result */
.ab-q-emoji { font-size: 3rem; text-align: center; margin-bottom: 0.25rem; }

.ab-q-verdict {
	font-family: var(--ab-serif);
	text-align: center;
	font-size: clamp(1.5rem, 4vw, 1.875rem);
	font-weight: 700;
	line-height: 1.2;
	margin: 0.25rem 0;
}

.ab-q-verdict--good { color: var(--ab-good-ink); }
.ab-q-verdict--mid { color: var(--ab-accent-ink); }
.ab-q-verdict--bad { color: var(--ab-bad-ink); }
.ab-q-verdict--primary { color: var(--ab-primary); }

.ab-q-blurb { text-align: center; color: var(--ab-muted); font-size: 1.125rem; margin: 0 auto 0.5rem; max-width: 56ch; }

.ab-q-meter {
	height: 2.25rem;
	border-radius: 0.5rem;
	border: 1px solid var(--ab-line);
	background: linear-gradient(90deg, var(--ab-bad), var(--ab-accent) 50%, var(--ab-good));
	position: relative;
	margin: 1.375rem 0 0.375rem;
}

.ab-q-meter .ab-q-pin {
	position: absolute;
	top: -6px;
	width: 4px;
	height: calc(100% + 12px);
	background: var(--ab-ink);
	border-radius: 2px;
	transition: left 0.5s ease;
}

.ab-q-meter-labels {
	display: flex;
	justify-content: space-between;
	font-size: 0.875rem;
	color: var(--ab-muted);
	margin-bottom: 1.125rem;
}

.ab-q-scorebar { display: flex; height: 2.5rem; border-radius: 0.5rem; overflow: hidden; margin: 1.25rem 0; font-weight: 600; color: #fff; }
.ab-q-scorebar > div { display: flex; align-items: center; justify-content: center; min-width: 3rem; font-size: 0.9375rem; }
.ab-q-scorebar .ab-a { background: var(--ab-primary); }
.ab-q-scorebar .ab-b { background: var(--ab-accent); color: var(--ab-ink); }

.ab-q-recap { margin-top: 1.25rem; border: 1px solid var(--ab-line); border-radius: 0.5rem; overflow: hidden; }
.ab-q-recap-row {
	display: flex;
	gap: 0.625rem;
	padding: 0.75rem 0.875rem;
	font-size: 0.9375rem;
	border-bottom: 1px solid var(--ab-line);
	align-items: flex-start;
}
.ab-q-recap-row:last-child { border-bottom: none; }
.ab-q-recap-row--plus { background: var(--ab-good-tint); }
.ab-q-recap-row--minus { background: var(--ab-bad-tint); }
.ab-q-recap-row b { display: block; }

.ab-q-tag {
	flex: 0 0 auto;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border-radius: 0.25rem;
	padding: 0.25rem 0.5rem;
	margin-top: 0.125rem;
}
.ab-q-tag--plus { background: var(--ab-good-ink); color: #fff; }
.ab-q-tag--minus { background: var(--ab-bad-ink); color: #fff; }
.ab-q-tag--mid { background: var(--ab-accent); color: var(--ab-ink); }

.ab-q-next {
	margin-top: 1.25rem;
	background: var(--ab-primary-tint);
	border: 1px solid var(--ab-primary-line);
	border-radius: 0.5rem;
	padding: 1.125rem 1.375rem;
}
.ab-q-next h3 {
	font-family: var(--ab-sans);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ab-primary);
	margin: 0 0 0.5rem;
}
.ab-q-next li { font-size: 1rem; margin: 0.375rem 0 0.375rem 1.125rem; }

.ab-q-note {
	margin-top: 1.25rem;
	background: var(--ab-accent-tint);
	border: 1px solid var(--ab-accent-line);
	border-radius: 0.5rem;
	padding: 1.125rem 1.375rem;
	font-size: 1rem;
}
.ab-q-note h3 { font-family: var(--ab-serif); font-size: 1.25rem; font-weight: 600; margin: 0 0 0.5rem; color: var(--ab-accent-ink); }
.ab-q-note p { margin: 0 0 0.5rem; }
.ab-q-note p:last-child { margin-bottom: 0; }

.ab-q-center { text-align: center; }

/* ---------- Lead form ---------- */
.ab-lf {
	background: var(--ab-card);
	border: 1px solid var(--ab-line);
	border-top: 3px solid var(--ab-accent);
	border-radius: 0.5rem;
	box-shadow: var(--ab-shadow);
	padding: clamp(1.375rem, 3vw, 1.75rem);
	margin-top: 1.5rem;
}

.ab-lf h2, .ab-lf h3 { font-family: var(--ab-serif); font-size: 1.5rem; font-weight: 600; line-height: 1.3; margin: 0 0 0.25rem; }
.ab-lf .ab-lf-sub { font-size: 1rem; color: var(--ab-muted); margin: 0 0 1.125rem; }

.ab-lf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }
@media (max-width: 560px) { .ab-lf-row { grid-template-columns: 1fr; } }

.ab-lf input, .ab-lf textarea {
	width: 100%;
	font: inherit;
	font-size: 1rem;
	color: var(--ab-ink);
	background: #fff;
	border: 1px solid var(--ab-line);
	border-radius: 0.5rem;
	padding: 0.75rem 0.875rem;
	margin-bottom: 0.625rem;
}

.ab-lf input:focus, .ab-lf textarea:focus {
	outline: none;
	border: 2px solid var(--ab-primary);
	padding: calc(0.75rem - 1px) calc(0.875rem - 1px);
}

.ab-lf textarea { min-height: 5rem; resize: vertical; }

.ab-lf label {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.ab-lf .ab-hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.ab-lf-ok { text-align: center; padding: 1.25rem 0; }
.ab-lf-ok .ab-lf-ok-emoji { font-size: 2.5rem; }
.ab-lf-ok h2, .ab-lf-ok h3 { color: var(--ab-good-ink); font-size: 1.5rem; margin: 0.375rem 0 0.25rem; }
.ab-lf-ok p { font-size: 1rem; color: var(--ab-muted); margin: 0; }

.ab-lf-error { color: var(--ab-bad-ink); font-size: 0.875rem; margin-top: 0.5rem; display: none; }

/* ---------- Checklist ---------- */
.ab-checklist { max-width: 800px; margin: 0 auto; }

.ab-cl-head { margin-bottom: 1.5rem; }

.ab-cl-progress-wrap {
	position: sticky;
	top: 70px;
	z-index: 10;
	background: rgba(255, 255, 255, 0.86);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border: 1px solid var(--ab-line);
	border-radius: 0.5rem;
	padding: 0.875rem 1.125rem;
	margin-bottom: 1.5rem;
}

.ab-cl-progress-label {
	display: flex;
	justify-content: space-between;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ab-muted);
	margin-bottom: 0.375rem;
}

.ab-cl-progress { height: 8px; background: var(--ab-line); border-radius: 999px; overflow: hidden; }
.ab-cl-progress .ab-cl-bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--ab-primary), var(--ab-accent));
	transition: width 0.3s ease;
}

.ab-cl-section { margin-bottom: 1.5rem; }

.ab-cl-section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	border-bottom: 2px solid var(--ab-accent);
	padding-bottom: 0.5rem;
	margin-bottom: 0.75rem;
}

.ab-cl-section-head h2 {
	font-family: var(--ab-serif);
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
}

.ab-cl-section-head .ab-cl-when {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ab-primary);
	background: var(--ab-primary-tint);
	border-radius: 0.25rem;
	padding: 0.25rem 0.625rem;
	white-space: nowrap;
}

.ab-cl-item {
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
	background: var(--ab-card);
	border: 1px solid var(--ab-line);
	border-radius: 0.5rem;
	padding: 0.8125rem 1rem;
	margin-bottom: 0.5rem;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.ab-cl-item:hover { border-color: var(--ab-primary); }

.ab-cl-item input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.125rem;
	border: 2px solid var(--ab-primary);
	border-radius: 0.25rem;
	cursor: pointer;
	position: relative;
	background: #fff;
}

.ab-cl-item input[type="checkbox"]:checked { background: var(--ab-primary); border-color: var(--ab-primary); }

.ab-cl-item input[type="checkbox"]:checked::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg);
}

.ab-cl-item .ab-cl-text b { font-size: 1rem; }
.ab-cl-item .ab-cl-text span { display: block; font-size: 0.875rem; color: var(--ab-muted); }

.ab-cl-item--done { background: var(--ab-canvas); border-color: var(--ab-line); }
.ab-cl-item--done .ab-cl-text b { text-decoration: line-through; color: var(--ab-muted); }
.ab-cl-item--done .ab-cl-text span { color: var(--ab-muted); }

.ab-cl-tools { display: flex; gap: 0.625rem; flex-wrap: wrap; margin: 1.5rem 0; }

.ab-cl-tip {
	background: var(--ab-accent-tint);
	border: 1px solid var(--ab-accent-line);
	border-radius: 0.5rem;
	padding: 0.8125rem 1rem;
	font-size: 0.9375rem;
	margin: 0.5rem 0 0;
}

/* ---------- Print ---------- */
@media print {
	.ab-header, .ab-footer, .ab-cl-tools, .ab-lf, .ab-cl-progress-wrap { display: none !important; }
	.ab-cl-item { break-inside: avoid; border: 1px solid #bbb; }
	.ab-tool { color: #000; }
	.ab-cl-item input[type="checkbox"] { border-color: #000; }
}

@media (prefers-reduced-motion: reduce) {
	.ab-q-bar, .ab-cl-bar, .ab-q-pin, .ab-t-btn, .ab-q-opt { transition: none; }
}
