/**
 * Lonyu Robot - Products by Scenario (v2)
 *
 * Visual language is intentionally aligned with the /products XStore archive:
 *   #F5F5F5 canvas, 1400px content width, 22% / 78% white cards, 5px radius,
 *   Inter/Arial type, #1C51FF active counter, 3-column centred product grid
 *   with square images and a soft 1px 1px 5px 1px rgba(0,0,0,.18) shadow.
 *
 * Everything stays namespaced with .ly- so the module can be dropped into any
 * Elementor layout without colliding with XStore / WooCommerce styles.
 */

.ly-scenarios {
	--ly-accent: #1C51FF;
	--ly-cols: 3;
	--ly-cols-tablet: 2;
	--ly-cols-mobile: 1;
	--ly-card-bg: #FFFFFF;
	--ly-title-color: #1B1B1B;
	--ly-text-color: #555555;
	--ly-border: #ECECEC;
	--ly-radius: 5px;
	--ly-gap: 15px;

	box-sizing: border-box;
	width: 100%;
	max-width: 1400px;
	margin: 0 auto;
	color: var(--ly-text-color);
	font-family: Inter, Arial, Helvetica, sans-serif;
	font-size: 15px;
	line-height: 1.6;
}

.ly-scenarios *,
.ly-scenarios *::before,
.ly-scenarios *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ *
 * Optional section head (usually handled by the Elementor hero)
 * ------------------------------------------------------------------ */

.ly-scenarios__head {
	margin: 0 0 20px;
}

.ly-scenarios__title {
	margin: 0 0 6px;
	color: var(--ly-title-color);
	font-size: clamp(24px, 2.6vw, 32px);
	font-weight: 600;
	line-height: 1.25;
}

.ly-scenarios__subtitle {
	max-width: 820px;
	margin: 0;
	color: #6B6B6B;
	font-size: 16px;
}

/* ------------------------------------------------------------------ *
 * 22% / 78% two-card shell (mirrors the /products layout)
 * ------------------------------------------------------------------ */

.ly-scenarios__grid {
	display: grid;
	grid-template-columns: 22% minmax(0, 1fr);
	gap: var(--ly-gap);
	align-items: start;
}

.ly-scenarios__grid--single {
	grid-template-columns: minmax(0, 1fr);
}

/* ------------------------------------------------------------------ *
 * Left card: scenario navigation
 * ------------------------------------------------------------------ */

.ly-sidenav {
	min-width: 0;
	padding: 20px 18px;
	border-radius: var(--ly-radius);
	background: #FFFFFF;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ly-sidenav__title {
	margin: 0 0 8px;
	color: var(--ly-title-color);
	font-family: Inter, Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.35;
}

.ly-sidenav__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ly-sidenav__list li {
	margin: 0;
	border-bottom: 1px solid #F1F1F1;
}

.ly-sidenav__list li:last-child {
	border-bottom: 0;
}

.ly-scenarios__tab {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	padding: 11px 8px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--ly-title-color);
	font-family: inherit;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.4;
	text-align: left;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.ly-scenarios__tab:hover {
	color: var(--ly-tab-accent, var(--ly-accent));
	background: #F7F8FF;
}

.ly-scenarios__tab.is-active {
	color: var(--ly-tab-accent, var(--ly-accent));
	background: #F5F7FF;
	font-weight: 600;
}

.ly-scenarios__tab:focus-visible {
	outline: 2px solid var(--ly-tab-accent, var(--ly-accent));
	outline-offset: -2px;
}

.ly-scenarios__tab-label {
	min-width: 0;
	overflow-wrap: anywhere;
}

/* Count badge: #F5F5F7 resting, #1C51FF when active (same as /products). */
.ly-scenarios__count {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 7px;
	border-radius: 3px;
	background: #F5F5F7;
	color: #777777;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.ly-scenarios__tab:hover .ly-scenarios__count {
	color: var(--ly-tab-accent, var(--ly-accent));
}

