/**
 * Haat Pro — styles.
 *
 * Reads the theme's tokens rather than defining colours of its own, so a
 * merchant who repaints the store in the Customizer repaints Pro with it. This
 * is why the stylesheet is enqueued with haat-components as a dependency: the
 * token file is guaranteed to be in front of it.
 *
 * @package Haat\Pro
 */

/* ── Wishlist button ─────────────────────────────────────────────────────*/
.haat-wishlist-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	background: var( --haat-surface );
	border: 1px solid var( --haat-border );
	border-radius: var( --haat-radius-full );
	color: var( --haat-foreground );
	cursor: pointer;
	transition: background var( --haat-duration-fast ) var( --haat-ease-out ),
		border-color var( --haat-duration-fast ) var( --haat-ease-out ),
		color var( --haat-duration-fast ) var( --haat-ease-out );
}

.haat-wishlist-button:hover {
	border-color: var( --haat-primary );
	color: var( --haat-primary );
}

.haat-wishlist-button[disabled] {
	opacity: 0.6;
	cursor: default;
}

.haat-wishlist-button.is-active {
	background: var( --haat-flame-50 );
	border-color: var( --haat-flame-300 );
	color: var( --haat-flame-600 );
}

.haat-wishlist-button__icon {
	width: 1.05rem;
	height: 1.05rem;
	flex-shrink: 0;
	background: currentColor;
	-webkit-mask-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1.1 1L12 21l7.7-7.6 1.1-1a5.5 5.5 0 0 0 0-7.8z'/%3E%3C/svg%3E" );
	mask-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1.1 1L12 21l7.7-7.6 1.1-1a5.5 5.5 0 0 0 0-7.8z'/%3E%3C/svg%3E" );
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
}

/* The card variant is icon-only. The label stays in the DOM as the accessible
 * name and as the live region the error message is written into — hiding it
 * with the screen-reader class rather than display:none is what keeps both. */
.haat-wishlist-button--icon {
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	box-shadow: var( --haat-shadow-soft );
}

/* Inside the theme's card action stack the stack sets the hover colours, and it
 * wins on specificity by design — see the note in the theme's components.css.
 * This only makes sure the icon itself does not fight that, so a hovered heart
 * is white on primary rather than primary on primary. */
.haat-product-card__actions .haat-wishlist-button:hover .haat-wishlist-button__icon {
	background: currentColor;
}

.haat-wishlist-button--icon .haat-wishlist-button__label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	clip-path: inset( 50% );
	white-space: nowrap;
	border: 0;
}

.haat-wishlist-button--wide {
	width: 100%;
	margin-block: 0.75rem;
	padding: 0.7rem 1.25rem;
	border-radius: var( --haat-radius-md );
	font-size: var( --haat-text-sm );
	font-weight: var( --haat-weight-semibold );
}

.haat-wishlist-empty {
	padding: 3rem 1rem;
	text-align: center;
	color: var( --haat-muted-foreground );
}

/* ── Tabbed showcase ─────────────────────────────────────────────────────*/
.haat-pro-tabs__nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-bottom: 1.5rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var( --haat-border );
}

.haat-pro-tabs__tab {
	padding: 0.55rem 1.1rem;
	background: transparent;
	border: 0;
	border-radius: var( --haat-radius-full );
	color: var( --haat-muted-foreground );
	font-size: var( --haat-text-sm );
	font-weight: var( --haat-weight-semibold );
	cursor: pointer;
	transition: background var( --haat-duration-fast ) var( --haat-ease-out ),
		color var( --haat-duration-fast ) var( --haat-ease-out );
}

.haat-pro-tabs__tab:hover {
	background: var( --haat-muted );
	color: var( --haat-foreground );
}

.haat-pro-tabs__tab[aria-selected="true"] {
	background: var( --haat-primary );
	color: var( --haat-primary-foreground );
}

.haat-pro-tabs__panel[hidden] {
	display: none;
}

/* ── Compare ─────────────────────────────────────────────────────────────
 *
 * The button mirrors the wishlist's so the card's action stack stays one
 * consistent column. Golden rule 16 applies here as much as there: the theme
 * owns the stack's layout, and pro.css loads AFTER the theme, so anything of
 * equal specificity in here silently wins. These rules style the button's own
 * appearance and leave size and position to the theme.
 */
.haat-compare-button {
	position: relative;
	display: grid;
	place-items: center;
	color: var( --haat-foreground );
	background: var( --haat-surface );
	border: 1px solid var( --haat-border );
	cursor: pointer;
}

.haat-compare-button.is-active {
	color: var( --haat-primary );
	border-color: var( --haat-primary );
}

/* Two bars of different lengths: a comparison, not a generic icon. */
.haat-compare-button__icon {
	position: relative;
	width: 1rem;
	height: 1rem;
}

.haat-compare-button__icon::before,
.haat-compare-button__icon::after {
	position: absolute;
	inset-inline-start: 0;
	height: 2px;
	background: currentColor;
	border-radius: 1px;
	content: "";
}

.haat-compare-button__icon::before {
	top: 0.3rem;
	width: 100%;
}

.haat-compare-button__icon::after {
	top: 0.7rem;
	width: 60%;
}

.haat-compare-button--icon .haat-compare-button__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset( 50% );
	white-space: nowrap;
}

.haat-compare-button--wide {
	width: 100%;
	gap: 0.5rem;
	grid-auto-flow: column;
	justify-content: center;
	padding: 0.75rem 1rem;
	border-radius: var( --haat-radius-md );
	font-weight: var( --haat-weight-medium );
}

/* ── Compare table ───────────────────────────────────────────────────────*/
.haat-compare {
	/*
	 * The scroll container is the WRAPPER, never the table, and nothing is
	 * absolutely positioned out of it -- golden rule 24. A comparison genuinely
	 * can exceed the viewport on a phone, and scrolling it is correct; clipping
	 * it is not.
	 */
	overflow-x: auto;
}

.haat-compare__table {
	width: 100%;
	border-collapse: collapse;
	text-align: start;
}

.haat-compare__table th,
.haat-compare__table td {
	padding: 0.85rem 1rem;
	border-bottom: 1px solid var( --haat-border );
	vertical-align: top;
	text-align: start;
}

/* The row labels stay readable against the values while the table scrolls. */
.haat-compare__table tbody th {
	width: 12rem;
	font-weight: var( --haat-weight-medium );
	color: var( --haat-muted-foreground );
}

.haat-compare__product {
	min-width: 12rem;
}

.haat-compare__product img {
	display: block;
	width: 100%;
	height: auto;
	margin-bottom: 0.6rem;
	border-radius: var( --haat-radius-md );
}

.haat-compare__name {
	display: block;
	font-weight: var( --haat-weight-bold );
	color: var( --haat-foreground );
}

.haat-compare__remove {
	margin-top: 0.5rem;
	padding: 0;
	font-size: var( --haat-text-sm );
	color: var( --haat-muted-foreground );
	background: none;
	border: 0;
	cursor: pointer;
	text-decoration: underline;
}

.haat-compare__remove:hover {
	color: var( --haat-primary );
}

.haat-compare-empty {
	padding: 2rem;
	text-align: center;
	color: var( --haat-muted-foreground );
	background: var( --haat-surface );
	border: 1px dashed var( --haat-border );
	border-radius: var( --haat-radius-lg );
}
