/* =========================================================
   PHENIX MARKETS TABS
========================================================= */

.phenix-markets-tabs {
	--markets-navy: #002859;
	--markets-red: #c8202f;
	--markets-text: #172033;
	--markets-panel: #ffffff;
	--markets-soft: #eef2f6;
	--markets-border: #dfe5ec;

	width: 100%;
	color: var(--markets-text);
}

.phenix-markets-tabs,
.phenix-markets-tabs * {
	box-sizing: border-box;
}


/* =========================================================
   TAB NAVIGATION
========================================================= */

.phenix-markets-tabs__tablist {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	align-items: stretch;
	gap: clamp(5px, 0.65vw, 12px);
	width: 100%;
	margin: 0;
	padding: 0;
}


/* Base tab */
.phenix-markets-tabs__tab {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(5px, 0.5vw, 8px);

	min-width: 0;
	min-height: clamp(58px, 4.25vw, 68px);
	padding: clamp(8px, 0.8vw, 12px) clamp(6px, 0.75vw, 12px);

	border: 1px solid var(--markets-border);
	border-top: 4px solid transparent;
	border-bottom-color: transparent;
	border-radius: 12px 12px 0 0;

	background: #fff;
	box-shadow: none;

	color: var(--markets-navy) !important;
	font: inherit;
	font-size: clamp(12px, 0.9vw, 17px);
	font-weight: 700;
	line-height: 1.15;
	text-align: left;

	cursor: pointer;

	transition:
		border-color 180ms ease,
		background-color 180ms ease,
		color 180ms ease;
}

.phenix-markets-tabs__tab-icon {
	display: block;
	flex: 0 0 auto;
	width: clamp(22px, 1.7vw, 30px);
	height: clamp(22px, 1.7vw, 30px);
	object-fit: contain;
	transition: transform 180ms ease;
}


/* Keep all tab text from inheriting theme button hover colors */

.phenix-markets-tabs__tab span {
	display: block;
	flex: 0 1 auto;
	width: auto;
	min-width: 0;
	max-width: 100%;
	color: inherit !important;
	text-align: left;
	white-space: normal;
	transition: color 180ms ease;
}

/* Inactive tab hover */