.ly-scenarios__tab.is-active .ly-scenarios__count {
	background: var(--ly-tab-accent, var(--ly-accent));
	color: #FFFFFF;
}

.ly-sidenav__foot {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid #F1F1F1;
}

.ly-sidenav__all {
	color: var(--ly-accent);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.ly-sidenav__all:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 * Right card: scenario panels
 * ------------------------------------------------------------------ */

.ly-scenarios__panels {
	min-width: 0;
	padding: 20px;
	border-radius: var(--ly-radius);
	background: #FFFFFF;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ly-scenarios--stacked .ly-scenarios__panels {
	padding: 0;
	background: transparent;
	box-shadow: none;
}

.ly-scenarios--sidebar .ly-panel {
	display: none;
}

.ly-scenarios--sidebar .ly-panel.is-active,
.ly-scenarios--stacked .ly-panel {
	display: block;
	animation: ly-fade-in 0.25s ease both;
}

.ly-scenarios--stacked .ly-panel + .ly-panel {
	margin-top: 40px;
	padding-top: 32px;
	border-top: 1px solid var(--ly-border);
}

@keyframes ly-fade-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.ly-scenarios--sidebar .ly-panel.is-active,
	.ly-scenarios--stacked .ly-panel { animation: none; }
}

/* Scenario header (replaces the old heavy intro block). */

.ly-panel__header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px 24px;
	margin: 0 0 22px;
	padding: 0 0 16px;
	border-bottom: 1px solid var(--ly-border);
}

.ly-panel__heading {
	min-width: 0;
}

.ly-panel__title {
	margin: 0;
	color: var(--ly-title-color);
	font-size: 24px;
	font-weight: 600;
	line-height: 1.25;
}

.ly-panel__subtitle {
	margin: 4px 0 0;
	color: #666666;
	font-size: 15px;
}

.ly-panel__desc {
	max-width: 82ch;
	margin: 8px 0 0;
	color: #777777;
	font-size: 14px;
	line-height: 1.65;
}

.ly-panel__desc p {
	margin: 0 0 6px;
}

.ly-panel__meta {
	display: flex;
	align-items: center;
	gap: 16px;
	white-space: nowrap;
}

.ly-panel__total {
	color: #888888;
	font-size: 13px;
}

.ly-panel__total strong {
	color: var(--ly-title-color);
	font-size: 15px;
}

.ly-panel__link,
.ly-panel__more a {
	color: var(--ly-panel-accent, var(--ly-accent));
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.ly-panel__link span,
.ly-panel__more a span {
	display: inline-block;
	margin-left: 4px;
	transition: transform 0.2s ease;
}

.ly-panel__link:hover span,
.ly-panel__more a:hover span {
	transform: translateX(4px);
}

/* ------------------------------------------------------------------ *
 * Product grid & cards (XStore-like, minimal, centred)
 * ------------------------------------------------------------------ */

.ly-grid {
	display: grid;
	grid-template-columns: repeat(var(--ly-cols), minmax(0, 1fr));
	gap: 15px;
}

.ly-card {
	position: relative;
	display: grid;
	align-content: start;
	min-width: 0;
	overflow: hidden;
	border-radius: var(--ly-radius);
	background: var(--ly-card-bg);
	box-shadow: 1px 1px 5px 1px rgba(0, 0, 0, 0.18);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.ly-card:hover {
	transform: translateY(-2px);
	box-shadow: 1px 3px 14px 2px rgba(0, 0, 0, 0.18);
}

.ly-card__media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	background: #FFFFFF;
}

.ly-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.5s ease;
}

.ly-card:hover .ly-card__media img {
	transform: scale(1.04);
}

.ly-card__no-image {
	display: block;
	width: 100%;
	height: 100%;
	background: #F5F5F7;
}

.ly-card__hover-label {
	position: absolute;
	left: 50%;
	bottom: 14px;
	padding: 8px 16px;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.78);
	color: #FFFFFF;
	font-size: 12px;
	line-height: 1;
	white-space: nowrap;
	opacity: 0;
	transform: translate(-50%, 8px);
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.ly-card:hover .ly-card__hover-label,
.ly-card__media:focus-visible .ly-card__hover-label {
	opacity: 1;
	transform: translate(-50%, 0);
}

