/* Identity pages (IdentityModule): forms, account tabs, security sections,
   public profile. Tokens from tokens.css; layout basics from community.css. */

.identity {
	max-width: 36rem;
	margin: 0 auto;
	padding: var(--sp-lg) 0 var(--sp-2xl);
}

/* Sign-in, registration and token pages sit on the shared form card
   (forms.css .form-card); account pages stay wide and frameless. */
.identity:not(.identity-wide) {
	max-width: var(--form-measure);
	background: var(--ground-page);
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	padding: clamp(var(--sp-md), 5vw, var(--sp-xl));
	margin-block: var(--sp-md) var(--sp-xl);
}

.identity-wide {
	max-width: 48rem;
}

.identity .hero-title {
	margin-bottom: var(--sp-sm);
}

.identity .hero-lead {
	margin-bottom: var(--sp-lg);
}

/* Running text between the heading and a form (delete effects, security
   status lines): the global reset zeroes list padding and paragraph margins,
   which glued bullets to the left edge and text to the next label. */
.identity > ul:not([class]) {
	padding-left: 1.25rem;
	margin-bottom: var(--sp-md);
}

.security-section > p {
	margin-bottom: var(--sp-sm);
}

.identity-form {
	display: grid;
	gap: var(--form-gap);
	margin-bottom: var(--sp-lg);
}

.identity:not(.identity-wide) .identity-form > .btn {
	width: 100%;
}

.hp-field {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.identity-alt {
	color: var(--ink-muted);
}

.identity-providers {
	display: grid;
	gap: var(--sp-sm);
	margin: var(--sp-lg) 0;
	padding-top: var(--sp-lg);
	border-top: 1px solid var(--line);
}

.btn-provider {
	width: 100%;
}

.btn-small,
form .btn-small {
	min-height: var(--hit-min);
	padding: 0 0.75rem; /* = compose.css .post-foot .btn-small */
	font-size: 1rem;
}

.btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-sm);
}

.notice-info form {
	margin-top: var(--sp-sm);
}

.account-nav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-xs);
	margin-bottom: var(--sp-lg);
	border-bottom: 1px solid var(--line);
}

.account-nav a {
	display: inline-flex;
	align-items: center;
	min-height: var(--hit-min);
	padding: var(--sp-xs) var(--sp-sm);
	border-bottom: 3px solid transparent;
	color: var(--ink-muted);
	text-decoration: none;
	transition:
		color 0.15s ease,
		border-color 0.15s ease;
}

.account-nav a:hover {
	border-bottom-color: var(--line-deep);
	color: var(--ink);
}

.account-nav a[aria-current="page"] {
	border-bottom-color: var(--petrol);
	color: var(--ink);
}

.security-section {
	margin-bottom: var(--sp-xl);
	padding-bottom: var(--sp-lg);
	border-bottom: 1px solid var(--line);
}

.security-section h2 {
	margin-bottom: var(--sp-sm);
	font-size: 1.25rem;
}

.recovery-codes {
	padding: var(--sp-md);
	border: 1px solid var(--amber);
	border-radius: var(--r-md);
	background: var(--ground-zone);
}

.code-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
	gap: var(--sp-xs);
	margin: var(--sp-sm) 0 0;
	padding: 0;
	list-style: none;
}

.code-list code,
.secret {
	font-size: 1.125rem;
	letter-spacing: 0.05em;
	user-select: all;
}

.totp-qr {
	/* Always dark on white, also in dark mode: scanners need the contrast. */
	width: 12.5rem;
	margin: var(--sp-sm) 0 var(--sp-md);
	padding: 0;
	background: #fff;
	border-radius: var(--r-md);
	line-height: 0;
}

.totp-qr svg {
	width: 100%;
	height: auto;
}

.enrol-steps {
	display: grid;
	gap: var(--sp-sm);
	margin-bottom: var(--sp-lg);
	padding-left: 1.25rem;
}

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

.provider-list li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-sm);
	padding: var(--sp-xs) 0;
}

.session-table {
	width: 100%;
	margin-bottom: var(--sp-md);
	border-collapse: collapse;
	font-size: 1rem;
}

.session-table th,
.session-table td {
	padding: var(--sp-xs) var(--sp-sm) var(--sp-xs) 0;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: middle;
}

/* Phones: each session becomes a card like the forum rows (forum.css);
   the header row stays for screen readers, data-label names the dates. */
@media (max-width: 720px) {
	.session-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
	.session-table,
	.session-table tbody,
	.session-table tr,
	.session-table td {
		display: block;
	}
	.session-table tr {
		display: grid;
		gap: 4px;
		margin-bottom: var(--sp-xs);
		padding: var(--sp-sm);
		border: 1px solid var(--line);
		border-radius: var(--r-md);
	}
	.session-table td {
		padding: 0;
		border: 0;
	}
	.session-table td:first-child {
		font-weight: 600;
	}
	.session-table td[data-label]::before {
		content: attr(data-label) ': ';
		color: var(--ink-muted);
	}
	.session-table td:last-child:has(form) {
		margin-top: var(--sp-xs);
	}
}

.avatar-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
	gap: var(--sp-xs);
}

.avatar-option {
	position: relative;
	display: block;
	cursor: pointer;
}

.avatar-option input {
	position: absolute;
	inset: 0;
	opacity: 0;
}

.avatar-option img {
	display: block;
	width: 100%;
	height: auto;
	border: 3px solid transparent;
	border-radius: 50%;
}

.avatar-option:hover img {
	border-color: var(--line-deep);
}

.avatar-option input:checked + img {
	border-color: var(--petrol);
}

/* The site-wide ring (tokens.css :focus-visible) on the visible image. */
.avatar-option input:focus-visible + img {
	outline: 2px solid var(--focus);
	outline-offset: 3px;
}

.profile-head {
	display: flex;
	align-items: center;
	gap: var(--sp-md);
	margin-bottom: var(--sp-lg);
}

.profile-avatar {
	flex: none;
	border-radius: 50%;
}

.profile-meta {
	margin: 0;
	color: var(--ink-muted);
}

.profile-stats {
	display: grid;
	/* Three across where they fit; on a 360px phone (or with large text)
	   the tiles wrap instead of widening the page. */
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
	gap: var(--sp-sm);
	margin: 0 0 var(--sp-lg);
}

.profile-stats div {
	padding: var(--sp-sm);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	text-align: center;
}

.profile-stats dt {
	overflow-wrap: break-word;
	hyphens: auto;
	color: var(--ink-muted);
	font-size: 1rem;
}

.profile-stats dd {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

.profile-threads {
	padding-left: 1.25rem;
}

.profile-threads time {
	color: var(--ink-muted);
	font-size: 1rem;
}

/* --- UX review: "Meine Beiträge" on the public profile (H4) --- */
.profile-contributions h3 {
	margin-top: var(--sp-md);
	font-size: 1.25rem;
}
.profile-empty {
	color: var(--ink-muted);
}
