/* ===================================================================
   10. UTILITIES & HELPERS
================================================================== */

.hidden {
	display: none;
}

/* Visually hidden class - must override everything */
.visually-hidden,
.embeddable-buttondown-form .visually-hidden,
label.visually-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(1px, 1px, 1px, 1px) !important;
	white-space: nowrap !important;
	border: 0 !important;
	clip-path: inset(50%) !important;
}

.pagefind-ui__result-link::before {
	left: -1rem !important;
}

/* Responsive image class */
.responsive-img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* Print styles */
@media print {
	.site-header,
	.site-sidebar,
	.site-footer,
	nav,
	.author-card,
	.post-meta,
	.guestbook-form,
	.interactions,
	.related-posts,
	.pagination,
	.theme-toggle,
	.back-to-top,
	.hero-close {
		display: none !important;
	}

	.site-layout {
		grid-template-columns: 1fr;
	}

	.e-content {
		font-size: 12pt;
		line-height: 1.5;
	}

	.e-content a {
		color: #000;
		text-decoration: underline;
	}

	.e-content a::after {
		content: " (" attr(href) ")";
		font-size: 0.8em;
		color: #666;
	}

	.e-content a[href^="#"]::after {
		content: "";
	}

	h1,
	h2,
	h3 {
		page-break-after: avoid;
	}

	blockquote,
	pre {
		page-break-inside: avoid;
	}
}

/* ===================================================================
   STYLE GUIDE COMPONENTS
================================================================== */

/* Footnotes and citations */
.footnote-ref {
	font-size: 0.8em;
	vertical-align: super;
	color: var(--accent-primary);
	text-decoration: none;
	font-weight: 600;
}

.footnote-ref:hover {
	color: var(--link-hover);
	text-decoration: underline;
}

.footnotes {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
	font-size: 0.9em;
	color: var(--muted);
}

.footnotes ol {
	padding-left: 1.5rem;
}

.footnotes li {
	margin-bottom: 0.5rem;
	line-height: 1.5;
}

/* Citation styling */
sup.citation {
	font-size: 0.75em;
	vertical-align: super;
	color: var(--accent-primary);
	font-weight: 600;
	margin-left: 2px;
}

/* Emoji support */
body {
	/* Ensure emoji rendering is consistent */
	font-family: 'PT Serif', serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'EmojiFont', sans-serif;
}

code,
pre {
	/* Include emoji fonts in code blocks */
	font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
}

/* Color utility classes */
.text-primary {
	color: var(--accent-primary) !important;
}

.text-secondary {
	color: var(--accent-secondary) !important;
}

.text-success {
	color: #79740e !important;
	/* Using green from nav colors */
}

.text-danger {
	color: var(--accent-primary) !important;
	/* Using red as danger */
}

.text-muted {
	color: var(--muted) !important;
}

/* Badge styles */
.badge {
	display: inline-block;
	padding: 0.25em 0.6em;
	font-size: 0.75em;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	white-space: nowrap;
	vertical-align: baseline;
	border-radius: 4px;
	background: var(--panel);
	color: var(--fg);
	border: 1px solid var(--border);
}

.badge-primary {
	background: var(--accent-primary);
	color: var(--bg);
	border-color: var(--accent-primary);
}

.badge-secondary {
	background: var(--accent-secondary);
	color: var(--bg);
	border-color: var(--accent-secondary);
}

/* Alert boxes */
.alert {
	padding: 1rem 1.25rem;
	margin: 1.5rem 0;
	border: 1px solid;
	border-radius: 8px;
	position: relative;
}

.alert::before {
	font-family: 'Font Awesome 6 Free';
	font-weight: 900;
	position: absolute;
	left: 1rem;
	top: 1rem;
	font-size: 1.25rem;
	color: inherit;
}

.alert strong {
	margin-left: 1.75rem;
	display: block;
}

.alert>*:not(strong):not(:first-child) {
	margin-left: 1.75rem;
}

.alert-info {
	background: rgba(7, 102, 120, 0.1);
	border-color: #076678;
	color: #076678;
}

.alert-info::before {
	content: '\f05a';
	/* fa-info-circle */
}

.alert-warning {
	background: rgba(213, 93, 14, 0.1);
	border-color: #d65d0e;
	color: #d65d0e;
}

.alert-warning::before {
	content: '\f071';
	/* fa-exclamation-triangle */
}

.alert-danger {
	background: rgba(204, 36, 29, 0.1);
	border-color: #cc241d;
	color: #cc241d;
}

.alert-danger::before {
	content: '\f057';
	/* fa-times-circle */
}

/* Button variants */
.btn {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	margin: 0.25rem;
	border: 2px solid;
	border-radius: 8px;
	font-family: 'Public Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: all 140ms ease;
	background: none;
}

.btn-primary {
	background: var(--accent-primary);
	border-color: var(--accent-primary);
	color: var(--bg);
}

.btn-primary:hover {
	background: var(--link-hover);
	border-color: var(--link-hover);
	color: var(--bg);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(204, 36, 29, 0.3);
}

.btn-secondary {
	background: var(--accent-secondary);
	border-color: var(--accent-secondary);
	color: var(--bg);
}

.btn-secondary:hover {
	background: #458588;
	border-color: #458588;
	color: var(--bg);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(7, 102, 120, 0.3);
}

.btn-outline {
	background: transparent;
	border-color: var(--accent-primary);
	color: var(--accent-primary);
}

.btn-outline:hover {
	background: var(--accent-primary);
	color: var(--bg);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(204, 36, 29, 0.3);
}

/* Keyboard keys styling */
kbd {
	display: inline-block;
	padding: 0.2em 0.4em;
	margin: 0 0.1em;
	font-size: 0.875em;
	font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
	line-height: 1;
	color: var(--fg);
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 4px;
	box-shadow: 0 2px 0 var(--border), 0 3px 5px rgba(0, 0, 0, 0.1);
}

/* Details/accordion styling */
details {
	margin: 1rem 0;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0;
	background: var(--bg-alt);
}

details summary {
	padding: 1rem;
	cursor: pointer;
	font-weight: 600;
	border-radius: 8px;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

details summary:hover {
	background: var(--panel);
}

details summary::marker {
	display: none;
}

details summary::before {
	content: '▶';
	font-size: 0.75rem;
	transition: transform 200ms ease;
}

details[open] summary::before {
	transform: rotate(90deg);
}

details>*:not(summary) {
	padding: 0 1rem 1rem;
}

details[open] summary {
	border-bottom: 1px solid var(--border);
}

/* Highlight/mark styling */
mark {
	background: #fabd2f;
	color: #1d2021;
	padding: 0.1em 0.2em;
	border-radius: 2px;
}

/* Underline styling */
u {
	text-decoration: underline;
	text-decoration-color: var(--accent-primary);
	text-decoration-thickness: 2px;
	text-underline-offset: 2px;
}
