/* ==========================================================================
   BSA profile editor — [bsa_profile_editor] on Edit Your Profile (333,
   /members/profile/), inside the members' dashboard template
   Markup reference: docs/shortcodes.md section 6.1 (and 10.4).
   No mockup: designed from the design system's components and tokens.
   Needs tokens.css, typography.css, buttons.css, forms.css and
   member-dashboard.css first. Fields, errors, notices and the error
   summary come from forms.css; this file lays out the editor's sections,
   the image area and the status panel.

   The page itself is one section, one row and a Code module, like the
   other member pages (member-dashboard.css lays those out).

   Rules this file keeps (see forms.css too):
   - Elements profile-editor.js shows and hides with "hidden" get no
     display rule. forms.css's guard covers .bsa-profile-editor [hidden].
   - Field order is never changed with CSS.
   - The gallery grid keeps the list's order (left to right, then down),
     which is the order Move earlier / Move later work in.

   Specificity: as forms.css. ":not(#bsa)" on lists, links and paragraphs
   to beat Divi; headings use the "body.et-db #et-boc .et-l" prefix that
   typography.css uses, plus a class.

   Breakpoints follow Divi: 980px (tablet) and 767px (phone).
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. The editor and its form
   -------------------------------------------------------------------------- */

.bsa-profile-editor {
	display: flex;
	flex-direction: column;
	gap: var(--space-8);
}

/* The form uses the whole content column so the gallery can; its plain
   fields keep forms.css's 640px reading width (section 2). */
.bsa-form.bsa-profile-editor-form {
	max-width: none;
	gap: 0;
}


/* --------------------------------------------------------------------------
   2. Sections: Name and art media, Images, About you, Videos, Contact
   -------------------------------------------------------------------------- */

.bsa-profile-section {
	display: flex;
	flex-direction: column;
	gap: var(--space-6);
}

.bsa-profile-section + .bsa-profile-section {
	margin-top: var(--space-12);
	padding-top: calc(var(--space-8) + var(--space-2));
	border-top: 1px solid var(--border);
}

body.et-db #et-boc .et-l .bsa-profile-section > h2,
.bsa-profile-section > h2:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* Plain fields at the form width; the image area may use the column. */
.bsa-profile-section > .bsa-field,
.bsa-profile-section > fieldset {
	max-width: 640px;
}

/* Video and social rows: their labels look like every other label. */
.bsa-form :is(.bsa-field-video, .bsa-field-social) {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.bsa-form :is(.bsa-field-video, .bsa-field-social) > label {
	font-size: 0.9375rem;
	line-height: 20px;
	font-weight: 600;
	color: var(--ink);
}

/* A group of rows: a little more air between rows than inside one. */
.bsa-form :is(.bsa-profile-field-videos, .bsa-profile-field-social) {
	gap: var(--space-4);
}

.bsa-profile-add-video:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* Art media: three columns of checkboxes (two on a phone), in the
   order WordPress lists them (alphabetical, reading across). */
.bsa-form fieldset.bsa-profile-field-art_media {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--space-2) var(--space-6);
}

.bsa-form fieldset.bsa-profile-field-art_media > :is(p, .bsa-field-error, .bsa-field-hint) {
	grid-column: 1 / -1;
}


/* --------------------------------------------------------------------------
   3. Rich text fields (About, Education, Awards, Publications)
   WordPress's editor: our border and corners on its frame, and the focus
   ring on the whole editor while you're typing in it. The text inside
   the editor's iframe isn't reachable from here.
   -------------------------------------------------------------------------- */

.bsa-profile-editor .wp-editor-wrap {
	border-radius: var(--radius-sm);
}

/* The border goes on TinyMCE's panel, which writes an inline border
   width (hence !important); WordPress's container around it gets none. */
.bsa-profile-editor .wp-editor-container:not(#bsa) {
	border: 0;
}

.bsa-profile-editor .wp-editor-wrap .mce-tinymce:not(#bsa) {
	border: 1px solid var(--border-strong) !important;
	border-radius: var(--radius-sm);
	overflow: hidden;
	box-shadow: none;
}

.bsa-profile-editor .wp-editor-wrap:focus-within {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}

/* The toolbar: Paper, with a hairline under it */
.bsa-profile-editor .mce-tinymce .mce-toolbar-grp:not(#bsa) {
	border-bottom: 1px solid var(--border);
	background: var(--paper);
}

/* An editor with an error */
.bsa-profile-editor .bsa-field:has(> .bsa-field-error) .mce-tinymce:not(#bsa) {
	border: 2px solid var(--danger) !important;
}


/* --------------------------------------------------------------------------
   4. Status panel: where the profile stands, Hide/Show, staff's note
   -------------------------------------------------------------------------- */

.bsa-profile-status {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	max-width: 720px;
	padding: var(--space-6);
	border-radius: var(--radius-md);
	background: var(--paper);
}

.bsa-profile-status > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* The notice after Save, Show, Hide or Ask for review sits on the Paper
   as a white strip, so it still reads as news. */