.phenix-markets-tabs__tab:not(.is-active):hover {
	z-index: 2;

	border-top-color: var(--market-accent, #168cf0);

	border-right-color: color-mix(
		in srgb,
		var(--market-accent, #168cf0) 18%,
		var(--markets-border)
	);

	border-left-color: color-mix(
		in srgb,
		var(--market-accent, #168cf0) 18%,
		var(--markets-border)
	);

	border-bottom-color: #fff;

	background:
		linear-gradient(
			180deg,
			color-mix(
				in srgb,
				var(--market-accent, #168cf0) 7%,
				#fff
			) 0%,
			#fff 100%
		);

	color: var(--markets-navy) !important;
	box-shadow: none;
}


/* Slight accent color in inactive hovered label */

.phenix-markets-tabs__tab:not(.is-active):hover span {
	color: color-mix(
		in srgb,
		var(--market-accent, #168cf0) 42%,
		var(--markets-navy)
	) !important;
}


/* Active tab */

.phenix-markets-tabs__tab.is-active {
	z-index: 3;

	border: 1px solid var(--markets-border);
	border-top: 4px solid var(--market-accent, #168cf0);
	border-bottom-color: #fff;

	background: #fff;
	box-shadow: none;

	color: var(--markets-navy) !important;
}


/* Prevent active hover from changing text or background */

.phenix-markets-tabs__tab.is-active:hover,
.phenix-markets-tabs__tab.is-active:hover span {
	background: #fff;
	color: var(--markets-navy) !important;
}


/* Extend active and hovered tabs across the panel seam */

.phenix-markets-tabs__tab.is-active::after,
.phenix-markets-tabs__tab:not(.is-active):hover::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: -3px;
	left: 0;
	height: 4px;
	background: #fff;
	pointer-events: none;
}


/* Keyboard focus */

.phenix-markets-tabs__tab:focus-visible {
	z-index: 4;

	outline: 3px solid color-mix(
		in srgb,
		var(--market-accent, #168cf0) 35%,
		transparent
	);

	outline-offset: 2px;
	color: var(--markets-navy) !important;
}


/* Tab icon */

.phenix-markets-tabs__tab-icon {
	display: block;
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	object-fit: contain;

	transition: transform 180ms ease;
}

.phenix-markets-tabs__tab:not(.is-active):hover
.phenix-markets-tabs__tab-icon {
	transform: scale(1.06);
}


/* Panel shell */

.phenix-markets-tabs__panels {
	position: relative;
	z-index: 1;
	margin-top: -1px;
}

.phenix-markets-tabs__panel {
	display: grid;
	grid-template-columns:
		minmax(220px, 1.05fr)
		minmax(280px, 1.1fr)
		minmax(260px, 1.05fr);
	gap: clamp(24px, 3vw, 42px);
	align-items: stretch;
	min-height: 420px;
	padding: clamp(28px, 3vw, 42px);
	border: 1px solid var(--markets-border);
	border-radius: 0 0 16px 16px;
	background: var(--markets-panel);
	box-shadow: 0 18px 38px rgba(9, 28, 57, 0.08);
}

.phenix-markets-tabs__panel[hidden] {
	display: none;
}


/* Feature image */

.phenix-markets-tabs__media {
	min-width: 0;
	height: 100%;
	min-height: 360px;
	overflow: hidden;
	border-radius: 14px;
}

/*
 * The class is currently output on the picture element.
 */
.phenix-markets-tabs__image {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 360px;
	overflow: hidden;
	border-radius: 14px;
}

/* The actual image inside the picture element */
.phenix-markets-tabs__image img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 360px;
	border-radius: 14px;
	object-fit: cover;
	object-position: center;
}
/* Main copy */

.phenix-markets-tabs__main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding-block: 4px;
}

.phenix-markets-tabs__eyebrow {
	margin: 0 0 14px;
	color: var(--markets-red);
	font-size: clamp(16px, 1.125vw, 18px);
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: 1;
	text-transform: uppercase;
}

.phenix-markets-tabs__heading {
	
	margin: 0 0 18px;
	font-size: clamp(28px, 2.1vw, 40px);
	font-weight: 400;
	letter-spacing: -0.035em;
	line-height: 1.08;
	text-wrap: balance;
}

.phenix-markets-tabs__intro {
	margin: 0 0 20px;
	font-size: 18px;
	line-height: 1.5;
}

.phenix-markets-tabs__intro p {
	margin: 0;
}

/* Decorated product list */

.phenix-markets-tabs__product-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px 24px;

	/* Normal spacing below the intro instead of pushing down */
	margin: 8px 0 0;

	padding: 0;
	list-style: none;
}

.phenix-markets-tabs__product-list li {
	position: relative;
	margin: 0;
	padding-left: 18px;
	font-size: 18px;
	line-height: 1.3;
}

.phenix-markets-tabs__product-list li::before {
	content: "✓";
	position: absolute;
	top: 0;
	left: 0;
	color: var(--markets-red);
	font-weight: 800;
}

/* Benefits */

.phenix-markets-tabs__aside {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.phenix-markets-tabs__benefits {
	display: grid;
	gap: 10px;
}

.phenix-markets-tabs__benefit {
	padding: 15px 16px;
	border-radius: 14px;
	background: var(--markets-soft);
}

.phenix-markets-tabs__benefit h4 {
	margin: 0 0 5px;
	color: var(--markets-navy);
	font-size: 18px;
	font-weight: 800;
	line-height: 1.2;
}

.phenix-markets-tabs__benefit p {
	margin: 0;
	font-size: 18px;
	line-height: 1.4;
}

/* Buttons */

.phenix-markets-tabs__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-end;
	min-height: 44px;

	/* Keeps some separation without creating excessive empty space */
	margin-top: 28px;

	padding: 11px 18px;
	border: 1px solid var(--markets-navy);
	border-radius: 5px;
	background: var(--markets-navy);
	color: #fff;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
}

.phenix-markets-tabs__button:hover,
.phenix-markets-tabs__button:focus-visible {
	background: #fff;
	color: var(--markets-navy);
	transform: translateY(-2px);
}

.phenix-markets-tabs__button:focus-visible {
	outline: 3px solid rgba(6, 43, 87, 0.25);
	outline-offset: 3px;
}

.phenix-markets-tabs__overall-cta {
	display: flex;
	justify-content: center;
	margin-top: 28px;
}

.phenix-markets-tabs__button--overall {
	align-self: auto;
	margin-top: 0;
}

/* Editor empty state */

.phenix-markets-tabs--empty {
	padding: 30px;
	border: 1px dashed #aab4c0;
	background: #f5f7f9;
	text-align: center;
}



/* =========================================================
   MOBILE ACCORDION TRIGGERS
========================================================= */

.phenix-markets-tabs__accordion-trigger {
	display: none;
}

.phenix-markets-tabs__accordion-label {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.phenix-markets-tabs__accordion-icon {
	display: block;
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	object-fit: contain;
}

.phenix-markets-tabs__accordion-toggle {
	position: relative;
	flex: 0 0 22px;
	width: 22px;
	height: 22px;
}

.phenix-markets-tabs__accordion-toggle::before,
.phenix-markets-tabs__accordion-toggle::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 2px;
	border-radius: 999px;
	background: currentColor;
	transform: translate(-50%, -50%);
	transition: transform 180ms ease;
}

.phenix-markets-tabs__accordion-toggle::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.phenix-markets-tabs__accordion-trigger.is-active
.phenix-markets-tabs__accordion-toggle::after {
	transform: translate(-50%, -50%) rotate(0deg);
}
/* Tablet */

/* =========================================================
   COMPACT TABS / LARGE TABLET
   Keep all seven markets on one row.
========================================================= */

@media screen and (max-width: 1200px) and (min-width: 769px) {

	.phenix-markets-tabs__tablist {
		grid-template-columns: repeat(7, minmax(0, 1fr));
		gap: 6px;
	}

	.phenix-markets-tabs__tab {
		gap: 5px;
		min-height: 58px;
		padding: 8px 6px;
		font-size: clamp(11px, 1.25vw, 14px);
	}

	.phenix-markets-tabs__tab-icon {
		width: clamp(21px, 2.4vw, 27px);
		height: clamp(21px, 2.4vw, 27px);
	}

	.phenix-markets-tabs__panel {
		grid-template-columns:
			minmax(200px, 0.9fr)
			minmax(280px, 1.1fr);
		gap: clamp(22px, 3vw, 34px);
		padding: clamp(24px, 3vw, 34px);
		border-radius: 0 0 16px 16px;
	}

	.phenix-markets-tabs__aside {
		grid-column: 1 / -1;
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: end;
		gap: 24px;
	}

	.phenix-markets-tabs__button {
		margin-top: 0;
	}
}

/* Mobile */

@media screen and (max-width: 768px) {
	/* Hide desktop tabs */
	.phenix-markets-tabs__tablist {
		display: none;
	}

	.phenix-markets-tabs__panels {
		display: grid;
		gap: 12px;
		margin-top: 0;
	}

	/* Mobile accordion headers */
	.phenix-markets-tabs__accordion-trigger {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		width: 100%;
		min-height: 66px;
		margin: 0;
		padding: 14px 16px;

		border: 1px solid var(--markets-border);
		border-left: 4px solid var(--market-accent, #168cf0);
		border-radius: 12px;

		background: #fff;
		box-shadow: 0 7px 18px rgba(9, 28, 57, 0.06);

		color: var(--markets-navy) !important;
		font: inherit;
		font-size: 17px;
		font-weight: 800;
		line-height: 1.2;
		text-align: left;

		cursor: pointer;
	}

	.phenix-markets-tabs__accordion-trigger.is-active {
		border-radius: 12px 12px 0 0;
		border-bottom-color: transparent;
		background:
			linear-gradient(
				180deg,
				color-mix(
					in srgb,
					var(--market-accent, #168cf0) 7%,
					#fff
				) 0%,
				#fff 100%
			);
	}

	.phenix-markets-tabs__accordion-trigger:focus-visible {
		outline: 3px solid color-mix(
			in srgb,
			var(--market-accent, #168cf0) 35%,
			transparent
		);
		outline-offset: 2px;
	}

	.phenix-markets-tabs__accordion-icon {
		width: 28px;
		height: 28px;
	}

	/* Accordion panel */
	.phenix-markets-tabs__panel {
		grid-template-columns: 1fr;
		gap: 24px;
		min-height: 0;
		margin-top: -12px;
		padding: 22px;

		border-top: 0;
		border-radius: 0 0 12px 12px;
		box-shadow: 0 12px 24px rgba(9, 28, 57, 0.08);
	}

	.phenix-markets-tabs__panel[hidden] {
		display: none;
	}

	.phenix-markets-tabs__media {
		height: auto;
		min-height: 0;
	}

	.phenix-markets-tabs__image,
	.phenix-markets-tabs__image img {
		width: 100%;
		height: auto;
		min-height: 0;
		aspect-ratio: 4 / 3;
		object-fit: cover;
	}

	.phenix-markets-tabs__heading {
		max-width: none;
		font-size: clamp(28px, 8vw, 36px);
	}

	.phenix-markets-tabs__product-list {
		grid-template-columns: 1fr 1fr;
	}

	.phenix-markets-tabs__aside {
		grid-column: auto;
		display: flex;
		gap: 22px;
	}

	.phenix-markets-tabs__button {
		align-self: flex-start;
	}
}

@media screen and (max-width: 460px) {
	.phenix-markets-tabs__product-list {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.phenix-markets-tabs__tab,
	.phenix-markets-tabs__button {
		transition: none;
	}
}

/* =========================================================
   GUTENBERG EDITOR PREVIEW
   Rendered only by markets-tabs.php when $is_preview is true.
========================================================= */
.phenix-block-preview--markets {
	max-width: 1100px;
	margin: 18px auto;
	border: 1px solid #d8dee8;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 8px 28px rgba(9, 28, 57, 0.08);
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: #15243a;
}

.phenix-block-preview--markets .phenix-block-preview__bar,
.phenix-block-preview--markets .phenix-block-preview__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 18px;
	background: #f5f7fa;
	border-bottom: 1px solid #e3e7ed;
}

.phenix-block-preview--markets .phenix-block-preview__bar > div { display: flex; align-items: baseline; gap: 10px; }
.phenix-block-preview--markets .phenix-block-preview__bar strong { font-size: 15px; }
.phenix-block-preview--markets .phenix-block-preview__bar span { font-size: 12px; color: #66758a; }
.phenix-block-preview--markets .phenix-block-preview__count { padding: 4px 9px; border-radius: 999px; background: #e8edf4; font-weight: 700; }
.phenix-block-preview--markets .phenix-block-preview__chips { display: flex; gap: 7px; flex-wrap: wrap; padding: 14px 18px 0; }
.phenix-block-preview--markets .phenix-block-preview__chips span { padding: 6px 9px; border: 1px solid #d9e0e9; border-radius: 5px; background: #fff; font-size: 12px; font-weight: 650; color: #526175; }
.phenix-block-preview--markets .phenix-block-preview__chips .is-active { border-color: #168cf0; color: #0d64ad; background: #eef7ff; }
.phenix-block-preview--markets .phenix-block-preview__body { display: grid; grid-template-columns: minmax(180px, 32%) 1fr; gap: 24px; padding: 18px; }
.phenix-block-preview--markets .phenix-block-preview__media { min-height: 190px; border-radius: 7px; overflow: hidden; background: #edf1f5; }
.phenix-block-preview--markets .phenix-block-preview__media img { display: block; width: 100%; height: 100%; min-height: 190px; max-height: 260px; object-fit: cover; }
.phenix-block-preview--markets .phenix-block-preview__content { align-self: center; }
.phenix-block-preview--markets .phenix-block-preview__eyebrow { margin: 0 0 5px; font-size: 11px; line-height: 1.3; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #168cf0; }
.phenix-block-preview--markets h3 { margin: 0 0 8px; font-size: clamp(23px, 3vw, 34px); line-height: 1.08; color: #13223a; }
.phenix-block-preview--markets .phenix-block-preview__copy { max-width: 680px; font-size: 14px; line-height: 1.55; color: #526175; }
.phenix-block-preview--markets .phenix-block-preview__copy p { margin: 0; }
.phenix-block-preview--markets .phenix-block-preview__hint { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #e6eaf0; font-size: 12px; color: #758297; }
.phenix-block-preview--markets .phenix-block-preview__empty { display: grid; gap: 5px; padding: 36px 22px; text-align: center; color: #526175; }
.phenix-block-preview--markets .phenix-block-preview__empty strong { color: #15243a; }

@media (max-width: 700px) {
	.phenix-block-preview--markets .phenix-block-preview__body { grid-template-columns: 1fr; }
	.phenix-block-preview--markets .phenix-block-preview__media { min-height: 150px; }
}