.ly-card__body {
	padding: 12px 12px 18px;
	text-align: center;
}

.ly-card__cats {
	margin: 0 0 6px;
	overflow: hidden;
	color: #8A8A8A;
	font-size: 12px;
	line-height: 1.4;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ly-card__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	min-height: 2.8em;
	margin: 0;
	color: var(--ly-title-color);
	font-family: inherit;
	font-size: 1.14rem;
	font-weight: 500;
	line-height: 1.4;
}

.ly-card__title a {
	color: inherit;
	text-decoration: none;
}

.ly-card__title a:hover {
	color: var(--ly-accent);
}

/* Optional extras - hidden by default so cards match /products exactly. */

.ly-card__excerpt {
	margin: 8px 0 0;
	color: var(--ly-text-color);
	font-size: 13px;
	line-height: 1.5;
}

.ly-card__price {
	margin: 8px 0 0;
	color: var(--ly-title-color);
	font-size: 14px;
	font-weight: 600;
}

.ly-card a:focus-visible,
.ly-scenarios a:focus-visible {
	outline: 2px solid var(--ly-accent);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * Empty states & "view all" footer
 * ------------------------------------------------------------------ */

.ly-empty {
	padding: 44px 24px;
	border: 1px dashed #DCDCDC;
	border-radius: var(--ly-radius);
	background: #FAFAFA;
	text-align: center;
}

.ly-empty p {
	margin: 0;
	color: #777777;
	font-size: 14px;
}

.ly-empty--global {
	margin-top: 12px;
}

.ly-panel__more {
	margin: 26px 0 0;
	text-align: center;
}

.ly-panel__more a {
	display: inline-block;
	padding: 11px 26px;
	border: 1px solid var(--ly-panel-accent, var(--ly-accent));
	border-radius: 3px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.ly-panel__more a:hover {
	background: var(--ly-panel-accent, var(--ly-accent));
	color: #FFFFFF;
}

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 1200px) {
	.ly-scenarios__grid { grid-template-columns: 26% minmax(0, 1fr); }
	.ly-sidenav { padding: 16px 14px; }
	.ly-scenarios__panels { padding: 16px; }
}

@media (max-width: 1024px) {
	.ly-grid { grid-template-columns: repeat(var(--ly-cols-tablet), minmax(0, 1fr)); }
	.ly-panel__title { font-size: 21px; }
}

@media (max-width: 767px) {
	.ly-scenarios__grid,
	.ly-scenarios__grid--single {
		grid-template-columns: minmax(0, 1fr);
		gap: 12px;
	}

	/* Side nav becomes a horizontally scrollable chip row. */
	.ly-sidenav { padding: 14px 12px; }
	.ly-sidenav__title { margin-bottom: 6px; font-size: 16px; }
	.ly-sidenav__list {
		display: flex;
		gap: 8px;
		overflow-x: auto;
		padding-bottom: 4px;
		-webkit-overflow-scrolling: touch;
	}
	.ly-sidenav__list li { flex: 0 0 auto; border-bottom: 0; }
	.ly-scenarios__tab {
		width: auto;
		gap: 8px;
		padding: 8px 12px;
		border: 1px solid #ECECEC;
		white-space: nowrap;
	}
	.ly-scenarios__tab.is-active { border-color: var(--ly-tab-accent, var(--ly-accent)); }
	.ly-sidenav__foot { margin-top: 10px; padding-top: 10px; }

	.ly-scenarios__panels { padding: 14px; }
	.ly-panel__header { margin-bottom: 16px; }
	.ly-panel__meta { width: 100%; justify-content: space-between; }
}

@media (max-width: 640px) {
	.ly-grid { grid-template-columns: repeat(var(--ly-cols-mobile), minmax(0, 1fr)); gap: 12px; }
	.ly-scenarios__head { margin-bottom: 14px; }
	.ly-panel__title { font-size: 20px; }
	.ly-scenarios--stacked .ly-panel + .ly-panel { margin-top: 28px; padding-top: 24px; }
}

/* ------------------------------------------------------------------ *
 * Back-end helpers (term form / product metabox)
 * ------------------------------------------------------------------ */

.ly-term-image__preview {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 150px;
	min-height: 90px;
	margin-bottom: 8px;
	border: 1px dashed #C3C4C7;
	background: #F6F7F8;
}

.ly-term-image__preview img {
	display: block;
	max-width: 100%;
	height: auto;
}

.ly-term-image__actions {
	margin: 0;
}

.ly-term-checklist {
	max-height: 220px;
	overflow-y: auto;
	padding: 4px 2px;
}

.ly-term-checklist__item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 0;
	line-height: 1.3;
}

