/* =================================================================
   Project Page - The Interactive Project Canvas v2
================================================================= */

/* Main layout */
.project-page {
	background-color: #f8f9fa; /* Slightly off-white for a softer feel */
}

.project-header {
	background: linear-gradient(to bottom, #ffffff, #f8f9fa);
	padding: 4rem 0;
	border-bottom: 1px solid #dee2e6;
	text-align: center;
}

.project-header .container {
	max-width: 900px; /* Constrain width for readability */
}

.project-title-section .project-meta {
	margin-bottom: 1.5rem;
	display: flex;
	justify-content: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.project-meta span {
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 1rem;
	border-radius: 9999px;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	background-color: #e9ecef;
	color: #495057;
	height: 38px; /* Enforce uniform height */
}

.project-meta svg {
	width: 1em;
	height: 1em;
	margin-right: 0.5em;
	opacity: 0.8;
}

.project-difficulty.difficulty-beginner {
	background-color: #dcfce7;
	color: #166534;
}
.project-difficulty.difficulty-intermediate {
	background-color: #fef9c3;
	color: #713f12;
	border: 1px solid #fde047;
}
.project-difficulty.difficulty-advanced {
	background-color: #fee2e2;
	color: #991b1b;
	border: 2px solid #fca5a5;
	font-weight: 700;
}

.project-title-section h1 {
	font-size: 3.25rem;
	font-weight: 800;
	letter-spacing: -0.025em;
	margin-bottom: 1rem;
}

.project-description {
	font-size: 1.125rem;
	color: #4b5563;
	max-width: 70ch;
}

/* --- Project Body Layout --- */
.project-body {
	padding: 4rem 0;
}

.project-details-section,
.asset-list-section {
	max-width: 900px;
	margin: 0 auto 4rem;
}

.project-details-section h2,
.asset-list-section h2 {
	font-size: 2rem;
	font-weight: 700;
	margin-bottom: 2rem;
	border-bottom: 1px solid #e5e7eb;
	padding-bottom: 1rem;
}

.prose {
	font-size: 1rem;
	line-height: 1.7;
	color: #374151;
}

/* --- New Screenshot Section --- */
.project-screenshot-section {
	margin-bottom: 4rem;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.project-screenshot-section img {
	width: 100%;
	height: auto;
	display: block;
}

/* --- Asset List --- */
.asset-list {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.asset-item {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	background-color: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 1.5rem;
	transition: all 0.2s ease-in-out;
}

.asset-item:hover {
	border-color: #d1d5db;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	transform: translateY(-2px);
}

.asset-item.asset-item-expandable {
	flex-direction: column;
	align-items: stretch;
}

.asset-main-content {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.asset-item.locked .asset-main-content {
}

.asset-preview {
	width: 200px;
	height: 200px;
	flex-shrink: 0;
	border-radius: 8px;
	position: relative;
	overflow: hidden;
	background-color: #f3f4f6;
}

.asset-preview.video-modal-trigger {
	cursor: pointer;
}

.asset-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.preview-icon-overlay {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 50px;
	height: 50px;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	backdrop-filter: blur(4px);
	transition: transform 0.2s ease;
}

.asset-item:hover .preview-icon-overlay {
	transform: translate(-50%, -50%) scale(1.1);
}

.expansion-svg-preview svg {
	width: 100%;
	height: 100%;
	border-radius: 8px; /* Match parent container */
}

.file-icon-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #9ca3af;
}

.file-icon-placeholder svg {
	width: 100%;
	height: 100%;
	border-radius: 8px; /* Match parent container */
}

.file-icon-placeholder.is-doc svg {
	width: 80px;
	height: 80px;
}

.lock-icon-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(255, 255, 255, 0.5);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	color: #374151;
	font-size: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.asset-info {
	flex-grow: 1;
}

.asset-info h4 {
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0 0 0.5rem;
}

.asset-info p {
	margin: 0;
	color: #6b7280;
	line-height: 1.5;
}

.asset-action {
	flex-shrink: 0;
	margin-left: auto; /* Push button to the far right */
}

.asset-action .btn {
	width: 215px;
	height: 48px;
}

/* Locked State */
.asset-item.locked {
	opacity: 0.75;
}

a.btn.btn-locked:hover {
	color: black;
}

.asset-item.locked .asset-info p {
	font-style: italic;
}

.btn-locked {
	background-color: #e5e7eb;
	color: #4b5563;
	border-color: #d1d5db;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.btn-locked:hover {
	background-color: #d1d5db;
	border-color: #9ca3af;
}

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

.unlock-helper-text {
	font-size: 0.75rem;
	color: var(--primary-color);
	margin-bottom: 0.75rem;
	text-align: center;
	margin-bottom: 7px;
	font-weight: 800;
}

/* --- Expansion Ideas Accordion --- */
.expansion-ideas-panel {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.5s ease-out, padding-top 0.5s ease-out;
	padding-top: 0;
}

.asset-item-expandable.active .expansion-ideas-panel {
	max-height: 1000px; /* Large enough to not clip content */
	padding-top: 1.5rem; /* Add space when panel is open */
	transition: max-height 0.5s ease-in, padding-top 0.5s ease-in;
}

/* --- Main CTA Section --- */
.main-cta-section {
	max-width: 900px;
	margin: 2rem auto;
	padding: 3rem;
	background-color: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	text-align: center;
}

.main-cta-section h3 {
	font-size: 1.75rem;
	font-weight: 700;
	margin-top: 0;
	margin-bottom: 1rem;
}

.main-cta-section p {
	color: #6b7280;
	font-size: 1.125rem;
	max-width: 60ch;
	margin: 0 auto 2rem;
}

/* --- Expansions Grid (re-styled for consistency) --- */
.expansions-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1.5rem;
}

.expansion-card {
	background: #ffffff;
	padding: 1.5rem;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	transition: all 0.2s ease-in-out;
	display: flex;
	align-items: flex-start;
	gap: 1rem;
}
.expansion-card:hover {
	border-color: #d1d5db;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	transform: translateY(-2px);
}
.expansion-card p {
	margin: 0;
	color: #374151;
	flex-grow: 1;
	font-size: 0.8rem;
}

.expansion-icon {
	flex-shrink: 0;
	color: #f8ba00;
	width: 20px;
	height: 20px;
}
.expansion-icon svg {
	width: 100%;
	height: 100%;
}

/* --- Video Modal (no major changes needed) --- */
.video-modal-trigger {
	display: block;
	position: relative;
	cursor: pointer;
	border-radius: 0.75rem;
	overflow: hidden;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

	/* Modern aspect ratio */
	aspect-ratio: 16 / 9;
	background-color: #e5e7eb; /* Fallback color */
}

.video-modal-trigger img {
	width: 100%;
	height: 100%;
	object-fit: cover; /* Crop image to fit, don't distort */
	transition: transform 0.3s ease;
}

.video-modal-trigger:hover img {
	transform: scale(1.05);
}

.play-button-overlay {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80px;
	height: 80px;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
	color: #fff;
	font-size: 2.5rem;
	transition: background 0.3s ease, transform 0.3s ease;
	backdrop-filter: blur(5px);
	border: 2px solid rgba(255, 255, 255, 0.5);
}

.video-modal-trigger:hover .play-button-overlay {
	transform: translate(-50%, -50%) scale(1.1);
	background: rgba(0, 0, 0, 0.7);
}

.video-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.8);
	display: none; /* Hidden by default */
	justify-content: center;
	align-items: center;
	z-index: 1000;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.video-modal.active {
	display: flex;
}

.video-modal-content {
	position: relative;
	width: 90%;
	max-width: 1200px;
	height: auto;
	background: #000;
	box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.video-modal-content .video-player-container {
	padding-top: 56.25%; /* 16:9 Aspect Ratio */
	position: relative;
}

.video-modal-content video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.video-modal-close {
	position: absolute;
	top: -40px;
	right: 0;
	background: none;
	border: none;
	color: #fff;
	font-size: 2.5rem;
	cursor: pointer;
	line-height: 1;
}

.video-modal.loading .video-player-container {
	visibility: hidden;
}

/* --- Download Section Polish --- */
.download-item {
	display: flex;
	align-items: center;
	padding: 1.5rem;
	background-color: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 0.5rem;
	margin-bottom: 1rem;
	transition: all 0.3s ease;
}

.download-item:hover {
	border-color: #ced4da;
	background-color: #f1f3f5;
}

.download-icon {
	font-size: 2rem;
	margin-right: 1.5rem;
}

/* Specificity override to ensure video trigger buttons use the correct theme colors */
.asset-item .btn.video-modal-trigger.btn-primary {
	background-color: var(--primary-color, #f8ba00);
	color: var(--button-text-color, #1a1a1a);
	border-color: var(--primary-color, #f8ba00);
}

.asset-item .btn.video-modal-trigger.btn-primary:hover {
	background-color: var(--primary-hover-color, #e0a800);
	border-color: var(--primary-hover-color, #e0a800);
}

.asset-item .btn.video-modal-trigger.btn-secondary {
	background-color: var(--secondary-color, #4a5568);
	color: #fff;
	border-color: var(--secondary-color, #4a5568);
}

.asset-item .btn.video-modal-trigger.btn-secondary:hover {
	background-color: var(--secondary-hover-color, #2d3748);
	border-color: var(--secondary-hover-color, #2d3748);
}

/* --- New, Independent Loader --- */
.video-loader {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80px;
	height: 80px;
	display: none; /* Hidden by default */
	z-index: 10; /* Ensure it's above the video player container */
}
.video-loader::after {
	content: " ";
	display: block;
	width: 64px;
	height: 64px;
	margin: 8px;
	border-radius: 50%;
	background: #fff;
	animation: pulse 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
@keyframes pulse {
	0% {
		transform: scale(0);
		opacity: 1;
	}
	100% {
		transform: scale(1);
		opacity: 0;
	}
}

/* Responsive adjustments for the asset list */
@media (max-width: 768px) {
	.asset-main-content {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
		width: 100%;
	}
	.asset-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
	}
	.asset-preview {
		width: 100%;
		height: 180px; /* Adjust height for mobile */
	}
	.asset-action {
		margin-left: 0;
		width: 100%;
	}
	.asset-action .btn {
		width: 100%;
		justify-content: center;
	}
	/* Hide watch button on mobile ONLY for UNLOCKED video assets */
	.asset-item[data-asset-type="video"].unlocked .asset-action {
		display: none;
	}
	.main-cta-section {
		padding: 2rem 1.5rem;
	}
}
