/* ============================================
   CRAVEYTRAIN.COM - FOUNDATION CSS
   Warm Editorial Design System
   ============================================ */

/* ─── 1. Modern CSS Reset (Josh Comeau style) ─── */
*,
*::before,
*::after {
	box-sizing: border-box;
}

* {
	margin: 0;
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

input,
button,
textarea,
select {
	font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/* ─── 2. @font-face Declarations ─── */

/* Inter - Variable font (weights 400, 500, 600) */
@font-face {
	font-family: Inter;
	font-style: normal;
	font-weight: 400 600;
	font-display: swap;
	src: url('/fonts/inter-variable.woff2') format('woff2');
}

/* Fraunces - Variable font (weights 300, 600, 800) */
@font-face {
	font-family: Fraunces;
	font-style: normal;
	font-weight: 300 800;
	font-display: swap;
	src: url('/fonts/fraunces-variable.woff2') format('woff2');
}

/* Fraunces - Italic (weight 400) */
@font-face {
	font-family: Fraunces;
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/fraunces-italic.woff2') format('woff2');
}

/* Inconsolata - Regular (weight 400) */
@font-face {
	font-family: Inconsolata;
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/inconsolata-400.woff2') format('woff2');
}

/* ─── 3. :root Design Tokens ─── */
:root {
	/* Colors - Core Palette (OKLCH) */
	--warm-bg: oklch(97% 0.01 80deg);
	--warm-bg-deep: oklch(93% 0.02 70deg);
	--ink: oklch(25% 0.02 55deg);
	--ink-light: oklch(48% 0.03 55deg);
	--accent: oklch(55% 0.18 40deg);
	--accent-hover: oklch(48% 0.17 40deg);
	--accent-soft: oklch(84% 0.05 55deg);
	--border: oklch(87% 0.02 70deg);
	--white: oklch(100% 0 0deg);

	/* Colors - Syntax Highlighting (OKLCH) */
	--syntax-property: oklch(55% 0.18 40deg);
	--syntax-value: oklch(45% 0.12 305deg);
	--syntax-at-rule: oklch(52% 0.12 130deg);
	--syntax-selector: oklch(25% 0.02 55deg);
	--syntax-comment: oklch(64% 0.03 60deg);
	--syntax-punctuation: oklch(64% 0.03 60deg);

	/* Typography - font names lowercase per stylelint */
	--font-display: fraunces, georgia, serif;
	--font-body: inter, -apple-system, sans-serif;
	--font-code: inconsolata, 'SFMono-Regular', consolas, monospace;

	/* Layout */
	--max-width: 1100px;
	--gutter-width: 200px;
	--content-gap: 3rem;
	--prose-max-width: 640px;
	--page-padding: 2rem;
}

/* ─── 4. Base Element Styles ─── */
html {
	font-size: 16px;
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-body);
	background: var(--warm-bg);
	color: var(--ink);
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

/* ─── Tag-level Typography ─── */
blockquote {
	border-left: 4px solid var(--accent);
	margin-block: 1.5rem;
	margin-left: 0;
	padding-left: 1.5rem;
	font-style: italic;
	color: var(--ink-light);
}

ul,
ol {
	margin-block: 1.25rem;
	padding-left: 1.5rem;
}

li {
	margin-block: 0.5rem;
}

li::marker {
	color: var(--accent);
}

li > ul,
li > ol {
	margin-block: 0.5rem;
}

h2,
h3,
h4 {
	font-family: var(--font-display);
	font-weight: 600;
	color: var(--ink);
}

h2 {
	font-size: clamp(1.5rem, 3vw + 0.5rem, 2rem);
	line-height: 1.25;
}

h3 {
	font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
	line-height: 1.3;
}

h4 {
	font-size: 1.15rem;
	line-height: 1.4;
}

/* Inline code (not in pre blocks) */
:not(pre) > code {
	font-family: var(--font-code);
	font-size: 0.9em;
	background: var(--warm-bg-deep);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.15em 0.4em;
	color: var(--accent-hover);
}

/* ─── 5. Section Grid Pattern (200px / 1fr) ─── */
.section-grid {
	display: grid;
	grid-template-columns: var(--gutter-width) 1fr;
	gap: var(--content-gap);
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 0 var(--page-padding);
}

.section-label {
	font-family: var(--font-display);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--accent);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	padding-top: 0.3rem;
}

/* ─── 6. Divider Component ─── */
.divider {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 0 var(--page-padding);
}

.divider hr {
	border: none;
	border-top: 1px solid var(--border);
}

/* ─── 7. Body Link Treatment (DSYS-08) ─── */
a {
	color: var(--accent);
	text-decoration: underline;
	text-decoration-color: var(--accent-soft);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 2px;
	transition:
		text-decoration-color 0.2s,
		color 0.2s;
}

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

/* ─── 8. Accessibility - Focus States (DSYS-10) ─── */
:focus {
	outline: none;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ─── 9. Accessibility - Skip Link (DSYS-11) ─── */
.skip-link {
	position: absolute;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
	z-index: 1000;
}

.skip-link:focus {
	position: fixed;
	top: 0.5rem;
	left: 0.5rem;
	width: auto;
	height: auto;
	padding: 1rem 1.5rem;
	background: var(--accent);
	color: var(--white);
	text-decoration: none;
	font-weight: 600;
	border-radius: 4px;
}

/* ─── 10. Accent Bar (DSYS-04) ─── */
.accent-bar {
	height: 0.5rem;
	background: var(--accent);
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
}

/* ─── 11. Header (DSYS-05) ─── */
header {
	margin-top: 0.5rem;
	padding: 2rem var(--page-padding) 0;
	max-width: var(--max-width);
	margin-left: auto;
	margin-right: auto;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.logo {
	font-family: var(--font-display);
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--ink);
	text-decoration: none;
	letter-spacing: -0.02em;
}

.logo:hover {
	text-decoration: underline;
	color: var(--accent);
}

nav {
	display: flex;
	gap: 2rem;
}

/* stylelint-disable-next-line no-descending-specificity -- nav links override base link styles */
nav a {
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--ink-light);
	text-decoration: none;
	transition: color 0.2s;
}

nav a:hover {
	color: var(--accent);
	text-decoration: underline;
}

nav a[aria-current='page'] {
	font-weight: 600;
	color: var(--accent);
}

/* ─── 12. Footer (DSYS-06) ─── */
footer {
	background: var(--ink);
	color: var(--warm-bg-deep);
	padding: 3rem var(--page-padding);
}

.footer-inner {
	max-width: var(--max-width);
	margin: 0 auto;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 1rem;
}

.footer-inner .copyright {
	font-size: 0.85rem;
	opacity: 0.6;
}

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

/* stylelint-disable-next-line no-descending-specificity -- footer links override base link styles */
.footer-nav a {
	font-size: 0.85rem;
	color: var(--warm-bg-deep);
	text-decoration: none;
	opacity: 0.6;
	transition: opacity 0.2s;
}

.footer-nav a:hover {
	opacity: 1;
}

/* ─── 13. Page Header ─── */
.page-header {
	padding-top: 4rem;
	padding-bottom: 2rem;
}

.page-title {
	font-family: var(--font-display);
	font-size: clamp(2rem, 4vw + 1rem, 2.75rem);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.02em;
	color: var(--ink);
}

/* ─── 14. Shared Components ─── */

/* Tag Chips - used on homepage, posts listing, single posts, tag pages */
.tag-chip {
	font-size: 0.75rem;
	font-weight: 500;
	padding: 3px 10px;
	background: var(--warm-bg-deep);
	color: var(--ink-light);
	border-radius: 20px;
	border: 1px solid var(--border);
	text-decoration: none;
	transition:
		background 0.2s,
		border-color 0.2s,
		color 0.2s;
}

.tag-chip:hover {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--white);
}

/* View All Links - used on homepage, tag pages */
.view-all {
	display: inline-block;
	margin-top: 2rem;
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	border-bottom: 1.5px solid var(--accent-soft);
	padding-bottom: 2px;
	transition: border-color 0.2s;
}

.view-all:hover {
	text-decoration: none;
	border-color: var(--accent);
}

/* ─── 15. Mobile-first Responsive (DSYS-09) ─── */

/* Mobile base styles (default) */
@media (width < 768px) {
	.section-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
		padding: 0 1.5rem;
	}

	header {
		padding: 2rem 1.5rem 0;
	}

	nav {
		gap: 1rem;
	}

	.divider {
		padding: 0 1.5rem;
	}

	footer {
		padding: 3rem 1.5rem;
	}

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

/* Desktop styles (768px and up) */
@media (width >= 768px) {
	.section-grid {
		grid-template-columns: var(--gutter-width) 1fr;
	}
}
