/* ============================================================
   larn tutorial archive — modern facelift (2026-07-24)
   Targets the existing #container / #masthead / #navigation /
   #content / #footer structure. No HTML edits required.
   ============================================================ */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	padding: 0;
	min-height: 100vh;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
		"Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.7;
	color: #1f2937;
	background: #f5f7fa;
	background-image:
		radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.06) 0, transparent 50%),
		radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.05) 0, transparent 50%);
	background-attachment: fixed;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* ---------- Layout ---------- */
#container {
	max-width: 1200px;
	margin: 32px auto;
	padding: 0;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow:
		0 1px 2px rgba(15, 23, 42, 0.04),
		0 10px 30px -10px rgba(15, 23, 42, 0.10);
	overflow: hidden;
}

/* ---------- Masthead / hero ---------- */
#masthead {
	padding: 40px 40px 32px;
	background:
		linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
	color: #ffffff;
	text-align: left;
	border-bottom: 1px solid #e5e7eb;
}

#masthead h1 {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 700;
	letter-spacing: 0.5px;
	color: #ffffff;
	line-height: 1.3;
}

#masthead h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.85);
}

#masthead h3 a {
	color: #ffffff;
	text-decoration: none;
	border-bottom: 1px dashed rgba(255, 255, 255, 0.6);
	padding-bottom: 1px;
	transition: border-color 0.15s ease;
}

#masthead h3 a:hover {
	border-bottom-color: #ffffff;
	border-bottom-style: solid;
}

/* ---------- Navigation ---------- */
#navigation {
	padding: 24px 0;
	background: #f8fafc;
	border-bottom: 1px solid #e5e7eb;
}

#navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	padding: 0 32px;
}

#navigation li {
	flex: 1 1 auto;
	min-width: 140px;
	margin: 0;
	padding: 0;
	border: none;
	background: transparent;
}

#navigation a {
	display: block;
	padding: 10px 14px;
	font-size: 14px;
	font-weight: 500;
	color: #475569;
	text-decoration: none;
	border-radius: 8px;
	border: 1px solid transparent;
	background: transparent;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	white-space: nowrap;
}

#navigation a:hover {
	color: #1d4ed8;
	background: #eff6ff;
	border-color: #bfdbfe;
}

/* ---------- Content ---------- */
#content {
	padding: 36px 40px 48px;
	font-size: 16px;
	line-height: 1.8;
	color: #1f2937;
	background: #ffffff;
}

#content h1,
#content h2,
#content h3,
#content h4,
#content h5,
#content h6 {
	color: #1e3a8a;
	font-weight: 700;
	line-height: 1.35;
	margin-top: 1.6em;
	margin-bottom: 0.6em;
}

#content h1:first-child,
#content h2:first-child {
	margin-top: 0;
}

#content h2 {
	font-size: 24px;
	padding-bottom: 8px;
	border-bottom: 2px solid #e0e7ff;
}

#content h3 {
	font-size: 19px;
	color: #2563eb;
}

#content h4 {
	font-size: 17px;
	color: #334155;
}

#content p {
	margin: 0 0 1em;
}

#content a {
	color: #2563eb;
	text-decoration: none;
	border-bottom: 1px solid rgba(37, 99, 235, 0.3);
	transition: color 0.15s ease, border-color 0.15s ease;
}

#content a:hover {
	color: #1d4ed8;
	border-bottom-color: #1d4ed8;
}

#content img {
	margin: 12px auto;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 4px;
	background: #ffffff;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

#content ul,
#content ol {
	padding-left: 1.6em;
	margin: 0 0 1em;
}

#content li {
	margin: 0.2em 0;
}

#content .auto-style2 {
	color: #dc2626;
	font-weight: 700;
}

/* Preserve inline-class utility styles from old style3.css */
.style_bold { font-weight: bold; }
.style_italic { font-style: italic; }

/* ---------- Footer ---------- */
#footer {
	clear: both;
	padding: 24px 40px;
	background: #f8fafc;
	border-top: 1px solid #e5e7eb;
	text-align: center;
	font-size: 13px;
}

#footer p {
	margin: 0;
	color: #64748b;
}

#footer a {
	color: #475569;
	text-decoration: none;
	margin: 0 4px;
	transition: color 0.15s ease;
}

#footer a:hover {
	color: #1d4ed8;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
	body {
		font-size: 15px;
	}

	#container {
		margin: 12px;
		border-radius: 8px;
	}

	#masthead {
		padding: 28px 20px 22px;
	}

	#masthead h1 {
		font-size: 22px;
	}

	#navigation {
		padding: 16px 0;
	}

	#navigation ul {
		flex-direction: column;
		gap: 2px;
		padding: 0 16px;
	}

	#navigation li {
		min-width: 0;
	}

	#navigation a {
		padding: 12px 14px;
	}

	#content {
		padding: 24px 20px 32px;
	}

	#content h2 {
		font-size: 20px;
	}

	#footer {
		padding: 20px;
	}

	#footer a {
		display: inline-block;
		padding: 4px 2px;
	}
}

/* ---------- Print ---------- */
@media print {
	body {
		background: #ffffff;
		color: #000;
		font-size: 12pt;
	}

	#container {
		max-width: none;
		margin: 0;
		box-shadow: none;
		border: none;
		border-radius: 0;
	}

	#masthead {
		background: #ffffff !important;
		color: #000 !important;
		border-bottom: 2px solid #000;
	}

	#masthead h1,
	#masthead h3,
	#masthead h3 a {
		color: #000 !important;
	}

	#navigation {
		display: none;
	}

	#content {
		padding: 16px 0;
	}

	#content img {
		max-width: 100% !important;
		page-break-inside: avoid;
		box-shadow: none;
	}

	#content a {
		color: #000;
		text-decoration: underline;
		border-bottom: none;
	}

	#footer {
		background: #ffffff;
		border-top: 1px solid #000;
	}
}