/**
 * DSS Artwork Upload — front-end styles.
 *
 * Everything is scoped under `.dss-au`, so nothing here can leak into the
 * theme, WooCommerce, or any other plugin. Colours are sampled directly from
 * the DSS logo / "Add to cart" button (#FFD623) and the site ink (#1A1A1A).
 *
 * Mobile-first. The only breakpoint widens the preview card at 480px.
 *
 * @package DSS_Artwork_Upload
 */

.dss-au {
	--dss-au-brand: #ffd623;
	--dss-au-brand-dark: #f0c400;
	--dss-au-brand-tint: #fffbe6;
	--dss-au-brand-wash: #fffdf4;
	--dss-au-ink: #1a1a1a;
	--dss-au-muted: #6b6b6b;
	--dss-au-line: #dcdcdc;
	--dss-au-surface: #ffffff;
	--dss-au-danger: #b3261e;
	--dss-au-danger-tint: #fdeceb;
	--dss-au-radius: 14px;
	--dss-au-ring: 0 0 0 3px rgba(255, 214, 35, 0.55);

	position: relative;
	display: block;
	width: 100%;
	margin: 0 0 4px;
	font-family: inherit;
	box-sizing: border-box;
}

.dss-au *,
.dss-au *::before,
.dss-au *::after {
	box-sizing: border-box;
}

/* `hidden` must win against the theme's display rules. */
.dss-au [hidden] {
	display: none !important;
}

/* Any duplicate "(max file size …)" hint printed by the add-on plugin. */
.dss-au-hidden {
	display: none !important;
}

/* Visually-hidden, still focusable, still submitted. Never display:none —
   Chrome refuses to focus a display:none control during form validation. */
.dss-au__input.dss-au__input {
	position: absolute !important;
	top: 0;
	left: 0;
	width: 1px !important;
	height: 1px !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	opacity: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	pointer-events: none;
}

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

/* ---------------------------------------------------------------------------
 * Drop zone
 * ------------------------------------------------------------------------ */

.dss-au__drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 26px 16px 22px;
	text-align: center;
	background-color: var(--dss-au-brand-wash);
	background-image: none;
	border: 2px dashed var(--dss-au-line);
	border-radius: var(--dss-au-radius);
	cursor: pointer;
	transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

.dss-au__drop:hover {
	border-color: var(--dss-au-brand);
	background-color: var(--dss-au-brand-tint);
}

/* The real focus ring lives on the hidden input; surface it on the zone. */
.dss-au:focus-within .dss-au__drop {
	border-color: var(--dss-au-brand);
	box-shadow: var(--dss-au-ring);
}

.dss-au[data-dragging='true'] .dss-au__drop {
	border-style: solid;
	border-color: var(--dss-au-brand);
	background-color: var(--dss-au-brand-tint);
	transform: translateY(-1px);
}

.dss-au[data-dragging='true'] .dss-au__icon {
	transform: translateY(-3px);
}

.dss-au[data-invalid='true'] .dss-au__drop {
	border-color: var(--dss-au-danger);
	background-color: var(--dss-au-danger-tint);
}

.dss-au__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin-bottom: 2px;
	color: var(--dss-au-ink);
	background-color: var(--dss-au-brand);
	border-radius: 50%;
	transition: transform 0.18s ease;
}

.dss-au__icon svg {
	display: block;
}

.dss-au__headline {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--dss-au-ink);
	letter-spacing: -0.01em;
}

