/**
 * BW Customer Portal
 *
 * No palette of its own. Two roles carry all the colour:
 *
 *   --bwcp-primary  document titles, buttons, the active tab
 *   --bwcp-accent   category headings, card borders, inactive tabs
 *
 * Each comes from the customer's own brand colours where set, falling back to
 * Avada's palette (colour 5 and colour 4). Everything else is neutral.
 *
 * Font family is always inherited. Sizes are set only in em, relative to the
 * theme's body text, to give the four levels the client asked for — parent
 * category, child category, document title, description — without fixing
 * any absolute size.
 */

.bwcp-portal {
	--bwcp-primary: var( --awb-color5, #2b2b2b );
	--bwcp-accent: var( --awb-color4, #666666 );
	--bwcp-line: var( --awb-color3, rgba( 0, 0, 0, 0.18 ) );
	--bwcp-surface: rgba( 0, 0, 0, 0.03 );
	--bwcp-muted: rgba( 0, 0, 0, 0.55 );
	--bwcp-radius: 12px;

	max-width: 75rem;
	margin-inline: auto;
}

/* ---------- Header ---------- */

.bwcp-account {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
	gap: 0.5rem 1.25rem;
	margin-bottom: 1.25rem;
	font-size: 0.9375em;
}

.bwcp-portal .bwcp-account-link {
	color: var( --bwcp-primary );
}

.bwcp-portal .bwcp-account .bwcp-button {
	font-size: 1em;
}

/* New password form */
.bwcp-password-form {
	max-width: 28rem;
	margin-top: 1.5rem;
}

.bwcp-portal .bwcp-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0 0 1.25rem;
}

.bwcp-portal .bwcp-field label {
	font-weight: 600;
}

.bwcp-portal .bwcp-field input {
	width: 100%;
	padding: 0.65em 0.9em;
	border: 1px solid var( --bwcp-line );
	border-radius: 3px;
}

.bwcp-portal .bwcp-field input:focus {
	outline: 2px solid var( --bwcp-primary );
	outline-offset: 1px;
}

.bwcp-portal .bwcp-field .bwcp-muted {
	font-size: 0.875em;
}

/* Card buttons stretch on mobile (see Responsive); these stay their own size. */
.bwcp-portal .bwcp-account .bwcp-button,
.bwcp-portal .bwcp-terms-actions .bwcp-button {
	flex: none;
}

@media ( max-width: 600px ) {
	.bwcp-account {
		justify-content: flex-start;
	}
}

.bwcp-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.5rem 2rem;
	padding-bottom: 1.75rem;
	margin-bottom: 2rem;
	border-bottom: 2px solid var( --bwcp-primary );
}

.bwcp-logo img {
	display: block;
	max-width: 180px;
	max-height: 72px;
	width: auto;
	height: auto;
}

.bwcp-customer-name {
	margin: 0;
}

.bwcp-greeting {
	flex: 1 1 22rem;
	max-width: 46rem;
}

.bwcp-greeting p {
	margin: 0 0 0.5em;
}

.bwcp-greeting p:last-child {
	margin-bottom: 0;
}

/* ---------- Search ---------- */

.bwcp-filter {
	margin-bottom: 1.5rem;
}

.bwcp-filter input[type="search"] {
	width: 100%;
	max-width: 24rem;
	padding: 0.65em 0.9em;
	border: 1px solid var( --bwcp-line );
	border-radius: 3px;
	background: #fff;
}

.bwcp-filter input[type="search"]:focus {
	outline: 2px solid var( --bwcp-primary );
	outline-offset: 1px;
	border-color: transparent;
}

/* ---------- Category tabs ----------
   Lines above and below, like Avada's portfolio filters. Buttons are reset
   hard because themes style <button> globally. */

.bwcp-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0 2rem;
	margin: 0 0 2.5rem;
	border-top: 1px solid var( --bwcp-line );
	border-bottom: 1px solid var( --bwcp-line );
}

.bwcp-portal .bwcp-tab {
	position: relative;
	margin: 0;
	padding: 0.7em 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var( --bwcp-accent );
	font: inherit;
	line-height: 1.4;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}

.bwcp-portal .bwcp-tab:hover {
	background: none;
	color: var( --bwcp-primary );
}

.bwcp-portal .bwcp-tab[aria-pressed="true"] {
	color: var( --bwcp-primary );
}

/* The active marker sits on the top line. */
.bwcp-portal .bwcp-tab[aria-pressed="true"]::before {
	content: "";
	position: absolute;
	top: -1px;
	left: 0;
	right: 0;
	height: 3px;
	background: var( --bwcp-primary );
}

