/* ============================================
   BASE.CSS — Shared across all pages
   ============================================
   1. FOUNDATION — Imports, resets, variables
   2. GLOBAL — Base element styles
   3. LAYOUT — Container
   4. COMPONENTS — Buttons, Nav, Footer
   5. UTILITIES — Toast, animations, responsive
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── FOUNDATION: Reset & Variables ── */

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

:root {
	--ink: #0d0f12;
	--ink2: #1a1d24;
	--ink3: #252932;
	--blue: #2563eb;
	--blue2: #3b82f6;
	--white: #ffffff;
	--warm: #fafaf9;
	--grey1: #f4f4f5;
	--grey2: #e4e4e7;
	--grey3: #a1a1aa;
	--grey4: #52525b;
	--success: #16a34a;
	--danger: #dc2626;
	--amber: #d97706;

	--font-serif: 'Instrument Serif', Georgia, serif;
	--font-sans: 'Inter', system-ui, sans-serif;

	--radius-sm: 6px;
	--radius: 10px;
	--radius-lg: 16px;
	--radius-xl: 24px;

	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
	--shadow: 0 4px 16px rgba(0, 0, 0, 0.09);
	--shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.14);
	--shadow-blue: 0 4px 16px rgba(37, 99, 235, 0.28);

	--transition: 0.17s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
	scroll-behavior: smooth;
}

/* ── GLOBAL: Base Elements ── */

body {
	font-family: var(--font-sans);
	background: var(--warm);
	color: var(--ink);
	line-height: 1.6;
	font-size: 15px;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img {
	display: block;
	max-width: 100%;
}
a {
	text-decoration: none;
	color: inherit;
}
button {
	cursor: pointer;
	font-family: var(--font-sans);
	border: none;
	outline: none;
}
input {
	font-family: var(--font-sans);
	outline: none;
}

/* ── LAYOUT: Container ── */
.container {
	width: 100%;
	max-width: 1080px;
	margin: 0 auto;
	padding: 0 28px;
}

/* ── COMPONENTS: Buttons ── */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 18px;
	border-radius: var(--radius);
	font-size: 14px;
	font-weight: 500;
	letter-spacing: -0.01em;
	transition: var(--transition);
	white-space: nowrap;
}
.btn-primary {
	background: var(--blue);
	color: var(--white);
	box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
	background: var(--blue2);
	transform: translateY(-1px);
}
.btn-primary:active {
	transform: none;
}
.btn-ghost {
	background: transparent;
	color: var(--grey4);
	border: 1px solid var(--grey2);
}
.btn-ghost:hover {
	border-color: var(--grey3);
	color: var(--ink);
	background: var(--grey1);
}
.btn-sm {
	padding: 6px 12px;
	font-size: 13px;
}
.btn-full {
	width: 100%;
	justify-content: center;
}

/* ── Nav ── */
.nav {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(250, 250, 249, 0.94);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border-bottom: 1px solid var(--grey2);
}
.nav-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 56px;
}
.nav-logo {
	display: flex;
	align-items: center;
	font-size: 16px;
	font-weight: 600;
	color: var(--ink);
	letter-spacing: -0.03em;
	flex-shrink: 0;
}
.logo-mark {
	width: 25px;
	height: 25px;
	margin-right: 7px;
	background: var(--ink);
	border-radius: 7px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.logo-tld {
	color: var(--blue);
}
.nav-links {
	display: flex;
	align-items: center;
	list-style: none;
}
.nav-links a {
	font-size: 14px;
	font-weight: 400;
	color: var(--grey4);
	padding: 5px 11px;
	border-radius: var(--radius-sm);
	transition: var(--transition);
}
.nav-links a:hover {
	color: var(--ink);
	background: var(--grey1);
}
.nav-links a.active {
	color: var(--ink);
	font-weight: 500;
}
.nav-right {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}
.nav-github {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--radius-sm);
	color: var(--grey4);
	border: 1px solid var(--grey2);
	transition: var(--transition);
	flex-shrink: 0;
}
.nav-github:hover {
	color: var(--ink);
	border-color: var(--grey3);
	background: var(--grey1);
}
.nav-github svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

