/* Layout */

body {
	font-family: 'Fira Code', 'Nanum Gothic Coding', monospace;
	display: flex;
	flex-flow: row;
}

body > header {
	text-align: center;
}

body > header h1 {
	/* Modified: No vertical Japanese display */
	width: auto;
	font-size: 2em; 
	margin: 0 auto;
	visibility: visible;
}

body > header p {
	color: gray;
}

/* Theme Toggle Button - Fixed positioning for top-right corner */
.theme-toggle-fixed {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 1000;
}

.theme-toggle-button {
	background: transparent;
	border: none;
	padding: 8px;
	border-radius: 6px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	transition: background-color 0.15s ease, color 0.15s ease;
	color: inherit;
}

.theme-toggle-button:hover {
	background-color: rgba(128, 128, 128, 0.2);
}

.theme-toggle-button svg {
	width: 16px;
	height: 16px;
	stroke-width: 2;
}

/* Icon visibility logic - Show current state icon */
/* In light mode, show sun icon to indicate current light/sun state */
[data-theme="light"] .moon-icon {
	display: none;
}

/* In dark mode, show moon icon to indicate current dark/moon state */
[data-theme="dark"] .sun-icon {
	display: none;
}

#main {
	flex: auto;
	min-height: 100vh;
	max-width: 820px;
	overflow: hidden;

	display: flex;
	flex-flow: column;
}

#main > nav, #main > main, #main > footer {
	padding: 15px;
}

#main > nav {
	text-align: center;
}

#main > main {
	flex: 1;
	margin-right: 25px;
}

#main > footer {
	padding-top: 50px;
}

@media (max-width: 640px) {
	body {
		flex-direction: column;
	}

	body > header h1 {
		width: auto;
		font-size: 2em;
	}

	#main {
		display: block;
		min-height: 0;
	}

	#main > main {
		margin-right: 0;
	}
}

hr {
	border: none;
	border-top: 1px solid gray;
	max-width: 25px;
	margin: 35px auto;
}

.muted {
	color: gray;
}

::selection {
	background-color: black;
	color: white;
}

/* Enhanced theme system that overrides your existing media query approach */
/* Default state - let your original system preference logic work */
@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) {
		background-color: black;
		color: #dfdfdf;
	}

	html:not([data-theme="light"]) article img:not([src$=".jpg"]):not([src$=".jpeg"]):not(.opaque) {
		background-color: white;
		border: 5px solid white;
		box-sizing: border-box;
	}

	html:not([data-theme="light"]) ::selection {
		background-color: #dfdfdf;
		color: black;
	}
}

/* Force dark mode when explicitly chosen */
[data-theme="dark"] {
	background-color: black !important;
	color: #dfdfdf !important;
}

[data-theme="dark"] article img:not([src$=".jpg"]):not([src$=".jpeg"]):not(.opaque) {
	background-color: white;
	border: 5px solid white;
	box-sizing: border-box;
}

[data-theme="dark"] ::selection {
	background-color: #dfdfdf;
	color: black;
}

[data-theme="dark"] .theme-toggle-button:hover {
	background-color: rgba(255, 255, 255, 0.15);
}

/* Force light mode when explicitly chosen */
[data-theme="light"] {
	background-color: white !important;
	color: black !important;
}

[data-theme="light"] ::selection {
	background-color: black;
	color: white;
}

[data-theme="light"] .theme-toggle-button:hover {
	background-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] p code, [data-theme="light"] li code {
	color: #EB6A6A;
}

[data-theme="light"] kbd {
	border-color: black;
	background-color: rgba(0, 0, 0, 0.15);
	box-shadow: inset 0 -1px 0 black;
}

/* Dark mode specific styling that your original CSS had */
[data-theme="dark"] p code, [data-theme="dark"] li code {
	color: #EB6A6B;
}

[data-theme="dark"] kbd {
	border-color: white;
	background-color: rgba(255, 255, 255, 0.15);
	box-shadow: inset 0 -1px 0 white;
}

/* Homepage */

#intro {
	width: 100%;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
}

#intro h1 {
	font-size: 10em;
	margin: 0;
	margin-bottom: 0.2em;
}

@media (max-width: 640px) {
	#intro h1 {
		font-size: 7em;
	}
}

/* Typography */

article > header {
	margin-bottom: 2em;
}

article > header time {
	color: gray;
	white-space: nowrap;
}

article img, article video {
	max-width: 100%;
}

article .footnotes {
	font-size: 0.75em;
}

pre {
	font-family: 'Fira Code', 'Nanum Gothic Coding', monospace;
	background-color: #272822;
	color: #f8f8f2;
	padding: 15px;
	overflow: auto;

	tab-size: 2;
	-moz-tab-size: 2;
}

p code, li code {
	color: #EB6A6A;
}

a, a:visited {
	color: inherit;
}

kbd {
	display: inline-block;
	padding: 3px 5px;
	font-size: 0.8em;
	line-height: normal;
	line-height: 10px;
	vertical-align: middle;
	border: 1px solid black;
	border-radius: 3px;
	box-shadow: inset 0 -1px 0 black;
	background-color: rgba(0, 0, 0, 0.15);
}

iframe[src*="youtube-nocookie.com"], iframe.video {
	border: none;
	width: 100%;
	height: 460px;
}

@media (max-width: 640px) {
	iframe[src*="youtube-nocookie.com"], iframe.video {
		height: 260px;
	}
}

/* Article list */

.article-list article > header {
	display: flex;
	flex-flow: row;
	align-items: center;
	margin-bottom: 0;
}

.article-list article h3 {
	display: inline-block;
	margin: 0.5em;
}

.article-list article small {
	font-weight: normal;
	color: gray;
}

.alt-links {
	float: right;
	color: gray;
	margin: 30px 0;
}

/* Japanese title class */
.japanese-title {
	font-family: 'Noto Sans JP', sans-serif;
}
