/* Long-form pages: NSPIRE guides, the /guides/ and /pha/ hubs, housing authority notes, legal pages.
   Owner: content-pages agent. Builds on the tokens and components in /assets/site.css; mobile-first.
   Layout: one reading column; from 64rem a sticky "On this page" rail sits to its right. */

/* ---------- Page frame ---------- */

.doc {
	padding-top: var(--sp-5);
}

@media (min-width: 48rem) {
	.doc {
		padding-top: var(--sp-6);
	}
}

.doc-head {
	margin-bottom: var(--sp-6);
}

.doc-head__title {
	max-width: 32ch;
	margin-bottom: var(--sp-4);
	font-size: clamp(1.875rem, 1.3rem + 2.3vw, 2.75rem);
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.doc-head__sub {
	max-width: 62ch;
	margin-bottom: var(--sp-4);
	color: var(--ink-2);
	font-size: var(--fs-lg);
	line-height: 1.5;
}

.doc-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-1) var(--sp-4);
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--muted);
	font-size: var(--fs-sm);
	font-variant-numeric: tabular-nums;
}

/* Separators only where the row fits on one line; on phones the items wrap with plain gaps. */
@media (min-width: 48rem) {
	.doc-meta {
		column-gap: 0;
	}

	.doc-meta li {
		padding-right: var(--sp-3);
	}

	.doc-meta li + li {
		padding-left: var(--sp-3);
		border-left: 1px solid var(--rule-strong);
	}
}

/* On phones the current page is the h1 right below; the trail keeps only the way back. */
@media (max-width: 39.99rem) {
	.doc .breadcrumbs__item:last-child:not(:first-child) {
		display: none;
	}
}

.doc-meta a {
	color: var(--teal-800);
}

.doc-grid {
	display: grid;
	gap: var(--sp-6);
}

.doc-main {
	min-width: 0;
	max-width: 42.5rem;
}

.doc-main > :first-child {
	margin-top: 0;
}

@media (min-width: 64rem) {
	.doc-grid {
		grid-template-columns: minmax(0, 42.5rem) 15.5rem;
		justify-content: space-between;
		gap: var(--sp-7) 4rem;
		align-items: start;
	}

	.doc-rail {
		position: sticky;
		top: var(--sp-5);
		max-height: calc(100vh - 2 * var(--sp-5));
		overflow-y: auto;
		overscroll-behavior: contain;
		padding-bottom: var(--sp-4);
	}
}

/* Headings jumped to from the table of contents keep a little air above them. */
.doc :is(h2, h3)[id],
.doc section[id] {
	scroll-margin-top: var(--sp-5);
}

/* ---------- On this page ---------- */

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

.toc__item + .toc__item {
	margin-top: 0;
}

.toc__link {
	display: block;
	padding: 0.3125rem 0 0.3125rem var(--sp-3);
	color: var(--ink-2);
	font-size: var(--fs-sm);
	line-height: 1.35;
	text-decoration: none;
}

.toc__link:hover {
	color: var(--teal-800);
	text-decoration: underline;
}

.toc__list--sub .toc__link {
	padding-left: calc(var(--sp-3) + 0.875rem);
	color: var(--muted);
	font-size: var(--fs-xs);
}

.toc--inline {
	margin: 0 0 var(--sp-6);
	border: 1px solid var(--rule-strong);
	border-radius: var(--radius-card);
	background: var(--surface);
}

.toc__summary {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	min-height: 2.875rem;
	padding: var(--sp-2) var(--sp-4);
	color: var(--ink);
	font-weight: 650;
	cursor: pointer;
	list-style: none;
}

.toc__summary::-webkit-details-marker {
	display: none;
}

.toc__summary::after {
	content: "+";
	margin-left: auto;
	color: var(--teal-700);
	font-size: 1.375rem;
	font-weight: 500;
	line-height: 1;
}

.toc__details[open] > .toc__summary::after {
	content: "\2212";
}

