/**
 * Inoforest Section Heading
 *
 * Contents
 * 1. Variables and frame
 * 2. Subtitle (script, uppercase, pill; decorative lines)
 * 3. Title and text
 * 4. Button
 *
 * Colours read the Design System (--inoforest-color-*) with fallbacks. The title is the heading tag chosen in the
 * widget, so its font, weight and size are the Design System's for that tag.
 */

/* 1. Variables and frame ---------------------------------------------------- */
.ino-heading {
	--ino-heading-primary: var(--inoforest-color-primary, #0b7a75);
	--ino-heading-accent: var(--inoforest-color-accent, #ff6a3d);
	--ino-heading-title: var(--inoforest-color-heading, #0d1b2a);
	--ino-heading-highlight: var(--ino-heading-primary);
	--ino-heading-subtitle: var(--ino-heading-accent);
	--ino-heading-pill: color-mix(in srgb, var(--ino-heading-accent) 12%, #fff);
	--ino-heading-text: var(--inoforest-color-text, #5a6a79);
	--ino-heading-border: var(--inoforest-color-border, #e3e9ee);
	--ino-heading-line: 34px;
	display: flex;
	flex-direction: var(--ino-heading-direction, column);
	flex-wrap: wrap;
	align-items: var(--ino-heading-items, flex-start);
	justify-content: space-between;
	gap: 28px;
	max-width: var(--ino-heading-max, var(--ino-heading-width, 680px));
	margin-inline: var(--ino-heading-inline, 0);
	text-align: var(--ino-heading-align, start);
}

/* A split heading: text and button side by side, 40 px apart; 20 px when the button moves under the text. */
.ino-heading[data-align="split"] {
	gap: 20px 40px;
}

.ino-heading__main {
	max-width: var(--ino-heading-main-max, none);
}

/* 2. Subtitle ----------------------------------------------------------------- */
.ino-heading__subtitle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
	font-family: "Caveat", cursive;
	font-size: 1.65rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--ino-heading-subtitle);
}

.ino-heading[data-subtitle-line="true"] .ino-heading__subtitle::before,
.ino-heading[data-line-after="true"] .ino-heading__subtitle::after {
	content: "";
	flex: none;
	width: var(--ino-heading-line);
	height: 2px;
	background: currentColor;
}

/* After the subtitle only while the heading is centred (the Alignment control sets the variable per device). */
.ino-heading[data-line-after="true"] .ino-heading__subtitle::after {
	content: var(--ino-heading-after, none);
}

.ino-heading[data-subtitle-style="uppercase"] .ino-heading__subtitle {
	font-family: inherit;
	font-size: 0.85rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.ino-heading[data-subtitle-style="pill"] .ino-heading__subtitle {
	padding: 6px 16px;
	font-family: inherit;
	font-size: 0.875rem;
	background: var(--ino-heading-pill);
	border-radius: 999px;
}

/* 3. Title and text ------------------------------------------------------------ */
.ino-heading .ino-heading__title {
	margin: 0 0 0.55em;
	color: var(--ino-heading-title);
}

.ino-heading__title span {
	color: var(--ino-heading-highlight);
}

.ino-heading[data-highlight="italic"] .ino-heading__title span {
	font-style: italic;
}

.ino-heading__main > :last-child {
	margin-bottom: 0;
}

.ino-heading .ino-heading__text {
	margin: 0;
	color: var(--ino-heading-text);
}

/* 4. Button ----------------------------------------------------------------------- */
.ino-heading .ino-heading__button {
	--ino-heading-btn-color: #fff;
	--ino-heading-btn-bg: var(--ino-heading-primary);
	--ino-heading-btn-border: var(--ino-heading-btn-bg);
	--ino-heading-btn-color-hover: #fff;
	--ino-heading-btn-bg-hover: color-mix(in srgb, var(--ino-heading-primary) 80%, #000);
	--ino-heading-btn-border-hover: var(--ino-heading-btn-bg-hover);
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 54px;
	padding: 14px 30px;
	font-size: 0.975rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--ino-heading-btn-color);
	text-decoration: none;
	background: var(--ino-heading-btn-bg);
	border: 2px solid var(--ino-heading-btn-border);
	border-radius: 999px;
	transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.ino-heading .ino-heading__button:hover,
.ino-heading .ino-heading__button:focus-visible {
	color: var(--ino-heading-btn-color-hover);
	background: var(--ino-heading-btn-bg-hover);
	border-color: var(--ino-heading-btn-border-hover);
}

.ino-heading .ino-heading__button--accent {
	--ino-heading-btn-bg: var(--ino-heading-accent);
	--ino-heading-btn-bg-hover: color-mix(in srgb, var(--ino-heading-accent) 80%, #000);
}

/* Outline: the heading colour on a line in the border colour, filled with the primary colour on hover. */
.ino-heading .ino-heading__button--outline {
	--ino-heading-btn-color: var(--ino-heading-title);
	--ino-heading-btn-bg: transparent;
	--ino-heading-btn-border: var(--ino-heading-border);
	--ino-heading-btn-bg-hover: var(--ino-heading-primary);
	--ino-heading-btn-border-hover: var(--ino-heading-primary);
}

/* Light outline, for a dark section: white on a faint white line, white with the heading colour on hover. */
.ino-heading .ino-heading__button--light {
	--ino-heading-btn-color: #fff;
	--ino-heading-btn-bg: transparent;
	--ino-heading-btn-border: rgba(255, 255, 255, 0.4);
	--ino-heading-btn-color-hover: var(--inoforest-color-heading, #0d1b2a);
	--ino-heading-btn-bg-hover: #fff;
	--ino-heading-btn-border-hover: #fff;
}

.ino-heading__button svg,
.ino-heading__button i {
	width: 1em;
	height: 1em;
	font-size: 1em;
	fill: currentColor;
}

@media (prefers-reduced-motion: reduce) {
	.ino-heading .ino-heading__button {
		transition: none;
	}
}
