/**
 * Files on community posts: the button on the forms, the list of chosen
 * files, the figures and the file rows under a post, a group's Files tab.
 *
 * Painted with the child theme's tokens (design-tokens.css, docs/design-
 * tokens.md): the secondary button is the guide's outlined one, a file row
 * is a bordered row with the download icon, the kind and the size in
 * supporting text. Icons are the theme's Lucide classes (icons-lucide.css).
 * Two classes on the rules that MyListing's stylesheet would otherwise
 * override (buttons, lists).
 */

/* The button on the forms. */

.raskin-bp-attach {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin-top: 8px;
	font-family: var(--sba-font-sans, inherit);
}

/* BuddyPress's options box holds the submit button, which MyListing floats
   right at full width. The file block goes above it, unfloated, and the
   button clears it; the script moves the block before the button. */
#buddypress #whats-new-form #whats-new-options .raskin-bp-attach-post {
	width: 100%;
	margin-top: 12px;
}

#buddypress #whats-new-form #whats-new-submit {
	float: none;
	clear: both;
}

.raskin-bp-attach .raskin-bp-attach-button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 6px 14px;
	border: 1px solid var(--sba-border, #E2E4E9);
	border-radius: var(--sba-radius-md, 6px);
	background: var(--sba-surface, #fff);
	color: var(--sba-charcoal, #1D212B);
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
	cursor: pointer;
	transition: border-color var(--sba-duration-hover, 0.3s) ease, color var(--sba-duration-hover, 0.3s) ease;
}

.raskin-bp-attach .raskin-bp-attach-button:hover,
.raskin-bp-attach .raskin-bp-attach-button:has(+ .raskin-bp-input:focus-visible) {
	border-color: var(--sba-red-dark, #BD2810);
	color: var(--sba-red-dark, #BD2810);
}

.raskin-bp-attach .raskin-bp-attach-button .sba-i {
	font-size: 16px;
	color: var(--sba-red-dark, #BD2810);
}

.raskin-bp-attach .raskin-bp-input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.raskin-bp-attach-comment .raskin-bp-attach-button {
	padding: 4px 10px;
	font-size: 13px;
}

#buddypress .ac-reply-content .raskin-bp-attach-comment {
	margin: 4px 0 10px;
}

/* The chosen files, before posting. */

#buddypress .raskin-bp-attach .raskin-bp-list {
	flex: 1 1 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

#buddypress .raskin-bp-attach .raskin-bp-list:empty {
	display: none;
}

.raskin-bp-list-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	border-top: 1px solid var(--sba-border, #E2E4E9);
	color: var(--sba-charcoal, #1D212B);
	font-size: 14px;
	line-height: 20px;
}

.raskin-bp-list-item:first-child {
	border-top: 0;
}

.raskin-bp-list-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.raskin-bp-list-meta {
	flex: none;
	color: var(--sba-slate, #6A7181);
	font-size: 13px;
}

.raskin-bp-list-item.is-uploading .raskin-bp-list-name {
	opacity: 0.6;
}

.raskin-bp-list-item.is-error .raskin-bp-list-meta {
	color: var(--sba-destructive, #EF4343);
}

.raskin-bp-list-item.is-removing {
	opacity: 0.4;
}

#buddypress .raskin-bp-list-remove,
#buddypress .raskin-bp-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0 0 0 auto;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--sba-slate, #6A7181);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
}

#buddypress .raskin-bp-list-remove:hover,
#buddypress .raskin-bp-remove:hover {
	background: var(--sba-muted, #F3F4F6);
	color: var(--sba-red-dark, #BD2810);
}

/* Under a post or a comment. */

.raskin-bp-attachments {
	margin-top: 12px;
	font-family: var(--sba-font-sans, inherit);
}

.raskin-bp-attachments-comment {
	margin-top: 8px;
}

.raskin-bp-images {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
	margin-bottom: 12px;
}

.raskin-bp-images-2,
.raskin-bp-images-3,
.raskin-bp-images-4 {
	grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
	.raskin-bp-images-3 {
		grid-template-columns: repeat(3, 1fr);
	}
}

.raskin-bp-figure {
	position: relative;
	margin: 0;
}

.raskin-bp-figure a {
	display: block;
	overflow: hidden;
	border-radius: var(--sba-radius, 8px);
	background: var(--sba-muted, #F3F4F6);
}

.raskin-bp-figure img {
	display: block;
	width: 100%;
	max-height: 480px;
	object-fit: contain;
	border-radius: var(--sba-radius, 8px);
}

.raskin-bp-images-1 .raskin-bp-figure img {
	width: auto;
	max-width: 100%;
}

#buddypress .raskin-bp-figure .raskin-bp-remove {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--sba-surface, #fff);
	box-shadow: 0 1px 2px hsl(var(--sba-charcoal-hsl, 220 20% 14%) / 0.15);
}

#buddypress .raskin-bp-files {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--sba-border, #E2E4E9);
	border-radius: var(--sba-radius, 8px);
	background: var(--sba-surface, #fff);
}

#buddypress .raskin-bp-file {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
	margin: 0;
	padding: 10px 12px;
	border-top: 1px solid var(--sba-border, #E2E4E9);
	font-size: 14px;
	line-height: 20px;
}

#buddypress .raskin-bp-file:first-child {
	border-top: 0;
}

#buddypress .raskin-bp-file-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	color: var(--sba-charcoal, #1D212B);
	font-weight: 500;
	text-decoration: none;
}

#buddypress .raskin-bp-file-link .sba-i {
	flex: none;
	font-size: 18px;
	color: var(--sba-red-dark, #BD2810);
}

#buddypress .raskin-bp-file-link:hover .raskin-bp-file-name {
	text-decoration: underline;
	text-decoration-color: var(--sba-red, #E73137);
	text-underline-offset: 4px;
}

.raskin-bp-file-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.raskin-bp-file-meta,
.raskin-bp-file-by {
	color: var(--sba-slate, #6A7181);
	font-size: 13px;
}

#buddypress .raskin-bp-file-by a {
	color: var(--sba-charcoal, #1D212B);
	font-weight: 500;
}

/* A group's Files tab. */

.raskin-bp-group-files {
	font-family: var(--sba-font-sans, inherit);
}

#buddypress .raskin-bp-group-files-title {
	margin: 0 0 16px;
	font-size: 20px;
	font-weight: var(--sba-heading-weight, 700);
	letter-spacing: var(--sba-heading-tracking, -0.025em);
	line-height: 28px;
}

.raskin-bp-group-files-empty {
	color: var(--sba-slate, #6A7181);
}

#buddypress .raskin-bp-files-group .raskin-bp-file {
	padding: 12px;
}

#buddypress .raskin-bp-files-group .raskin-bp-file-by {
	flex: 1 1 100%;
	padding-left: 26px;
}

#buddypress .raskin-bp-files-group .raskin-bp-file-thumb {
	flex: none;
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: var(--sba-radius-sm, 4px);
}

#buddypress .raskin-bp-files-group .raskin-bp-file-link:has(.raskin-bp-file-thumb) + .raskin-bp-file-meta ~ .raskin-bp-file-by {
	padding-left: 48px;
}
