/* ============================================
   BuildersTrack Ghost Theme
   ============================================ */

:root {
	/* Light mode */
	--bg-primary: #ffffff;
	--bg-secondary: #f8f9fa;
	--bg-card: #ffffff;
	--text-primary: #1a1a2e;
	--text-secondary: #6b7280;
	--text-muted: #9ca3af;
	--border: #e5e7eb;
	--accent: #6366f1;
	--accent-hover: #4f46e5;
	--code-bg: #f3f4f6;
	--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	--font-mono: 'JetBrains Mono', 'Fira Code', monospace;
	--content-width: 680px;
	--page-width: 1200px;
}

[data-theme="dark"] {
	--bg-primary: #0f0f1a;
	--bg-secondary: #1a1a2e;
	--bg-card: #1e1e32;
	--text-primary: #e5e5e5;
	--text-secondary: #9ca3af;
	--text-muted: #6b7280;
	--border: #2d2d44;
	--accent: #818cf8;
	--accent-hover: #a5b4fc;
	--code-bg: #1e1e32;
}

/* ---- Reset ---- */

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

/* ---- Base ---- */

html {
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

body {
	font-family: var(--font-sans);
	line-height: 1.6;
	color: var(--text-primary);
	background: var(--bg-primary);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	transition: background 0.2s, color 0.2s;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	color: var(--accent-hover);
}

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

/* ---- Buttons ---- */

.btn {
	display: inline-block;
	padding: 0.5rem 1.25rem;
	font-family: var(--font-sans);
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.5;
	border: 1px solid var(--border);
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	text-decoration: none;
}

.btn-primary {
	background: var(--accent);
	color: #fff;
	border-color: var(--accent);
}

.btn-primary:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
	color: #fff;
}

.btn-secondary {
	background: transparent;
	color: var(--text-primary);
	border-color: var(--border);
}

.btn-secondary:hover {
	border-color: var(--text-secondary);
}

.btn-sm {
	padding: 0.375rem 1rem;
	font-size: 0.8125rem;
}

.btn.disabled {
	opacity: 0.4;
	pointer-events: none;
}

/* ---- Header ---- */

.site-header {
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	background: var(--bg-primary);
	z-index: 100;
}

.nav-container {
	max-width: var(--page-width);
	margin: 0 auto;
	padding: 0.875rem 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.site-logo {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--text-primary);
	text-decoration: none;
	letter-spacing: -0.01em;
}

.site-logo:hover {
	color: var(--text-primary);
}

.nav-menu {
	display: flex;
	align-items: center;
	gap: 2rem;
}

.nav-links {
	display: flex;
	gap: 1.5rem;
}

.nav-links a {
	color: var(--text-secondary);
	font-size: 0.875rem;
	font-weight: 400;
	text-decoration: none;
}

.nav-links a:hover {
	color: var(--text-primary);
}

.nav-actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

/* Hamburger */
.nav-toggle {
	display: none;
	flex-direction: column;
	gap: 4px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
}

.nav-toggle-bar {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--text-primary);
	border-radius: 1px;
	transition: transform 0.2s, opacity 0.2s;
}

/* ---- Theme Toggle ---- */

.theme-toggle {
	background: none;
	border: 1px solid var(--border);
	border-radius: 6px;
	cursor: pointer;
	padding: 0.375rem 0.5rem;
	font-size: 1rem;
	line-height: 1;
	color: var(--text-secondary);
	transition: border-color 0.15s;
}

.theme-toggle:hover {
	border-color: var(--text-secondary);
}

[data-theme="dark"] .theme-toggle-dark { display: none; }
[data-theme="dark"] .theme-toggle-light { display: inline; }
:root:not([data-theme="dark"]) .theme-toggle-light,
html:not([data-theme="dark"]) .theme-toggle-light { display: none; }
:root:not([data-theme="dark"]) .theme-toggle-dark,
html:not([data-theme="dark"]) .theme-toggle-dark { display: inline; }

/* ---- Main ---- */

.site-main {
	flex: 1;
	max-width: var(--page-width);
	margin: 0 auto;
	padding: 2rem 1.5rem;
	width: 100%;
}

/* ---- Hero ---- */

.hero {
	padding: 4rem 0 3rem;
	max-width: var(--content-width);
}

.hero-headline {
	font-size: 2.25rem;
	font-weight: 600;
	line-height: 1.2;
	margin-bottom: 1rem;
	letter-spacing: -0.02em;
}

