/* ========================================
   FIXES CRITIQUES POUR LE SCROLL VIDEO
   ======================================== */

/* Reset HTML pour permettre le scroll sur video.html */
body[data-page="video"] ~ html,
html:has(body[data-page="video"]) {
	height: auto !important;
	overflow: auto !important;
}

/* Override complet pour la page video */
body[data-page="video"] {
	height: auto !important;
	min-height: 100vh !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	position: relative !important;
	top: auto !important;
	left: auto !important;
	right: auto !important;
	bottom: auto !important;
	width: 100vw !important;
	scroll-behavior: smooth !important;
	-webkit-overflow-scrolling: touch !important;
}

/* Mobile fix pour video */
@media (max-width: 768px) {
	body[data-page="video"] {
		position: relative !important;
		overflow-y: auto !important;
		overflow-x: hidden !important;
		-webkit-overflow-scrolling: touch !important;
		overscroll-behavior: auto !important;
		touch-action: auto !important;
		height: auto !important;
		min-height: 100vh !important;
	}
}

/* ========================================
   BASE STYLES & RESETS
   ======================================== */

html {
	height: 100%;
	overflow: hidden;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* NOUVEAU BACKGROUND SYSTEM - COMPATIBLE MOBILE */
body {
	background-color: #ff0000 !important;
	background-attachment: scroll !important;
	font-family: 'Anton', 'Oswald', 'Arial Black', sans-serif !important;
	font-weight: 400 !important;
	color: white !important;
	overflow: hidden !important;
	height: 100vh !important;
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100vw !important;
	margin: 0 !important;
	padding: 0 !important;
	transition: background 0.2s ease;
}

/* IMAGE DE BACKGROUND */
body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: -2;
	pointer-events: none;
	background-image: url('images/background.webp');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-attachment: scroll;
	opacity: 0.9;
}

/* GRADIENT PAR DESSUS */
body::after {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: -1;
	pointer-events: none;
	background: linear-gradient(to bottom, rgba(255, 0, 0, 0.6), rgba(0, 0, 0, 0.6));
}

/* Special styles for index and shitty demos pages */
body.fixed-page {
	background-color: #ff0000 !important;
	background-attachment: scroll !important;
	overflow: hidden !important;
	height: 100vh !important;
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100vw !important;
}

/* FIXES MOBILES BACKGROUND */
@media (max-width: 768px) {
	body::before {
		background-attachment: scroll !important;
		-webkit-transform: translateZ(0);
		transform: translateZ(0);
		will-change: auto;
	}
	
	body::after {
		background: linear-gradient(to bottom, rgba(255, 0, 0, 0.4), rgba(0, 0, 0, 0.4));
	}
}

/* FIX WEBKIT (SAFARI/CHROME MOBILE) */
@supports (-webkit-touch-callout: none) {
	body::before {
		background-attachment: scroll !important;
		-webkit-transform: translateZ(0);
		transform: translateZ(0);
	}
}

@media screen and (-webkit-device-pixel-ratio: 1),
       screen and (-webkit-device-pixel-ratio: 1.5),
       screen and (-webkit-device-pixel-ratio: 2),
       screen and (-webkit-device-pixel-ratio: 3) {
	* {
		font-family: 'Anton', 'Oswald', system-ui, sans-serif !important;
	}
}

/* ========================================
   LAYOUT COMPONENTS
   ======================================== */

.container {
	position: relative;
	height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding-bottom: 80px;
	z-index: 2;
	width: 100%;
}

/* ========================================
   LOGO STYLES
   ======================================== */

body.fixed-page .logo {
	position: absolute !important;
	top: 40px !important;
	left: 50% !important;
	transform: translateX(-50%) !important;
	z-index: 10 !important;
	padding: 0 !important;
	height: auto !important;
	width: auto !important;
	display: block !important;
}

body.fixed-page .logo img {
	max-width: 250px !important;
	height: auto !important;
	filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5)) !important;
}

.logo {
	text-align: center;
	padding: 20px;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 70vh;
}

.logo img {
	max-width: 400px;
	height: auto;
	max-width: 90%;
	max-height: 90%;
	object-fit: contain;
}

.small-logo {
	text-align: center;
	padding: 10px;
	margin-bottom: 10px;
}

.small-logo img {
	max-width: 300px;
	height: auto;
	transition: opacity 0.3s ease;
}

.small-logo img:hover {
	opacity: 0.8;
}

/* ========================================
   WHEEL STYLES
   ======================================== */

.wheel-container {
	position: relative;
	width: 900px;
	height: 900px;
	z-index: 100;
	margin: 0 auto !important;
	display: flex;
	align-items: center;
	justify-content: center;
	top: 20vh;
}