.dss-au__or {
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	color: var(--dss-au-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------------------
 * The button
 * ------------------------------------------------------------------------ */

.dss-au__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px; /* WCAG 2.5.5 target size. */
	padding: 11px 26px;
	font-size: 14px;
	font-weight: 800;
	line-height: 1;
	color: var(--dss-au-ink);
	letter-spacing: 0.01em;
	background-color: var(--dss-au-brand);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 2px 0 0 var(--dss-au-brand-dark), 0 6px 16px -6px rgba(26, 26, 26, 0.45);
	transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.dss-au__drop:hover .dss-au__btn {
	background-color: var(--dss-au-brand-dark);
	transform: translateY(-1px);
	box-shadow: 0 3px 0 0 #d9b100, 0 10px 20px -8px rgba(26, 26, 26, 0.5);
}

.dss-au__drop:active .dss-au__btn {
	transform: translateY(1px);
	box-shadow: 0 0 0 0 var(--dss-au-brand-dark), 0 4px 10px -6px rgba(26, 26, 26, 0.4);
}

.dss-au__hint {
	margin-top: 4px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--dss-au-muted);
}

/* ---------------------------------------------------------------------------
 * Preview list
 * ------------------------------------------------------------------------ */

.dss-au__list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.dss-au__list::before,
.dss-au__list::after {
	content: none;
}

.dss-au__item {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 12px;
	list-style: none;
	background-color: var(--dss-au-surface);
	border: 1px solid var(--dss-au-line);
	border-left: 4px solid var(--dss-au-brand);
	border-radius: var(--dss-au-radius);
	box-shadow: 0 2px 10px -6px rgba(26, 26, 26, 0.35);
}

/* Drop zone stays visible under the list on multi-file inputs. */
.dss-au[data-state='filled'] .dss-au__drop {
	margin-top: 10px;
	padding: 16px 14px;
}

.dss-au__thumb {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	overflow: hidden;
	color: var(--dss-au-ink);
	border: 1px solid var(--dss-au-line);
	border-radius: 10px;
}

.dss-au__thumb--image {
	/* Checkerboard so transparent PNG / WebP artwork is obvious. */
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #eeeeee 25%, transparent 25%),
		linear-gradient(-45deg, #eeeeee 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #eeeeee 75%),
		linear-gradient(-45deg, transparent 75%, #eeeeee 75%);
	background-size: 12px 12px;
	background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.dss-au__thumb--doc {
	background-color: var(--dss-au-brand-tint);
}

.dss-au__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: contain;
}

.dss-au__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 5px;
	min-width: 0; /* Enables the ellipsis on the child. */
}

.dss-au__name {
	overflow: hidden;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	color: var(--dss-au-ink);
	text-overflow: ellipsis;
	white-space: nowrap;
	word-break: break-all;
}

.dss-au__size {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--dss-au-muted);
}

.dss-au__badge {
	display: inline-block;
	padding: 3px 7px;
	font-size: 10px;
	font-weight: 800;
	line-height: 1;
	color: var(--dss-au-ink);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	background-color: var(--dss-au-brand);
	border-radius: 4px;
}

.dss-au__actions {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	align-items: stretch;
	gap: 6px;
}

.dss-au__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	min-height: 32px;
	padding: 6px 11px;
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	color: var(--dss-au-ink);
	text-decoration: none;
	white-space: nowrap;
	background-color: #f4f4f4;
	border: 1px solid var(--dss-au-line);
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dss-au__action:hover {
	background-color: var(--dss-au-brand);
	border-color: var(--dss-au-brand-dark);
}

.dss-au__action:focus-visible {
	outline: 2px solid var(--dss-au-ink);
	outline-offset: 2px;
}

.dss-au__action--remove:hover {
	color: #fff;
	background-color: var(--dss-au-danger);
	border-color: var(--dss-au-danger);
}

.dss-au__action svg {
	display: block;
	flex: 0 0 auto;
}

/* ---------------------------------------------------------------------------
 * Error
 * ------------------------------------------------------------------------ */

.dss-au__error {
	display: flex;
	gap: 7px;
	margin: 10px 0 0;
	padding: 10px 12px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--dss-au-danger);
	background-color: var(--dss-au-danger-tint);
	border: 1px solid rgba(179, 38, 30, 0.28);
	border-radius: 10px;
}

.dss-au__error::before {
	flex: 0 0 auto;
	font-weight: 800;
	content: '!';
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	font-size: 12px;
	color: #fff;
	background-color: var(--dss-au-danger);
	border-radius: 50%;
}

/* ---------------------------------------------------------------------------
 * ≥480px — roomier card, side-by-side actions
 * ------------------------------------------------------------------------ */

@media screen and (min-width: 480px) {

	.dss-au__drop {
		padding: 32px 20px 26px;
	}

	.dss-au__item {
		gap: 14px;
		padding: 14px;
	}

	.dss-au__thumb {
		width: 72px;
		height: 72px;
	}

	.dss-au__actions {
		flex-direction: row;
		align-items: center;
	}

	.dss-au__name {
		font-size: 15px;
	}
}

/* ---------------------------------------------------------------------------
 * Preferences
 * ------------------------------------------------------------------------ */

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

	.dss-au__drop,
	.dss-au__btn,
	.dss-au__icon,
	.dss-au__action {
		transition: none;
	}

	.dss-au__drop:hover .dss-au__btn,
	.dss-au__drop:active .dss-au__btn,
	.dss-au[data-dragging='true'] .dss-au__drop,
	.dss-au[data-dragging='true'] .dss-au__icon {
		transform: none;
	}
}

@media (prefers-contrast: more), (forced-colors: active) {

	.dss-au__drop {
		border-color: currentColor;
	}

	.dss-au__btn {
		border: 2px solid currentColor;
		box-shadow: none;
	}
}