.toc__count {
	color: var(--muted);
	font-size: var(--fs-sm);
	font-weight: 400;
}

.toc--inline .toc__details > .toc__list {
	padding: 0 var(--sp-4) var(--sp-3);
	border-top: 1px solid var(--rule);
}

.toc--inline .toc__details > .toc__list > .toc__item {
	border-bottom: 1px solid var(--rule);
}

.toc--inline .toc__details > .toc__list > .toc__item:last-child {
	border-bottom: 0;
}

.toc--inline .toc__link {
	padding-block: 0.5rem;
	padding-left: 0;
}

.toc--inline .toc__list--sub {
	padding-bottom: var(--sp-2);
}

.toc--inline .toc__list--sub .toc__link {
	padding-block: 0.3125rem;
	padding-left: var(--sp-4);
}

.toc--rail {
	display: none;
}

@media (min-width: 64rem) {
	.toc--inline {
		display: none;
	}

	.toc--rail {
		display: block;
	}
}

.toc__heading {
	margin-bottom: var(--sp-2);
	color: var(--ink);
	font-size: var(--fs-sm);
	letter-spacing: 0;
}

.toc--rail > .toc__list {
	border-left: 2px solid var(--rule);
}

.toc--rail .toc__link {
	margin-left: -2px;
	border-left: 2px solid transparent;
}

.toc--rail .toc__link[aria-current] {
	border-left-color: var(--teal-700);
	color: var(--teal-900);
	font-weight: 650;
}

/* ---------- The short answer ---------- */

.answer {
	margin: 0 0 var(--sp-6);
	padding: var(--sp-4) var(--sp-5) var(--sp-5);
	background: var(--teal-50);
	border-left: 4px solid var(--teal-700);
	border-radius: 0 var(--radius-card) var(--radius-card) 0;
}

.answer__title {
	margin-bottom: var(--sp-2);
	color: var(--teal-800);
	font-size: var(--fs-sm);
	letter-spacing: 0;
}

.answer__body > :last-child {
	margin-bottom: 0;
}

.answer__body p {
	color: var(--ink);
	font-size: 1.0625rem;
	line-height: 1.6;
}

@media (min-width: 48rem) {
	.answer__body p {
		font-size: 1.1875rem;
		line-height: 1.55;
	}
}

/* ---------- Figure ---------- */

.doc-figure {
	margin: 0 0 var(--sp-6);
}

.doc-figure img {
	width: 100%;
	aspect-ratio: 2 / 1;
	object-fit: cover;
	border-radius: var(--radius-card);
	background: var(--wash);
}

.doc-figure figcaption {
	margin-top: var(--sp-2);
	color: var(--muted);
	font-size: var(--fs-xs);
}

/* ---------- Body copy ---------- */

.doc-body {
	max-width: none;
}

.doc-body h2 {
	margin-top: 2.4em;
	margin-bottom: 0.6em;
	font-size: clamp(1.375rem, 1.2rem + 0.7vw, 1.625rem);
	line-height: 1.2;
}

.doc-body h3 {
	margin-top: 1.8em;
	margin-bottom: 0.45em;
	font-size: 1.1875rem;
	letter-spacing: -0.005em;
}

.doc-body h2 + h3 {
	margin-top: 1em;
}

.doc-body p,
.doc-body ul,
.doc-body ol {
	margin-bottom: 1.05em;
}

.doc-body a {
	overflow-wrap: anywhere;
}

.doc-body blockquote {
	margin: 1.5em 0;
	padding: 0.25em 0 0.25em 1.1em;
	border-left: 3px solid var(--teal-200);
	color: var(--ink);
}

/* Responsive tables: wide tables scroll inside their frame; from phone width down, labelled tables stack. */
.rtable {
	margin: 1.5em 0 1.75em;
	overflow-x: auto;
	border: 1px solid var(--rule);
	border-radius: var(--radius-card);
	-webkit-overflow-scrolling: touch;
}