.bsa-profile-status > .bsa-notice:not(#bsa) {
	background: var(--surface);
}

/* forms.css spaces a notice 24px from what follows; in this panel the
   panel's own 12px gap applies (the notice often leads into the list
   of reasons under it). */
.bsa-profile-editor .bsa-profile-status > .bsa-notice:not(#bsa):not(:last-child) {
	margin-bottom: 0;
}

/* The reasons it isn't public, or what it will need */
.bsa-profile-status > ul:not(#bsa) {
	margin: calc(var(--space-1) * -1) 0 0;
	padding: 0 0 0 1.25em;
	list-style: disc;
	line-height: 28px;
}

.bsa-profile-status > ul > li:not(#bsa) {
	margin: 0;
	padding: 0;
}

.bsa-profile-status a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.bsa-profile-status a:not(#bsa):hover {
	color: var(--blue-700);
	text-decoration-thickness: 2px;
}

/* Hide/Show and Ask for review: hint, then the button */
.bsa-profile-status .bsa-form {
	gap: var(--space-3);
	margin-top: var(--space-2);
}

/* Staff's note when they hid the profile */
.bsa-profile-staff-note {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-6) var(--space-4) calc(var(--space-4) + var(--space-1));
	border-left: 4px solid var(--Orange);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	background: var(--orange-50);
}

.bsa-profile-staff-note > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

body.et-db #et-boc .et-l .bsa-profile-staff-note > blockquote,
.bsa-profile-staff-note > blockquote:not(#bsa) {
	margin: 0;
	padding: var(--space-3) var(--space-4);
	border: 0;
	border-left: 3px solid var(--border-strong);
	background: var(--surface);
	font-family: var(--font-sans);
	font-size: 1rem;
	font-style: normal;
	line-height: 26px;
	color: var(--ink);
}

.bsa-profile-staff-note > blockquote > p:not(#bsa) {
	margin: 0;
	padding: 0;
	font: inherit;
}

/* After a version conflict: "Load the latest version" */
.bsa-profile-reload a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}


/* --------------------------------------------------------------------------
   5. Image area: headshot, gallery (or a student's directory image)
   -------------------------------------------------------------------------- */

.bsa-profile-images {
	display: flex;
	flex-direction: column;
	gap: var(--space-8);
}

.bsa-profile-images > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* Uploads and moves are announced here by the script */
.bsa-profile-images-status:not(#bsa) {
	font-size: 0.9375rem;
	line-height: 24px;
	color: var(--ink-muted);
}

.bsa-profile-images-status:empty {
	display: none;
}

/* Each part (Headshot, Gallery, Directory image) */
.bsa-profile-images-part {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

/* "Headshot" and "Directory image": the h4 style, like the Gallery
   legend (forms.css gives plain fieldsets' legends that style). */
body.et-db #et-boc .et-l .bsa-profile-images-part > h3,
.bsa-profile-images-part > h3:not(#bsa) {
	margin: 0;
	padding: 0;
	font-family: var(--font-sans);
	font-size: 1.25rem;
	line-height: 28px;
	font-weight: 600;
}

.bsa-form .bsa-profile-images-gallery > legend {
	margin-bottom: var(--space-4);
}

/* The gallery's error target for the directory image: no space when
   it has no error in it. */
.bsa-profile-images-part > div:empty {
	display: none;
}

/* 5.1 One image item */
.bsa-profile-image {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	min-width: 0;
}

.bsa-profile-image > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

/* "Image 3" / "Removed image" */
.bsa-profile-image > .bsa-profile-image-number:not(#bsa) {
	font-size: 0.9375rem;
	line-height: 20px;
	font-weight: 600;
	color: var(--ink-muted);
}

/* The preview: artwork whole (never cropped, never rounded) in a Paper
   frame, so tall and wide works line up card to card. */
.bsa-profile-image-preview {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 220px;
	padding: var(--space-2);
	border-radius: var(--radius-none);
	background: var(--paper);
	object-fit: contain;
}

/* The headshot is already a square crop: show it as one, at 200px. */
.bsa-profile-images-headshot .bsa-profile-image-preview {
	width: 200px;
	height: 200px;
	padding: 0;
	object-fit: cover;
}

/* "Not saved yet" / "Needs a title" / "Will be removed when you save":
   a small tag. The words carry the meaning. */
.bsa-profile-image > .bsa-profile-image-state:not(#bsa) {
	align-self: flex-start;
	padding: 2px var(--space-2);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font-size: 0.875rem;
	line-height: 20px;
	font-weight: 600;
	color: var(--ink);
}

/* Move earlier / Move later / Remove (Put back): compact secondary
   buttons, still 44px tall for touch. */
.bsa-profile-image-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.bsa-profile-image-actions > .bsa-button,
.bsa-profile-image-actions > .bsa-button:hover,
.bsa-profile-add-video > .bsa-button,
.bsa-profile-add-video > .bsa-button:hover {
	min-height: 44px;
	padding: var(--space-2) var(--space-4);
	font-size: 0.9375rem;
}

/* Marked for removal: faded and outlined dashed. */
.bsa-profile-image.bsa-profile-image-removed .bsa-profile-image-preview {
	opacity: 0.4;
	filter: grayscale(1);
}

/* 5.2 The gallery: a grid of cards, in list order */
.bsa-profile-gallery-list:not(#bsa) {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
	gap: var(--space-4);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bsa-profile-gallery-list > .bsa-profile-image:not(#bsa) {
	margin: 0;
	padding: var(--space-4);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
}

.bsa-profile-gallery-list > .bsa-profile-image.bsa-profile-image-removed:not(#bsa) {
	border-style: dashed;
	border-color: var(--border-strong);
	background: var(--paper);
}

/* The chosen directory image: a Blue edge as well as its ticked radio. */
.bsa-profile-gallery-list > .bsa-profile-image:has(.bsa-profile-image-card input:checked):not(#bsa) {
	border-color: var(--Blue);
	box-shadow: inset 0 0 0 1px var(--Blue);
}

/* "Use as directory image" sits on one line with its radio */
.bsa-form .bsa-profile-image-card > label {
	font-size: 1rem;
	line-height: 28px;
}

/* Gallery full / save to make room */
.bsa-profile-images-gallery > :is(.bsa-profile-gallery-full, .bsa-profile-gallery-save-hint):not(#bsa) {
	margin: 0;
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-md);
	background: var(--blue-50);
}

/* 5.3 Upload controls: label, then the native file input with its
   button drawn as our secondary button. */
.bsa-profile-upload {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-2);
}

