/**
 * 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.
 *
 * ---------------------------------------------------------------------------
 * CASCADE ISOLATION (v1.0.1)
 * ---------------------------------------------------------------------------
 * v1.0.0 scoped every selector with a single class (e.g. `.dss-au__drop`),
 * which is (0,1,0) specificity. Any host rule that pairs a class with an
 * element type — `.form-row label`, `.woocommerce ul`, `form.cart span` —
 * all extremely common in WooCommerce themes and cart / product-add-on
 * plugins — is (0,1,1) and wins outright, regardless of load order. That is
 * what breaks the layout: `display: flex` loses to the theme's own
 * `label { display: ...; }`, the flex column collapses to normal inline
 * flow, `gap` stops doing anything because there is no flex context left to
 * apply it in, and the drop zone's children run together exactly like
 * ordinary wrapped text.
 *
 * Two independent layers fix this so the component renders correctly no
 * matter what the host page does:
 *
 *   1. `all: revert` on the specific HTML tags this component creates
 *      (label, span, ul, li, p, button, img) strips away any author-origin
 *      declaration the theme/plugins placed on them, giving each one a
 *      clean browser-default baseline to build on. Deliberately NOT a
 *      universal `.dss-au *` selector: the icons below are inline SVG
 *      coloured via `fill`/`stroke` PRESENTATION ATTRIBUTES, and those sit
 *      at the very bottom of the author-origin cascade — `all: revert`
 *      would strip them too, turning "currentColor" back into the SVG
 *      user-agent default (fill: black, stroke: none) and breaking the
 *      icons. Naming the tags explicitly leaves svg/path/circle/rect/text
 *      untouched, so their colour attributes are safe.
 *   2. Every component selector below is written as `.dss-au .dss-au__x`
 *      (two classes -> (0,2,0)) instead of a bare `.dss-au__x` ((0,1,0)), so
 *      it structurally outranks the class+element-type pattern above. The
 *      properties that are 100% load-bearing for the layout — `display`,
 *      `flex-direction`, `align-items` on every flex container — also carry
 *      `!important` as a last line of defence against a theme rule that is
 *      itself `!important`.
 *
 * @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);
}

/* Layer 1 — wipe any author CSS the host page has aimed at these elements.
   `all` does not touch custom properties, so the variables above survive.
   Tags only — never `svg`, `path`, `circle`, `rect`, or `text`, so the
   icons' `fill`/`stroke` presentation attributes are never touched. */
.dss-au,
.dss-au label,
.dss-au span,
.dss-au ul,
.dss-au li,
.dss-au p,
.dss-au button,
.dss-au img {
	all: revert;
	box-sizing: border-box;
}

.dss-au {
	position: relative;
	display: block;
	width: 100%;
	margin: 0 0 4px;
	font-family: inherit;
}

/* `hidden` must win against the theme's display rules AND against every
   `display: ... !important` component rule below — several of which are
   now (0,2,0) themselves after the cascade-isolation hardening. Repeating
   the root class (same trick already used on `.dss-au__input.dss-au__input`)
   pushes this to (0,3,0) so it always outranks them regardless of source
   order, without having to reorder the whole file around it. */
.dss-au.dss-au [hidden] {
	display: none !important;
}

/* Any duplicate "(max file size …)" hint printed by the add-on plugin.
   This targets a SIBLING element outside `.dss-au`, so — unlike every
   other rule below — it cannot be scoped under the component root. It
   stays a standalone global class, same as v1.0.0. */
.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 .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 .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 .dss-au__drop {
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	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 .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 .dss-au__icon {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 52px;
	height: 52px;
	margin-bottom: 2px;
	color: var(--dss-au-ink);
	background-color: var(--dss-au-brand);
	border-radius: 50%;
	flex-shrink: 0;
	transition: transform 0.18s ease;
}

.dss-au .dss-au__icon svg {
	display: block;
}

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

.dss-au .dss-au__or {
	display: block;
	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 .dss-au__btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	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 .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 .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 .dss-au__hint {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--dss-au-muted);
}

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

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

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

.dss-au .dss-au__item {
	display: flex !important;
	align-items: center !important;
	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 .dss-au__thumb {
	display: flex !important;
	flex: 0 0 auto;
	align-items: center !important;
	justify-content: center !important;
	width: 60px;
	height: 60px;
	overflow: hidden;
	color: var(--dss-au-ink);
	border: 1px solid var(--dss-au-line);
	border-radius: 10px;
}

.dss-au .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 .dss-au__thumb--doc {
	background-color: var(--dss-au-brand-tint);
}

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

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

.dss-au .dss-au__name {
	display: block;
	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 .dss-au__size {
	display: flex !important;
	flex-wrap: wrap;
	align-items: center !important;
	gap: 6px;
	font-size: 12px;
	color: var(--dss-au-muted);
}

.dss-au .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 .dss-au__actions {
	display: flex !important;
	flex: 0 0 auto;
	flex-direction: column !important;
	align-items: stretch;
	gap: 6px;
}

.dss-au .dss-au__action {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	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 .dss-au__action:hover {
	background-color: var(--dss-au-brand);
	border-color: var(--dss-au-brand-dark);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	.dss-au .dss-au__drop:hover .dss-au__btn,
	.dss-au .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 .dss-au__drop {
		border-color: currentColor;
	}

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