/*
 * Novin Smart Assessment — the deep analysis report.
 *
 * Every rule is scoped under `.nsa-analysis-report`, which is a class on the
 * report wrapper and appears nowhere else in the product. This file is loaded
 * only on the dashboard, but the scoping is what makes that a performance
 * decision rather than a correctness one: if it were ever loaded beside the
 * public form it still could not reach it.
 *
 * There are no element selectors here — no bare `form`, `input`, `button`,
 * `h2`, `.card` or `.content`. A stylesheet that styles `input` is a stylesheet
 * that will eventually restyle somebody's theme, and the report is the part of
 * this plugin most likely to be dropped into a page that already has opinions.
 *
 * Colour variables come from `.nsa-wrap`, which is always an ancestor.
 */

/* ---------------------------------------------------------------- analysis */

/*
 * The report body is a reading column, not a dashboard.
 *
 * Everything else on this screen is a card grid because everything else is
 * scannable. Nine hundred words of Persian prose is not, and the single biggest
 * thing that makes long RTL text readable is a measure the eye can return from
 * — hence the cap below, which is deliberately narrower than the panels around
 * it and is the reason this section is not just more cards.
 */
.nsa-analysis-report,
.nsa-analysis-report .nsa-analysis {
	max-width: 920px;
	margin-inline: auto;
}

.nsa-analysis-report .nsa-analysis__p {
	margin: 0 0 14px;
	font-size: 15px;
	line-height: 2.15;
	color: var(--nsa-ink);
	text-align: justify;
	text-justify: inter-word;
}

.nsa-analysis-report .nsa-analysis__p:last-child { margin-bottom: 0; }

/*
 * A conclusion the validator could only tie to one fact. It is a real
 * observation and it stays, but it must not carry the same weight as one built
 * on the whole file — so it is set apart rather than styled down to unreadable.
 */
.nsa-analysis-report .nsa-analysis__p.is-tentative {
	padding-inline-start: 12px;
	border-inline-start: 2px solid var(--nsa-line);
	color: var(--nsa-muted);
}

.nsa-analysis-report .nsa-analysis__section + .nsa-analysis__section { margin-top: 14px; }

.nsa-analysis-report .nsa-analysis__head .nsa-kv { margin-bottom: 8px; }

.nsa-analysis-report .nsa-analysis__gap { border-inline-start: 3px solid var(--nsa-cyan); }

.nsa-analysis-report .nsa-analysis-summary .nsa-analysis__p { font-size: 15px; }


/* Scenarios: side by side where there is room, stacked where there is not. */
.nsa-analysis-report .nsa-scenarios {
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr;
}

.nsa-analysis-report .nsa-scenario {
	padding: 16px;
	background: #fff;
	border: 1px solid var(--nsa-line);
	border-radius: var(--nsa-radius-md);
}

.nsa-analysis-report .nsa-scenario.is-suggested { border-color: var(--nsa-cyan); }

.nsa-analysis-report .nsa-scenario__head {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 10px;
}

.nsa-analysis-report .nsa-scenario__risk {
	margin: 10px 0 0;
	font-size: 13px;
	color: var(--nsa-muted);
}

.nsa-analysis-report .nsa-scenario__risk strong { color: var(--nsa-ink); }

/* Trade-offs are two columns because the whole point is that they are two. */
.nsa-analysis-report .nsa-tradeoff {
	padding: 14px 0;
	border-top: 1px solid var(--nsa-line);
}

.nsa-analysis-report .nsa-tradeoff:first-of-type { border-top: 0; padding-top: 0; }

.nsa-analysis-report .nsa-tradeoff__q {
	margin: 0 0 6px;
	font-size: 15px;
	color: var(--nsa-navy);
}

.nsa-analysis-report .nsa-tradeoff__side {
	padding: 12px;
	background: var(--nsa-tint);
	border-radius: var(--nsa-radius-sm);
}

.nsa-analysis-report .nsa-tradeoff__side strong { display: block; margin-bottom: 4px; }
.nsa-analysis-report .nsa-tradeoff__side span { font-size: 13px; color: var(--nsa-muted); line-height: 1.9; }

/*
 * Archive cards. Kept visibly plainer than the programme cards elsewhere —
 * these are links to index pages, and anything that made them look like results
 * would undo the sentence above them.
 */
.nsa-analysis-report .nsa-archives__list {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

.nsa-analysis-report .nsa-archive a {
	display: block;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--nsa-line);
	border-radius: var(--nsa-radius-sm);
	text-decoration: none;
	color: inherit;
}

.nsa-analysis-report .nsa-archive a:hover { border-color: var(--nsa-cyan); }
.nsa-analysis-report .nsa-archive strong { display: block; margin-bottom: 4px; color: var(--nsa-navy); }
.nsa-analysis-report .nsa-archive span { font-size: 13px; color: var(--nsa-muted); line-height: 1.9; }

.nsa-analysis-report .nsa-list--muted li { color: var(--nsa-muted); font-size: 13px; }

