/*
 * HMB DevOps Projects Board — WordPress front-end styles.
 * Full-screen shell + the login overlay. The application supplies its own
 * styles; these only frame it inside WordPress and style the sign-in screen.
 */

html,
body.hmbpb-fullscreen {
	margin: 0;
	padding: 0;
	max-width: 100%;
	overflow-x: hidden;
	/* Use the application's own theme variable so the page background follows
	   its light/dark theme (and this higher-specificity rule beats any WordPress
	   global-styles body background). A hard-coded colour here previously broke
	   dark mode — a cream page behind dark tiles. */
	background: var(--bg);
}

/* Secondary fallback: if the shortcode is used WITHOUT the plugin's
   full-screen template (e.g. forced by a page builder), hide the most
   common theme chrome on these pages. The template is the primary method. */
body.hmbpb-fullscreen > header,
body.hmbpb-fullscreen > footer,
body.hmbpb-fullscreen .site-header,
body.hmbpb-fullscreen .site-footer,
body.hmbpb-fullscreen #masthead,
body.hmbpb-fullscreen #colophon {
	display: none !important;
}

#hmbpb-root {
	width: 100%;
}

/* Hide the application until the viewer is authenticated, so no board data
   flashes behind the login screen or during a refresh. The runtime adds
   "hmbpb-ready" to <body> after a successful sign-in. */
body.hmbpb-fullscreen .wrap {
	visibility: hidden;
}

body.hmbpb-fullscreen.hmbpb-ready .wrap {
	visibility: visible;
}

/* ---------- Login overlay ---------- */
/* Must beat the ".hmbpb-login { display:flex }" rule below, otherwise the
   overlay stays visible after login (class specificity outranks [hidden]). */
.hmbpb-login[hidden] {
	display: none !important;
}

.hmbpb-login {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	/* Light theme (default) */
	--hb-bg: #f6f0e4;
	--hb-ink: #2b1f1c;
	--hb-card: #fffdf8;
	--hb-line: #e3d7c1;
	--hb-head: #5e2224;
	--hb-input: #fffdf8;
	--hb-err: #b42318;
	--hb-err-bg: #fbe3e0;
	--hb-err-line: #f0c8c3;
	background: var(--hb-bg);
	color: var(--hb-ink);
}

/* Dark when the OS prefers dark and the viewer hasn't forced light */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .hmbpb-login {
		--hb-bg: #1b1416;
		--hb-ink: #f1e7da;
		--hb-card: #241b1d;
		--hb-line: #3b2e30;
		--hb-head: #f6e8da;
		--hb-input: #1b1416;
		--hb-err: #f08a80;
		--hb-err-bg: #42201e;
		--hb-err-line: #5a2e2a;
	}
}

/* Dark when the viewer explicitly chooses it with the toggle */
:root[data-theme="dark"] .hmbpb-login {
	--hb-bg: #1b1416;
	--hb-ink: #f1e7da;
	--hb-card: #241b1d;
	--hb-line: #3b2e30;
	--hb-head: #f6e8da;
	--hb-input: #1b1416;
	--hb-err: #f08a80;
	--hb-err-bg: #42201e;
	--hb-err-line: #5a2e2a;
}

.hmbpb-login-card {
	width: min(380px, 100%);
	box-sizing: border-box;
	background: var(--hb-card);
	border: 1px solid var(--hb-line);
	border-radius: 16px;
	padding: 28px 26px;
	box-shadow: 0 18px 50px rgba(43, 21, 22, 0.18);
}

.hmbpb-login-card h1 {
	margin: 0 0 4px;
	font-family: Fraunces, Georgia, "Times New Roman", serif;
	font-size: 1.4rem;
	line-height: 1.2;
	color: var(--hb-head);
}

.hmbpb-login-card .hmbpb-sub {
	margin: 0 0 20px;
	font-size: 0.95rem;
	opacity: 0.7;
}

.hmbpb-login-card label {
	display: block;
	margin: 0 0 14px;
	font-size: 0.85rem;
	font-weight: 600;
}

.hmbpb-login-card input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin-top: 6px;
	padding: 12px 14px;
	font-size: 1rem;
	border: 1px solid var(--hb-line);
	border-radius: 10px;
	background: var(--hb-input);
	color: var(--hb-ink);
}

.hmbpb-login-card input[name="pin"] {
	letter-spacing: 0.3em;
	text-align: center;
	font-size: 1.3rem;
}

.hmbpb-login-card input:focus {
	outline: 2px solid #a84344;
	outline-offset: 1px;
	border-color: #a84344;
}

.hmbpb-go {
	width: 100%;
	margin-top: 6px;
	padding: 13px 16px;
	font-size: 1rem;
	font-weight: 700;
	color: #fff;
	background: #a84344;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
}

.hmbpb-go:hover {
	background: #963b3c;
}

.hmbpb-go:disabled {
	opacity: 0.6;
	cursor: default;
}

.hmbpb-err {
	margin: 0 0 14px;
	padding: 10px 12px;
	font-size: 0.85rem;
	color: var(--hb-err);
	background: var(--hb-err-bg);
	border: 1px solid var(--hb-err-line);
	border-radius: 8px;
}

