/**
 * Moot Premium — WCAG 2.2 AA shared layer.
 * Presentation only. Does not change customs, HMRC, OAuth, Stripe, or matching logic.
 */

:root {
	--moot-focus-ink: #0f172a;
	--moot-focus-halo: #84cc16;
	--moot-lime-text: #3f6212;
	--moot-error-text: #b91c1c;
	--moot-success-text: #15803d;
	--moot-warn-text: #b45309;
	--moot-muted-safe: #475569;
	--moot-target: 44px;
}

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

/* Skip link — first Tab stop */
.moot-skip-link {
	position: absolute;
	left: 12px;
	top: 12px;
	z-index: 100000;
	padding: 0.65rem 1rem;
	background: #0f172a;
	color: #f8fafc;
	font-weight: 700;
	border-radius: 8px;
	text-decoration: underline;
	transform: translateY(-160%);
}

.moot-skip-link:focus,
.moot-skip-link:focus-visible {
	transform: translateY(0);
}

#main-content:focus {
	outline: none;
}

/* Visible keyboard focus on every interactive control */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="option"]:focus-visible,
[role="menuitem"]:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid var(--moot-focus-ink) !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 5px var(--moot-focus-halo) !important;
}

.dash-sidebar a:focus-visible,
.dash-sidebar button:focus-visible,
.fs-sidebar a:focus-visible,
.freight-sidebar a:focus-visible,
.site-header a:focus-visible,
.site-footer a:focus-visible {
	outline-color: #84cc16 !important;
	box-shadow: 0 0 0 5px #ffffff !important;
}

/* Practical 44px targets for primary actions */
.btn,
.moot-signup-btn,
.moot-social-btn,
.fs-btn,
.cp-btn,
.settings-primary-btn,
.settings-outline-btn,
.settings-menu__btn,
.dash-sidebar__cta,
.dash-sidebar__logout,
.freight-btn,
.portal-form__actions .btn {
	min-height: var(--moot-target);
}

.dash-icon-btn,
.settings-menu-btn,
.dash-menu-btn,
.nav-toggle,
.fs-menu-btn,
.freight-menu-btn {
	min-width: var(--moot-target);
	min-height: var(--moot-target);
}

/* Error / invalid fields */
[aria-invalid="true"] {
	border-color: var(--moot-error-text) !important;
}

.moot-field-error,
.portal-alert--error,
.moot-signup-alert--error,
.dash-alert--error,
.fs-alert--error,
.fo-alert {
	color: var(--moot-error-text);
}

.portal-alert:empty,
.moot-signup-alert:empty,
.dash-alert:empty,
.fs-alert:empty {
	display: none;
}

.portal-alert:not(:empty),
.moot-signup-alert:not([hidden]),
.dash-alert:not([hidden]) {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border-radius: 10px;
	font-weight: 600;
}

.portal-form__footer a,
.legal-doc a {
	text-decoration: underline;
}

.portal-alert--error:not(:empty),
.dash-alert--error:not([hidden]),
.fs-alert--error:not([hidden]) {
	background: #fef2f2;
	border: 1px solid #fecaca;
}

/* Colour is never the only status signal — keep text readable */
.settings-hmrc-card__env,
.settings-hmrc__status,
.cp-notice,
.customs-upload-status {
	font-weight: 600;
}

/* Lime never as small text on white */
.moot-lime-text,
.text-lime {
	color: var(--moot-lime-text) !important;
}

/* Zoom / reflow helpers */
img,
video,
svg {
	max-width: 100%;
}

@media (max-width: 320px), (max-width: 40rem) {
	.portal-form__row,
	.moot-signup-field-row,
	.fo-grid {
		grid-template-columns: 1fr !important;
	}
}

/* Reduced motion — theme-wide, not only homepage */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Dialogs: keep the panel in view at 200% zoom */
[role="dialog"] {
	max-width: min(100vw - 1.5rem, 40rem);
	max-height: min(90vh, 100%);
	overflow: auto;
}
