/**
 * Valheim Progression Checklist - Stylesheet
 * Tattered book aesthetic with responsive design
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
}

:root {
	/* Color Palette */
	--color-dark-brown: #2c2416;
	--color-med-brown: #3d3326;
	--color-parchment-light: #e8dcc8;
	--color-parchment-dark: #d4c4a8;
	--color-text-primary: #3a2a1a;
	--color-text-secondary: #5a3a1a;
	--color-text-tertiary: #6a4a2a;
	--color-text-quaternary: #8a6a4a;
	--color-accent: #6a4a2a;
	--color-accent-dark: #5a3a1a;
	--color-accent-light: #f8f4e8;
	--color-complete: #6a9a6a;
	--color-danger: #a44a3a;
    
	/* Spacing */
	--spacing-xs: 5px;
	--spacing-sm: 10px;
	--spacing-md: 15px;
	--spacing-lg: 20px;
	--spacing-xl: 30px;
	--spacing-xxl: 40px;
    
	/* Typography */
	--font-family: 'Georgia', serif;
	--font-size-base: 16px;
	--line-height-base: 1.5;
    
	/* Transitions */
	--transition-fast: 0.2s ease;
	--transition-normal: 0.3s ease;
	--transition-slow: 0.5s ease;
}

body {
	font-family: var(--font-family);
	font-size: var(--font-size-base);
	line-height: var(--line-height-base);
	background: linear-gradient(135deg, var(--color-dark-brown) 0%, var(--color-med-brown) 100%);
	background-attachment: fixed;
	min-height: 100vh;
	padding: var(--spacing-lg);
	color: var(--color-text-primary);
}

/* Desktop-only centering */
@media (min-width: 769px) {
	body {
		display: flex;
		justify-content: center;
		align-items: center;
	}
}

/* ============================================
   BOOK CONTAINER
   ============================================ */
.book-container {
	max-width: 900px;
	width: 100%;
	background: linear-gradient(to bottom, var(--color-parchment-light) 0%, var(--color-parchment-dark) 100%);
	border-radius: 8px;
	box-shadow: 
		0 10px 40px rgba(0, 0, 0, 0.5),
		inset 0 0 20px rgba(0, 0, 0, 0.1),
		0 0 0 1px rgba(139, 115, 85, 0.3);
	position: relative;
	overflow: visible;
}

/* Desktop: hide overflow for cleaner look */
@media (min-width: 769px) {
	.book-container {
		overflow: hidden;
	}
}

/* Parchment Texture Overlay */
.book-container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image: 
		repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(139, 115, 85, 0.05) 2px, rgba(139, 115, 85, 0.05) 4px),
		repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 115, 85, 0.05) 2px, rgba(139, 115, 85, 0.05) 4px);
	pointer-events: none;
	opacity: 0.3;
	z-index: 1;
}

/* Optional: Torn edge effect */
.book-container::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: linear-gradient(90deg, 
		transparent 0%, 
		rgba(139, 115, 85, 0.2) 10%, 
		transparent 20%,
		rgba(139, 115, 85, 0.2) 30%, 
		transparent 40%,
		rgba(139, 115, 85, 0.2) 50%,
		transparent 60%,
		rgba(139, 115, 85, 0.2) 70%,
		transparent 80%,
		rgba(139, 115, 85, 0.2) 90%,
		transparent 100%
	);
	pointer-events: none;
	z-index: 2;
}

/* ============================================
   PAGE STYLES
   ============================================ */
.page {
	padding: var(--spacing-xxl) 50px var(--spacing-xxl) 50px;
	display: none;
	position: relative;
	z-index: 2;
}

/* Desktop: ensure minimum height for aesthetics */
@media (min-width: 769px) {
	.page {
		min-height: 600px;
	}
}

.page.active {
	display: block;
	animation: pageFlip var(--transition-slow);
}

