/**
 * CWS - Read more (Text Editor extension) — frontend styles.
 *
 * The toggle is a real <button> reset to look like an inline text link so it
 * flows right after the truncated text. Colors/typography come from the
 * widget's "CWS - Read more" controls ({{WRAPPER}} selectors); the defaults
 * inherit the surrounding text.
 *
 * Visibility model:
 * - Simple markup (one budget for all devices): .cws-readmore__full carries
 *   the native `hidden` attribute, so it works before this stylesheet loads
 *   (it is enqueued mid-render and prints late).
 * - Responsive markup (.cws-readmore--responsive, per-device budgets): shorts
 *   are hidden by default here; the per-device show/hide rules are printed
 *   INLINE by PHP (breakpoint values come from the site's Elementor config).
 */

.cws-readmore {
	--cws-rm-fade-color: #ffffff;
	--cws-rm-fade-h: 48px;
}

.cws-readmore__toggle {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-weight: 600;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.cws-readmore__toggle:hover,
.cws-readmore__toggle:focus-visible {
	text-decoration: none;
}

.cws-readmore__cta {
	white-space: nowrap;
}

/* ------------------------------------------------------------------ *
 * Shortcode ([cws_read_more]) link colors. A shortcode has no
 * Elementor {{WRAPPER}}, so its `color` / `hover_color` attributes ride
 * on the root as custom properties. Scoped to .cws-readmore--shortcode
 * so the widget path (styled by higher-specificity {{WRAPPER}} rules)
 * is untouched.
 * ------------------------------------------------------------------ */
.cws-readmore--shortcode .cws-readmore__toggle {
	color: var(--cws-rm-link-color, inherit);
}

.cws-readmore--shortcode .cws-readmore__toggle:hover,
.cws-readmore--shortcode .cws-readmore__toggle:focus-visible {
	color: var(--cws-rm-link-color-hover, var(--cws-rm-link-color, inherit));
}

.cws-readmore__less-wrap {
	margin: 0.6em 0 0;
}

.cws-readmore__short:focus,
.cws-readmore__full:focus {
	outline: none;
}

/* ------------------------------------------------------------------ *
 * Fade style — gradient over the last lines, toggle below the text.
 * The gradient hangs above the .cws-readmore__more-wrap paragraph that
 * PHP appends as the short block's last child, so it always covers the
 * text directly above the link and never the link itself.
 * ------------------------------------------------------------------ */
.cws-readmore__more-wrap {
	position: relative;
	margin: 0.2em 0 0;
}

.cws-readmore--fade .cws-readmore__more-wrap::before {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 0;
	right: 0;
	height: var(--cws-rm-fade-h);
	background: linear-gradient(to bottom, transparent, var(--cws-rm-fade-color));
	pointer-events: none;
}

/* ------------------------------------------------------------------ *
 * Responsive (device-split) markup — CSS-driven visibility.
 * Defaults: full visible, shorts hidden, collapse link hidden; the
 * inline PHP media queries flip full/short per truncating device, and
 * the expanded state below restores the full text everywhere.
 * ------------------------------------------------------------------ */
.cws-readmore--responsive > .cws-readmore__short {
	display: none;
}

.cws-readmore--responsive > .cws-readmore__full {
	display: block;
}

.cws-readmore--responsive > .cws-readmore__full > .cws-readmore__less-wrap {
	display: none;
}

.cws-readmore--responsive.cws-readmore--expanded > .cws-readmore__full > .cws-readmore__less-wrap {
	display: block;
}
