/*
 * HTL Villach - component modifiers.
 *
 * Small, opt-in classes that adjust widgets of the Ashley theme without
 * touching the theme or the plugin. A class is put on the widget (Elementor:
 * Erweitert > CSS-Klassen), never on the single card, so one setting covers a
 * whole list.
 *
 * Nothing in here has anything to do with the hero shapes - those live in
 * htlv-shapes.css.
 *
 * Contents
 *   .htlv-cards-open     service cards with their text permanently unfolded
 *   .htlv-cards-reveal   service cards that unfold their text on hover/focus
 */

/* ---------- service cards: text always open ---------- */

/*
 * The theme hides the card text twice over: opacity 0 until hover, and
 * -webkit-line-clamp: 3, which cuts a long text off after three lines even
 * once it is visible. Both have to go, hence the line-clamp reset next to the
 * opacity.
 *
 * The arrow button is dimmed and scaled down by the theme in the same way, so
 * it gets its resting state back here too.
 */
.htlv-cards-open .mil-service-card-sm p {
	display: block;
	opacity: 1;
	-webkit-transform: none;
	    -ms-transform: none;
	        transform: none;
	overflow: visible;
	-webkit-line-clamp: none;
	        line-clamp: none;
}

.htlv-cards-open .mil-service-card-sm .mil-button {
	opacity: 1;
	-webkit-transform: scale(1);
	    -ms-transform: scale(1);
	        transform: scale(1);
	-webkit-filter: none;
	        filter: none;
}

/* ---------- service cards: text unfolds on hover ---------- */

/*
 * Height cannot be animated from 0 to "as tall as the text is", so the
 * paragraph becomes a one cell grid and the row goes from 0fr to 1fr. That
 * animates to the text's real height, whatever it is - no fixed max-height to
 * guess and no text cut off when it turns out longer than guessed.
 *
 * The line clamp is reset for the same reason as above: once the row is open,
 * the whole text should show.
 */
.htlv-cards-reveal .mil-service-card-sm p {
	display: grid;
	grid-template-rows: 0fr;
	opacity: 0;
	overflow: hidden;
	-webkit-line-clamp: none;
	        line-clamp: none;
	transition: grid-template-rows .5s cubic-bezier(0, 0, .3642, 1),
	            opacity .4s cubic-bezier(0, 0, .3642, 1);
}

/* The grid child needs min-height 0, otherwise it refuses to shrink below its
   content height and the 0fr row has no effect. */
.htlv-cards-reveal .mil-service-card-sm p > * {
	min-height: 0;
	overflow: hidden;
}

/* focus-within keeps the card usable for keyboard navigation. */
.htlv-cards-reveal .mil-service-card-sm:hover p,
.htlv-cards-reveal .mil-service-card-sm:focus-within p {
	grid-template-rows: 1fr;
	opacity: 1;
}

/* Touch devices have no hover, so there the text simply stays open. */
@media (hover: none) {
	.htlv-cards-reveal .mil-service-card-sm p {
		grid-template-rows: 1fr;
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.htlv-cards-reveal .mil-service-card-sm p {
		transition: none;
	}
}