.hero-subline {
	font-size: 1.125rem;
	color: var(--text-secondary);
	line-height: 1.6;
	margin-bottom: 2rem;
	max-width: 560px;
}

.hero-cta-group {
	display: flex;
	gap: 0.5rem;
	max-width: 440px;
}

.hero-cta-input {
	flex: 1;
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	font-family: var(--font-sans);
	background: var(--bg-secondary);
	color: var(--text-primary);
	border: 1px solid var(--border);
	border-radius: 6px;
	outline: none;
}

.hero-cta-input:focus {
	border-color: var(--accent);
}

/* ---- Section Headings ---- */

.section-heading {
	font-size: 0.8125rem;
	font-family: var(--font-mono);
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
	margin-bottom: 1.5rem;
}

/* ---- Content Grid (Home) ---- */

.content-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
	margin-bottom: 3rem;
}

/* ---- Post Card ---- */

.post-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 8px;
	transition: border-color 0.15s;
}

.post-card:hover {
	border-color: var(--text-muted);
}

.post-card-link {
	display: block;
	padding: 1.25rem;
	text-decoration: none;
	color: inherit;
}

.post-card-tag {
	display: inline-block;
	font-size: 0.6875rem;
	font-family: var(--font-mono);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--accent);
	margin-bottom: 0.5rem;
}

.post-card-title {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	margin-bottom: 0.5rem;
	color: var(--text-primary);
}

.post-card-excerpt {
	font-size: 0.875rem;
	color: var(--text-secondary);
	line-height: 1.5;
	margin-bottom: 0.75rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.post-card-date {
	font-size: 0.75rem;
	color: var(--text-muted);
	font-family: var(--font-mono);
}

/* ---- Explainer ---- */

.explainer {
	max-width: var(--content-width);
	padding: 2rem 0 3rem;
}

.explainer p {
	color: var(--text-secondary);
	margin-bottom: 1rem;
	line-height: 1.7;
}

.read-more {
	font-weight: 500;
	font-size: 0.9375rem;
}

/* ---- News Feed ---- */

.news-feed {
	max-width: var(--content-width);
}

.news-item {
	display: flex;
	gap: 1.5rem;
	padding: 1.25rem 0;
	border-bottom: 1px solid var(--border);
}

.news-item:first-child {
	padding-top: 0;
}

.news-item-date {
	font-size: 0.75rem;
	font-family: var(--font-mono);
	color: var(--text-muted);
	white-space: nowrap;
	min-width: 3.5rem;
	padding-top: 0.125rem;
}

.news-item-title {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	margin-bottom: 0.375rem;
}

.news-item-title a {
	color: var(--text-primary);
}

.news-item-title a:hover {
	color: var(--accent);
}

.news-item-commentary {
	font-size: 0.875rem;
	color: var(--text-secondary);
	line-height: 1.5;
	margin-bottom: 0.375rem;
}

.news-item-source {
	font-size: 0.75rem;
	font-family: var(--font-mono);
	color: var(--text-muted);
}

/* ---- Articles List ---- */

.articles-list {
	max-width: var(--content-width);
}

.article-card {
	border-bottom: 1px solid var(--border);
}

.article-card-link {
	display: block;
	padding: 1.5rem 0;
	text-decoration: none;
	color: inherit;
}

.article-card-title {
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 0.5rem;
	color: var(--text-primary);
}

.article-card:hover .article-card-title {
	color: var(--accent);
}

.article-card-excerpt {
	font-size: 0.9375rem;
	color: var(--text-secondary);
	line-height: 1.6;
	margin-bottom: 0.75rem;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.article-card-meta {
	display: flex;
	align-items: center;
	gap: 1rem;
	font-size: 0.75rem;
	font-family: var(--font-mono);
	color: var(--text-muted);
}

.article-card-tag {
	color: var(--accent);
}

/* ---- Directory Grid ---- */

.directory-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
}

.directory-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 8px;
	transition: border-color 0.15s;
}

.directory-card:hover {
	border-color: var(--text-muted);
}

.directory-card-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 2rem 1.25rem;
	text-decoration: none;
	color: inherit;
}

.directory-card-logo {
	width: 48px;
	height: 48px;
	object-fit: contain;
	border-radius: 8px;
	margin-bottom: 1rem;
}

.directory-card-name {
	font-size: 1rem;
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: 0.375rem;
}

.directory-card-desc {
	font-size: 0.8125rem;
	color: var(--text-secondary);
	line-height: 1.5;
}