.ly-term-checklist__item--depth-1 { padding-left: 16px; }
.ly-term-checklist__item--depth-2 { padding-left: 32px; }
.ly-term-checklist__item--depth-3 { padding-left: 48px; }
.ly-term-checklist__item--depth-4 { padding-left: 64px; }

/* ------------------------------------------------------------------ *
 * Scenario taxonomy archive (/application-scenario/<slug>/)
 * Uses the same hero + #F5F5F5 canvas + white card language.
 * ------------------------------------------------------------------ */

.ly-archive {
	padding: 0 0 60px;
	background: #F5F5F5;
	color: #1B1B1B;
	font-family: Inter, Arial, Helvetica, sans-serif;
}

.ly-archive__hero {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 320px;
	background-color: #101010;
	background-position: center;
	background-size: cover;
	color: #FFFFFF;
}

.ly-archive__hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.8);
}

.ly-archive__hero-inner {
	position: relative;
	width: 100%;
	max-width: 1400px;
	margin: 0 auto;
	padding: 56px 5%;
}

.ly-archive__eyebrow {
	display: block;
	margin-bottom: 10px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	opacity: 0.85;
}

.ly-archive__title {
	margin: 0 0 10px;
	color: #FFFFFF;
	font-family: Arial, Helvetica, sans-serif;
	font-size: clamp(28px, 3.4vw, 40px);
	font-weight: 700;
	line-height: 1.2;
}

.ly-archive__subtitle {
	max-width: 900px;
	margin: 0 0 8px;
	color: #FAFAFA;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
}

.ly-archive__desc {
	max-width: 900px;
	margin: 0;
	color: #FAFAFA;
	font-size: 16px;
	line-height: 1.7;
	opacity: 0.92;
}

.ly-archive__desc p {
	margin: 0 0 8px;
}

.ly-archive__inner {
	width: 100%;
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 5%;
}

.ly-archive__crumb {
	padding: 14px 0 0;
	color: #888888;
	font-size: 13px;
}

.ly-archive__crumb a {
	color: #666666;
	text-decoration: none;
}

.ly-archive__crumb a:hover {
	color: var(--ly-archive-accent, #1C51FF);
}

.ly-archive__card {
	margin-top: 14px;
	padding: 24px;
	border-radius: 5px;
	background: #FFFFFF;
}

.ly-archive__note {
	margin-top: 22px;
	padding: 20px;
	border-radius: 5px;
	background: #FFFFFF;
	font-size: 16px;
	line-height: 1.7;
}

.ly-archive__note h2 {
	margin: 0 0 10px;
	font-size: 20px;
	font-weight: 600;
}

.ly-archive__note p {
	margin: 0 0 8px;
}

.ly-archive__back {
	margin: 26px 0 0;
	text-align: center;
}

.ly-archive__back a {
	color: var(--ly-archive-accent, #1C51FF);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

@media (max-width: 767px) {
	.ly-archive__hero { min-height: 240px; }
	.ly-archive__hero-inner { padding: 36px 5%; }
	.ly-archive__subtitle { font-size: 16px; }
	.ly-archive__desc { font-size: 14px; }
	.ly-archive__card { padding: 16px; }
}
