/*
 * Guides, search results and 404: guide article layout (header, contents,
 * FAQs, sources, notice, sidebar call to action and featured firm), the
 * guides index (topic chips, card grid) and the 404 link columns.
 * Loaded only where those blocks render (block.json "style": "pdir-theme-guides").
 */

/* ---------- Guide article header ---------- */
.sg-guidehead__topic {
	margin-bottom: 16px;
}

.sg-guidehead__title {
	max-width: 880px;
	margin: 0 0 16px;
	font-size: var(--sg-fs-page-h1);
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -0.025em;
}

.sg-guidehead__lead {
	max-width: 760px;
	margin: 0 0 20px;
	color: var(--sg-muted);
	font-size: var(--sg-fs-lead);
	line-height: 1.6;
}

.sg-guidehead__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	margin: 0;
	color: var(--sg-muted);
	font-size: 0.875rem;
}

.sg-guidehead__meta a {
	color: var(--sg-muted);
	text-decoration: underline;
}

.sg-guidehead__meta a:hover {
	color: var(--sg-ink);
}

.sg-guidehead__dot {
	opacity: 0.6;
}

/* ---------- Guide layout: article + sticky sidebar ---------- */
.sg-guide__layout {
	display: grid;
	grid-template-columns: minmax(0, 760px) 320px;
	justify-content: space-between;
	gap: 64px;
	padding-top: 48px;
	padding-bottom: 96px;
	align-items: start;
}

.sg-guide__main {
	min-width: 0;
}

.sg-guide__aside {
	align-self: stretch;
	min-width: 0;
}

/* The call to action and featured firm sit at the top of the sidebar; the
   contents list follows and stays in view while the article scrolls. */
.sg-guide-aside {
	display: flex;
	flex-direction: column;
	gap: 20px;
	height: 100%;
}

.sg-toc--aside {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--sg-header-h) + 24px);
	max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - var(--sg-header-h) - 48px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

@media (max-width: 1023px) {
	.sg-guide__layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 40px;
		padding-top: 32px;
		padding-bottom: 64px;
	}

	.sg-toc--aside {
		display: none;
	}
}

@media (min-width: 1024px) {
	.sg-toc--inline {
		display: none;
	}
}

/* ---------- Contents list ---------- */
.sg-toc__list {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: sg-toc;
}

.sg-toc__list a {
	display: block;
	color: var(--sg-muted);
	font-size: 0.875rem;
	line-height: 1.45;
	text-decoration: none;
}

.sg-toc__list a:hover {
	color: var(--sg-ink);
	text-decoration: underline;
}

.sg-toc--aside {
	padding: 4px 0 4px 2px;
}

