/* simple, old-school web: clean light and dark themes, small animations */

:root {
	color-scheme: light;
	/* fluid type scale: shrinks on small screens, grows on large ones */
	--font-base: clamp(15px, 0.92rem + 0.3vw, 18px);
	--font-tagline: clamp(1.15rem, 1rem + 0.8vw, 1.7rem);
	--font-h1: clamp(1.4rem, 1.2rem + 1vw, 2rem);
	--font-h2: clamp(1.15rem, 1rem + 0.6vw, 1.6rem);
	--font-h3: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
	--page-pad-top: clamp(28px, 6vw, 72px);
	--page-pad-side: clamp(12px, 4vw, 28px);
	--page-pad-bottom: clamp(32px, 8vw, 64px);
	--bg: #ffffff;
	--text: #000000;
	--link: #0000ee;
	--link-visited: #551a8b;
	--link-hover: #cc0000;
	--border: #999999;
	--panel: #eeeeee;
	--panel-hover: #dddddd;
	--panel-active: #cccccc;
	--muted: #555555;
	--code-bg: #f4f4f4;
	--loader-muted: #666666;
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #0b0f14;
	--text: #e6edf3;
	--link: #7aa2f7;
	--link-visited: #bb9af7;
	--link-hover: #ff7b72;
	--border: #3a4454;
	--panel: #151b24;
	--panel-hover: #1e2632;
	--panel-active: #273140;
	--muted: #a6b1bf;
	--code-bg: #151b24;
	--loader-muted: #a6b1bf;
}

*, *::before, *::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "Times New Roman", Times, serif;
	font-size: var(--font-base);
	line-height: 1.5;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.page {
	width: 100%;
	max-width: 820px;
	margin: 0 auto;
	padding: var(--page-pad-top) var(--page-pad-side) var(--page-pad-bottom);
}

a {
	color: var(--link);
	text-decoration: underline;
}
a:visited { color: var(--link-visited); }
a:hover { color: var(--link-hover); }

a:focus-visible,
button:focus-visible {
	outline: 2px dashed var(--link);
	outline-offset: 2px;
}

h1, h2, h3 {
	font-weight: bold;
	line-height: 1.2;
}
h1 { font-size: var(--font-h1); margin: 0.4em 0 0.2em; }
h2 { font-size: var(--font-h2); margin: 1.4em 0 0.5em; }
h3 { font-size: var(--font-h3); margin: 1.4em 0 0.4em; }

p { margin: 0.6em 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: clamp(1.2em, 3vw, 1.8em) 0; }
code, pre {
	font-family: "Courier New", Courier, monospace;
	font-size: 0.95em;
	overflow-wrap: anywhere;
}
small { font-size: 0.85em; }

.site-header .tagline {
	margin: 0 0 0.8em;
	font-family: "Courier New", Courier, monospace;
	font-size: var(--font-tagline);
	font-weight: bold;
	line-height: 1.3;
	overflow-wrap: anywhere;
}
.top-nav, .footer-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 6px;
}
.top-nav a { margin-right: 2px; }