@media (min-width: 860px) {
	.nsa-analysis-report .nsa-scenarios { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

@media (max-width: 640px) {
	.nsa-analysis-report .nsa-archives__list { grid-template-columns: 1fr; }
	.nsa-analysis-report .nsa-analysis__p { text-align: start; }
}

/* ------------------------------------------------------------------ story */

/*
 * The report as a vertical spine.
 *
 * The line and the numbers are doing real work rather than decorating: they are
 * what tells the reader that box four follows from box two. The previous layout
 * was a stack of equal cards, which reads as a pile of independent findings —
 * and a pile is exactly what makes somebody skim to the bottom looking for the
 * verdict instead of following the argument to it.
 */
.nsa-analysis-report .nsa-story { max-width: 900px; margin-inline: auto; }

.nsa-analysis-report .nsa-story__list {
	position: relative;
	list-style: none;
	margin: 0;
	padding: 0;
}

/* The spine itself, behind the markers. */
.nsa-analysis-report .nsa-story__list::before {
	content: "";
	position: absolute;
	inset-block: 18px;
	inset-inline-start: 15px;
	width: 2px;
	background: linear-gradient(to bottom, var(--nsa-cyan), var(--nsa-border));
}

.nsa-analysis-report .nsa-story__item {
	position: relative;
	padding-inline-start: 48px;
	margin-bottom: 18px;
}

.nsa-analysis-report .nsa-story__item:last-child { margin-bottom: 0; }

.nsa-analysis-report .nsa-story__marker {
	position: absolute;
	inset-inline-start: 0;
	top: 22px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 999px;
	background: var(--nsa-card, #fff);
	border: 2px solid var(--nsa-cyan);
	color: var(--nsa-navy);
	font-size: .85rem;
	font-weight: 700;
}

.nsa-analysis-report .nsa-story__card {
	padding: 24px;
	background: var(--nsa-card, #fff);
	border: 1px solid var(--nsa-border);
	border-radius: 22px;
	box-shadow: 0 1px 2px rgba(7, 54, 95, .04), 0 8px 24px rgba(7, 54, 95, .06);
}

.nsa-analysis-report .nsa-story__title {
	margin: 0 0 14px;
	font-size: 1.08rem;
	font-weight: 700;
	line-height: 1.7;
	color: var(--nsa-navy);
}

/* The applicant's own answers, so the narrative can be checked against them. */
.nsa-analysis-report .nsa-story__facts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
}

.nsa-analysis-report .nsa-story__facts li {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	padding: 5px 12px;
	background: var(--nsa-bg, #f5f8fa);
	border-radius: 999px;
	font-size: .8rem;
	line-height: 1.9;
}

.nsa-analysis-report .nsa-story__facts span { color: var(--nsa-muted); }
.nsa-analysis-report .nsa-story__facts strong { color: var(--nsa-text); font-weight: 700; }

.nsa-analysis-report .nsa-story__lead {
	margin: 0 0 12px;
	font-size: 1rem;
	font-weight: 700;
	line-height: 2;
	color: var(--nsa-text);
}

/* The consequence, set apart because it is the part that decides something. */
.nsa-analysis-report .nsa-story__effect {
	margin: 14px 0 0;
	padding-inline-start: 12px;
	border-inline-start: 2px solid var(--nsa-cyan);
	font-size: .92rem;
	line-height: 2;
	color: var(--nsa-muted);
}

/* ------------------------------------------------------------- two paths */

.nsa-analysis-report .nsa-paths {
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr;
	margin-top: 16px;
}

.nsa-analysis-report .nsa-path {
	padding: 18px;
	background: var(--nsa-bg, #f5f8fa);
	border: 1px solid transparent;
	border-radius: 18px;
}

.nsa-analysis-report .nsa-path.is-suggested {
	background: var(--nsa-card, #fff);
	border-color: var(--nsa-cyan);
}

.nsa-analysis-report .nsa-path__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
	color: var(--nsa-navy);
}

.nsa-analysis-report .nsa-path__line,
.nsa-analysis-report .nsa-path__risk {
	margin: 8px 0 0;
	font-size: .88rem;
	line-height: 1.95;
}

.nsa-analysis-report .nsa-path__line span,
.nsa-analysis-report .nsa-path__risk span {
	display: block;
	color: var(--nsa-muted);
	font-size: .78rem;
}

.nsa-analysis-report .nsa-story__cta { margin: 18px 0 0; }

@media (min-width: 720px) {
	.nsa-analysis-report .nsa-paths { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
	/* Single column, and the spine tucks in so nothing can push the page wide. */
	.nsa-analysis-report .nsa-story__item { padding-inline-start: 0; }
	.nsa-analysis-report .nsa-story__list::before { display: none; }
	.nsa-analysis-report .nsa-story__card { padding: 18px 16px; border-radius: 18px; }

	.nsa-analysis-report .nsa-story__marker {
		position: static;
		margin-bottom: 10px;
	}

	.nsa-analysis-report .nsa-story,
	.nsa-analysis-report .nsa-story__card { max-width: 100%; overflow-wrap: break-word; }

	.nsa-analysis-report .nsa-story__cta .nsa-btn { width: 100%; }
}
