/*
 * Index and fund pages: price chart in the stock page's Chart-tab style (owner request 2026-11-07).
 * Mirrors the chart rules in css/ms-stock-layout.css. Scoped to body.ms-chart-v2
 * (see includes/ms-price-chart-v2.php).
 */
body.ms-chart-v2 {
	--ms-sl-gold: #F59E0B;
	--ms-sl-tile: rgba(255, 255, 255, 0.04);
	--ms-sl-tile-border: rgba(255, 255, 255, 0.08);
}

/* Same page width as the stock page (style.css narrows index pages to 70%). */
body.ms-chart-v2 .stockDetailsStack {
	width: min(var(--ms-page-max, 1168px), calc(100% - 2 * var(--ms-page-gutter, 16px))) !important;
	max-width: none !important;
}
body.ms-chart-v2 .detailsStackInner .wp-block-group:has(.chartStockDetailsWrap) {
	width: 100% !important;
	max-width: none !important;
}

/* Outer card: no horizontal scrollbar. */
body.ms-chart-v2 .chartStockDetailsWrap {
	width: 100% !important;
	max-width: none !important;
	overflow-x: auto !important;
	scrollbar-width: none;
}
body.ms-chart-v2 .chartStockDetailsWrap::-webkit-scrollbar { display: none; }

/* "Trading Metrics" label: section-heading style. */
body.ms-chart-v2 .chartStockDetailsWrap p:has(> strong) {
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--ms-sl-gold);
	text-align: left;
	margin: 24px 0 8px;
}
body.ms-chart-v2 .chartStockDetailsWrap p:has(> strong) strong { font-weight: 600; }

/* Chart card: flat inner surface and one gold hairline (no blue-grey gradient). */
body.ms-chart-v2 .modern-chart-container {
	background: var(--ms-sl-tile) !important;
	border: 1px solid var(--ms-sl-tile-border) !important;
	box-shadow: none !important;
	border-radius: 12px !important;
}
body.ms-chart-v2 .modern-chart-container::before { background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.5), transparent); }

/* Header row: ticker left, timeframes right, aligned with the chart card. */
body.ms-chart-v2 .chartStockDetailsWrap > .wp-block-group:first-of-type {
	display: flex !important;
	flex-wrap: wrap !important;
	justify-content: space-between !important;
	align-items: center !important;
	width: 100% !important;
	max-width: none !important;
	padding: 0 20px !important;
	box-sizing: border-box;
}
body.ms-chart-v2 .chartStockDetailsWrap > .wp-block-group:first-of-type > :first-child { flex: 0 0 auto !important; width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; text-align: left !important; }
body.ms-chart-v2 .chartStockDetailsWrap > .wp-block-group:first-of-type > :first-child > * { max-width: none !important; margin-left: 0 !important; text-align: left !important; }
body.ms-chart-v2 .chartStockDetailsWrap .stockChartTabs { flex: 0 0 auto !important; margin: 0 0 0 auto !important; justify-content: flex-end !important; }

/* Period change sits in the chart card's top-right corner. */
body.ms-chart-v2 .stockChartWrap .periodChg { right: 30px !important; top: 16px !important; border-radius: 8px; }

@media (max-width: 1000px) {
	body.ms-chart-v2 .chartStockDetailsWrap > .wp-block-group:first-of-type { padding: 0 !important; }
	body.ms-chart-v2 .stockChartWrap .periodChg { right: 10px !important; top: 14px !important; }
}

/* Desktop: full width, taller chart (height set by the inline script). */
@media (min-width: 1001px) {
	body.ms-chart-v2 .stockChartWrap,
	body.ms-chart-v2 .modern-chart-container { width: 100% !important; max-width: none !important; height: auto !important; max-height: none !important; }
	body.ms-chart-v2 #tradingMetricsT { max-width: none !important; width: 100% !important; margin-left: 0 !important; }
}

/* Phones: the seven period buttons share one full-width row (5Y was cut off). */
@media (max-width: 640px) {
	body.ms-chart-v2 .chartStockDetailsWrap .stockChartTabs {
		flex: 1 1 100% !important;
		width: 100% !important;
		margin: 8px 0 0 !important;
		flex-wrap: nowrap !important;
		justify-content: space-between !important;
		gap: 4px !important;
	}
	body.ms-chart-v2 .chartStockDetailsWrap .stockChartTabs .subTabChartButton { flex: 1 1 0 !important; min-width: 0 !important; margin: 0 !important; }
	body.ms-chart-v2 .chartStockDetailsWrap .stockChartTabs .subTabChartButton .wp-block-button__link { width: 100% !important; min-width: 0 !important; padding-left: 0 !important; padding-right: 0 !important; text-align: center; }
}

/* Fund pages: the template's tab script hides every #tab-Content-N pane, but the fund template has
   no tab bar, so the chart pane (#tab-Content-5) would never show. Keep it visible. */
body.ms-chart-v2 #tab-Content-5 { display: block !important; }
