/**
 * SPECIFICITY NOTE
 *
 * The console's own stylesheet targets #dsk-bk-app, which is an id. A
 * class selector never beats an id however many classes it carries, so
 * every rule here that overrides one of those must carry the id too.
 *
 * Getting that wrong is invisible in the CSS and obvious on the screen:
 * the negative margin that pulls the console against the wp-admin menu
 * stayed applied on the front end and dragged the whole app twenty
 * pixels off the left of the window.
 */

/**
 * The front-end shell.
 *
 * The console's own stylesheet does the heavy lifting; this only undoes
 * the assumptions it makes about living inside wp-admin — a negative
 * margin to sit against the admin menu, and a viewport-height rail that
 * has nothing to sit beside out here.
 */

#dsk-bk-app.dsk-bk-app--front {
	margin: 0;
	min-height: 0;
	border-radius: 14px;
	overflow: hidden;
}

#dsk-bk-app.dsk-bk-app--front .dsk-shell {
	min-height: 0;
}

#dsk-bk-app.dsk-bk-app--front .dsk-main {
	padding: 24px;
}

/* ---------------------------------------------------------------
 * Sign-in
 *
 * Deliberately plain and narrow. This is a door, not a dashboard, and
 * it inherits the theme's own typography so it does not look like a
 * different site from the one the practitioner just came from.
 * ------------------------------------------------------------- */

.dsk-portal-login {
	max-width: 380px;
	margin: 40px auto;
	padding: 28px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 14px;
	background: #fff;
}

.dsk-portal-login h2 {
	margin: 0 0 18px;
	font-size: 22px;
}

.dsk-portal-login label {
	display: block;
	margin-bottom: 4px;
	font-size: 14px;
}

.dsk-portal-login input[type="text"],
.dsk-portal-login input[type="password"],
.dsk-portal-login input[type="email"] {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	margin-bottom: 14px;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 8px;
	font-size: 15px;
}

.dsk-portal-login button,
.dsk-portal-login input[type="submit"] {
	width: 100%;
	padding: 11px 16px;
	border: 0;
	border-radius: 8px;
	background: #1f6f4e;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.dsk-portal-login .login-remember {
	font-size: 14px;
	margin-bottom: 12px;
}

.dsk-portal-note {
	padding: 10px 12px;
	border-radius: 8px;
	background: rgba(31, 111, 78, 0.08);
	font-size: 14px;
}

.dsk-portal-note--bad {
	background: rgba(163, 55, 47, 0.08);
	color: #a3372f;
}

.dsk-portal-alt {
	margin-top: 18px;
	font-size: 14px;
}

.dsk-portal-alt summary {
	cursor: pointer;
	padding: 6px 0;
}

.dsk-portal-alt form {
	margin-top: 10px;
}

@media (prefers-color-scheme: dark) {
	.dsk-portal-login {
		background: #161c19;
		border-color: rgba(255, 255, 255, 0.12);
		color: #e8efea;
	}

	.dsk-portal-login input {
		background: #1c2320;
		border-color: rgba(255, 255, 255, 0.16);
		color: #e8efea;
	}
}

/*
 * The console on a theme's page.
 *
 * It was built to sit inside wp-admin, where the browser default font
 * and a known background are guaranteed. A theme provides neither, so
 * the shell states both rather than inheriting whatever the page sets.
 */

#dsk-bk-app.dsk-bk-app--front {
	background: var(--shell, #f6f7f4);
	color: var(--ink, #14201b);
	font-size: 14px;
	line-height: 1.55;
	text-align: left;
	box-shadow: 0 1px 2px rgba(20, 32, 27, 0.04), 0 12px 34px rgba(20, 32, 27, 0.08);
}

#dsk-bk-app.dsk-bk-app--front .dsk-rail {
	min-height: 0;
}

/* A theme's own heading styles must not reach inside the console. */
.dsk-bk-app--front h1,
.dsk-bk-app--front h2,
.dsk-bk-app--front h3 {
	text-transform: none;
	letter-spacing: normal;
	margin-top: 0;
}

