/* Article talk pages: subject list + nested subject thread (Reddit-style). */

.talk-page {
	max-width: 80rem;
	margin-inline: auto;
	padding: 1.5rem clamp(1rem, 3vw, 2rem);
	color: var(--color-foreground); /* light-dark(var(--color-foreground), var(--color-foreground)); */
}

.talk-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 18rem;
	gap: 2rem;
	align-items: start;
}

.talk-main {
	min-width: 0;
}

/* ---- Sidebar (placeholder content) ---- */

.talk-sidebar {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	position: sticky;
	top: 1rem;
}

.talk-sidebar-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 0.75rem;
	padding: 1rem 1.25rem;
}

.talk-sidebar-eyebrow {
	margin: 0 0 0.6rem;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-muted);
}

.talk-sidebar-blurb {
	margin: 0 0 1rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--color-foreground);
}

.talk-stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.85rem 1rem;
	margin: 0;
}

.talk-stat {
	margin: 0;
}

.talk-stat dt {
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-muted);
	margin-block-end: 0.15rem;
}

.talk-stat dd {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--color-foreground);
}

.talk-house-rules {
	margin: 0;
	padding-inline-start: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
	font-size: 0.875rem;
	line-height: 1.4;
	color: var(--color-foreground);
}

.talk-house-rules li::marker {
	color: var(--color-muted);
	font-weight: 600;
}

@media (max-width: 900px) {
	.talk-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.talk-sidebar {
		position: static;
		order: 2;
	}
}

.talk-page-header {
	margin-block-end: 2rem;
	border-block-end: 1px solid var(--color-border);
	padding-block-end: 1rem;
}

.talk-page-header h1 {
	margin: 0.25rem 0 0.5rem;
	font-size: clamp(1.5rem, 2.5vw, 2rem);
	text-wrap: balance;
}

.talk-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	font-size: 0.875rem;
	color: var(--color-muted);
}

.talk-breadcrumb a {
	color: var(--color-hyperlinks);
	text-decoration: none;
}

.talk-breadcrumb a:hover {
	text-decoration: underline;
}

.talk-page-tag,
.talk-subject-meta {
	color: var(--color-muted);
	font-size: 0.875rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: baseline;
}

.talk-empty {
	color: var(--color-muted);
	font-style: italic;
	padding: 1rem 0;
}

/* ---- Subject list ---- */

.talk-subject-list {
	list-style: none;
	padding: 0;
	margin: 0 0 2.5rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.talk-subject-row {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 0.75rem;
	padding: 1rem 1.25rem;
	transition: border-color 0.15s ease;
}

.talk-subject-row:hover {
	border-color: var(--color-hyperlinks);
}

.talk-subject-title {
	display: block;
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--color-foreground);
	text-decoration: none;
	margin-block-end: 0.35rem;
}

.talk-subject-title:hover {
	color: var(--color-hyperlinks);
}

.talk-subject-author {
	color: var(--color-hyperlinks);
	text-decoration: none;
}

.talk-subject-author:hover {
	text-decoration: underline;
}

/* ---- Subject thread (Reddit nesting) ---- */

.talk-thread {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-block-end: 2.5rem;
}

.talk-post {
	--indent-step: 1.1rem;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 0.5rem;
	padding: 0.85rem 1rem;
	margin-inline-start: calc(var(--depth, 0) * var(--indent-step));
	position: relative;
}

.talk-post[style*="--depth: 0"] {
	margin-inline-start: 0;
}

.talk-post:not([style*="--depth: 0"])::before {
	content: "";
	position: absolute;
	inset-block: 0;
	inset-inline-start: calc(var(--indent-step) * -0.5);
	border-inline-start: 2px solid var(--color-border);
}

.talk-post-header {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: baseline;
	font-size: 0.8125rem;
	color: var(--color-muted);
	margin-block-end: 0.4rem;
}

.talk-post-author {
	font-weight: 700;
	color: var(--color-foreground);
	text-decoration: none;
}

.talk-post-author:hover {
	color: var(--color-hyperlinks);
	text-decoration: underline;
}

.talk-post-sep {
	opacity: 0.5;
}

.talk-post-edited {
	font-style: italic;
}

.talk-post-body {
	color: var(--color-foreground);
	line-height: 1.55;
	font-size: 0.95rem;
}

.talk-post-body > :first-child {
	margin-block-start: 0;
}

.talk-post-body > :last-child {
	margin-block-end: 0;
}

.talk-post-body p {
	margin: 0.5em 0;
}

.talk-post-body pre,
.talk-post-body code {
	background: var(--color-surface-alt, rgb(0 0 0 / 0.05));
	border-radius: 0.25rem;
}

.talk-post-body code {
	padding: 0.05em 0.3em;
	font-size: 0.9em;
}

.talk-post-body pre {
	padding: 0.6rem 0.8rem;
	overflow-x: auto;
}

.talk-post-body pre code {
	background: transparent;
	padding: 0;
}

.talk-post-body blockquote {
	border-inline-start: 3px solid var(--color-border);
	margin: 0.5em 0;
	padding-inline-start: 0.75rem;
	color: var(--color-muted);
}

.talk-post-footer {
	margin-block-start: 0.5rem;
}

.talk-reply > summary,
.talk-thread-collapse > summary {
	cursor: pointer;
	font-size: 0.8125rem;
	color: var(--color-hyperlinks);
	user-select: none;
	display: inline-block;
	padding: 0.25rem 0;
}

.talk-reply[open] > summary,
.talk-thread-collapse[open] > summary {
	margin-block-end: 0.5rem;
}

.talk-reply form button[type="submit"] {
	margin-block-start: 0.5rem;
}

.talk-children {
	margin-block-start: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.talk-thread-collapse {
	margin-block-start: 0.75rem;
}

/* ---- New subject / new reply forms ---- */

.talk-new-subject,
.talk-new-reply {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 0.75rem;
	padding: 1.25rem 1.5rem;
	margin-block-start: 2rem;
}

.talk-new-subject h2,
.talk-new-reply h2 {
	margin: 0 0 1rem;
	font-size: 1.125rem;
}

.talk-validation {
	display: block;
	color: var(--color-danger, oklch(60% 0.2 25));
	font-size: 0.85rem;
	margin-block: 0.25rem 0.5rem;
}

/* ---- Plain form controls for talk (md3-field doesn't support textareas) ---- */

.talk-form-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-block-end: 0.85rem;
}

.talk-form-field > label {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--color-muted);
}

.talk-form-field > input,
.talk-form-field > textarea {
	font: inherit;
	color: var(--color-foreground);
	background: rgb(255 255 255 / 0.9); /* light-dark(rgb(255 255 255 / 0.9), rgb(0 0 0 / 0.25)); */
	border: 1px solid var(--color-border);
	border-radius: 0.5rem;
	padding: 0.6rem 0.75rem;
	width: 100%;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.talk-form-field > textarea {
	resize: vertical;
	min-height: 6rem;
	line-height: 1.45;
	field-sizing: content;
}

.talk-form-field > input:focus,
.talk-form-field > textarea:focus {
	outline: none;
	border-color: var(--color-hyperlinks);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-hyperlinks) 25%, transparent);
}

/* Small screens: tighten indent so deep threads don't blow out horizontally. */
@media (max-width: 480px) {
	.talk-post {
		--indent-step: 0.6rem;
	}
}
