/*
 * Phase 5 account and share surfaces.
 *
 * A new file rather than additions to reader.css or utt.css, both of which the
 * presentation pass is working in. Everything here is namespaced under
 * .utt-account or .utt-share, so it cannot reach the reader, the card library
 * or the verification page whatever load order the site ends up with.
 *
 * Custom properties are read with fallbacks rather than defined, so these
 * pages inherit the theme's palette where one exists and still render sanely
 * on their own.
 */

.utt-account,
.utt-share {
	--utt-account-ink: var(--utt-parchment, #eee6d6);
	--utt-account-muted: var(--utt-parchment-muted, #b9b2a4);
	--utt-account-gold: var(--utt-gold, #d8b643);
	--utt-account-gold-bright: var(--utt-gold-bright, #e3c355);
	--utt-account-raised: var(--utt-raised, #101725);
	--utt-account-rule: var(--utt-rule, #697182);
	max-width: 46rem;
	margin: 0 auto;
	padding: 1.5rem 1rem 4rem;
	color: var(--utt-account-ink);
	font-size: 1.05rem;
	line-height: 1.65;
}

.utt-account p,
.utt-account label,
.utt-account li,
.utt-account summary,
.utt-share p,
.utt-share label,
.utt-share li {
	color: inherit;
}

.utt-account a,
.utt-share a {
	color: var(--utt-account-gold);
}

/* ── navigation ──────────────────────────────────────────────────────── */

.utt-account__nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.25rem;
	margin: 0 0 2rem;
	padding: 0 0 0.75rem;
	border-bottom: 1px solid var(--utt-account-rule);
}

.utt-account__nav-link {
	padding: 0.35rem 0;
	text-decoration: none;
	border-bottom: 2px solid transparent;
}

.utt-account__nav-link:hover,
.utt-account__nav-link:focus-visible {
	text-decoration: underline;
}

.utt-account__nav-link.is-current {
	font-weight: 600;
	border-bottom-color: currentColor;
}

/* ── headings and meta ───────────────────────────────────────────────── */

.utt-account__heading,
.utt-share__heading {
	margin: 0 0 0.5rem;
	font-size: 1.6rem;
	line-height: 1.25;
}

.utt-account__subheading {
	margin: 2rem 0 0.5rem;
	font-size: 1.2rem;
}

.utt-account__meta,
.utt-share__meta,
.utt-account__crumb {
	margin: 0 0 1rem;
	font-size: 0.9rem;
	opacity: 0.8;
}

.utt-account__note,
.utt-share__question-note,
.utt-account__immutable {
	margin: 0.75rem 0;
	padding: 0.75rem 1rem;
	font-size: 0.92rem;
	color: var(--utt-account-ink);
	background: var(--utt-account-raised);
	border-radius: 0.4rem;
}

.utt-account__immutable code {
	font-size: 0.85em;
	word-break: break-all;
}

.utt-account__warning {
	margin: 0.75rem 0;
	padding: 0.85rem 1rem;
	border-left: 3px solid var(--utt-warning, #a8431f);
	color: var(--utt-account-ink);
	background: var(--utt-account-raised);
}

.utt-account__empty {
	margin: 1rem 0;
	opacity: 0.75;
	font-style: italic;
}

/* ── stats ───────────────────────────────────────────────────────────── */

.utt-account__stats {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	margin: 1rem 0 2rem;
	padding: 0;
	list-style: none;
}

.utt-account__stat-value {
	display: block;
	font-size: 1.9rem;
	font-weight: 600;
	line-height: 1.1;
}

.utt-account__stat-label {
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.75;
}

/* ── lists ───────────────────────────────────────────────────────────── */

.utt-account__readings,
.utt-account__entries,
.utt-account__policy {
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}

.utt-account__policy {
	list-style: disc;
	padding-left: 1.4rem;
}

.utt-account__reading,
.utt-account__entry {
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--utt-account-rule);
}

.utt-account__reading-link,
.utt-account__entry-link {
	font-weight: 600;
}

.utt-account__reading-date,
.utt-account__entry-date,
.utt-account__reading-status,
.utt-account__reading-journal {
	font-size: 0.85rem;
	opacity: 0.75;
}

.utt-account__reading-status {
	padding: 0.1rem 0.45rem;
	border: 1px solid currentColor;
	border-radius: 0.8rem;
}

.utt-account__reading-question,
.utt-account__entry-excerpt {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.95rem;
	opacity: 0.9;
}

.utt-account__entry-tags {
	margin: 0.35rem 0 0;
	font-size: 0.82rem;
	opacity: 0.7;
}

/* ── the reading itself ──────────────────────────────────────────────── */

.utt-account__question,
.utt-share__question {
	margin: 1rem 0;
	padding: 0.5rem 0 0.5rem 1rem;
	border-left: 3px solid var(--utt-accent, #6b5ca5);
	font-style: italic;
}

.utt-account__positions,
.utt-share__positions {
	margin: 1.5rem 0;
	padding-left: 1.4rem;
}

.utt-account__position,
.utt-share__position {
	margin-bottom: 1.75rem;
}

.utt-account__position-name,
.utt-share__position-name {
	margin: 0 0 0.25rem;
	font-size: 1.05rem;
}

.utt-account__position-card,
.utt-share__position-card {
	margin: 0 0 0.5rem;
	font-weight: 600;
}

.utt-account__reversed,
.utt-share__reversed {
	font-weight: 400;
	opacity: 0.8;
}

/* ── forms ───────────────────────────────────────────────────────────── */

.utt-account__form {
	margin: 1rem 0 2rem;
}

.utt-account__label {
	display: block;
	margin: 0.9rem 0 0.25rem;
	font-size: 0.9rem;
	font-weight: 600;
}

.utt-account__input,
.utt-account__textarea,
.utt-account__filters select {
	width: 100%;
	max-width: 100%;
	padding: 0.55rem 0.7rem;
	font: inherit;
	color: #f8f3e8;
	background: #0b101c;
	border: 1px solid var(--utt-account-rule);
	border-radius: 0.35rem;
}

.utt-account__input::placeholder,
.utt-account__textarea::placeholder {
	color: var(--utt-account-muted);
	opacity: 1;
}

.utt-account__textarea {
	min-height: 9rem;
	resize: vertical;
}

.utt-account__filters {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 0.5rem 0.75rem;
	margin-bottom: 1.5rem;
}

.utt-account__filters select {
	width: auto;
	min-width: 12rem;
}

.utt-account__button {
	margin-top: 0.75rem;
	padding: 0.55rem 1.1rem;
	font: inherit;
	color: #080c15;
	background: var(--utt-account-gold);
	border: 1px solid transparent;
	border-radius: 0.35rem;
	cursor: pointer;
}

.utt-account__button:hover,
.utt-account__button:focus-visible {
	color: #080c15;
	background: var(--utt-account-gold-bright);
	filter: none;
}

.utt-account__button--danger {
	color: var(--utt-warning, #a8431f);
	background: transparent;
	border-color: currentColor;
}

.utt-account__confirm {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.92rem;
}

/* Focus must stay visible; the reader's accessibility guarantee applies here. */
.utt-account :focus-visible,
.utt-share :focus-visible {
	outline: 3px solid var(--utt-account-gold-bright);
	outline-offset: 3px;
}

/* ── share ───────────────────────────────────────────────────────────── */

.utt-account__share {
	margin: 2.5rem 0;
	padding: 1.25rem;
	color: var(--utt-account-ink);
	background: var(--utt-account-raised);
	border-radius: 0.5rem;
}

.utt-account__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin: 1.25rem 0 0.5rem;
}

.utt-account__button--link {
	display: inline-block;
	margin: 0;
	text-decoration: none;
}

.utt-account a.utt-account__button--link,
.utt-account a.utt-account__button--link:hover,
.utt-account a.utt-account__button--link:focus-visible {
	color: #080c15;
}

.utt-account__secondary-link {
	font-weight: 600;
}

.utt-account__details {
	margin-top: 2rem;
	padding: 1rem 1.1rem;
	color: var(--utt-account-ink);
	background: var(--utt-account-raised);
	border: 1px solid var(--utt-account-rule);
	border-radius: 0.4rem;
}

.utt-account__details summary {
	cursor: pointer;
	font-weight: 600;
}

.utt-account__details p:last-child {
	margin-bottom: 0;
}

@media (max-width: 36rem) {
	.utt-account,
	.utt-share {
		padding: 1rem 0.9rem 3rem;
	}

	.utt-account__actions {
		align-items: stretch;
		flex-direction: column;
	}

	.utt-account__button--link {
		text-align: center;
	}
}

.utt-share__intro {
	margin: 1rem 0 2rem;
	font-size: 0.95rem;
	opacity: 0.9;
}

.utt-share__disclosure,
.utt-share__verify,
.utt-share__cta {
	margin: 1.25rem 0;
	font-size: 0.95rem;
}

/* ── pagination ──────────────────────────────────────────────────────── */

.utt-account__pagination {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin: 2rem 0;
	font-size: 0.95rem;
}

/* ── print ───────────────────────────────────────────────────────────── */

@media print {
	.utt-account__nav,
	.utt-account__share,
	.utt-account__form,
	.utt-account__pagination,
	.utt-account__crumb,
	.utt-account__print,
	.utt-share__cta {
		display: none !important;
	}

	.utt-account,
	.utt-share {
		max-width: none;
		padding: 0;
		font-size: 11pt;
	}

	/* A saved reading should print with its provenance, not without it. */
	.utt-account__immutable,
	.utt-account__verify {
		display: block;
		background: none;
		padding: 0;
		font-size: 9pt;
	}
}

@media (prefers-reduced-motion: reduce) {
	.utt-account *,
	.utt-share * {
		animation: none !important;
		transition: none !important;
	}
}