.sg-toc__title {
	margin: 0 0 12px;
	color: var(--sg-ink);
	font-family: var(--sg-font-head);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.sg-toc--aside .sg-toc__list {
	border-left: 2px solid var(--sg-line);
}

.sg-toc--aside .sg-toc__list a {
	margin-left: -2px;
	padding: 6px 0 6px 14px;
	border-left: 2px solid transparent;
}

.sg-toc--aside .sg-toc__list a:hover {
	border-left-color: var(--sg-teal-700);
	text-decoration: none;
}

.sg-toc--inline {
	margin: 0 0 32px;
	border: 1px solid var(--sg-line);
	border-radius: var(--sg-radius-input);
	background: var(--sg-soft);
}

.sg-toc__summary {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	padding: 0 16px;
	color: var(--sg-ink);
	font-family: var(--sg-font-head);
	font-size: 0.9375rem;
	font-weight: 600;
	list-style: none;
	cursor: pointer;
}

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

.sg-toc__summary svg:first-child {
	color: var(--sg-teal-700);
}

.sg-toc__chev {
	margin-left: auto;
	transition: transform 0.2s var(--sg-ease);
}

.sg-toc--inline[open] .sg-toc__chev {
	transform: rotate(180deg);
}

.sg-toc--inline .sg-toc__list {
	display: grid;
	gap: 2px;
	padding: 0 16px 16px 44px;
	list-style: decimal;
	color: var(--sg-muted);
	font-size: 0.875rem;
}

.sg-toc--inline .sg-toc__list a {
	padding: 4px 0;
	font-size: 0.9375rem;
}

/* ---------- Article sections ---------- */
.sg-guide-section {
	margin-top: 56px;
	scroll-margin-top: 96px;
}

.sg-guide-section__title {
	margin: 0 0 16px;
	font-size: 1.625rem;
	font-weight: 700;
}

.sg-sources {
	display: grid;
	gap: 10px;
	margin: 0;
	padding-left: 1.4em;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.sg-sources a {
	color: var(--sg-blue);
	text-decoration: underline;
}

.sg-sources a:hover {
	color: var(--sg-ink);
}

.sg-sources__host {
	display: inline-block;
	margin-left: 6px;
	color: var(--sg-muted);
	font-size: 0.8125rem;
}

.sg-guide-notice {
	margin-top: 48px;
	padding: 20px 24px;
	border: 1px solid var(--sg-line);
	border-left: 3px solid var(--sg-teal-700);
	border-radius: 0 var(--sg-radius-input) var(--sg-radius-input) 0;
	background: var(--sg-soft);
	font-size: 0.9375rem;
	line-height: 1.6;
}

.sg-guide-notice p {
	margin: 0 0 8px;
}

.sg-guide-notice p:last-child {
	margin-bottom: 0;
}

.sg-guide-notice__title {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--sg-ink);
	font-family: var(--sg-font-head);
	font-weight: 600;
}

.sg-guide-notice__title svg {
	color: var(--sg-teal-700);
}

.sg-guide-notice a {
	color: var(--sg-blue);
	text-decoration: underline;
}

.sg-guide-notice__meta {
	color: var(--sg-muted);
	font-size: 0.875rem;
}

/* ---------- Sidebar call to action ---------- */
.sg-cta-card {
	padding: 24px;
	border: 1px solid #dfe7fb;
	border-radius: var(--sg-radius-card);
	background: linear-gradient(180deg, var(--sg-tint) 0%, var(--sg-tint-2) 100%);
}

.sg-cta-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-bottom: 14px;
	border-radius: 50%;
	background: #fff;
	color: var(--sg-teal-700);
	box-shadow: var(--sg-shadow-card);
}

.sg-cta-card__title {
	margin: 0 0 6px;
	color: var(--sg-ink);
	font-family: var(--sg-font-head);
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.3;
}

.sg-cta-card__text {
	margin: 0 0 18px;
	color: var(--sg-muted);
	font-size: 0.9375rem;
	line-height: 1.55;
}

.sg-cta-card__btn {
	width: 100%;
}

/* ---------- Featured firm (paid placement, always labelled) ---------- */
.sg-featured-firm {
	padding: 20px;
	border: 1px solid #f0dc9f;
	border-radius: var(--sg-radius-card);
	background: #fff;
	box-shadow: var(--sg-shadow-card);
}

.sg-featured-firm__label {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	margin: 0 0 14px;
}

.sg-featured-firm__why {
	color: var(--sg-muted);
	font-size: 0.8125rem;
	text-decoration: underline;
}

.sg-featured-firm__why:hover {
	color: var(--sg-ink);
}

.sg-featured-firm__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
}

.sg-featured-firm__logo {
	flex: none;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	object-fit: contain;
	background: #fff;
	border: 1px solid var(--sg-line);
}

/* A real logo keeps its proportions in a wider frame (wordmarks are wide). */
.sg-featured-firm__logo--img {
	width: 88px;
	height: 56px;
	padding: 6px;
}