/* Secondary links on the login steps (use backup code, start over, etc.) */
.hmbpb-login-card .hmbpb-link {
	display: block;
	width: 100%;
	margin-top: 10px;
	padding: 4px;
	background: none;
	border: 0;
	font: 600 0.85rem Inter, system-ui, sans-serif;
	color: #a84344;
	cursor: pointer;
	text-align: center;
}

.hmbpb-login-card .hmbpb-link:hover {
	text-decoration: underline;
}

/* Two-factor enrollment panel */
.hmbpb-2fa-setup {
	margin: 0 0 16px;
	padding: 14px;
	border: 1px solid var(--hb-line);
	border-radius: 10px;
	background: color-mix(in srgb, var(--hb-head) 6%, transparent);
}

.hmbpb-2fa-qr {
	display: flex;
	justify-content: center;
	margin: 0 0 14px;
}

.hmbpb-2fa-qr .hmbpb-qr {
	width: 190px;
	height: 190px;
	background: #fff;
	padding: 8px;
	border-radius: 8px;
	border: 1px solid var(--hb-line);
}

.hmbpb-2fa-row {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 10px;
}

.hmbpb-2fa-label {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.7;
}

.hmbpb-2fa-secret {
	font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
	font-size: 1.05rem;
	letter-spacing: 0.08em;
	word-break: break-all;
	color: var(--hb-head);
	user-select: all;
}

.hmbpb-2fa-open {
	display: inline-block;
	font-size: 0.85rem;
	font-weight: 600;
	color: #a84344;
}

.hmbpb-2fa-hint {
	margin: 8px 0 0;
	font-size: 0.8rem;
	opacity: 0.75;
	line-height: 1.4;
}

/* Backup codes list */
.hmbpb-2fa-codes {
	list-style: none;
	margin: 0 0 16px;
	padding: 14px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px 16px;
	border: 1px solid var(--hb-line);
	border-radius: 10px;
	background: var(--hb-input);
	font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
	font-size: 0.95rem;
	letter-spacing: 0.04em;
	color: var(--hb-ink);
	user-select: all;
}

/* ---------- Staff manager modal (admin, in-board) ---------- */
.hmbpb-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	background: rgba(27, 20, 22, 0.55);
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	/* light defaults */
	--mb-card: #fffdf8;
	--mb-ink: #2b1f1c;
	--mb-line: #e3d7c1;
	--mb-sunk: #f6f0e4;
	color: var(--mb-ink);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .hmbpb-modal {
		--mb-card: #241b1d;
		--mb-ink: #f1e7da;
		--mb-line: #3b2e30;
		--mb-sunk: #1b1416;
	}
}

:root[data-theme="dark"] .hmbpb-modal {
	--mb-card: #241b1d;
	--mb-ink: #f1e7da;
	--mb-line: #3b2e30;
	--mb-sunk: #1b1416;
}

.hmbpb-modal-card {
	width: min(680px, 100%);
	max-height: 86vh;
	overflow: auto;
	box-sizing: border-box;
	background: var(--mb-card);
	border: 1px solid var(--mb-line);
	border-radius: 14px;
	padding: 20px 22px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.hmbpb-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.hmbpb-modal-head h2 {
	margin: 0;
	font-family: Fraunces, Georgia, serif;
	font-size: 1.25rem;
	color: #a84344;
}

.hmbpb-modal-x {
	border: 0;
	background: none;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	color: var(--mb-ink);
	opacity: 0.7;
}

.hmbpb-staff-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.hmbpb-staff-table th,
.hmbpb-staff-table td {
	text-align: left;
	padding: 8px 8px;
	border-bottom: 1px solid var(--mb-line);
	vertical-align: middle;
}

.hmbpb-staff-table th {
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.6;
}

.hmbpb-staff-acts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.hmbpb-staff-pin,
.hmbpb-staff-name,
.hmbpb-staff-newpin {
	padding: 7px 9px;
	font-size: 0.85rem;
	border: 1px solid var(--mb-line);
	border-radius: 8px;
	background: var(--mb-sunk);
	color: var(--mb-ink);
	width: 7.5em;
	box-sizing: border-box;
}

.hmbpb-staff-name {
	width: 12em;
}

.hmbpb-mini {
	padding: 7px 11px;
	font-size: 0.82rem;
	font-weight: 600;
	border: 1px solid var(--mb-line);
	border-radius: 8px;
	background: var(--mb-sunk);
	color: var(--mb-ink);
	cursor: pointer;
	white-space: nowrap;
}

.hmbpb-mini.primary {
	background: #a84344;
	border-color: #a84344;
	color: #fff;
}

.hmbpb-mini.danger {
	color: #b42318;
}

.hmbpb-staff-add {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--mb-line);
}

.hmbpb-staff-add h3 {
	width: 100%;
	margin: 0 0 4px;
	font-size: 0.95rem;
}

.hmbpb-staff-err {
	margin: 0 0 12px;
	padding: 9px 11px;
	font-size: 0.85rem;
	color: #b42318;
	background: #fbe3e0;
	border: 1px solid #f0c8c3;
	border-radius: 8px;
}
