/* CSS Custom Properties */
:root {
	--primary-font: 'Georgia', 'Times New Roman', serif;
	--secondary-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
	--text-color: #2d3142;
	--background-color: #faf6f0;
	--paper-texture: #f5f1e8;
	--accent-color: #8b4513;
	--muted-color: #6b705c;
	--border-color: #e8dcc6;
	--dialogue-color: #1f2937;
	--reading-width: 80ch;
	--line-height: 1.7;
	--font-size-base: 1.125rem;
	--shadow-light: 0 2px 4px rgba(139, 69, 19, 0.1);
}

@media (prefers-color-scheme: dark) {
	:root {
		--text-color: #d6d3d1;
		--background-color: #292524;
		--paper-texture: #1c1917;
		--accent-color: #d97706;
		--muted-color: #a8a29e;
		--border-color: #44403c;
		--dialogue-color: #f5f5f4;
	}
}

/* Base Styles */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: var(--primary-font);
	font-size: var(--font-size-base);
	line-height: var(--line-height);
	color: var(--text-color);
	background: linear-gradient(45deg, var(--background-color) 0%, var(--paper-texture) 100%);
	background-attachment: fixed;
	transition: all 0.3s ease;
}

body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image:
		radial-gradient(circle at 20% 50%, rgba(120, 119, 122, 0.03) 0%, transparent 50%),
		radial-gradient(circle at 80% 20%, rgba(120, 119, 122, 0.03) 0%, transparent 50%),
		radial-gradient(circle at 40% 80%, rgba(120, 119, 122, 0.03) 0%, transparent 50%);
	pointer-events: none;
	z-index: -1;
}

/* Layout */
.container {
	max-width: var(--reading-width);
	margin: 0 auto;
	padding: 2rem 1.5rem;
	min-height: 100vh;
	background: var(--paper-texture);
	box-shadow: var(--shadow-light);
	border-left: 1px solid var(--border-color);
	border-right: 1px solid var(--border-color);
	position: relative;
}

/* Headers - Shared styles */
.story-header,
.site-header {
	text-align: center;
	margin-bottom: 3rem;
	border-bottom: 2px solid var(--border-color);
	padding-bottom: 2rem;
	position: relative;
}

.site-header {
	margin-bottom: 4rem;
	padding-bottom: 3rem;
}

.story-header::after,
.site-header::after {
	content: '❦';
	position: absolute;
	bottom: -0.75rem;
	left: 50%;
	transform: translateX(-50%);
	background: var(--paper-texture);
	color: var(--accent-color);
	padding: 0 1rem;
	font-size: 1.5rem;
}

.site-header::after {
	font-size: 2rem;
}

.story-title,
.site-title {
	font-weight: 400;
	color: var(--accent-color);
	letter-spacing: -0.02em;
	text-shadow: 0 1px 2px rgba(0,0,0,0.1);
	margin-bottom: 1rem;
}

.story-title {
	font-size: 2.5rem;
}

.site-title {
	font-size: 3rem;
	font-weight: 300;
	margin-bottom: 0.5rem;
	text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.site-tagline {
	font-family: var(--secondary-font);
	font-size: 1.1rem;
	color: var(--muted-color);
	font-style: italic;
	margin-bottom: 1rem;
}

.site-description {
	font-size: 1rem;
	color: var(--text-color);
	max-width: 50ch;
	margin: 0 auto;
	line-height: 1.6;
}

/* Meta information */
.story-meta {
	font-family: var(--secondary-font);
	font-size: 0.875rem;
	color: var(--muted-color);
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	font-style: italic;
	margin-bottom: 1rem;
}

.story-meta span {
	position: relative;
}

.story-meta span:not(:last-child)::after {
	content: '⋄';
	margin-left: 1rem;
	opacity: 0.6;
}

/* Story content */
.story-content {
	font-size: var(--font-size-base);
	line-height: var(--line-height);
}

.story-content p {
	margin-bottom: 1.5rem;
	text-align: justify;
	hyphens: auto;
}

.story-content p:first-child::first-letter {
	font-size: 4em;
	font-weight: 400;
	float: left;
	line-height: 0.8;
	margin: 0.1em 0.15em 0 0;
	color: var(--accent-color);
	text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.story-content em {
	font-style: italic;
	color: var(--accent-color);
}

.story-content strong {
	font-weight: 600;
	color: var(--dialogue-color);
}

.story-content blockquote {
	margin: 2rem 0;
	padding: 1.5rem;
	border-left: 4px solid var(--accent-color);
	background: var(--background-color);
	font-style: italic;
	color: var(--muted-color);
	border-radius: 0 4px 4px 0;
	box-shadow: var(--shadow-light);
}

hr {
    /* 1. Use the HR's border for a guaranteed line */
    border: none;
    border-top: 2px dotted var(--accent-color); 
    
    /* 2. Style and center the line */
    margin: 3rem auto;
    width: 50%;
    height: 0; 
    position: relative;
    text-align: center;
}

hr::before {
    /* 3. The star element sits over the dotted line */
    content: '✶';
    font-size: 1.5rem;
    color: var(--accent-color);
    background: var(--paper-texture); /* This cuts out the dotted line */
    padding: 0 1rem;
    position: relative;
    /* Adjust vertical position to center the star over the line */
    top: -1em; 
    z-index: 1; /* Ensures the star is always on top */
    font-family: var(--primary-font);
}

/* Czech dialogue styling - not needed */
.dialogue-quote {
	color: var(--dialogue-color);
	font-weight: 500;
}

.dialogue,
.speaker {
	display: none;
}

/* Controls */
.reading-controls,
.site-controls {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 100;
	display: flex;
	gap: 0.5rem;
	opacity: 0.7;
	transition: opacity 0.3s ease;
}

.reading-controls:hover,
.site-controls:hover {
	opacity: 1;
}

.control-btn,
.category-btn {
	background: var(--paper-texture);
	border: 1px solid var(--border-color);
	color: var(--text-color);
	padding: 0.5rem;
	border-radius: 6px;
	cursor: pointer;
	font-family: var(--secondary-font);
	font-size: 0.75rem;
	transition: all 0.2s ease;
	box-shadow: var(--shadow-light);
}

.control-btn:hover,
.category-btn:hover,
.category-btn.active {
	background: var(--accent-color);
	color: var(--paper-texture);
	border-color: var(--accent-color);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(139, 69, 19, 0.2);
}

.category-btn {
	padding: 0.5rem 1rem;
	border-radius: 20px;
	text-decoration: none;
	font-size: 0.875rem;
}

/* Reading progress */
.reading-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 0%;
	height: 4px;
	background: linear-gradient(90deg, var(--accent-color), var(--muted-color));
	z-index: 101;
	transition: width 0.1s ease;
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Stories grid */
.stories-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 2rem;
	margin-bottom: 3rem;
}

.story-card {
	background: var(--background-color);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	padding: 2rem;
	transition: all 0.3s ease;
	box-shadow: var(--shadow-light);
	position: relative;
	overflow: hidden;
}

.story-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(90deg, var(--accent-color), var(--muted-color));
	opacity: 0;
	transition: opacity 0.3s ease;
}

