/*
 * Parent journey — country banner + school-location sheet (plan §5, §11).
 * Colours come from the theme's palette (theme.json presets) with the same
 * values as fallbacks, so the engine renders correctly under any theme.
 * The banner and sheet are position:fixed — nothing enters the page flow,
 * so they never shift layout (plan §5 "must not shift the page"). The two
 * in-flow pieces (context line, coverage list, Phase 2) reserve no height
 * for per-visitor content: the line stays hidden until it is filled.
 */
.pgj-root, .pgj-line, .pgj-coverage, .pgc {
	--pgj-primary: var(--wp--preset--color--primary, #1b3beb);
	--pgj-primary-dark: var(--wp--preset--color--primary-dark, #0c1b9e);
	--pgj-ink: var(--wp--preset--color--ink, #03050f);
	--pgj-body: var(--wp--preset--color--body, #3d4570);
	--pgj-muted: var(--wp--preset--color--muted, #5f6894);
	--pgj-line: var(--wp--preset--color--line, #dbe0f1);
	--pgj-surface: var(--wp--preset--color--surface, #eceff9);
	--pgj-base: var(--wp--preset--color--base, #ffffff);
	--pgj-danger: var(--wp--preset--color--danger, #dc2626);
	font-family: inherit;
	color: var(--pgj-body);
	line-height: 1.45;
}
.pgj-root *, .pgj-root *::before, .pgj-root *::after,
.pgj-line *, .pgj-coverage *, .pgc * { box-sizing: border-box; }

/* ── Main button ([pge_next_step]) ─────────────────────────────── */
.pgj-cta-wrap { display: inline-flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pgj-cta {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 48px; padding: 12px 24px; border-radius: 12px;
	background: var(--wp--preset--color--primary, #1b3beb); color: #fff;
	font-weight: 600; font-size: 1.0625rem; text-decoration: none;
}
.pgj-cta:hover { background: var(--wp--preset--color--primary-dark, #0c1b9e); color: #fff; }
.pgj-cta:focus-visible { outline: 3px solid var(--wp--preset--color--accent, #4d93ff); outline-offset: 3px; }
.pgj-cta-support { font-size: .875rem; color: var(--wp--preset--color--muted, #5f6894); }

/* ── Country banner: a fixed bottom bar, never a redirect ─────── */
.pgj-banner {
	position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 99990;
	max-width: 720px; margin: 0 auto;
	display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
	padding: 14px 48px 14px 18px; border-radius: 14px;
	background: var(--pgj-base); border: 1px solid var(--pgj-line);
	box-shadow: 0 10px 30px rgba(3, 5, 15, .16);
}
.pgj-banner__q { flex: 1 1 240px; margin: 0; font-weight: 600; color: var(--pgj-ink); }
.pgj-banner__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Buttons ──────────────────────────────────────────────────── */
.pgj-btn {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 44px; padding: 10px 18px; border-radius: 10px;
	font: inherit; font-weight: 600; font-size: .9375rem; line-height: 1.2;
	cursor: pointer; text-decoration: none; border: 1px solid transparent;
}
.pgj-btn--primary { background: var(--pgj-primary); color: #fff; }
.pgj-btn--primary:hover { background: var(--pgj-primary-dark); color: #fff; }
.pgj-btn--ghost { background: var(--pgj-base); color: var(--pgj-ink); border-color: var(--pgj-line); }
.pgj-btn--ghost:hover { background: var(--pgj-surface); }
.pgj-btn--link { background: none; border: 0; padding: 10px 4px; color: var(--pgj-primary); text-decoration: underline; min-height: 44px; }
.pgj-btn[disabled] { opacity: .6; cursor: progress; }
.pgj-btn:focus-visible, .pgj-x:focus-visible, .pgj-field select:focus-visible, .pgj-choice input:focus-visible + span {
	outline: 3px solid var(--wp--preset--color--accent, #4d93ff); outline-offset: 2px;
}
.pgj-x {
	position: absolute; top: 8px; right: 8px; width: 40px; height: 40px;
	display: grid; place-items: center; border: 0; border-radius: 10px;
	background: none; color: var(--pgj-muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.pgj-x:hover { background: var(--pgj-surface); color: var(--pgj-ink); }

/* ── Sheet: bottom sheet on phones, centred dialog on larger screens ─ */
.pgj-backdrop {
	position: fixed; inset: 0; z-index: 99995;
	display: flex; align-items: flex-end; justify-content: center;
	background: rgba(3, 5, 15, .45);
}
.pgj-sheet {
	position: relative; width: 100%; max-height: 92vh; overflow-y: auto;
	padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
	border-radius: 18px 18px 0 0; background: var(--pgj-base);
	box-shadow: 0 -8px 30px rgba(3, 5, 15, .2);
}
@media (min-width: 640px) {
	.pgj-backdrop { align-items: center; padding: 24px; }
	.pgj-sheet { max-width: 520px; border-radius: 18px; padding: 28px 28px 24px; }
}
@media (prefers-reduced-motion: no-preference) {
	.pgj-sheet { animation: pgj-rise .18s ease-out; }
	@keyframes pgj-rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
}
.pgj-sheet h2 { margin: 0 40px 6px 0; font-size: 1.375rem; line-height: 1.25; color: var(--pgj-ink); }
.pgj-sheet__intro { margin: 0 0 18px; color: var(--pgj-body); }
.pgj-progress { margin: 0 0 14px; font-size: .8125rem; color: var(--pgj-muted); }

.pgj-field { margin: 0 0 16px; border: 0; padding: 0; }
.pgj-field > label, .pgj-field > legend { display: block; margin: 0 0 6px; font-weight: 600; color: var(--pgj-ink); padding: 0; }
.pgj-field select {
	width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px;
	border: 1px solid var(--pgj-line); background: var(--pgj-base); color: var(--pgj-ink); font: inherit; font-size: 1rem;
}
.pgj-field[data-invalid] select { border-color: var(--pgj-danger); }
.pgj-error { margin: 6px 0 0; font-size: .875rem; color: var(--pgj-danger); font-weight: 600; }
.pgj-error::before { content: "! "; }

.pgj-choices { display: grid; gap: 8px; }
.pgj-choice { display: block; cursor: pointer; }
.pgj-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pgj-choice span {
	display: block; padding: 12px 14px; border-radius: 12px;
	border: 1px solid var(--pgj-line); background: var(--pgj-base);
}
.pgj-choice strong { display: block; color: var(--pgj-ink); }
.pgj-choice small { display: block; margin-top: 2px; color: var(--pgj-muted); font-size: .8125rem; }
.pgj-choice input:checked + span { border-color: var(--pgj-primary); box-shadow: inset 0 0 0 1px var(--pgj-primary); background: var(--pgj-surface); }
.pgj-choice input:checked + span strong::after { content: " ✓"; color: var(--pgj-primary); }

.pgj-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.pgj-actions .pgj-btn--primary { flex: 1 1 auto; }
.pgj-status { min-height: 1.2em; margin: 10px 0 0; font-size: .875rem; color: var(--pgj-muted); }
.pgj-status[data-kind="error"] { color: var(--pgj-danger); font-weight: 600; }

.pgj-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Context line: "Grade 8 · North Carolina · Math · NC EOG" ─── */
.pgj-line { margin: 14px 0 0; }
.pgj-line[hidden] { display: none; }
.pgj-line__items { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pgj-line__items li { margin: 0; }
.pgj-chip {
	display: inline-flex; align-items: center; gap: 6px;
	min-height: 40px; padding: 8px 14px; border-radius: 999px;
	font: inherit; font-size: .9375rem; font-weight: 600; line-height: 1.2;
	background: var(--pgj-base); color: var(--pgj-ink); border: 1px solid var(--pgj-line);
}
button.pgj-chip { cursor: pointer; }
/* The edit affordance is a shape as well as a colour: a pencil mark. */
button.pgj-chip::after { content: "✎"; font-weight: 400; color: var(--pgj-muted); }
button.pgj-chip:hover { border-color: var(--pgj-primary); }
button.pgj-chip:focus-visible { outline: 3px solid var(--wp--preset--color--accent, #4d93ff); outline-offset: 2px; }
.pgj-chip--empty { color: var(--pgj-primary); border-style: dashed; }
.pgj-chip--static { font-weight: 500; }
.pgj-chip--exam { background: var(--pgj-surface); border-color: transparent; }
.pgj-chip__icon { font-weight: 700; }
.pgj-line__note { margin: 10px 0 0; font-size: .875rem; color: var(--pgj-body); }
.pgj-line__note a { color: var(--pgj-primary); }
.pgj-line__fine { margin: 4px 0 0; font-size: .8125rem; color: var(--pgj-muted); }

/* ── Local coverage list ([pge_local_coverage]) ───────────────── */
.pgj-coverage { margin: 0; }
.pgj-coverage__h { margin: 0 0 12px; color: var(--pgj-ink); }
.pgj-coverage__region { margin: 18px 0 8px; font-size: 1rem; color: var(--pgj-ink); }
.pgj-coverage__group[hidden] { display: none; }
.pgj-coverage__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.pgj-card { margin: 0; padding: 14px 16px; border: 1px solid var(--pgj-line); border-radius: 14px; background: var(--pgj-base); }
.pgj-card__title { margin: 0 0 6px; font-weight: 600; color: var(--pgj-ink); }
.pgj-card__acr { font-weight: 500; color: var(--pgj-muted); }
.pgj-card__detail, .pgj-card__meta { margin: 6px 0 0; font-size: .875rem; }
.pgj-card__meta { color: var(--pgj-muted); }
.pgj-card__meta a { color: var(--pgj-primary); }
.pgj-coverage__note, .pgj-coverage__empty { margin: 14px 0 0; font-size: .875rem; color: var(--pgj-muted); }
/* Claim: text plus a shape — never colour alone (WCAG 1.4.1). */
.pgj-claim { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .875rem; font-weight: 600; color: var(--pgj-ink); }
.pgj-claim__icon::before { content: "◇"; }
.pgj-claim[data-claim="verified_aligned"] .pgj-claim__icon::before { content: "✓"; color: var(--wp--preset--color--success, #15803d); }
.pgj-claim[data-claim="partial"] .pgj-claim__icon::before { content: "◐"; }
.pgj-claim[data-claim="preview"] .pgj-claim__icon::before { content: "…"; }