/* hamburger — mobile only */
.nav-burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	width: 32px;
	height: 32px;
	background: none;
	border: 1px solid var(--grey2);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: var(--transition);
	flex-shrink: 0;
}
.nav-burger:hover {
	border-color: var(--grey3);
	background: var(--grey1);
}
.nav-burger span {
	display: block;
	width: 14px;
	height: 1.5px;
	background: var(--grey4);
	border-radius: 2px;
	transition: var(--transition);
	transform-origin: center;
}
.nav-burger.is-open span:nth-child(1) {
	transform: translateY(6.5px) rotate(45deg);
}
.nav-burger.is-open span:nth-child(2) {
	opacity: 0;
	transform: scaleX(0);
}
.nav-burger.is-open span:nth-child(3) {
	transform: translateY(-6.5px) rotate(-45deg);
}

/* mobile drawer */
.nav-drawer {
	display: none;
	border-top: 1px solid var(--grey2);
	background: rgba(250, 250, 249, 0.98);
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-drawer.is-open {
	max-height: 200px;
}
.nav-drawer-links {
	list-style: none;
	padding: 8px 0 12px;
}
.nav-drawer-links a {
	display: block;
	padding: 11px 28px;
	font-size: 15px;
	font-weight: 400;
	color: var(--grey4);
	transition: var(--transition);
}
.nav-drawer-links a:hover,
.nav-drawer-links a.active {
	color: var(--ink);
	background: var(--grey1);
}
.nav-drawer-links a.active {
	font-weight: 500;
}

/* ── Footer ── */
.footer {
	border-top: 1px solid var(--grey2);
	padding: 20px 0;
	background: var(--warm);
}
.footer-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}
.footer-left {
	display: flex;
	align-items: center;
	gap: 10px;
}
.footer-wordmark {
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
	letter-spacing: -0.03em;
}
.footer-wordmark .tld {
	color: var(--blue);
}
.footer-sep {
	width: 1px;
	height: 12px;
	background: var(--grey2);
	flex-shrink: 0;
}
.footer-byline {
	font-size: 12px;
	color: var(--grey3);
}
.footer-byline a {
	color: var(--grey4);
	transition: var(--transition);
}
.footer-byline a:hover {
	color: var(--ink);
}
.footer-right {
	display: flex;
	align-items: center;
	gap: 6px;
}
.footer-icon-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--grey2);
	color: var(--grey4);
	transition: var(--transition);
}
.footer-icon-link:hover {
	color: var(--ink);
	border-color: var(--grey3);
	background: var(--grey1);
}
.footer-icon-link svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
}

/* ── Toast Notifications ── */
.toast {
	position: fixed;
	bottom: 18px;
	right: 18px;
	z-index: 9999;
	background: var(--ink2);
	color: var(--white);
	border-radius: var(--radius);
	padding: 10px 15px;
	font-size: 13px;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 8px;
	box-shadow: var(--shadow-lg);
	animation: fadeSlideUp 0.22s ease;
}
.toast.success {
	border-left: 2px solid var(--success);
}
.toast.error {
	border-left: 2px solid var(--danger);
}

/* ── Inline Code Badge ── */
.code-badge {
	font-family: monospace;
	font-size: 12px;
	background: var(--grey1);
	padding: 1px 5px;
	border-radius: 4px;
	border: 1px solid var(--grey2);
	display: inline-block;
}
.code-badge-sm {
	font-size: 11px;
	padding: 1px 4px;
	border-radius: 3px;
}

/* ── Spacing Utilities ── */
.mt-1 { margin-top: 16px; }
.flex-center { width: 100%; justify-content: center; }
.text-subtle { font-weight: 400; color: var(--grey3); }

/* ── Animations ── */
@keyframes dot-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.35); }
	50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0); }
}
@keyframes marquee {
	0% { transform: translateX(0); }
	100% { transform: translateX(-50%); }
}
@keyframes fadeSlideUp {
	from { opacity: 0; transform: translateY(7px); }
	to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 640px) {
	/* nav: swap desktop links for hamburger */
	.nav-links { display: none; }
	.nav-burger { display: flex; }
	.nav-drawer { display: block; }

	/* footer */
	.footer-inner {
		flex-direction: row;
		align-items: center;
		flex-wrap: nowrap;
	}
	.footer-top { flex-direction: column; gap: 10px; }
	.footer-tagline { max-width: 100%; }
}

@media (max-width: 480px) {
	.container { padding: 0 18px; }
}