.dsk-bk-app--front a {
	box-shadow: none;
}

@media (max-width: 782px) {
	#dsk-bk-app.dsk-bk-app--front .dsk-main {
		padding: 16px;
	}
}

/* ---------------------------------------------------------------
 * Standalone
 *
 * These pages are their own document: no theme stylesheet is loaded,
 * so there is nothing to override and nothing to defend against. What
 * is left is making the console fill the window the way it does in
 * wp-admin, where the browser chrome provided the frame.
 * ------------------------------------------------------------- */

html,
body.dsk-bk-standalone {
	height: 100%;
	margin: 0;
	padding: 0;
}

body.dsk-bk-standalone {
	background: #f6f7f4;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Helvetica Neue", Arial, "Noto Sans", sans-serif;
	-webkit-font-smoothing: antialiased;
}

body.dsk-bk-standalone #dsk-bk-app.dsk-bk-app--front {
	margin: 0;
	border-radius: 0;
	box-shadow: none;
	min-height: 100vh;
	min-height: 100dvh;
}

body.dsk-bk-standalone #dsk-bk-app .dsk-shell {
	min-height: 100vh;
	min-height: 100dvh;
}

/* The rail runs the full height again, as it does in the console. */
body.dsk-bk-standalone #dsk-bk-app .dsk-rail {
	min-height: 100vh;
	min-height: 100dvh;
}

body.dsk-bk-standalone #dsk-bk-app .dsk-main {
	padding: 26px 30px 48px;
}

/*
 * A phone draws the page under its system bars, so the rail and the
 * content are kept clear of them.
 */
body.dsk-bk-standalone #dsk-bk-app .dsk-rail,
body.dsk-bk-standalone #dsk-bk-app .dsk-main {
	padding-top: calc(26px + env(safe-area-inset-top, 0px));
	padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px));
}

/* Sign-in fills the window rather than floating in a page. */
body.dsk-bk-standalone .dsk-portal-login {
	margin: 0;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: calc(100% - 32px);
	max-width: 380px;
}

@media (prefers-color-scheme: dark) {
	body.dsk-bk-standalone {
		background: #10150f;
	}
}

@media (max-width: 782px) {
	body.dsk-bk-standalone #dsk-bk-app .dsk-main {
		padding-left: 16px;
		padding-right: 16px;
	}
}

/*
 * Standalone spacing.
 *
 * The window edge is the only frame these pages have, so the content
 * keeps a margin from it rather than running into the glass.
 */

body.dsk-bk-standalone #dsk-bk-app .dsk-main {
	padding: 24px 40px 48px;
}

/*
 * The rail keeps its own inset. Zeroing it put the icons against the
 * edge of the glass, where a menu has nothing to sit in.
 */
body.dsk-bk-standalone #dsk-bk-app .dsk-rail {
	padding-left: 0;
	padding-right: 0;
}

body.dsk-bk-standalone #dsk-bk-app .dsk-brand,
body.dsk-bk-standalone #dsk-bk-app .dsk-nav-group {
	padding-left: 24px;
	padding-right: 20px;
}

body.dsk-bk-standalone #dsk-bk-app .dsk-nav button,
body.dsk-bk-standalone #dsk-bk-app .dsk-rail-toggle {
	padding-left: 24px;
	padding-right: 20px;
}

body.dsk-bk-standalone #dsk-bk-app .dsk-shell.is-closed .dsk-nav button,
body.dsk-bk-standalone #dsk-bk-app .dsk-shell.is-closed .dsk-rail-toggle,
body.dsk-bk-standalone #dsk-bk-app .dsk-shell.is-closed .dsk-brand {
	padding-left: 0;
	padding-right: 0;
}

@media (max-width: 1100px) {
	body.dsk-bk-standalone #dsk-bk-app .dsk-main {
		padding-left: 24px;
		padding-right: 24px;
	}
}

@media (max-width: 782px) {
	body.dsk-bk-standalone #dsk-bk-app .dsk-main {
		padding-left: 16px;
		padding-right: 16px;
	}
}
