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

.hidden {
	display: none;
}

/* Breadcrumbs */
.breadcrumbs {
	margin-bottom: var(--space-md);
	font-size: 0.85rem;
	color: var(--muted);
}

.breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 0.35rem;
}

.breadcrumbs li:not(:last-child)::after {
	content: "/";
	margin-left: 0.35rem;
	color: var(--muted);
}

.breadcrumbs li[aria-current="page"] {
	color: var(--fg);
}

.sc {
	font-variant: small-caps;
}

/* 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 */
.print-masthead {
	display: none;
}

@page {
	margin: 2cm;
}

@media print {
	body {
		background: #fff !important;
		color: #000;
	}

	.site-header,
	.sidebar,
	.site-footer,
	nav,
	.breadcrumbs,
	.post-meta,
	.post-tags,
	.post-footer,
	.post-nav,
	.like-form,
	.newsletter-signup,
	.comments-section,
	.webmentions,
	.related-posts-list,
	.pagination,
	.theme-toggle,
	.to-top,
	.back-to-top,
	.hero-close,
	#skip-to-content,
	.mobile-hidden,
	.toc,
	.reply-context,
	.external-link-notice,
	.cite-article,
	.cite-export,
	noscript,
	script,
	iframe {
		display: none !important;
	}

	.post-single .content > h2,
	.post-single .content > hr {
		display: none !important;
	}

	.site-layout {
		display: block;
		max-width: none;
		padding: 0;
	}

	.content {
		padding-left: 0;
	}

	/* Reorder the article for print */
	.h-entry {
		display: flex;
		flex-direction: column;
	}

	/* Title / cover page */
	.post-single .post-header {
		order: 1;
		text-align: center;
		padding-top: 15vh;
		padding-bottom: 2rem;
		border-bottom: none;
		margin-bottom: 0;
	}

	.post-single .post-header .p-name {
		font-size: 2rem;
		margin-bottom: 0.5rem;
		page-break-after: auto;
	}

	.post-single .post-header .p-summary {
		font-size: 1.1rem;
		font-style: italic;
		color: #333;
		margin: 0.5rem 0 0;
	}

	/* Featured image on cover */
	.featured-image {
		order: 2;
		page-break-inside: avoid;
		margin: 0 auto;
		max-width: 80%;
		text-align: center;
	}

	.featured-image img {
		max-height: 45vh;
		width: auto;
		height: auto;
		display: block;
		margin: 0 auto;
	}

	.featured-image figcaption {
		font-size: 0.85rem;
		font-style: italic;
		color: #333;
		margin-top: 0.5rem;
	}

	/* Date and URL after the break line */
	.featured-image::after {
		display: block;
		content: attr(data-date) "\A" attr(data-url);
		white-space: pre;
		text-align: center;
		font-size: 0.9rem;
		color: #333;
		border-top: 1px solid #333;
		padding-top: 1rem;
		margin-top: 1.5rem;
		word-break: break-all;
	}

	/* Masthead page */
	.print-masthead {
		display: block;
		order: 3;
		text-align: center;
		padding-top: 40vh;
		font-size: 1.1rem;
		page-break-before: always;
		page-break-after: always;
	}

	.print-masthead p {
		margin: 0.25rem 0;
	}

	.e-content {
		order: 4;
		font-size: 11pt;
		line-height: 1.45;
	}

	.e-content h2,
	.e-content h3 {
		margin: 1.25em 0 0.4em;
	}

	.e-content h2 {
		font-size: 1.25rem;
	}

	.e-content h3 {
		font-size: 1.1rem;
	}

	.e-content p {
		margin: 0;
	}

	.e-content p + p {
		text-indent: 1.5em;
	}

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

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

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

	img,
	figure,
	svg {
		max-width: 100%;
		height: auto;
	}

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

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

	p {
		widows: 2;
		orphans: 2;
	}

	/* About the Author page */
	.author-card {
		display: block !important;
		page-break-before: always;
		text-align: center;
		padding-top: 30vh;
	}

	.author-card h3 {
		font-size: 1.25rem;
		margin: 0 0 1rem;
	}

	.author-card .author-card-icon {
		display: none;
	}

	.author-card .author-avatar {
		max-width: 120px;
		height: auto;
		margin-bottom: 1rem;
	}

	.author-card-bio {
		max-width: 40em;
		margin: 1rem auto 0;
		font-size: 11pt;
		line-height: 1.4;
		text-align: left;
	}

	.author-card-cta,
	.author-card-buttons {
		display: none !important;
	}
}

/* ===================================================================
   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: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'EmojiFont', sans-serif;
}

code,
pre {
	/* Include emoji fonts in code blocks */
	font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', 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 1rem 3rem;
	margin: 1.5rem 0;
	border: 1px solid;
	
	position: relative;
}

.alert i,
.alert svg {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	font-size: 1.25rem;
	width: 1.25rem;
	height: 1.25rem;
}

.alert strong {
	display: block;
}

.alert>*:not(i):not(svg):not(:first-child) {
	margin-top: 0.25rem;
}

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

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

.alert-danger {
	background: rgba(138, 24, 20, 0.1);
	border-color: #8a1814;
	color: #8a1814;
}

/* Button variants */
.btn {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	margin: 0.25rem;
	border: 2px solid;
	
	font-family: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif;
	font-weight: 900;
	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: #fbf1c7 !important;
	font-weight: 600;
}

.btn-primary svg {
	fill: #fbf1c7 !important;
}

.btn-primary:hover {
	background: var(--link-hover);
	border-color: var(--link-hover);
	color: #fbf1c7 !important;
	font-weight: 600;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(204, 36, 29, 0.3);
}

.btn-primary:hover svg {
	fill: #fbf1c7 !important;
}

/* Dark mode - using actual theme classes */
.dark-mode .btn-primary {
	color: #282828 !important;
}

.dark-mode .btn-primary svg {
	fill: #282828 !important;
}

.dark-mode .btn-primary:hover {
	color: #282828 !important;
}

.dark-mode .btn-primary:hover svg {
	fill: #282828 !important;
}

.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: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', 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;
	
	padding: 0;
}

details summary {
	padding: 0.3rem;
	cursor: pointer;
	font-weight: 600;
}

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

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

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

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

.cite-article p {
	margin: 0;
	padding: 0.1rem 1rem;
	font-size: 0.8rem;
}

/* 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;
}
