/**
 * Shared base stylesheet of Reader Experience, loaded once (handle "dwp-rx-base") for every block.
 *
 * Why one shared file: "all: unset" is load-order sensitive. When every block bundle carried its
 * own copy, the one that loaded last decided the padding and size of the bar buttons.
 *
 * Contents:
 * 1. .dwp-rx-reset-button  Neutral starting point for every clickable element of the plugin.
 * 2. State rules       Same hover/focus/active look everywhere, immune to theme button styles.
 * 3. .dwp-rx-bar__button   One icon button, used by comments, share, table of contents and thumbs.
 *
 * Colours follow the --c-* variables (see the separate dark-mode package), each with a system
 * colour fallback for themes without those variables.
 */

/* 1. Reset ---------------------------------------------------------------------------------- */
.dwp-rx-reset-button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	/* Android Chrome shows a translucent (often orange) highlight on tap unless this is off. */
	-webkit-tap-highlight-color: transparent;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	color: var(--c-text-muted, GrayText);
	border: 1px solid transparent;
}

/* 2. States ---------------------------------------------------------------------------------
 * Themes often style button:hover or a:hover (colour, background, box-shadow). Those selectors
 * beat "all: unset" on a single class, so the state rules use a doubled class selector.
 */
.dwp-rx-reset-button.dwp-rx-reset-button:is(:hover, :focus, :active) {
	background: transparent;
	color: var(--c-text, CanvasText);
	border-color: transparent;
	box-shadow: none;
	text-decoration: none;
	transform: none;
	filter: none;
	opacity: 1;
	outline: none;
}
.dwp-rx-reset-button.dwp-rx-reset-button:is(:hover, :focus-visible) {
	background: color-mix(in srgb, currentColor 12%, transparent);
}
.dwp-rx-reset-button.dwp-rx-reset-button:active {
	background: color-mix(in srgb, currentColor 20%, transparent);
}
.dwp-rx-reset-button.dwp-rx-reset-button:focus-visible {
	outline: 2px solid var(--c-accent, Highlight);
	outline-offset: 2px;
}

/* 3. Bar button ----------------------------------------------------------------------------- */
.dwp-rx-bar__button {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 6px;
	border-radius: 8px;
	font-size: 0.75rem;
	line-height: 1.1;
	text-decoration: none;
}
.dwp-rx-bar__icon {
	display: inline-flex;
}
/* An icon font glyph (custom link block) gets the box of an SVG icon. */
.dwp-rx-bar__icon > i {
	display: inline-block;
	width: 20px;
	height: 20px;
	font-size: 20px;
	line-height: 20px;
	text-align: center;
}

/*
 * Primary buttons in the panels (copy link, send, "yes").
 *
 * They carry WordPress' .wp-element-button class, so a block theme styles them through Styles →
 * Blocks → Buttons in the site editor, and a classic theme through its own button rules. These
 * defaults are wrapped in :where() and therefore have no specificity: anything the theme says
 * wins, and they only fill in what the theme leaves open. The fallback colours are neutral
 * (dark button on light, inverted on dark) instead of a fixed blue.
 */
:where(.dwp-rx-share__copy, .dwp-rx-rating__send, .dwp-rx-rating__follow-up-yes) {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	box-sizing: border-box;
	padding: 0.55em 1.1em;
	font: inherit;
	line-height: 1.2;
	color: var(--c-accent-contrast, Canvas);
	background: var(--c-accent, CanvasText);
	border: 1px solid transparent;
	border-radius: 6px;
	cursor: pointer;
	text-decoration: none;
}
