/* MerchSpine – What You Will Learn: frontend styles
   All selectors are scoped to plugin-prefixed classes only - never
   generic tags/classes - so this stylesheet cannot leak into Elementor,
   other widgets, or the rest of the theme. */

.merchspine-wyl-section {
	box-sizing: border-box;
}
.merchspine-wyl-section * {
	box-sizing: border-box;
}

.merchspine-wyl-title {
	margin: 0 0 24px;
}

.merchspine-wyl-grid {
	display: grid;
	--merchspine-wyl-columns: 4;
	grid-template-columns: repeat(var(--merchspine-wyl-columns), 1fr);
	gap: 24px;
	list-style: none;
	padding: 0;
	margin: 0;
}

.merchspine-wyl-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	min-width: 0;
}

/* Icon: rendered as a CSS-masked block so any uploaded artwork (SVG or
   raster) is recolored purely via `color`, regardless of the source
   file's own fill/stroke values. */
.merchspine-wyl-icon {
	width: 56px;
	height: 56px;
	flex: 0 0 auto;
	margin-bottom: 16px;
	color: #7B3FE4; /* overridden inline by the widget's Icon Color control */
}

.merchspine-wyl-icon-mask {
	display: block;
	width: 100%;
	height: 100%;
	background-color: currentColor;
	-webkit-mask-image: var(--merchspine-wyl-icon-url);
	mask-image: var(--merchspine-wyl-icon-url);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

/* Browsers without CSS mask support (very old browsers only) fall back
   to showing the icon's own colors rather than nothing at all. */
@supports not ((mask-image: none) or (-webkit-mask-image: none)) {
	.merchspine-wyl-icon-mask {
		background-color: transparent;
		background-image: var(--merchspine-wyl-icon-url);
		background-repeat: no-repeat;
		background-position: center;
		background-size: contain;
	}
}

/* No font-size / line-height here on purpose: the Elementor Typography
   controls own them. (A default for the legacy widgets is printed with
   zero-specificity :where() in the widget's inline CSS, so it can never
   override a typography setting.) */
.merchspine-wyl-text {
	min-width: 0;
}

/* ---------------------------------------------------------------------
   Vertical layout: icon on the left, text on the right, per item.
   ------------------------------------------------------------------ */
.merchspine-wyl-layout-vertical .merchspine-wyl-grid {
	grid-template-columns: 1fr;
}

.merchspine-wyl-layout-vertical .merchspine-wyl-item {
	display: grid;
	grid-template-columns: 72px 1fr;
	column-gap: 20px;
	align-items: center;
	flex-direction: initial;
	text-align: left;
}

.merchspine-wyl-layout-vertical .merchspine-wyl-icon {
	margin-bottom: 0;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
}

/* Editor-only placeholder (never shown on the live frontend). */
.merchspine-wyl-editor-placeholder {
	padding: 16px;
	border: 1px dashed #c3c4c7;
	border-radius: 6px;
	color: #646970;
	font-size: 13px;
	background: #f6f7f7;
}

/* =====================================================================
   BOOK LEARNING & READER DETAILS (combined widget)
   ---------------------------------------------------------------------
   Layout is driven by CSS custom properties ("mode variables", --ms-*).
   The defaults below describe the Vertical layout. For every widget
   instance, PHP prints a tiny #id-scoped block that re-declares ONLY
   these variables for Desktop / Tablet / Mobile (using Elementor's real
   breakpoints), so the three devices can never leak into each other.
   Everything the user styles in Elementor (typography, colours, sizes,
   gaps...) uses normal Elementor selectors and is never fought by this
   file, because this file declares no font-size and uses low specificity.
   ===================================================================== */

.merchspine-bd,
.merchspine-bd *,
.merchspine-bd *::before,
.merchspine-bd *::after {
	box-sizing: border-box;
}

.merchspine-bd {
	width: 100%;
	min-width: 0;

	/* Shell */
	--ms-tabs-display: none;
	--ms-inactive-display: block;
	--ms-shell-cols: repeat(2, minmax(0, 1fr));
	--ms-panel-anim: none;

	/* Points: vertical list defaults */
	--ms-pts-cols: minmax(0, 1fr);
	--ms-pts-gap: var(--ms-row-gap, 20px);
	--ms-pt-display: grid;
	--ms-pt-dir: row;
	--ms-pt-ratio: auto;
	--ms-pt-self: stretch;
	--ms-pt-ai: var(--ms-row-va, center);
	--ms-pt-jc: normal;
	--ms-pt-ta: start;
	--ms-pt-overflow: visible;
	--ms-text-overflow: visible;
	--ms-icon-mb: 0;
	--ms-icon-mt: 0;
	--ms-vline-display: block;
	--ms-iline-display: none;
}

/* ---- Tabs navigation ------------------------------------------------ */
.ms-bd__tabs {
	display: var(--ms-tabs-display, none);
	flex-wrap: wrap;
	align-items: stretch;
	justify-content: flex-start;
	gap: 8px;
	margin: 0 0 24px;
	padding: 0;
}

/* Specificity is deliberately 3 classes so theme button styles
   (e.g. [type=button]:hover) cannot restyle the tabs, while Elementor's
   own selectors (wrapper + 2 classes = 5) still win over these defaults. */
.merchspine-bd .ms-bd__tabs .ms-bd__tab {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-align: center;
	color: #4A4A68;
	background-color: #F1EFF9;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 12px 22px;
	box-shadow: none;
	transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}
.merchspine-bd .ms-bd__tabs .ms-bd__tab:not(.is-active):hover {
	background-color: #E6E0F7;
}
.merchspine-bd .ms-bd__tabs .ms-bd__tab.is-active {
	color: #FFFFFF;
	background-color: #7B3FE4;
	border-color: #7B3FE4;
}
.merchspine-bd .ms-bd__tabs .ms-bd__tab:focus-visible {
	outline: 2px solid #7B3FE4;
	outline-offset: 2px;
}

/* ---- Tab style: UNDERLINE (alternative to the filled-background tabs) --
   Active when the root carries .ms-bd--tabs-underline. Specificity (4-6
   classes) beats the filled defaults above and theme button styles, yet
   stays below Elementor's generated selectors, so tab colour/typography
   controls still win. The thin baseline runs under the whole bar and the
   active tab's line overlays it (margin-bottom:-1px). */
.merchspine-bd.ms-bd--tabs-underline .ms-bd__tabs {
	border-bottom: 1px solid var(--ms-ul-base, #E4E4E4);
	/* One row only, so every underline sits on the same baseline; long
	   labels wrap inside their tab instead of pushing a tab to a new row. */
	flex-wrap: nowrap;
}
.merchspine-bd.ms-bd--tabs-underline .ms-bd__tabs .ms-bd__tab {
	background-color: transparent;
	border: 0;
	border-bottom: var(--ms-ul-w, 3px) solid transparent;
	border-radius: 0;
	margin-bottom: -1px;
	color: #4A4A68;
	padding: 12px 20px;
	flex: 0 1 auto;
	min-width: 0;
}
.merchspine-bd.ms-bd--tabs-underline .ms-bd__tabs .ms-bd__tab:not(.is-active):hover {
	background-color: transparent;
	color: #7B3FE4;
	border-bottom-color: var(--ms-ul-hover, #D9CFF5);
}
.merchspine-bd.ms-bd--tabs-underline .ms-bd__tabs .ms-bd__tab.is-active {
	background-color: transparent;
	color: #7B3FE4;
	border-bottom-color: var(--ms-ul-color, #7B3FE4);
}

/* ---- Section containers --------------------------------------------- */
.ms-bd__sections {
	display: grid;
	grid-template-columns: var(--ms-shell-cols, repeat(2, minmax(0, 1fr)));
	gap: 30px;
	align-items: stretch;
}
.ms-bd--single .ms-bd__sections {
	grid-template-columns: minmax(0, 1fr);
}
.ms-bd__section {
	min-width: 0;
}
/* Only the active panel is shown in Tabs mode; in every other mode the
   variable resolves to "block" and both containers are visible. */
.ms-bd__section:not(.is-active) {
	display: var(--ms-inactive-display, block);
}
.ms-bd__section.is-active {
	animation: var(--ms-panel-anim, none);
}
@keyframes ms-bd-fade {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
	.ms-bd__section.is-active { animation: none; }
	.merchspine-bd .ms-bd__tabs .ms-bd__tab { transition: none; }
}

.ms-bd__heading {
	margin: 0 0 20px;
}

/* ---- Points: one list element, two presentations (list / square cards) */
.ms-bd__points {
	display: grid;
	grid-template-columns: var(--ms-pts-cols, minmax(0, 1fr));
	gap: var(--ms-pts-gap, 20px);
	list-style: none;
	margin: 0;
	padding: 0;
}

.ms-bd__point {
	position: relative;
	display: var(--ms-pt-display, grid);
	/* used when display:grid (vertical list): icon | text */
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: var(--ms-icon-gap, 16px);
	row-gap: 0;
	/* used when display:flex (square card) */
	flex-direction: var(--ms-pt-dir, row);
	align-items: var(--ms-pt-ai, center);
	justify-content: var(--ms-pt-jc, normal);
	text-align: var(--ms-pt-ta, start);

	/* Square cards: width comes from the grid track, height from the
	   ratio. width:100% + align-self:start make the ratio authoritative;
	   min-height:0 + overflow stop long content from stretching the box. */
	width: 100%;
	aspect-ratio: var(--ms-pt-ratio, auto);
	align-self: var(--ms-pt-self, stretch);
	min-width: 0;
	min-height: 0;
	overflow: var(--ms-pt-overflow, visible);

	margin: 0;
	list-style: none;
	padding: var(--ms-pt-pad, 0);
	background: var(--ms-pt-bg, transparent);
	border: var(--ms-pt-border, 0 solid transparent);
	border-radius: var(--ms-pt-radius, 0);
}

/* Vertical list dividers: a line above every point plus one below the
   last point (above first, between each, below last). */
.ms-bd__point::before,
.ms-bd__point::after {
	content: "";
	display: var(--ms-vline-display, none);
	grid-column: 1 / -1;
	width: var(--ms-div-width, 100%);
	height: var(--ms-div-weight, 1px);
	background-color: var(--ms-div-color, #E4E4E4);
	margin: var(--ms-div-top, 12px) auto var(--ms-div-bottom, 12px);
}
.ms-bd__point::before {
	order: -1;
}
.ms-bd__point:not(:last-child)::after {
	display: none;
}

/* Icon (CSS-masked so any artwork is recoloured via `color`). */
.ms-bd__icon {
	/* Shrinkable so that in a small square box the icon yields space to
	   the text instead of overflowing the box (mask is `contain`, so the
	   artwork keeps its proportions). */
	flex: 0 1 auto;
	min-width: 0;
	min-height: 0;
	max-width: 100%;
	width: 48px;
	height: 48px;
	margin: var(--ms-icon-mt, 0) 0 var(--ms-icon-mb, 0);
	color: #7B3FE4;
}
.ms-bd__icon-mask {
	display: block;
	width: 100%;
	height: 100%;
	background-color: currentColor;
	-webkit-mask-image: var(--merchspine-wyl-icon-url);
	mask-image: var(--merchspine-wyl-icon-url);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}
@supports not ((mask-image: none) or (-webkit-mask-image: none)) {
	.ms-bd__icon-mask {
		background-color: transparent;
		background-image: var(--merchspine-wyl-icon-url);
		background-repeat: no-repeat;
		background-position: center;
		background-size: contain;
	}
}

/* Divider between icon and text (square-card mode only). */
.ms-bd__divider {
	display: var(--ms-iline-display, none);
	flex: 0 0 auto;
	align-self: var(--ms-pt-ai, center);
	width: var(--ms-div-width, 100%);
	height: var(--ms-div-weight, 1px);
	background-color: var(--ms-div-color, #E4E4E4);
	margin: var(--ms-div-top, 12px) 0 var(--ms-div-bottom, 12px);
}

/* Point text. NO font-size here: Elementor Typography owns it. */
.ms-bd__text {
	flex: 0 1 auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	overflow: var(--ms-text-overflow, visible);
	overflow-wrap: anywhere;
	word-break: break-word;
	hyphens: auto;
	scrollbar-width: thin;
}