.bwcp-portal .bwcp-tab:focus-visible {
	outline: 2px solid var( --bwcp-primary );
	outline-offset: 2px;
}

/* ---------- Category headings ----------
   Parent: largest, upper case, bold, accent colour.
   Child (and deeper): smaller, normal case, bold, accent colour. */

.bwcp-group {
	margin-bottom: 3rem;
}

.bwcp-group:last-of-type {
	margin-bottom: 0;
}

.bwcp-portal .bwcp-group-title {
	margin: 0 0 1.25rem;
	padding: 0;
	border: 0;
	color: var( --bwcp-accent );
	font-weight: 700;
	line-height: 1.3;
}

.bwcp-portal .bwcp-group-depth-0 > .bwcp-group-title {
	margin-bottom: 0.25rem;
	font-size: 1.5em;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.bwcp-portal .bwcp-group .bwcp-group > .bwcp-group-title {
	margin-bottom: 1rem;
	font-size: 1.125em;
	text-transform: none;
	letter-spacing: normal;
}

/* Sub-categories: the heading alone is indented and marked with a dash, so
   it reads as part of the parent above. The cards stay aligned with the
   parent's. */
.bwcp-group .bwcp-group {
	margin: 2rem 0 0;
}

.bwcp-portal .bwcp-group .bwcp-group > .bwcp-group-title {
	margin-left: 1.25rem;
	margin-bottom: 0.5em;
}

.bwcp-portal .bwcp-group .bwcp-group > .bwcp-group-title::before {
	content: "\2013\00a0";
	content: "\2013\00a0" / "";
}

/* A sub-category straight under its parent's heading sits close to it. */
.bwcp-group-title + .bwcp-group {
	margin-top: 0;
}

/* Documents sitting directly under a parent, followed by child groups. */
.bwcp-documents + .bwcp-group {
	margin-top: 2.25rem;
}

/* ---------- Document cards ----------
   Outlined cards in a grid, like the site's FAQ section. */

.bwcp-portal .bwcp-documents {
	display: grid;
	/* Three across at full width, like the FAQ cards; two on tablet; one on phones. */
	grid-template-columns: repeat( auto-fill, minmax( min( 100%, 20rem ), 1fr ) );
	gap: 1.5rem;
	list-style: none;
	/* Space above the cards, on the list rather than each card so it isn't
	   added between rows as well. */
	margin: 1.5em 0 0;
	padding: 0;
}

.bwcp-portal .bwcp-document {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin: 0;
	padding: 1.1rem 1.25rem 1.25rem;
	border: 1px solid var( --bwcp-accent );
	border-radius: var( --bwcp-radius );
	background: #fff;
}

.bwcp-document[hidden] {
	display: none;
}

.bwcp-doc-main {
	min-width: 0;
}

.bwcp-portal .bwcp-doc-title {
	margin: 0;
	padding: 0;
	color: var( --bwcp-primary );
	font-size: 1.125em;
	font-weight: 700;
	line-height: 1.35;
	text-transform: none;
	letter-spacing: normal;
}

.bwcp-portal .bwcp-doc-description {
	margin: 0.6em 0 0;
	font-size: 0.9375em;
	line-height: 1.5;
}

/* Scoped to .bwcp-portal: Avada's own paragraph margins otherwise win. */
.bwcp-portal .bwcp-doc-meta {
	margin: 1rem 0 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem 0.9rem;
	font-size: 0.8125em;
	color: var( --bwcp-muted );
}

.bwcp-doc-type {
	display: inline-block;
	padding: 0.1em 0.5em;
	border: 1px solid var( --bwcp-line );
	border-radius: 2px;
	background: var( --bwcp-surface );
	letter-spacing: 0.03em;
}

/* Document picked out by an email link. Tinted with the customer's own
   colour where the browser can mix it, a neutral surface where it can't. */

.bwcp-portal .bwcp-document.is-focused {
	border-color: var( --bwcp-primary );
	background: var( --bwcp-surface );
	background: color-mix( in srgb, var( --bwcp-primary ) 6%, #fff );
	box-shadow: 0 0 0 2px var( --bwcp-primary );
}

/* Focus is moved here by script for screen readers only. The card isn't in
   the tab order, and the highlight already marks it, so no focus ring. */
.bwcp-document.is-focused:focus,
.bwcp-document.is-focused:focus-visible {
	outline: none;
}

/* ---------- Actions ---------- */

.bwcp-doc-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: auto;
}

.bwcp-button {
	display: inline-block;
	padding: 0.5em 1.1em;
	border: 1px solid var( --bwcp-primary );
	border-radius: 3px;
	background: var( --bwcp-primary );
	color: #fff;
	font-size: 0.9375em;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
	transition: opacity 0.15s ease;
}

.bwcp-button:hover,
.bwcp-button:focus {
	opacity: 0.85;
	color: #fff;
	text-decoration: none;
}

.bwcp-button:focus-visible {
	outline: 2px solid var( --bwcp-accent );
	outline-offset: 2px;
}

.bwcp-button-quiet {
	background: transparent;
	color: var( --bwcp-primary );
}

.bwcp-button-quiet:hover,
.bwcp-button-quiet:focus {
	background: var( --bwcp-surface );
	color: var( --bwcp-primary );
}

/* ---------- States ---------- */

.bwcp-notice {
	margin-bottom: 2rem;
	padding: 0.9rem 1.1rem;
	border-left: 3px solid var( --bwcp-primary );
	background: var( --bwcp-surface );
}

.bwcp-notice p {
	margin: 0;
}

.bwcp-empty {
	padding: 3rem 0;
	text-align: center;
}

.bwcp-muted {
	color: var( --bwcp-muted );
}

.bwcp-no-results {
	padding: 2rem 0;
	color: var( --bwcp-muted );
}

/* ---------- Login ---------- */

.bwcp-portal-login {
	max-width: 26rem;
}

.bwcp-portal-login .login-username,
.bwcp-portal-login .login-password {
	margin-bottom: 1rem;
}

.bwcp-portal-login label {
	display: block;
	margin-bottom: 0.3rem;
}

.bwcp-portal-login input[type="text"],
.bwcp-portal-login input[type="password"] {
	width: 100%;
	padding: 0.65em 0.9em;
	border: 1px solid var( --bwcp-line );
	border-radius: 3px;
}

.bwcp-portal-login .login-submit input {
	padding: 0.65em 1.5em;
	border: 1px solid var( --bwcp-primary );
	border-radius: 3px;
	background: var( --bwcp-primary );
	color: #fff;
	cursor: pointer;
}

/* ---------- Responsive ---------- */

@media ( max-width: 600px ) {

	.bwcp-tabs {
		gap: 0 1.25rem;
	}

	.bwcp-portal .bwcp-group .bwcp-group > .bwcp-group-title {
		margin-left: 0.75rem;
	}

	.bwcp-portal .bwcp-group-depth-0 > .bwcp-group-title {
		font-size: 1.3em;
	}

	.bwcp-button {
		flex: 1 1 auto;
	}
}

@media ( prefers-reduced-motion: reduce ) {

	.bwcp-button {
		transition: none;
	}
}

/* ---------- Before the portal opens: 2FA setup, Terms of Use ---------- */

.bwcp-portal-step {
	max-width: 46rem;
}

.bwcp-step-logo {
	margin-bottom: 1.5rem;
}

.bwcp-portal .bwcp-step-title {
	margin: 0 0 0.75rem;
	color: var( --bwcp-primary );
}

.bwcp-portal .bwcp-terms {
	max-height: 24rem;
	overflow-y: auto;
	margin: 1.5rem 0;
	padding: 1.25rem 1.5rem;
	border: 1px solid var( --bwcp-accent );
	border-radius: var( --bwcp-radius );
	font-size: 0.9375em;
}

.bwcp-portal .bwcp-terms:focus-visible {
	outline: 2px solid var( --bwcp-primary );
	outline-offset: 2px;
}

.bwcp-portal .bwcp-terms h2,
.bwcp-portal .bwcp-terms h3,
.bwcp-portal .bwcp-terms h4 {
	margin: 1.25em 0 0.4em;
	font-size: 1.125em;
	line-height: 1.3;
}

.bwcp-portal .bwcp-terms p {
	margin: 0 0 0.75em;
}

.bwcp-portal .bwcp-terms > :first-child {
	margin-top: 0;
}

.bwcp-portal .bwcp-terms > :last-child {
	margin-bottom: 0;
}

.bwcp-portal .bwcp-terms-form .bwcp-notice {
	margin-bottom: 1rem;
}

.bwcp-portal .bwcp-terms-check {
	display: flex;
	gap: 0.6em;
	align-items: flex-start;
	cursor: pointer;
}

.bwcp-portal .bwcp-terms-check input {
	flex: none;
	width: 1.1em;
	height: 1.1em;
	margin: 0.2em 0 0;
	accent-color: var( --bwcp-primary );
}

.bwcp-portal .bwcp-terms-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	align-items: center;
	margin: 1.5rem 0 0;
}

.bwcp-portal button.bwcp-button {
	cursor: pointer;
	font-family: inherit;
}