.bsa-profile-upload > label {
	font-size: 0.9375rem;
	line-height: 20px;
	font-weight: 600;
	color: var(--ink);
}

.bsa-profile-upload > input[type=file] {
	max-width: 100%;
	font-family: var(--font-sans);
	font-size: 0.9375rem;
	color: var(--ink-muted);
}

.bsa-profile-upload > input[type=file]::file-selector-button {
	min-height: 44px;
	margin-right: var(--space-3);
	padding: var(--space-2) var(--space-4);
	border: 2px solid var(--Blue);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--Blue);
	font-family: var(--font-sans);
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.bsa-profile-upload > input[type=file]:hover::file-selector-button {
	background: var(--blue-50);
	color: var(--blue-700);
}

.bsa-profile-upload > input[type=file]:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}

.bsa-profile-upload > input[type=file]:disabled::file-selector-button {
	border-color: var(--border);
	background: var(--paper);
	color: var(--ink-muted);
	cursor: not-allowed;
}

/* One row per chosen file: its name, then a progress bar */
.bsa-profile-upload-list:not(#bsa) {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bsa-profile-upload-list:empty {
	display: none;
}

.bsa-profile-upload-list > li:not(#bsa) {
	margin: 0;
	padding: 0;
}

.bsa-profile-upload-list > li > label {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	max-width: 24rem;
	font-size: 0.9375rem;
	line-height: 22px;
	color: var(--ink);
	overflow-wrap: anywhere;
}

.bsa-profile-upload-list progress {
	width: 100%;
	height: 8px;
	accent-color: var(--Blue);
}


/* --------------------------------------------------------------------------
   6. Saving: the Save button stays at the bottom of the window while
   you're anywhere in the form, on a white bar with a hairline above.
   -------------------------------------------------------------------------- */

.bsa-profile-save-wait:not(#bsa) {
	margin: var(--space-8) 0 0;
	padding: 0;
	font-weight: 600;
}

.bsa-profile-save-wait:empty {
	display: none;
}

.bsa-profile-editor-form > .bsa-form-actions {
	position: sticky;
	bottom: 0;
	z-index: 2;
	margin-top: var(--space-8);
	padding: var(--space-4) 0;
	border-top: 1px solid var(--border);
	background: var(--surface);
}


/* --------------------------------------------------------------------------
   7. Lapsed and inactive messages (they replace the editor)
   -------------------------------------------------------------------------- */

/* The lapsed and can't-edit messages use the editor's wrapper: a short
   paragraph and a link, so a small gap, not the editor's 32px. */
.bsa-profile-editor.bsa-profile-editor-lapsed,
.bsa-profile-editor:not(:has(.bsa-profile-editor-form)) {
	gap: var(--space-3);
}

.bsa-profile-editor:not(:has(.bsa-profile-editor-form)) > p:not(#bsa) {
	margin: 0;
	padding: 0;
}

.bsa-profile-editor-lapsed a:not(#bsa),
.bsa-profile-editor-missing a:not(#bsa) {
	color: var(--Blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}


/* --------------------------------------------------------------------------
   8. Phone (767px and narrower)
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.bsa-profile-status {
		padding: var(--space-4);
	}

	.bsa-form fieldset.bsa-profile-field-art_media {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bsa-profile-gallery-list:not(#bsa) {
		grid-template-columns: 1fr;
	}

	.bsa-profile-image-preview {
		height: 200px;
	}
}