@keyframes pageFlip {
	0% {
		opacity: 0;
		transform: perspective(1000px) rotateY(-15deg);
	}
	100% {
		opacity: 1;
		transform: perspective(1000px) rotateY(0deg);
	}
}

/* Cover Page */
.cover-page {
	text-align: center;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: var(--spacing-lg);
}

/* Desktop: min-height for aesthetics */
@media (min-width: 769px) {
	.cover-page {
		min-height: 600px;
	}
}

/* Mobile: padding instead of min-height */
@media (max-width: 768px) {
	.cover-page {
		padding: var(--spacing-xxl) 0;
	}
}

.cover-title {
	font-size: 3em;
	color: var(--color-text-secondary);
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
	margin-bottom: var(--spacing-lg);
	font-weight: bold;
	letter-spacing: 2px;
}

.cover-subtitle {
	font-size: 1.2em;
	color: var(--color-text-tertiary);
	max-width: 500px;
	line-height: 1.6;
	font-style: italic;
}

/* Content Pages */
.section-label {
	font-size: 0.9em;
	color: var(--color-text-quaternary);
	text-transform: uppercase;
	letter-spacing: 2px;
	margin-bottom: var(--spacing-sm);
	font-weight: 600;
}

.task-heading {
	font-size: 2em;
	color: var(--color-accent-dark);
	margin-bottom: var(--spacing-lg);
	border-bottom: 2px solid var(--color-text-quaternary);
	padding-bottom: var(--spacing-sm);
	display: flex;
	align-items: center;
	gap: var(--spacing-sm);
}

.task-description {
	font-size: 1.1em;
	line-height: 1.8;
	margin-bottom: var(--spacing-xl);
	color: var(--color-text-secondary);
}

/* Page Complete Badge */
.page-complete-badge {
	display: inline-block;
	background: var(--color-complete);
	color: white;
	padding: 5px 12px;
	border-radius: 15px;
	font-size: 0.85em;
	margin-left: var(--spacing-sm);
	font-weight: normal;
	animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.05); }
}

/* ============================================
   CHECKLIST STYLES
   ============================================ */
.checklist {
	list-style: none;
	margin-bottom: var(--spacing-xxl);
}

.checklist-item {
	margin-bottom: var(--spacing-md);
	display: flex;
	align-items: flex-start;
	cursor: pointer;
	transition: all var(--transition-normal);
	padding: 8px;
	border-radius: 4px;
	position: relative;
	touch-action: manipulation;
}

/* Mobile: larger touch targets */
@media (max-width: 768px) {
	.checklist-item {
		padding: 12px;
		margin-bottom: var(--spacing-lg);
	}
}

.checklist-item:hover {
	background: rgba(139, 115, 85, 0.1);
	transform: translateX(3px);
}

/* Disable hover transform on touch devices */
@media (hover: none) {
	.checklist-item:hover {
		transform: none;
	}
}

.checklist-item.completed {
	opacity: 0.7;
}

.checkbox {
	width: 24px;
	height: 24px;
	border: 2px solid var(--color-accent);
	border-radius: 4px;
	margin-right: 12px;
	flex-shrink: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	background: var(--color-accent-light);
	transition: all var(--transition-normal);
	position: relative;
	touch-action: manipulation;
}

/* Mobile: larger touch target */
@media (max-width: 768px) {
	.checkbox {
		width: 32px;
		height: 32px;
		margin-right: 15px;
	}
	
	.checkbox.checked::after {
		font-size: 20px;
	}
}

.checkbox.checked {
	background: var(--color-accent);
	border-color: var(--color-accent-dark);
	animation: checkboxCheck 0.3s ease;
}

@keyframes checkboxCheck {
	0% { transform: scale(1); }
	50% { transform: scale(1.2); }
	100% { transform: scale(1); }
}