/* blinking old terminal cursor */
.cursor {
	font-family: "Courier New", Courier, monospace;
	animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* loading screen */
.loader {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: var(--bg);
	color: var(--text);
	font-family: "Courier New", Courier, monospace;
	transition: opacity 0.4s ease, visibility 0.4s ease;
}
.loader.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
.loader-text { margin: 0; letter-spacing: 0.08em; }
.loader-small { margin: 0; font-size: 0.8em; color: var(--loader-muted); }
.loader-bar {
	width: min(260px, 70vw);
	height: 12px;
	border: 1px solid var(--text);
}
.loader-fill {
	width: 0;
	height: 100%;
	background: var(--text);
	transition: width 0.15s linear;
}

/* scroll reveal */
.reveal {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible {
	opacity: 1;
	transform: none;
}

/* ssh box */
.ssh-box {
	font-family: "Courier New", Courier, monospace;
	background: var(--code-bg);
	border: 1px solid var(--border);
	padding: clamp(6px, 2vw, 10px);
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	overflow-wrap: anywhere;
}

button {
	font-family: "Times New Roman", Times, serif;
	font-size: 0.9em;
	color: var(--text);
	background: var(--panel);
	border: 1px solid var(--border);
	padding: 2px 8px;
	cursor: pointer;
}
button:hover { background: var(--panel-hover); }
button:active { background: var(--panel-active); }

/* sliding ball switch: ball on the left in light mode, right in dark mode */
.theme-switch {
	display: inline-flex;
	align-items: center;
	width: 36px;
	height: 18px;
	padding: 2px;
	vertical-align: middle;
	box-sizing: border-box;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
}
.theme-switch .theme-ball {
	display: block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--text);
	transition: transform 0.2s ease;
}
:root[data-theme="dark"] .theme-switch .theme-ball {
	transform: translateX(16px);
}

/* tables */
table.brief, table.footer-table {
	border-collapse: collapse;
	margin: 0.8em 0;
}
table.brief th, table.brief td,
table.footer-table th, table.footer-table td {
	border: 1px solid var(--border);
	padding: 5px 12px;
	text-align: left;
	vertical-align: top;
}
table.brief th, table.footer-table th {
	background: var(--panel);
	font-weight: bold;
}
table.brief, table.footer-table {
	max-width: 100%;
	table-layout: auto;
}
table.brief td, table.brief th,
table.footer-table td, table.footer-table th {
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* lists */
.project-list, .post-list, .commit-list {
	list-style: none;
	margin: 0.8em 0;
	padding: 0;
}
.project-list li, .post-list li,
.commit-list li {
	border-bottom: 1px dotted var(--border);
	padding: 8px 0;
}
.project-list .desc, .post-list .desc {
	margin-top: 3px;
	font-family: "Courier New", Courier, monospace;
	font-size: 0.9em;
	color: var(--text);
}
.post-list .date, .tags {
	font-family: "Courier New", Courier, monospace;
	font-size: 0.85em;
	color: var(--muted);
}

.log-tools {
	font-family: "Courier New", Courier, monospace;
	font-size: 0.9em;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.commit-list li {
	font-family: "Courier New", Courier, monospace;
	font-size: 0.9em;
}
.commit-list .meta {
	color: var(--muted);
	font-size: 0.85em;
}
.commit-list .add { color: #008000; }
.commit-list .del { color: #cc0000; }
.commit-list .empty {
	color: var(--muted);
	font-style: italic;
}

:root[data-theme="dark"] .commit-list .add { color: #4ec9a0; }
:root[data-theme="dark"] .commit-list .del { color: #ff7b72; }

/* blog pages */
.post-meta {
	font-family: "Courier New", Courier, monospace;
	font-size: 0.9em;
	color: var(--muted);
}
.post-desc { font-style: italic; }
.article h2 { border-bottom: 1px solid var(--border); padding-bottom: 3px; }
.article ul { margin: 0.5em 0; padding-left: 24px; }
.article li { margin: 0.3em 0; }
.article img, img.post-cover {
	display: block;
	max-width: 100%;
	height: auto;
	border: 1px solid var(--border);
	margin: 0.6em 0;
}
.footer-nav { font-family: "Courier New", Courier, monospace; font-size: 0.9em; }
.footer-bottom { margin-top: 2em; font-size: 0.9em; color: var(--muted); }

/* fluid spacing and layout across screen sizes */
@media (max-width: 600px) {
	.top-nav, .footer-nav { gap: 2px 4px; }
	.project-list li, .post-list li, .commit-list li { padding: 7px 0; }
	.article ul { padding-left: 18px; }
	table.brief th, table.brief td,
	table.footer-table th, table.footer-table td { padding: 4px 8px; }
}

@media (min-width: 1200px) {
	.page { max-width: 900px; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.reveal { opacity: 1; transform: none; transition: none; }
	.cursor { animation: none; }
	.loader { transition: none; }
	body { transition: none; }
}