.story-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 25px rgba(0,0,0,0.15);
	border-color: var(--accent-color);
}

.story-card:hover::before {
	opacity: 1;
}

.story-link {
	text-decoration: none;
	color: inherit;
	display: block;
}

.story-card .story-title {
	font-size: 1.5rem;
	line-height: 1.3;
	margin-bottom: 0.5rem;
}

.story-excerpt {
	color: var(--text-color);
	line-height: 1.6;
	margin-bottom: 1rem;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.story-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1rem;
}

.story-tag {
	font-family: var(--secondary-font);
	font-size: 0.75rem;
	background: var(--paper-texture);
	color: var(--muted-color);
	padding: 0.25rem 0.75rem;
	border-radius: 12px;
	border: 1px solid var(--border-color);
}

/* Categories */
.categories {
	margin-bottom: 3rem;
	text-align: center;
}

.categories-title {
	font-size: 1.2rem;
	color: var(--accent-color);
	margin-bottom: 1rem;
	font-weight: 400;
}

.category-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
}

/* Footer */
.site-footer {
	text-align: center;
	padding: 2rem 0;
	border-top: 1px solid var(--border-color);
	color: var(--muted-color);
	font-family: var(--secondary-font);
	font-size: 0.875rem;
}

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

.site-footer a:hover {
	text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
	.container {
		padding: 1.5rem 1rem;
		border-left: none;
		border-right: none;
		box-shadow: none;
	}

	.story-title {
		font-size: 2rem;
	}

	.site-title {
		font-size: 2.5rem;
	}

	.site-tagline {
		font-size: 1rem;
	}

	.story-meta {
		font-size: 0.8rem;
		gap: 0.5rem;
	}

	.story-meta span:not(:last-child)::after {
		margin-left: 0.5rem;
	}

	.story-content {
		font-size: 1rem;
	}

	.reading-controls,
	.site-controls {
		position: static;
		justify-content: center;
		margin-bottom: 2rem;
		opacity: 1;
	}

	.stories-grid {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}

	.story-card {
		padding: 1.5rem;
	}

	.category-filters {
		gap: 0.5rem;
	}

	.category-btn {
		padding: 0.4rem 0.8rem;
		font-size: 0.8rem;
	}
}

@media (max-width: 480px) {
	:root {
		--font-size-base: 1rem;
		--line-height: 1.6;
	}

	.story-title {
		font-size: 1.75rem;
	}

	.site-title {
		font-size: 2rem;
	}

	.story-content p:first-child::first-letter {
		font-size: 3em;
	}

	.story-meta {
		flex-direction: column;
		gap: 0.25rem;
	}

	.story-meta span:not(:last-child)::after {
		display: none;
	}
}

/* Print Styles */
@media print {
	.reading-controls,
	.reading-progress,
	.site-controls,
	.categories {
		display: none;
	}

	body {
		font-size: 12pt;
		line-height: 1.4;
		background: white;
	}

	body::before {
		display: none;
	}

	.container {
		max-width: none;
		margin: 0;
		padding: 0;
		box-shadow: none;
		border: none;
		background: white;
	}

	.story-content p {
		text-align: left;
		hyphens: none;
	}

	.stories-grid {
		grid-template-columns: 1fr;
	}

	.story-card {
		break-inside: avoid;
		box-shadow: none;
		border: 1px solid #ddd;
		margin-bottom: 1rem;
	}
}