.doc-body .rtable table {
	margin: 0;
	font-size: var(--fs-sm);
	line-height: 1.5;
}

.doc-body .rtable caption {
	padding: var(--sp-3) var(--sp-4);
	border-bottom: 1px solid var(--rule);
	color: var(--ink);
	font-weight: 650;
	text-align: left;
}

.doc-body .rtable th,
.doc-body .rtable td {
	padding: 0.625rem var(--sp-4);
}

.doc-body .rtable thead th {
	background: var(--wash);
	font-weight: 650;
}

.doc-body .rtable tbody th {
	background: transparent;
	font-weight: 650;
}

.doc-body .rtable tbody tr:last-child > * {
	border-bottom: 0;
}

@media screen and (max-width: 39.99rem) {
	.rtable--stack {
		overflow: visible;
		border: 0;
		border-radius: 0;
	}

	.rtable--stack table,
	.rtable--stack tbody,
	.rtable--stack tr,
	.rtable--stack th,
	.rtable--stack td,
	.rtable--stack caption {
		display: block;
		width: 100%;
	}

	.rtable--stack thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.doc-body .rtable--stack caption {
		padding: 0 0 var(--sp-2);
		border: 0;
	}

	.doc-body .rtable--stack tr {
		margin-bottom: var(--sp-3);
		padding: var(--sp-3) var(--sp-4);
		border: 1px solid var(--rule);
		border-radius: var(--radius-card);
		background: var(--surface);
	}

	.doc-body .rtable--stack th,
	.doc-body .rtable--stack td {
		padding: 0.25rem 0;
		border: 0;
	}

	.doc-body .rtable--stack .rtable__lead {
		padding-bottom: var(--sp-2);
		color: var(--ink);
		font-size: var(--fs-md);
		font-weight: 650;
	}

	.doc-body .rtable--stack [data-label]:not(.rtable__lead)::before {
		content: attr(data-label);
		display: block;
		color: var(--muted);
		font-size: var(--fs-xs);
		font-weight: 650;
	}
}

/* ---------- Sections after the body ---------- */

.doc-section {
	margin-top: var(--sp-7);
}

.doc-section > h2 {
	font-size: var(--fs-xl);
}

.sources__intro {
	color: var(--muted);
	font-size: var(--fs-sm);
}

.sources__list {
	margin: 0;
	padding-left: 1.75rem;
	font-size: var(--fs-sm);
	line-height: 1.5;
}

.sources__item {
	padding-left: var(--sp-1);
	overflow-wrap: anywhere;
}

.sources__item + .sources__item {
	margin-top: var(--sp-2);
}