.checkbox.checked::after {
    content: 'X';
    color: var(--color-accent-light);
    font-weight: bold;
    font-size: 16px;
}.checkbox-label {
	font-size: 1.05em;
	line-height: 1.5;
	color: var(--color-text-primary);
	flex: 1;
}

.checklist-item.completed .checkbox-label {
	text-decoration: line-through;
	opacity: 0.6;
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */
.toc-list {
	list-style: none;
	margin: var(--spacing-xl) 0;
	columns: 2;
	column-gap: var(--spacing-xl);
}

.toc-item {
	padding: var(--spacing-sm);
	margin-bottom: 8px;
	border-left: 3px solid var(--color-text-quaternary);
	background: rgba(139, 115, 85, 0.05);
	cursor: pointer;
	transition: all var(--transition-normal);
	break-inside: avoid;
	border-radius: 0 4px 4px 0;
}

.toc-item:hover {
	background: rgba(139, 115, 85, 0.15);
	border-left-width: 5px;
	transform: translateX(3px);
}

.toc-section {
	font-weight: bold;
	color: var(--color-accent-dark);
	font-size: 0.95em;
	display: block;
}

.toc-page {
	color: var(--color-text-tertiary);
	font-style: italic;
	font-size: 0.85em;
	margin-top: 3px;
	display: block;
}

/* ============================================
   INDEX
   ============================================ */
.index-columns {
	columns: 3;
	column-gap: 25px;
}

.index-section {
	margin-bottom: var(--spacing-lg);
	break-inside: avoid;
}

.index-letter {
	font-size: 1.3em;
	color: var(--color-accent-dark);
	font-weight: bold;
	margin-bottom: 8px;
	border-bottom: 2px solid var(--color-text-quaternary);
	padding-bottom: 3px;
}

.index-list {
	list-style: none;
	padding-left: var(--spacing-sm);
}

.index-item {
	padding: var(--spacing-xs);
	cursor: pointer;
	transition: all var(--transition-fast);
	border-radius: 4px;
	font-size: 0.9em;
}

.index-item:hover {
	background: rgba(139, 115, 85, 0.1);
	transform: translateX(2px);
}

/* ============================================
   IMAGE PLACEHOLDER
   ============================================ */
.biome-image {
	width: 100%;
	height: 300px;
	background: linear-gradient(135deg, #c4b4a4 0%, #a49484 100%);
	border: 3px solid var(--color-accent);
	border-radius: 8px;
	display: flex;
	justify-content: center;
	align-items: center;
	margin: var(--spacing-xl) 0;
	overflow: hidden;
	position: relative;
	box-shadow: 
		inset 0 2px 8px rgba(0, 0, 0, 0.2),
		0 4px 12px rgba(0, 0, 0, 0.15);
}

.biome-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	position: absolute;
	top: 0;
	left: 0;
	filter: sepia(0.15) brightness(0.95);
	transition: filter var(--transition-normal);
}

.biome-image:hover img {
	filter: sepia(0) brightness(1);
}

.biome-image.loading::before {
	content: '';
	position: absolute;
	width: 50px;
	height: 50px;
	border: 3px solid rgba(106, 74, 42, 0.3);
	border-top-color: var(--color-accent);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

.image-caption {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(58, 42, 26, 0.85);
	color: var(--color-accent-light);
	padding: 8px 12px;
	font-size: 0.9em;
	font-style: italic;
	text-align: center;
}

/* ============================================
   PAGE FOOTER
   ============================================ */
.page-footer {
	position: relative;
	margin-top: var(--spacing-xl);
	padding: var(--spacing-lg) 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	z-index: 3;
}

/* Desktop: absolute positioning */
@media (min-width: 769px) {
	.page-footer {
		position: absolute;
		bottom: var(--spacing-lg);
		left: 50px;
		right: 50px;
		margin-top: 0;
	}
}

.page-number {
	font-size: 0.9em;
	color: var(--color-text-tertiary);
	font-style: italic;
}

.progress-indicator {
	background: rgba(139, 115, 85, 0.2);
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 0.85em;
	color: var(--color-text-secondary);
}

.nav-buttons {
	display: flex;
	gap: var(--spacing-sm);
}

/* ============================================
   BUTTONS
   ============================================ */
button {
	padding: var(--spacing-sm) var(--spacing-lg);
	background: var(--color-accent);
	color: var(--color-accent-light);
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-family: var(--font-family);
	font-size: 0.95em;
	transition: all var(--transition-normal);
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
	font-weight: 600;
}

button:hover {
	background: var(--color-accent-dark);
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active {
	transform: translateY(0);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.secondary-btn {
	background: var(--color-text-quaternary);
}

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

.danger-btn {
	background: var(--color-danger);
}

.danger-btn:hover {
	background: #8a3a2a;
}

/* ============================================
   CONTROLS PANEL
   ============================================ */
.controls-panel {
	padding: var(--spacing-lg) 50px;
	background: rgba(139, 115, 85, 0.1);
	border-top: 1px solid var(--color-text-quaternary);
	display: flex;
	gap: var(--spacing-md);
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	z-index: 3;
	position: relative;
}

.jump-controls {
	display: flex;
	gap: var(--spacing-sm);
	align-items: center;
}

.jump-input {
	padding: 8px 12px;
	border: 2px solid var(--color-accent);
	border-radius: 4px;
	background: var(--color-accent-light);
	font-family: var(--font-family);
	width: 80px;
	font-size: 0.95em;
	transition: border-color var(--transition-fast);
}

.jump-input:focus {
	outline: none;
	border-color: var(--color-accent-dark);
}

.auto-advance-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	user-select: none;
	padding: 8px 12px;
	background: rgba(139, 115, 85, 0.05);
	border-radius: 4px;
	transition: background var(--transition-fast);
}

.auto-advance-toggle:hover {
	background: rgba(139, 115, 85, 0.15);
}

.auto-advance-toggle input[type="checkbox"] {
	cursor: pointer;
	width: 18px;
	height: 18px;
}

/* ============================================
   FOOTER CREDIT
   ============================================ */
.footer-credit {
	text-align: center;
	padding: var(--spacing-md);
	font-size: 0.85em;
	color: var(--color-text-tertiary);
	font-style: italic;
	background: rgba(139, 115, 85, 0.05);
	border-top: 1px solid rgba(139, 115, 85, 0.2);
}

/* ============================================
   CREDIT POPUP
   ============================================ */
.credit-popup {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(44, 36, 22, 0.95);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10000;
	padding: var(--spacing-lg);
}

.credit-popup.hidden {
	display: none;
}

.credit-popup-content {
	background: linear-gradient(to bottom, var(--color-parchment-light) 0%, var(--color-parchment-dark) 100%);
	border-radius: 8px;
	box-shadow: 
		0 10px 40px rgba(0, 0, 0, 0.5),
		inset 0 0 20px rgba(0, 0, 0, 0.1),
		0 0 0 2px rgba(139, 115, 85, 0.5);
	padding: var(--spacing-xxl);
	max-width: 600px;
	width: 100%;
	position: relative;
	animation: popupSlide 0.4s ease-out;
}

@keyframes popupSlide {
	0% {
		opacity: 0;
		transform: translateY(-30px) scale(0.95);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.credit-popup-title {
	font-size: 2em;
	color: var(--color-accent-dark);
	margin-bottom: var(--spacing-lg);
	text-align: center;
	border-bottom: 2px solid var(--color-text-quaternary);
	padding-bottom: var(--spacing-sm);
}

.credit-popup-text {
	font-size: 1.1em;
	line-height: 1.8;
	color: var(--color-text-secondary);
	margin-bottom: var(--spacing-lg);
	text-align: center;
}

.credit-popup-link {
	display: block;
	text-align: center;
	color: var(--color-accent-dark);
	font-size: 1.1em;
	text-decoration: none;
	padding: var(--spacing-sm);
	background: rgba(139, 115, 85, 0.1);
	border-radius: 4px;
	margin-bottom: var(--spacing-lg);
	transition: all var(--transition-normal);
	font-weight: 600;
}

.credit-popup-link:hover {
	background: rgba(139, 115, 85, 0.2);
	transform: translateY(-2px);
}

.credit-popup-close {
	width: 100%;
	padding: var(--spacing-md) var(--spacing-lg);
	font-size: 1.1em;
}

@media (max-width: 768px) {
	.credit-popup-content {
		padding: var(--spacing-lg);
		max-width: 90%;
	}
	
	.credit-popup-title {
		font-size: 1.5em;
	}
	
	.credit-popup-text {
		font-size: 1em;
	}
}

/* ============================================
   LOADING INDICATOR
   ============================================ */
.loading-indicator {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(44, 36, 22, 0.95);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: var(--spacing-lg);
	z-index: 9999;
	color: var(--color-parchment-light);
}

.loading-indicator.hidden {
	display: none;
}

.loading-spinner {
	width: 50px;
	height: 50px;
	border: 4px solid rgba(232, 220, 200, 0.2);
	border-top-color: var(--color-parchment-light);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .book-container {
        max-width: 95%;
    }
    
    .page {
        padding: var(--spacing-xl) 30px;
    }
    
    .page-footer {
        left: 30px;
        right: 30px;
    }
    
    .controls-panel {
        padding: var(--spacing-md) 30px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
    }
    
    .book-container {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .page {
        padding: var(--spacing-xl) 20px calc(var(--spacing-xxl) * 2) 20px;
    }
    
    .cover-title {
        font-size: 2em;
    }
    
    .task-heading {
        font-size: 1.5em;
        flex-wrap: wrap;
    }
    
    .page-footer {
        flex-direction: column;
        gap: var(--spacing-md);
        padding-bottom: var(--spacing-lg);
    }
    
    .nav-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .controls-panel {
        padding: var(--spacing-md) 20px;
        gap: var(--spacing-sm);
        justify-content: flex-start;
    }
    
    .controls-panel button {
        padding: 8px 12px;
        font-size: 0.85em;
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    .toc-list {
        columns: 1;
    }
    
    .index-columns {
        columns: 2;
    }
    
    .biome-image {
        height: 200px;
    }
}@media (max-width: 480px) {
    .page {
        padding: var(--spacing-lg) 15px calc(var(--spacing-xxl) * 2) 15px;
    }
    
    .cover-title {
        font-size: 1.5em;
        line-height: 1.2;
    }
    
    .cover-subtitle {
        font-size: 1em;
    }
    
    .task-heading {
        font-size: 1.3em;
    }
    
    .task-description {
        font-size: 1em;
    }
    
    .index-columns {
        columns: 1;
    }
    
    .jump-controls {
        width: 100%;
    }
    
    .jump-input {
        flex: 1;
    }
    
    .controls-panel {
        padding: var(--spacing-sm) 15px;
    }
    
    .controls-panel button {
        font-size: 0.8em;
        padding: 6px 10px;
    }
    
    .auto-advance-toggle {
        font-size: 0.85em;
    }
    
    .page-footer {
        font-size: 0.85em;
    }
    
    .biome-image {
        height: 180px;
    }
}/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
	display: none !important;
}

.text-center {
	text-align: center;
}

.text-muted {
	color: var(--color-text-quaternary);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
	body {
		background: white;
		padding: 0;
	}
    
	.book-container {
		box-shadow: none;
		max-width: 100%;
	}
    
	.controls-panel,
	.footer-credit,
	button,
	.page-footer {
		display: none !important;
	}
    
	.page {
		display: block !important;
		page-break-after: always;
	}
    
	.page.active {
		animation: none;
	}
}
