main {
	width: auto;
}

main.blog-post {
	padding: 40px 0;
}

.blog-post h1 {
	font-size: 3em;
	text-align: left;
	margin-bottom: 10px;
}

.blog-post h2 {
	margin: 0;
	margin-top: 30px;
}

.blog-post .date,
.blog-post .author {
	font-size: 0.9em;
	color: #666;
	margin-top: 10px;
	margin-bottom: 10px;
	width: 55%;
}

.blog-post .author {
	margin-bottom: 30px;
}

.blog-post .content {
	font-size: 1em;
	color: rgb(28, 28, 28);
	line-height: 1.6em;
	white-space: normal !important;
	white-space: pre-wrap;
	counter-reset: sidenote-counter;
	position: relative;
}

.blog-post .content h2 {
	font-family: "EB Garamond", serif;
	font-weight: 500;
	margin: 30px 0 15px 0;
	font-size: 1.5em;
}

.blog-post .content p {
	width: 55%;
	margin-top: 20px;
	margin-bottom: 20px;
}

.blog-post ol,
.blog-post ul {
	width: 50%;
	-webkit-padding-start: 5%;
	margin: 20px 0;
}

.blog-post .content a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid #000;
	cursor: pointer;
}

.blog-post .content a:hover {
	border-bottom: 1px solid #999;
	cursor: pointer;
}

.blog-post li {
	text-wrap: pretty;
	margin-bottom: 10px;
	line-height: 1.6;
}

/* Code styling */
.blog-post pre {
	background-color: #f8f8f8;
	border: 1px solid #e1e1e1;
	font-size: 14px !important;
	border-radius: 0.5rem !important;
	padding: 1em !important;
	line-height: 1.6 !important;
	font-family: "Apercu Mono", "Courier New", monospace;
	margin: 20px 0;
	overflow-x: auto;
	width: 55% !important;
	margin-left: 2.5%;
}

.blog-post code {
	background-color: #f0f0f0;
	border-radius: 3px;
	font-family: "Apercu Mono", "Courier New", monospace;
	font-size: 0.9em;
	padding: 2px 4px;
}

.blog-post pre code {
	background-color: transparent;
	border-radius: 0;
	padding: 0;
}

.blog-post img {
	max-width: 55%;
	height: auto;
	margin-bottom: 20px;
}

/* Conversation styling */
.conversation {
	width: 55%;
}

.message {
	margin-bottom: 15px;
}

.timestamp {
	font-size: 0.8em;
	color: #999;
	opacity: 0.7;
	font-weight: normal;
}

/* Sidenotes and margin notes */
.sidenote,
.marginnote {
	font-family: "Apercu", sans-serif;
	font-size: 0.9rem;
	float: right;
	clear: right;
	margin-right: -60%;
	width: 50%;
	margin-top: 0.3rem;
	margin-bottom: 0;
	line-height: 1.3;
	vertical-align: baseline;
	position: relative;
}

.sidenote-number {
	counter-increment: sidenote-counter;
}

.sidenote-number:after,
.sidenote:before {
	font-family: "Apercu", sans-serif;
	position: relative;
	vertical-align: baseline;
}

.sidenote-number:after {
	content: counter(sidenote-counter);
	font-size: 0.8rem;
	top: -0.5rem;
	left: 0.1rem;
}

.sidenote:before {
	content: counter(sidenote-counter) " ";
	font-size: 0.8rem;
	top: -0.5rem;
}

blockquote .sidenote,
blockquote .marginnote {
	margin-right: -82%;
	min-width: 59%;
	text-align: left;
}

/* Modal styles */
.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.modal-content {
	position: relative;
	max-width: 90%;
	max-height: 90%;
	overflow: hidden;
	border-radius: 8px;
}

.modal-content img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.clickable-img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: 4px;
	transition: transform 0.2s ease;
}

mjx-container {
	width: 55% !important;
}

/* Mobile responsive */
@media (max-width: 760px) {
	body {
		width: 100%;
		margin: 0;
		padding: 0 5%;
		box-sizing: border-box;
	}

	.header {
		padding: 15px 0;
		width: 100%;
	}

	.header.minimized {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 50px;
		padding: 10px 15px;
		background-color: white;
		border-bottom: 1px solid #eee;
		z-index: 100;
		box-sizing: border-box;
		margin: 0;
	}

	.header-title {
		font-size: 1.2em;
	}

	.header.minimized .header-title a {
		font-size: 1.2em;
	}

	main.blog-post {
		padding: 20px 0;
		margin-top: 60px;
		width: 100%;
		box-sizing: border-box;
	}

	.blog-post h1 {
		font-size: 2.2em;
		margin-bottom: 15px;
		width: 100%;
		box-sizing: border-box;
	}

	.blog-post h2 {
		font-size: 1.4em;
		margin-top: 25px;
		width: 100%;
	}

	.blog-post .content h2 {
		font-size: 1.4em;
		margin: 25px 0 12px 0;
		width: 100%;
	}

	.blog-post .date,
	.blog-post .author,
	.blog-post .content p,
	.conversation {
		width: 100%;
		box-sizing: border-box;
	}

	.blog-post .content p {
		margin-top: 15px;
		margin-bottom: 15px;
		width: 100%;
	}

	.blog-post pre {
		width: 100%;
		margin-left: 0;
		font-size: 13px !important;
		padding: 0.8em !important;
		box-sizing: border-box;
		overflow-x: auto;
	}

	.blog-post ol,
	.blog-post ul {
		width: 100%;
		padding-left: 20px;
		box-sizing: border-box;
	}

	.blog-post li {
		margin-bottom: 8px;
		width: 100%;
	}

	.blog-post img {
		max-width: 100%;
		width: 100%;
		height: auto;
		margin: 15px 0;
		box-sizing: border-box;
	}

	/* Completely hide sidenotes and related elements on mobile */
	.sidenote,
	.marginnote,
	.sidenote-number {
		display: none !important;
	}

	.sidenote-number:after {
		display: none !important;
	}

	.message {
		margin-bottom: 12px;
		width: 100%;
		box-sizing: border-box;
	}

	.timestamp {
		font-size: 0.75em;
	}

	.modal-content {
		max-width: 95%;
		max-height: 85%;
	}

	/* Ensure conversation messages don't overflow */
	.conversation {
		width: 100%;
		overflow-wrap: break-word;
		word-wrap: break-word;
	}

	.conversation .message {
		width: 100%;
		overflow-wrap: break-word;
		word-wrap: break-word;
	}

	/* Ensure code blocks don't cause horizontal scroll */
	.blog-post code {
		word-wrap: break-word;
		overflow-wrap: break-word;
	}

	/* Ensure all content containers respect mobile boundaries */
	.blog-post .content {
		width: 100%;
		overflow-x: hidden;
	}
}