.directory-cta {
	margin-top: 3rem;
	text-align: center;
	color: var(--text-secondary);
	font-size: 0.9375rem;
}

/* ---- Post (Full Article) ---- */

.post-full {
	max-width: var(--content-width);
	margin: 0 auto;
}

.post-header {
	margin-bottom: 2rem;
}

.post-title {
	font-size: 2rem;
	font-weight: 600;
	line-height: 1.2;
	margin-bottom: 1rem;
	letter-spacing: -0.02em;
}

.post-meta {
	display: flex;
	align-items: center;
	gap: 1rem;
	font-size: 0.8125rem;
	font-family: var(--font-mono);
	color: var(--text-muted);
}

.post-author {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.post-author-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
}

.post-author-name {
	color: var(--text-secondary);
}

/* Ghost content styles */
.gh-content {
	font-size: 1.125rem;
	line-height: 1.75;
	color: var(--text-primary);
}

.gh-content p {
	margin-bottom: 1.5rem;
}

.gh-content h2 {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 2.5rem 0 1rem;
	letter-spacing: -0.01em;
}

.gh-content h3 {
	font-size: 1.25rem;
	font-weight: 600;
	margin: 2rem 0 0.75rem;
}

.gh-content ul,
.gh-content ol {
	margin-bottom: 1.5rem;
	padding-left: 1.5rem;
}

.gh-content li {
	margin-bottom: 0.5rem;
}

.gh-content ul li {
	list-style: disc;
}

.gh-content ol li {
	list-style: decimal;
}

.gh-content blockquote {
	border-left: 3px solid var(--accent);
	padding-left: 1.25rem;
	margin: 1.5rem 0;
	color: var(--text-secondary);
	font-style: italic;
}

.gh-content pre {
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 1rem 1.25rem;
	overflow-x: auto;
	margin-bottom: 1.5rem;
	font-family: var(--font-mono);
	font-size: 0.875rem;
	line-height: 1.6;
}

.gh-content code {
	font-family: var(--font-mono);
	font-size: 0.875em;
	background: var(--code-bg);
	padding: 0.125rem 0.375rem;
	border-radius: 3px;
}

.gh-content pre code {
	background: none;
	padding: 0;
}

.gh-content img {
	border-radius: 6px;
	margin: 1.5rem 0;
}

.gh-content a {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.gh-content hr {
	border: none;
	border-top: 1px solid var(--border);
	margin: 2.5rem 0;
}

.gh-content table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1.5rem;
	font-size: 0.9375rem;
}

.gh-content th,
.gh-content td {
	border: 1px solid var(--border);
	padding: 0.625rem 0.75rem;
	text-align: left;
}

.gh-content th {
	background: var(--bg-secondary);
	font-weight: 600;
}

/* Post footer */
.post-footer {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
}