.sg-featured-firm__name {
	margin: 0;
	font-family: var(--sg-font-head);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

.sg-featured-firm__link {
	color: var(--sg-ink);
	text-decoration: none;
}

.sg-featured-firm__link:hover {
	color: var(--sg-ink);
	text-decoration: underline;
}

.sg-featured-firm__place {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 2px 0 0;
	color: var(--sg-muted);
	font-size: 0.875rem;
}

.sg-featured-firm__badge {
	margin: 0 0 14px;
}

.sg-featured-firm__btn {
	width: 100%;
}

/* ---------- Guides index header + topic chips ---------- */
.sg-topics {
	margin-top: 24px;
}

.sg-topics__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sg-topic {
	display: inline-flex;
	align-items: center;
	min-height: 38px;
	padding: 0 16px;
	border: 1px solid var(--sg-line);
	border-radius: var(--sg-radius-pill);
	background: #fff;
	color: var(--sg-text);
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
	transition: border-color 0.15s var(--sg-ease), background-color 0.15s var(--sg-ease);
}

.sg-topic:hover {
	border-color: var(--sg-ink);
	color: var(--sg-ink);
}

.sg-topic[aria-current="page"] {
	border-color: var(--sg-ink);
	background: var(--sg-ink);
	color: #fff;
}

@media (max-width: 639px) {
	.sg-topics {
		margin-inline: calc(var(--sg-gutter) * -1);
	}

	.sg-topics__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding: 2px var(--sg-gutter) 6px;
		scrollbar-width: none;
	}

	.sg-topics__list::-webkit-scrollbar {
		display: none;
	}
}

/* ---------- Card grid (guides, search results) ---------- */
.sg-results-count {
	margin: 0 0 20px;
	color: var(--sg-muted);
	font-size: 0.875rem;
}

.sg-guide-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 1023px) {
	.sg-guide-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 639px) {
	.sg-guide-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}
}

.sg-guide-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	padding: 24px;
	border: 1px solid var(--sg-line);
	border-radius: var(--sg-radius-card);
	background: #fff;
	box-shadow: var(--sg-shadow-card);
	transition: border-color 0.18s var(--sg-ease), box-shadow 0.18s var(--sg-ease), transform 0.18s var(--sg-ease);
}

.sg-guide-card:hover {
	border-color: var(--sg-line-strong);
	box-shadow: var(--sg-shadow-raised);
	transform: translateY(-2px);
}

.sg-guide-card:focus-within {
	outline: 2px solid var(--sg-blue);
	outline-offset: 2px;
}

.sg-guide-card__topic {
	position: relative;
	z-index: 2;
}

.sg-guide-card__title {
	margin: 0;
	font-size: 1.1875rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.015em;
}

.sg-guide-card__link {
	color: var(--sg-ink);
	text-decoration: none;
}

.sg-guide-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
}

.sg-guide-card__link:focus-visible {
	outline: none;
}

.sg-guide-card:hover .sg-guide-card__link {
	color: var(--sg-teal-700);
}

.sg-guide-card__excerpt {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--sg-muted);
	font-size: 0.9375rem;
	line-height: 1.55;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.sg-guide-card__meta {
	margin: auto 0 0;
	padding-top: 4px;
	color: var(--sg-muted);
	font-size: 0.8125rem;
}

@media (prefers-reduced-motion: reduce) {
	.sg-guide-card,
	.sg-guide-card:hover {
		transition: none;
		transform: none;
	}
}

/* ---------- 404 helpful links ---------- */
.sg-helpful {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

@media (max-width: 1023px) {
	.sg-helpful {
		grid-template-columns: minmax(0, 1fr);
	}
}

.sg-helpful__col {
	padding: 24px;
	border: 1px solid var(--sg-line);
	border-radius: var(--sg-radius-card);
	background: #fff;
	box-shadow: var(--sg-shadow-card);
}

.sg-helpful__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px;
	font-size: 1.125rem;
	font-weight: 600;
}

.sg-helpful__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--sg-teal-50);
	color: var(--sg-teal-700);
}

.sg-helpful__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px 16px;
	margin: 0 0 18px;
	padding: 0;
	list-style: none;
}

.sg-helpful__col:last-child .sg-helpful__list {
	grid-template-columns: minmax(0, 1fr);
}

.sg-helpful__list a {
	color: var(--sg-text);
	font-size: 0.9375rem;
	line-height: 1.45;
	text-decoration: none;
}

.sg-helpful__list a:hover {
	color: var(--sg-ink);
	text-decoration: underline;
}
