/*
 * Banner — Horizontal Card
 * Port of the 21st.dev heroui-card horizontal banner.
 */

.cw-bnr {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem;
	border-width: 0;
	border-style: solid;
	border-radius: 32px;
	color: #09090b;
}

/* --- Variants from the source component ------------------------------------- */

.cw-bnr--default {
	border-width: 1px;
	border-color: #e4e4e7;
	background-color: #ffffff;
}

.cw-bnr--secondary {
	border-width: 1px;
	border-color: #e4e4e7;
	background-color: #fafafa;
}

.cw-bnr--tertiary {
	border-width: 1px;
	border-color: #d4d4d8;
	background-color: #f4f4f5;
}

.cw-bnr--transparent {
	border-width: 0;
	background-color: transparent;
	box-shadow: none;
}

.cw-bnr--shadow:not(.cw-bnr--transparent) {
	box-shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
}

/* --- Image ------------------------------------------------------------------- */

.cw-bnr__media {
	position: relative;
	flex: 0 0 auto;
	width: 120px;
	height: 120px;
	overflow: hidden;
	border-radius: 16px;
}

/* Width/height are also set inline in PHP, because Elementor's own
   `.elementor img { height: auto }` outranks a single class here. */
.cw-bnr .cw-bnr__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	user-select: none;
	pointer-events: none;
}

.cw-bnr--image-right {
	flex-direction: row-reverse;
}

/* --- Body -------------------------------------------------------------------- */

.cw-bnr__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.75rem;
	min-width: 0;
}

.cw-bnr__heading {
	display: block;
}

.cw-bnr__title {
	/* inline-block so a capped width follows the text alignment rather than
	   staying pinned left. */
	display: inline-block;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.5;
	color: inherit;
}

.cw-bnr__description {
	display: inline-block;
	margin-top: 0.25rem;
	font-size: 0.875rem;
	line-height: 1.45;
	color: #71717a;
}

.cw-bnr__description p {
	margin: 0;
}

.cw-bnr__description p + p {
	margin-top: 0.5rem;
}

/* --- Footer ------------------------------------------------------------------ */

.cw-bnr__footer {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.75rem;
	margin-top: auto;
	width: 100%;
}

.cw-bnr__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}

.cw-bnr__meta-title {
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.4;
	color: inherit;
}

.cw-bnr__meta-sub {
	font-size: 0.75rem;
	line-height: 1.4;
	color: #71717a;
}

.cw-bnr__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0.5rem 1rem;
	border-radius: 9999px;
	background-color: var(--cw-btn-bg, #09090b);
	color: var(--cw-btn-fg, #ffffff);
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.4;
	transition: opacity 150ms ease, background-color 150ms ease;
}

.cw-bnr__button:hover {
	opacity: 0.9;
}

@media (min-width: 640px) {
	.cw-bnr__footer {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.cw-bnr__button {
		width: auto;
	}
}

/* --- Expandable terms -------------------------------------------------------- */

/* Stays transparent on hover; the theme must not paint it. */
.cw-w .cw-bnr__toggle:hover,
.cw-w .cw-bnr__toggle:focus {
	background: transparent;
	color: inherit;
}

.cw-w .cw-bnr__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0;
	background: transparent;
	cursor: pointer;
	text-align: left;
	color: inherit;
}

.cw-bnr__terms-arrow {
	display: inline-flex;
	flex: 0 0 auto;
	/* The shared icon set has no chevron-down, so the right chevron is rotated. */
	transform: rotate(90deg);
	transition: transform 200ms ease, color 150ms ease;
	color: inherit;
}

/* Keep the icon painted in every state — hover and open included. */
.cw-bnr .cw-bnr__terms-arrow .cw-icon {
	stroke: currentColor;
	fill: none;
	opacity: 1;
	visibility: visible;
}

.cw-bnr__terms-arrow .cw-icon {
	width: 14px;
	height: 14px;
}

.cw-w .cw-bnr__toggle[aria-expanded='true'] .cw-bnr__terms-arrow {
	transform: rotate(-90deg);
}

.cw-w .cw-bnr__toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* 0fr -> 1fr animates to the panel's natural height with no JS measuring. If this
   stylesheet ever fails to load the terms simply show expanded, which is a safe
   failure — the content stays readable. */
.cw-bnr__terms {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 300ms ease;
}

.cw-bnr__terms.is-open {
	grid-template-rows: 1fr;
}

.cw-bnr__terms-inner {
	overflow: hidden;
	min-height: 0;
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	/* No divider by default; the style control turns it on. */
	border-top-width: 0;
	border-top-color: rgba(0, 0, 0, 0.1);
	font-size: 0.8125rem;
	line-height: 1.6;
	color: #71717a;
}

.cw-bnr__terms-inner p {
	margin: 0;
}

.cw-bnr__terms-inner p + p {
	margin-top: 0.5rem;
}

/* --- Close button ------------------------------------------------------------ */

.cw-w .cw-bnr__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 9999px;
	background: transparent;
	color: #71717a;
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease;
}

.cw-w .cw-bnr__close:hover {
	background-color: rgba(0, 0, 0, 0.06);
	color: #09090b;
}

.cw-bnr .cw-bnr__close .cw-icon {
	width: 1rem;
	height: 1rem;
	fill: currentColor;
	stroke: none;
}

/* Keeps the title clear of the close button. */
.cw-bnr--closable .cw-bnr__head {
	padding-right: 2rem;
}

.cw-bnr.is-dismissed {
	display: none;
}

/* --- Stacking ----------------------------------------------------------------- */

@media (max-width: 639px) {
	.cw-bnr--stack,
	.cw-bnr--stack.cw-bnr--image-right {
		flex-direction: column;
		align-items: stretch;
	}

	.cw-bnr--stack .cw-bnr__media {
		width: 100%;
		height: 140px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cw-bnr__terms,
	.cw-bnr__terms-arrow {
		transition: none;
	}
}