.post-tags {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.post-tag {
	font-size: 0.75rem;
	font-family: var(--font-mono);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.25rem 0.625rem;
	text-decoration: none;
}

.post-tag:hover {
	color: var(--accent);
	border-color: var(--accent);
}

/* Share buttons */
.share-buttons {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.share-label {
	font-size: 0.75rem;
	font-family: var(--font-mono);
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.share-btn {
	font-size: 0.8125rem;
	font-family: var(--font-mono);
	color: var(--text-secondary);
	text-decoration: none;
	cursor: pointer;
	background: none;
	border: none;
	padding: 0;
}

.share-btn:hover {
	color: var(--accent);
}

/* Related posts */
.related-posts {
	margin-top: 4rem;
	max-width: var(--content-width);
	margin-left: auto;
	margin-right: auto;
}

.related-posts-heading {
	font-size: 0.8125rem;
	font-family: var(--font-mono);
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
	margin-bottom: 1.5rem;
}

.related-posts-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
}

/* ---- Page (Full) ---- */

.page-full {
	max-width: var(--content-width);
	margin: 0 auto;
}

.page-full-header {
	margin-bottom: 2rem;
}

.page-full-title {
	font-size: 2rem;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.page-content {
	font-size: 1.125rem;
	line-height: 1.75;
}

/* ---- Page Header (List pages) ---- */

.page-header {
	margin-bottom: 2rem;
}

.page-title {
	font-size: 2rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
	letter-spacing: -0.02em;
}

.page-description {
	font-size: 1.0625rem;
	color: var(--text-secondary);
}

/* ---- Author Header ---- */

.author-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.75rem;
}

.author-avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
}

/* ---- Newsletter Blocks ---- */

.newsletter-block {
	background: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 3rem 2rem;
	text-align: center;
	margin: 3rem 0;
}

.newsletter-heading {
	font-size: 1.5rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
}

.newsletter-subline {
	color: var(--text-secondary);
	margin-bottom: 1.5rem;
	max-width: 480px;
	margin-left: auto;
	margin-right: auto;
}

.newsletter-form {
	max-width: 440px;
	margin: 0 auto;
}

.newsletter-input-group {
	display: flex;
	gap: 0.5rem;
}

.newsletter-input {
	flex: 1;
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	font-family: var(--font-sans);
	background: var(--bg-primary);
	color: var(--text-primary);
	border: 1px solid var(--border);
	border-radius: 6px;
	outline: none;
}

.newsletter-input:focus {
	border-color: var(--accent);
}

.newsletter-message {
	margin-top: 0.75rem;
	font-size: 0.875rem;
}

.newsletter-message-success {
	color: #22c55e;
}

.newsletter-message-error {
	color: #ef4444;
}

/* Newsletter landing page */
.newsletter-page {
	max-width: 480px;
	margin: 4rem auto;
	text-align: center;
}

.newsletter-page-heading {
	font-size: 2rem;
	font-weight: 600;
	margin-bottom: 2rem;
	letter-spacing: -0.02em;
}

.newsletter-page-benefits {
	list-style: none;
	margin-bottom: 2rem;
	text-align: left;
	max-width: 320px;
	margin-left: auto;
	margin-right: auto;
}

.newsletter-page-benefits li {
	position: relative;
	padding-left: 1.5rem;
	margin-bottom: 0.75rem;
	color: var(--text-secondary);
	font-size: 0.9375rem;
}

.newsletter-page-benefits li::before {
	content: "—";
	position: absolute;
	left: 0;
	color: var(--accent);
	font-family: var(--font-mono);
}

/* ---- Pagination ---- */

.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.5rem;
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 1px solid var(--border);
}

.pagination-info {
	font-size: 0.8125rem;
	font-family: var(--font-mono);
	color: var(--text-muted);
}

.load-more-container {
	text-align: center;
	margin-top: 2rem;
}

/* ---- Empty State ---- */

.empty-state {
	color: var(--text-muted);
	font-size: 0.9375rem;
	padding: 2rem 0;
}

/* ---- Footer ---- */

.site-footer {
	border-top: 1px solid var(--border);
	margin-top: 4rem;
}

.footer-container {
	max-width: var(--page-width);
	margin: 0 auto;
	padding: 2rem 1.5rem;
}

.footer-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.5rem;
}

.footer-nav {
	display: flex;
	gap: 1.5rem;
}

.footer-nav a,
.footer-social a {
	font-size: 0.8125rem;
	color: var(--text-secondary);
	text-decoration: none;
}

.footer-nav a:hover,
.footer-social a:hover {
	color: var(--text-primary);
}

.footer-social {
	display: flex;
	gap: 1rem;
}

.footer-bottom {
	text-align: center;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border);
	font-size: 0.8125rem;
	color: var(--text-muted);
}

.footer-bottom a {
	color: var(--text-secondary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
	.content-grid,
	.directory-grid,
	.related-posts-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.nav-toggle {
		display: flex;
	}

	.nav-menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--bg-primary);
		border-bottom: 1px solid var(--border);
		flex-direction: column;
		padding: 1rem 1.5rem 1.5rem;
		gap: 1rem;
	}

	.nav-menu.is-open {
		display: flex;
	}

	.nav-container {
		position: relative;
	}

	.nav-links {
		flex-direction: column;
		gap: 0.75rem;
	}

	.content-grid,
	.directory-grid,
	.related-posts-grid {
		grid-template-columns: 1fr;
	}

	.hero-headline {
		font-size: 1.75rem;
	}

	.hero-cta-group {
		flex-direction: column;
	}

	.newsletter-input-group {
		flex-direction: column;
	}

	.post-title,
	.page-title,
	.page-full-title {
		font-size: 1.5rem;
	}

	.footer-top {
		flex-direction: column;
		gap: 1rem;
		align-items: flex-start;
	}

	.news-item {
		flex-direction: column;
		gap: 0.375rem;
	}

	.post-footer {
		flex-direction: column;
		align-items: flex-start;
	}
}