.sources__item::marker {
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.sources__meta {
	display: block;
	color: var(--muted);
	font-size: var(--fs-xs);
}

/* ---------- Guide lists ---------- */

.guide-list {
	display: grid;
	gap: 0 var(--sp-6);
	margin: 0;
	padding: 0;
	list-style: none;
}

.guide-list__item {
	display: flex;
	gap: var(--sp-4);
	padding-block: var(--sp-4);
	border-top: 1px solid var(--rule);
}

.guide-list__thumb {
	flex: none;
}

.guide-list__thumb img {
	width: 5.5rem;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: var(--radius-control);
	background: var(--wash);
}

@media (min-width: 40rem) {
	.guide-list__thumb img {
		width: 8rem;
	}
}

.guide-list__text {
	min-width: 0;
}

.guide-list__title {
	margin-bottom: var(--sp-1);
	font-size: 1.0625rem;
	line-height: 1.3;
	letter-spacing: 0;
	text-wrap: pretty;
}

.guide-list__title a {
	color: var(--teal-800);
	text-decoration: none;
}

.guide-list__title a:hover {
	color: var(--teal-900);
	text-decoration: underline;
}

.guide-list__desc {
	margin-bottom: var(--sp-1);
	color: var(--ink-2);
	font-size: var(--fs-sm);
	line-height: 1.5;
}

.guide-list__meta {
	margin: 0;
	color: var(--muted);
	font-size: var(--fs-xs);
	font-variant-numeric: tabular-nums;
}

.doc-related {
	margin-top: var(--sp-7);
	padding-block: var(--sp-6) var(--sp-5);
	background: var(--wash);
	border-block: 1px solid var(--rule);
}

.doc-related h2 {
	margin-bottom: var(--sp-4);
	font-size: var(--fs-xl);
}

.doc-related .guide-list__item:first-child {
	border-top-color: var(--rule-strong);
}

@media (min-width: 48rem) {
	.doc-related .guide-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.doc-related .guide-list__item:nth-child(2) {
		border-top-color: var(--rule-strong);
	}
}

/* ---------- Call to action: deep teal, framed like a phone camera's viewfinder ---------- */

.cta-panel {
	--frame: rgb(153 246 228 / 0.55);
	--corner: 1.25rem;
	--inset: 0.875rem;
	display: grid;
	gap: var(--sp-5);
	margin-top: var(--sp-7);
	padding: clamp(1.75rem, 5vw, 2.75rem) clamp(1.5rem, 5vw, 3rem);
	border-radius: 14px;
	background:
		linear-gradient(var(--frame), var(--frame)) left var(--inset) top var(--inset) / var(--corner)
			2px,
		linear-gradient(var(--frame), var(--frame)) left var(--inset) top var(--inset) / 2px
			var(--corner),
		linear-gradient(var(--frame), var(--frame)) right var(--inset) top var(--inset) / var(--corner)
			2px,
		linear-gradient(var(--frame), var(--frame)) right var(--inset) top var(--inset) / 2px
			var(--corner),
		linear-gradient(var(--frame), var(--frame)) left var(--inset) bottom var(--inset) /
			var(--corner) 2px,
		linear-gradient(var(--frame), var(--frame)) left var(--inset) bottom var(--inset) / 2px
			var(--corner),
		linear-gradient(var(--frame), var(--frame)) right var(--inset) bottom var(--inset) /
			var(--corner) 2px,
		linear-gradient(var(--frame), var(--frame)) right var(--inset) bottom var(--inset) / 2px
			var(--corner),
		var(--teal-900);
	background-repeat: no-repeat;
	color: var(--teal-100);
}

@media (min-width: 56rem) {
	.cta-panel {
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		gap: var(--sp-6) 4rem;
	}
}

.cta-panel__title {
	max-width: 22ch;
	margin-bottom: var(--sp-3);
	color: #fff;
	font-size: var(--fs-2xl);
}

.cta-panel__body {
	max-width: 56ch;
	margin: 0;
	color: var(--teal-100);
}

.cta-panel__actions {
	display: grid;
	gap: var(--sp-3);
	justify-items: stretch;
}

@media (min-width: 56rem) {
	.cta-panel__actions {
		min-width: 17rem;
	}
}

.cta-panel .btn--primary {
	background: #fff;
	color: var(--teal-900);
}

.cta-panel .btn--primary:hover {
	background: var(--teal-50);
	color: var(--teal-900);
}

.cta-panel .btn--secondary {
	background: transparent;
	border-color: var(--teal-200);
	color: #fff;
}

.cta-panel .btn--secondary:hover {
	background: rgb(255 255 255 / 0.08);
	color: #fff;
}

.cta-panel__more {
	justify-self: center;
	padding-block: var(--sp-1);
	color: var(--teal-200);
	font-size: var(--fs-sm);
}

.cta-panel__more:hover {
	color: #fff;
}

.cta-panel :focus-visible {
	outline-color: var(--teal-200);
}

.doc-note {
	max-width: 75ch;
	margin-top: var(--sp-5);
	color: var(--muted);
	font-size: var(--fs-sm);
}

.doc-note > :last-child {
	margin-bottom: 0;
}

/* ---------- Callouts ---------- */

.doc-callout {
	margin: 0 0 var(--sp-6);
	padding: var(--sp-4) var(--sp-5);
	background: var(--wash);
	border: 1px solid var(--rule);
	border-radius: var(--radius-card);
	color: var(--ink-2);
}

.doc-callout > :last-child {
	margin-bottom: 0;
}

.doc-callout h2,
.doc-callout__title {
	margin-bottom: var(--sp-2);
	font-size: var(--fs-md);
	letter-spacing: 0;
}

.doc-callout--plain {
	margin-top: var(--sp-7);
	background: var(--surface);
}

/* ---------- /guides/ hub ---------- */

.hub-feature {
	display: grid;
	gap: var(--sp-5);
	margin-bottom: var(--sp-6);
	padding: var(--sp-4);
	border: 1px solid var(--rule);
	border-radius: 14px;
	background: var(--surface);
}

.hub-feature .doc-figure {
	margin: 0;
}

.hub-feature__title {
	margin-bottom: var(--sp-3);
	font-size: var(--fs-2xl);
}

.hub-feature__title a {
	color: var(--ink);
	text-decoration: none;
}

.hub-feature__title a:hover {
	color: var(--teal-800);
	text-decoration: underline;
}

.hub-feature__summary {
	color: var(--ink-2);
}

.hub-feature__text .guide-list__meta {
	margin-bottom: var(--sp-4);
}

@media (min-width: 56rem) {
	.hub-feature {
		grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
		align-items: center;
		gap: var(--sp-6);
		padding: var(--sp-5);
	}

	.hub-feature__text {
		padding-right: var(--sp-4);
	}
}

.hub-group,
.pha-state {
	display: grid;
	gap: var(--sp-3) 3rem;
	padding-block: var(--sp-5);
	border-top: 1px solid var(--rule-strong);
}

.hub-group__title,
.pha-state__title {
	margin-bottom: var(--sp-1);
	font-size: var(--fs-xl);
}

.hub-group__blurb {
	margin: 0;
	color: var(--muted);
	font-size: var(--fs-sm);
}

.hub-group .guide-list__item:first-child {
	border-top: 0;
}

@media (min-width: 56rem) {
	.hub-group,
	.pha-state {
		grid-template-columns: 15rem minmax(0, 1fr);
		padding-block: var(--sp-6);
	}

	.hub-group .guide-list__item:first-child {
		padding-top: 0;
	}
}

.hub-pha > :last-child {
	margin-bottom: 0;
}

.hub-pha p {
	max-width: 60ch;
}

/* ---------- /pha/ index ---------- */

.state-jump {
	margin-bottom: var(--sp-5);
}

.state-jump__title {
	margin-bottom: var(--sp-2);
	font-size: var(--fs-sm);
	letter-spacing: 0;
}

.state-jump__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.state-jump__list a {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	min-height: 2.5rem;
	padding: 0.375rem 0.75rem;
	border: 1px solid var(--rule-strong);
	border-radius: var(--radius-control);
	color: var(--ink);
	font-size: var(--fs-sm);
	text-decoration: none;
}

.state-jump__list a:hover {
	border-color: var(--teal-700);
	background: var(--teal-50);
	color: var(--teal-900);
}

.state-jump__count {
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

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

.pha-list__item {
	padding-block: var(--sp-3);
	border-top: 1px solid var(--rule);
}

.pha-list__item:first-child {
	border-top: 0;
	padding-top: 0;
}

.pha-list__name {
	margin-bottom: var(--sp-1);
	font-size: 1.0625rem;
	letter-spacing: 0;
}

.pha-list__name a {
	color: var(--teal-800);
	text-decoration: none;
}

.pha-list__name a:hover {
	text-decoration: underline;
}

.pha-list__where,
.pha-list__meta {
	margin: 0;
	font-size: var(--fs-sm);
}

.pha-list__meta {
	color: var(--muted);
}

/* ---------- Housing authority page ---------- */

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

.fact {
	padding: var(--sp-1) 0 var(--sp-1) var(--sp-4);
	border-left: 3px solid var(--teal-200);
}

.fact + .fact {
	margin-top: var(--sp-5);
}

.fact__text {
	margin-bottom: var(--sp-2);
	color: var(--ink);
	font-size: var(--fs-md);
	line-height: 1.6;
}

@media (min-width: 48rem) {
	.fact__text {
		font-size: 1.125rem;
	}
}

.fact__src {
	margin: 0;
	color: var(--ink-2);
	font-size: var(--fs-sm);
	overflow-wrap: anywhere;
}

.fact__meta {
	color: var(--muted);
}

.link-list {
	margin: 0;
	padding-left: 1.25rem;
}

.link-list li + li {
	margin-top: var(--sp-2);
}

.link-list__host {
	color: var(--muted);
	font-size: var(--fs-sm);
}

/* ---------- Legal pages ---------- */

.legal-nav {
	padding-bottom: var(--sp-5);
}

.legal-nav__title {
	margin-bottom: var(--sp-2);
	color: var(--ink);
	font-size: var(--fs-sm);
	letter-spacing: 0;
}

.legal-nav__list {
	margin: 0;
	padding: 0;
	list-style: none;
	border-left: 2px solid var(--rule);
}

.legal-nav__link {
	display: block;
	margin-left: -2px;
	padding: 0.375rem 0 0.375rem var(--sp-3);
	border-left: 2px solid transparent;
	color: var(--ink-2);
	font-size: var(--fs-sm);
	text-decoration: none;
}

.legal-nav__link:hover {
	color: var(--teal-800);
	text-decoration: underline;
}

.legal-nav__link[aria-current="page"] {
	border-left-color: var(--teal-700);
	color: var(--teal-900);
	font-weight: 650;
}

@media (max-width: 63.99rem) {
	.doc-grid--legal .doc-rail {
		padding-top: var(--sp-5);
		border-top: 1px solid var(--rule);
	}
}

.print-action {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2) var(--sp-4);
	margin-bottom: var(--sp-5);
}

.print-action[hidden] {
	display: none;
}

.print-action__hint {
	margin: 0;
	color: var(--muted);
	font-size: var(--fs-sm);
}

/* The tenant notice reads like the sheet it prints as. */
.notice-sheet {
	margin-block: var(--sp-6);
	padding: var(--sp-5);
	border: 1px solid var(--rule-strong);
	border-radius: var(--radius-control);
	background: var(--surface);
	box-shadow: 0 1px 0 var(--rule);
}

.notice-sheet > h2:first-child {
	margin-top: 0;
}

@media (min-width: 48rem) {
	.notice-sheet {
		padding: var(--sp-6);
	}
}

/* ---------- Print ---------- */

@media print {
	.doc-rail,
	.toc,
	.print-action,
	.cta-panel,
	.doc-related,
	.doc-figure,
	.state-jump {
		display: none !important;
	}

	.doc {
		padding-top: 0;
	}

	.doc-grid {
		display: block;
	}

	.doc-main,
	.doc-body,
	.prose {
		max-width: none;
	}

	.doc-head__title {
		max-width: none;
		font-size: 20pt;
	}

	.answer {
		border: 1px solid #000;
		border-left-width: 3pt;
		background: none;
	}

	.rtable {
		overflow: visible;
	}

	.rtable tr,
	.fact,
	.sources__item {
		break-inside: avoid;
	}

	/* The tenant notice prints only the notice itself, without the page around it. */
	body:has(.has-sheet) .site-header,
	body:has(.has-sheet) .site-footer,
	.has-sheet .doc-head,
	.has-sheet .doc-intro,
	.has-sheet .doc-sec:not(.notice-sheet) {
		display: none !important;
	}

	.has-sheet .notice-sheet {
		margin: 0;
		padding: 0;
		border: 0;
		box-shadow: none;
	}
}