.wheel-3d {
	width: 100%;
	height: 100%;
	position: relative;
	cursor: grab;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wheel-3d canvas {
	display: block !important;
	margin: 0 auto !important;
}

.wheel-3d:active {
	cursor: grabbing;
}

.wheel-3d.spinning {
	cursor: default;
}

/* ========================================
   ARROW STYLES
   ======================================== */

.arrow {
	position: absolute;
	top: 15px !important;
	left: 50% !important;
	transform: translateX(-50%) !important;
	width: 0;
	height: 0;
	border-left: 11px solid transparent !important; 
	border-right: 11px solid transparent !important;
	border-top: 33px solid white !important;
	filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
	z-index: 5;
	opacity: 0;
}

/* ========================================
   UI ELEMENTS
   ======================================== */

.lafep-image {
	position: fixed;
	top: 20px;
	left: 20px;
	max-width: 280px;
	height: auto;
	z-index: 10;
	cursor: pointer;
	transform: translateZ(0);
}

.easter-egg-images {
	position: fixed;
	bottom: 20px;
	z-index: 2;
	pointer-events: none;
	max-height: calc(100vh - 40px); 
}

.guy-image {
	left: 20px;
	max-width: 400px;
	height: auto;
	z-index: 5;
	position: absolute;
	object-fit: contain; 
}

.thing-image {
	right: 20px;
	max-width: 600px;
	height: auto;
	position: absolute;
}

.guy-image.clickable {
	pointer-events: auto;
	cursor: pointer;
	z-index: 5;
}

.instructions {
	margin-top: 30px;
	text-align: center;
	font-size: 45px;
	color: white;
	font-family: 'Anton', 'Oswald', 'Arial Black', sans-serif !important;
	font-weight: 400 !important;
	text-transform: uppercase;
	-webkit-text-stroke: 3px black;
	text-stroke: 3px black;
	opacity: 1;
}

/* ========================================
   RESULT DISPLAY
   ======================================== */

.result-display-wrapper {
	position: fixed;
	top: 60%;
	left: 50%;
	z-index: 200;
	pointer-events: none;
	transform: translate(-50%, -50%) translateZ(0);
}

.result-display {
	position: relative; 
	top: auto;
	left: auto;
	transform: none;
	background: transparent;
	border: none;
	padding: 30px;
	text-align: center;
	font-family: 'Anton', 'Oswald', 'Arial Black', sans-serif !important;
	color: white;
	font-size: 45px;
	font-weight: 400 !important;
	text-transform: uppercase;
	-webkit-text-stroke: 3px black;
	text-stroke: 3px black;
	display: none;
	cursor: pointer;
	opacity: 0.5;
	pointer-events: auto;
}

.result-display.preview {
	display: block;
	opacity: 0.6;
}

.result-display.show {
	display: block;
	opacity: 1;
}

/* ========================================
   AUDIO CONTROLS
   ======================================== */

.mute-button {
	position: fixed;
	top: 20px;
	right: 20px;
	background: transparent;
	border: none;
	color: white;
	padding: 10px 15px;
	font-family: 'Anton', 'Oswald', 'Arial Black', sans-serif !important;
	font-size: 50px;
	font-weight: 400 !important;
	text-transform: uppercase;
	-webkit-text-stroke: 2px black;
	text-stroke: 2px black;
	cursor: pointer;
	z-index: 1000;
}

.mute-button:hover {
	background: rgba(255, 255, 255, 0.3);
}

.sound-control {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 1000;
}

.sound-button {
	background: transparent;
	border: none;
	color: white;
	font-size: 16px;
	cursor: pointer;
	padding: 10px;
	text-transform: lowercase;
	transition: opacity 0.3s ease;
}

.sound-button:hover {
	opacity: 0.7;
}

.mute-text {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: white;
	font-size: 24px;
	text-align: center;
	z-index: 1000;
	pointer-events: none;
}

/* ========================================
   SCROLL CONTAINER & EFFECTS
   ======================================== */

.scroll-container {
	height: 100%;
	overflow-y: scroll;
	overflow-x: hidden;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE and Edge */
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	position: relative;
	background: transparent;
	transform-origin: top;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chrome, Safari and Opera */
.scroll-container::-webkit-scrollbar {
	width: 0;
	height: 0;
	background: transparent;
}

/* Smoother bounce effect */
@keyframes bounce {
	0% { transform: scale(1); }
	25% { transform: scale(1.015); }
	50% { transform: scale(0.995); }
	75% { transform: scale(1.005); }
	100% { transform: scale(1); }
}

.bounce {
	animation: bounce 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Overscroll effect */
.overscroll {
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.overscroll-top {
	transform-origin: top;
}

.overscroll-bottom {
	transform-origin: bottom;
}

/* ========================================
   CONTENT GRID & NAVIGATION
   ======================================== */

header {
	background: transparent;
	color: #fff;
	padding: 10px 20px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 20px 0 0 0;
	flex: 1;
}

nav ul {
	list-style: none;
	padding: 0;
}

nav ul li {
	display: inline;
	margin: 0 15px;
}

nav ul li a {
	color: #fff;
	text-decoration: none;
}

.hero {
	background: transparent;
	color: #fff;
	padding: 50px 20px;
	text-align: center;
}

section {
	padding: 20px;
	margin: 20px;
}

.content-grid {
	column-count: 4;
	column-gap: 0;
	padding: 0 20px;
	max-width: 2000px;
	margin: 0 auto;
}

.content-item {
	break-inside: avoid;
	margin: 0;
	line-height: 0;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	background: #1a1a1a;
}

.content-item img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.3s ease;
	opacity: 0;
	animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.content-item img.loaded {
	opacity: 1;
}

.content-item img:hover {
	transform: scale(1.02);
	z-index: 1;
}

.content-item.wide {
	grid-column: span 2;
	grid-row: span 250;
}

.content-item.extra-wide {
	grid-column: span 3;
	grid-row: span 300;
}

.content-item.tall {
	grid-row: span 350;
}

.content-item.extra-tall {
	grid-row: span 400;
}

.content-item video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.music-item {
	background: rgba(255, 255, 255, 0.1);
	padding: 20px;
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.music-item audio {
	width: 100%;
}

.nav-buttons {
	display: flex;
	justify-content: center;
	gap: 20px;
	padding: 20px;
	width: 100%;
}

.nav-button {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-decoration: none;
	color: white;
	transition: transform 0.3s ease;
}

.nav-button:hover {
	transform: scale(1.1);
}

.nav-button img {
	width: 100px;
	height: 100px;
	object-fit: cover;
	border-radius: 10px;
	margin-bottom: 10px;
}

.nav-button span {
	font-size: 1.1em;
	font-weight: bold;
}

/* ========================================
   VIDEO STYLES
   ======================================== */

.video-container {
	width: 90vw;
	max-width: 1600px;
	margin: 0 auto;
	padding: 20px;
}

.video-content {
	position: relative;
	width: 100%;
	background: transparent;
	margin-bottom: 50px;
}

.video-content:last-child {
	margin-bottom: 0;
}

.video-content video {
	width: 100%;
	height: auto;
	display: block;
}

.video-caption {
	text-align: center;
	color: white;
	padding: 15px 0;
	font-size: 1.1em;
	font-style: italic;
}

/* ========================================
   MODAL STYLES
   ======================================== */

.modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0);
	z-index: 1000;
	cursor: pointer;
	transition: background-color 0.3s ease;
}

.modal.active {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: rgba(0, 0, 0, 0.9);
}

.modal img {
	max-width: 90%;
	max-height: 90vh;
	object-fit: contain;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.modal.active img {
	opacity: 1;
}

/* ========================================
   PAGE VIDEO SPECIFIC STYLES
   ======================================== */

/* S'assurer que la page vidéo peut scroller */
body[data-page="video"] {
	overflow-y: auto !important;
	overflow-x: hidden !important;
	scroll-behavior: smooth !important;
	-webkit-overflow-scrolling: touch !important;
	height: auto !important;
	min-height: 100vh !important;
	position: relative !important;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
	display: none;
}

footer {
	text-align: center;
	padding: 10px 0;
	background: transparent;
	color: #fff;
}

/* ========================================
   SAFARI OPTIMIZATIONS
   ======================================== */

@supports (-webkit-touch-callout: none) {
	body.fixed-page .logo img { 
		max-width: 200px !important; 
	}
	.guy-image { 
		max-width: 250px !important; 
	}
	.thing-image { 
		max-width: 350px !important; 
	}
	.wheel-container { 
		width: 600px !important; 
		height: 600px !important; 
	}
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE
   ======================================== */

@media (max-width: 1200px) {
	.content-grid {
		column-count: 3;
	}
}

@media (max-width: 800px) {
	.content-grid {
		column-count: 2;
	}
}

@media (max-width: 768px) {
	/* DÉSACTIVATION COMPLÈTE DE L'OVERSCROLL ET ZOOM SUR TOUS LES DEVICES */
	html, body {
		overscroll-behavior: none !important;
		overscroll-behavior-x: none !important;
		overscroll-behavior-y: none !important;
		-webkit-overscroll-behavior: none !important;
		-webkit-overscroll-behavior-x: none !important;
		-webkit-overscroll-behavior-y: none !important;
		touch-action: manipulation !important;
		-webkit-touch-callout: none !important;
		-webkit-user-select: none !important;
		-webkit-tap-highlight-color: transparent !important;
		user-zoom: fixed !important;
		-webkit-user-zoom: fixed !important;
		-webkit-text-size-adjust: 100% !important;
		-ms-text-size-adjust: 100% !important;
		zoom: 1 !important;
		min-zoom: 1 !important;
		max-zoom: 1 !important;
		user-scalable: no !important;
		-webkit-user-scalable: no !important;
	}
	
	/* Prevent scroll bounce and fix positioning issues */
	body.fixed-page {
		position: fixed !important;
		overflow: hidden !important;
		-webkit-overflow-scrolling: auto !important;
		overscroll-behavior: none !important;
		overscroll-behavior-x: none !important;
		overscroll-behavior-y: none !important;
		-webkit-overscroll-behavior: none !important;
		touch-action: none !important;
		-webkit-touch-callout: none !important;
		-webkit-user-select: none !important;
		user-zoom: fixed !important;
		-webkit-user-zoom: fixed !important;
	}
	
	.container { 
		justify-content: center; 
		padding-bottom: 0; 
		padding-top: 0; 
	}
	
	/* WHEEL - PARFAITEMENT CENTRÉ AU MILIEU DE LA PAGE */
	.wheel-container { 
		position: fixed !important;
		top: 50% !important;
		left: 50% !important;
		transform: translate(-50%, -50%) !important;
		width: 550px !important; 
		height: 550px !important; 
		z-index: 150 !important; 
		margin: 0 !important;
	}
	
	/* ARROW - SUIT LA WHEEL */
	.arrow { 
		top: -1px !important; 
		opacity: 0; 
	}
	
	/* INSTRUCTIONS - JUSTE EN DESSOUS DE LA WHEEL CENTRÉE */
	.instructions { 
		position: fixed !important;
		top: 75% !important;
		left: 50% !important;
		transform: translateX(-50%) !important;
		width: 90% !important;
		margin: 0 !important;
		font-size: 28px !important; 
		font-weight: 400 !important; 
		padding: 0 20px; 
		-webkit-text-stroke: 2px black; 
		text-stroke: 2px black; 
		z-index: 10; 
		opacity: 1; 
		bottom: auto !important;
	}
	
	/* RESULT WRAPPER - CENTRÉ AVEC LA WHEEL */
	.result-display-wrapper { 
		position: fixed !important;
		top: 65% !important;
		left: 50% !important;
		transform: translate(-50%, -50%) !important;
		z-index: 200 !important; 
	}
	
	.result-display { 
		font-size: 24px !important; 
		font-weight: 400 !important; 
		-webkit-text-stroke: 2px black; 
		text-stroke: 2px black; 
		transform: none !important; 
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		text-align: center !important;
	}
	
	.result-display.preview { 
		opacity: 0.5; 
	}
	
	.result-display.show { 
		opacity: 1; 
	}
	
	.mute-button { 
		font-size: 20px !important; 
		font-weight: 400 !important; 
		-webkit-text-stroke: 1px black; 
		text-stroke: 1px black; 
	}
	
	.logo img { 
		max-width: 180px !important; 
	}
	
	.logo { 
		top: 30px !important; 
	}
	
	/* LAFEP - VERROUILLÉ EN BAS À DROITE */
	.lafep-image { 
		position: fixed !important;
		bottom: 20px !important;
		right: 10px !important;
		top: auto !important;
		left: auto !important;
		max-width: 180px !important;
		height: auto !important;
		z-index: 6 !important; 
		will-change: auto !important;
	}
	
	.easter-egg-images { 
		bottom: 10px; 
		z-index: 1; 
	}
	
	/* GUY - BAS GAUCHE FIXE */
	.guy-image { 
		position: fixed !important;
		bottom: 10px !important;
		left: 10px !important;
		max-width: 200px !important; 
	}
	
	.guy-image.clickable { 
		z-index: 5; 
	}
	
	/* THING - BAS DROITE FIXE */
	.thing-image { 
		position: fixed !important;
		bottom: 10px !important;
		right: 10px !important;
		max-width: 390px !important; 
	}
}

/* ========================================
   RESPONSIVE DESIGN - SMALL MOBILE
   ======================================== */

@media (max-width: 480px) {
	.logo img { 
		max-width: 80px !important; 
	}
	
	/* WHEEL - PLUS PETITE MAIS TOUJOURS PARFAITEMENT CENTRÉE */
	.wheel-container { 
		width: 350px !important; 
		height: 350px !important; 
	}
	
	.guy-image { 
		max-width: 150px !important; 
	}
	
	.thing-image { 
		max-width: 300px !important; 
	}
	
	.instructions { 
		font-size: 24px !important; 
		padding: 0 15px; 
	}
	
	.result-display { 
		font-size: 20px !important; 
	}
	
	/* LAFEP - POSITION BAISSÉE AUSSI SUR PETITS ÉCRANS */
	.lafep-image { 
		bottom: 10px !important;
		max-width: 50px !important;
	}
}