/* --------------------------------------------------------------------------
   HECM principal limit factor charts (inc/srm-charts.php)
   -------------------------------------------------------------------------- */
.srm-chart {
	margin: 1.75rem 0;
	padding: 1.25rem 1.25rem 1rem;
	max-width: 100%;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	background: #fff;
	box-sizing: border-box;
}

.srm-chart__title {
	margin: 0 0 0.35rem;
	color: #0f172a;
	font-weight: 700;
	font-size: 1.05rem;
	line-height: 1.35;
}

.srm-chart__summary,
.srm-chart__help,
.srm-chart__source {
	margin: 0 0 0.75rem;
	color: #334155;
	font-size: 0.9rem;
	line-height: 1.5;
}

.srm-chart__help[hidden] {
	display: none;
}

.srm-chart__frame {
	display: grid;
	grid-template-columns: 2.6rem minmax(0, 1fr);
	grid-template-rows: auto 260px auto auto;
	margin: 0.5rem 0 0.75rem;
	color: #5f6673;
	font-size: 0.8rem;
	line-height: 1;
}

.srm-chart__ytitle {
	grid-column: 1 / -1;
	margin-bottom: 0.6rem;
	font-weight: 600;
}

.srm-chart__yaxis,
.srm-chart__xaxis {
	position: relative;
}

.srm-chart__yaxis span {
	position: absolute;
	right: 0.5rem;
	transform: translateY(-50%);
	white-space: nowrap;
}

.srm-chart__xaxis {
	grid-column: 2;
	height: 1.6rem;
}

.srm-chart__xaxis span {
	position: absolute;
	top: 0.5rem;
	transform: translateX(-50%);
	white-space: nowrap;
}

.srm-chart__xaxis span:first-child {
	transform: none;
}

.srm-chart__xaxis span:last-child {
	transform: translateX(-100%);
}

.srm-chart__xtitle {
	grid-column: 2;
	margin-top: 0.35rem;
	font-weight: 600;
	text-align: center;
	line-height: 1.3;
}

.srm-chart__plot {
	position: relative;
	min-width: 0;
	border-radius: 4px;
	touch-action: pan-y;
	cursor: crosshair;
}

.srm-chart__plot:focus {
	outline: none;
}

.srm-chart__plot:focus-visible {
	outline: 2px solid #2e5eb1;
	outline-offset: 4px;
}

.srm-chart__svg {
	display: block;
	overflow: visible;
}

.srm-chart__grid {
	stroke: #e2e8f0;
	stroke-width: 1;
}

.srm-chart__line line {
	stroke: #2e5eb1;
	stroke-width: 2.5;
	stroke-linecap: round;
}

.srm-chart__cross,
.srm-chart__dot,
.srm-chart__tip {
	position: absolute;
	pointer-events: none;
}

.srm-chart__cross {
	top: 0;
	bottom: 0;
	width: 0;
	border-left: 1px dashed #64748b;
}

.srm-chart__dot {
	width: 12px;
	height: 12px;
	margin: -6px 0 0 -6px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #2e5eb1;
	box-shadow: 0 0 0 1px #2e5eb1;
	box-sizing: border-box;
}

.srm-chart__tip {
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 0.45rem 0.6rem;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
	color: #334155;
	max-width: 100%;
	box-sizing: border-box;
	font-size: 0.8rem;
	line-height: 1.2;
}

.srm-chart__tip strong {
	color: #0f172a;
	font-size: 0.95rem;
}

.srm-chart__cross[hidden],
.srm-chart__dot[hidden],
.srm-chart__tip[hidden] {
	display: none;
}

.srm-chart__live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.srm-chart__data {
	margin: 0 0 0.75rem;
}

.srm-chart__data summary {
	display: inline-block;
	min-height: 44px;
	padding: 0.7rem 0;
	color: #2e5eb1;
	font-weight: 600;
	cursor: pointer;
}

.srm-chart__data .srm-chart__table-wrap {
	max-width: 26rem;
	max-height: 22rem;
	margin: 0;
	overflow: auto;
}

.srm-chart__data .srm-chart__table-wrap td {
	min-width: 0;
	padding: 8px 18px;
}

.srm-chart__data .srm-chart__table-wrap th {
	position: sticky;
	top: 0;
	padding: 10px 18px;
}

.srm-chart__data caption {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.srm-chart__source {
	margin-bottom: 0;
	font-size: 0.82rem;
}

@media (min-width: 768px) {
	.srm-chart__frame {
		grid-template-rows: auto 300px auto auto;
	}
}

@media (max-width: 480px) {
	.srm-chart {
		padding: 1rem 0.75rem 0.85rem;
	}

	.srm-chart__frame {
		grid-template-columns: 2.3rem minmax(0, 1fr);
		grid-template-rows: auto 220px auto auto;
	}

	.srm-chart--dense-x .srm-chart__xaxis span:nth-child(even) {
		display: none;
	}
}

@media (forced-colors: active) {
	.srm-chart__line line {
		stroke: CanvasText;
	}

	.srm-chart__dot {
		background: Highlight;
	}
}
