/*
Theme Name: ld-os-main
Author: Jérémie
Description: Style OS principal
Version: 1.1 - Refactored by L'Empereur
*/

/* --- 0. RESET & BOX-SIZING (LA RÈGLE D'OR) --- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	width: 100%;
}

/* --- 1. VARIABLES SYSTÈME --- */
:root {
	--bg-color: #0a0a0a;
	--term-color: #00ffcc;
	--term-glow: 0 0 8px rgba(0, 255, 204, 0.4);
	--term-dim: #008877;
	--alert-color: #ff0055;
}

/* --- 2. BASE & TYPOGRAPHIE --- */
body {
	padding: 20px;
	background-color: var(--bg-color) !important;
	color: var(--term-color);
	font-family: "Courier New", Courier, monospace;
	line-height: 1.6;
	text-transform: uppercase;
}

h1,
h2 {
	margin-top: 0;
	font-weight: normal;
	text-shadow: var(--term-glow);
}

h1 {
	font-size: 2.5rem;
	border-bottom: 2px dashed var(--term-dim);
	padding-bottom: 10px;
}

h2 {
	font-size: 1.2rem;
	color: var(--term-dim);
}

a {
	color: var(--term-color);
	text-decoration: none;
	transition: all 0.2s;
}

a:hover {
	background-color: var(--term-color) !important;
	color: #000000 !important;
	text-shadow: none !important;
	padding: 0 5px;
}

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

li {
	margin-bottom: 12px;
}

/* --- 3. STRUCTURE & GRILLE --- */
.terminal-container {
	max-width: 900px;
	margin: 0 auto;
	padding: 40px;
	border: 1px solid var(--term-dim);
	box-shadow: inset 0 0 30px rgba(0, 255, 204, 0.05);
	position: relative; /* Sécurise les pseudos-éléments */
}

.sys-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
}

.span-full {
	grid-column: 1 / -1;
}

.sys-header {
	margin-bottom: 50px;
}

.sys-footer {
	margin-top: 50px;
	padding-top: 30px;
	text-align: left;
	border-top: 2px dashed var(--term-dim);
}

/* --- 4. COMPOSANTS --- */
.sys-panel {
	padding: 20px;
	border: 1px solid var(--term-dim);
	background: rgba(0, 255, 204, 0.02);
}

.sys-status {
	color: var(--alert-color);
	text-shadow: 0 0 8px rgba(255, 0, 85, 0.4);
	font-weight: bold;
}

.sys-desc {
	font-size: 0.9rem;
}

.btn-execute {
	display: inline-block;
	padding: 10px 20px;
	border: 1px solid var(--term-color);
	font-weight: bold;
	box-shadow: var(--term-glow);
}

.btn-execute:hover {
	padding: 10px 25px;
	background: var(--term-color);
	color: var(--bg-color);
}

/* --- 5. MÉDIAS (IMAGES, VIDÉOS, IFRAMES) --- */
.sys-gallery {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 30px;
	margin-top: 20px;
}

.sys-img,
.sys-video,
.iframe-container {
	width: 100%;
	border: 1px solid var(--term-dim);
	transition: all 0.3s ease;
}

.sys-img {
	height: auto;
	filter: grayscale(100%) contrast(1.2);
	cursor: crosshair;
}

.sys-img:hover {
	filter: grayscale(0%);
	border-color: var(--term-color);
	box-shadow: var(--term-glow);
	transform: scale(1.02);
	z-index: 10;
}

.sys-video {
	max-height: 70vh;
	background-color: #000;
	box-shadow: 0 0 15px rgba(0, 255, 204, 0.05);
}

.sys-video:hover,
.iframe-container:hover {
	border-color: var(--term-color);
	box-shadow: var(--term-glow);
}

.iframe-container {
	position: relative;
	height: 65vh;
	background-color: var(--bg-color);
	box-shadow: 0 0 15px rgba(0, 255, 204, 0.05);
	overflow: hidden;
}

.sys-iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* --- 6. UTILITAIRES & ANIMATIONS --- */
.locked-module {
	display: none;
}

.sys-spacer {
	visibility: hidden;
	pointer-events: none;
}

.cursor {
	display: inline-block;
	width: 12px;
	height: 24px;
	margin-left: 5px;
	background-color: var(--term-color);
	vertical-align: text-bottom;
	box-shadow: var(--term-glow);
	animation: blink 1s step-start infinite;
}

@keyframes blink {
	50% {
		opacity: 0;
	}
}

.snake-grid-container {
	font-family: monospace !important;
	letter-spacing: 0px;
	word-spacing: 0px;
}

/* --- 7. COMMAND LINE INTERFACE --- */
.cmd-line {
	display: flex;
	align-items: center;
	margin-top: 10px;
}

.cmd-prompt {
	color: var(--alert-color);
	margin-right: 10px;
	font-weight: bold;
}

#cmd-input {
	background: transparent;
	border: none;
	color: var(--term-color);
	font-family: inherit;
	font-size: 1rem;
	flex-grow: 1;
	outline: none;
	text-transform: uppercase;
}

#cmd-input::placeholder {
	color: var(--term-dim);
	opacity: 0.8;
}

#cmd-history {
	margin-bottom: 10px;
}

.cmd-output-line {
	margin-bottom: 8px;
}

.cmd-error {
	color: var(--alert-color);
}

/* --- 8. EASTER EGG : MODE CHEF --- */
body.chef-mode {
	--term-color: #ff9900;
	--term-glow: 0 0 10px rgba(255, 153, 0, 0.6);
	--term-dim: #884400;
	--alert-color: #ff3300;
}

/* --- 9. BOUTON QUICK CONTACT (PULSATION) --- */
#btn-quick-contact {
	display: block;
	width: 100%;
	text-align: center;
	font-size: 1.1rem;
	padding: 15px;
	background-color: rgba(0, 255, 204, 0.05);
	border: 2px solid var(--term-color);
	animation: pulse-border 2s infinite;
}

#btn-quick-contact:hover {
	background-color: var(--term-color);
	color: var(--bg-color);
	animation: none;
	cursor: pointer;
}

@keyframes pulse-border {
	0% {
		box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.4);
	}
	70% {
		box-shadow: 0 0 0 10px rgba(0, 255, 204, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(0, 255, 204, 0);
	}
}

/* --- 10. RESPONSIVE (MOBILES & TABLETTES) --- */
@media (max-width: 768px) {
	body {
		padding: 10px;
	}

	.terminal-container {
		padding: 15px;
		margin: 0;
		width: 100%;
		border: 1px solid var(--term-dim);
		box-shadow: none;
	}

	h1 {
		font-size: 1.5rem;
		word-wrap: break-word;
	}

	.sys-grid,
	.sys-gallery {
		grid-template-columns: 1fr !important;
		gap: 20px;
	}

	.sys-panel {
		padding: 15px;
	}

	.iframe-container {
		height: 45vh;
	}

	.cmd-line {
		flex-direction: column;
		align-items: flex-start;
	}

	.cmd-prompt {
		margin-bottom: 5px;
		font-size: 0.8rem;
	}

	#cmd-input {
		width: 100%;
		font-size: 16px !important;
		padding: 5px 0;
	}

	.btn-execute {
		display: block;
		width: 100%;
		text-align: center;
		padding: 15px;
	}
}

/* --- 11. EFFET CRT ÉQUILIBRÉ --- */
body::after {
	content: " ";
	display: block;
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	background:
		linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 50%),
		linear-gradient(
			90deg,
			rgba(255, 0, 0, 0.04),
			rgba(0, 255, 0, 0.02),
			rgba(0, 0, 255, 0.04)
		);
	z-index: 998; /* Un niveau sous le loader global */
	background-size:
		100% 3px,
		3px 100%;
	pointer-events: none;
	opacity: 0.7;
}

body::before {
	content: " ";
	display: block;
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	background: rgba(18, 16, 16, 0);
	opacity: 0.02;
	z-index: 1000;
	pointer-events: none;
	animation: flicker-soft 0.2s infinite;
}

.terminal-container::before {
	content: " ";
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 100%;
	background: linear-gradient(
		to bottom,
		rgba(18, 16, 16, 0) 0%,
		rgba(18, 16, 16, 0.1) 50%,
		rgba(18, 16, 16, 0) 100%
	);
	background-size: 100% 200%;
	animation: scanline-slow 8s linear infinite;
	z-index: 1001;
	pointer-events: none;
}

@keyframes flicker-soft {
	0% {
		opacity: 0.04;
	}
	50% {
		opacity: 0.02;
	}
	100% {
		opacity: 0.04;
	}
}

@keyframes scanline-slow {
	0% {
		transform: translateY(-100%);
	}
	100% {
		transform: translateY(100%);
	}
}

/* ===================================================================
   12. COUCHE FINALE : EXTINCTION ET TRANSITION DU SYSTEME (Z-INDEX MAX)
   =================================================================== */

.sys-overlay-loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 999999; /* Priorité absolue sur tout l'univers du site */
	pointer-events: none;
	opacity: 1;
	background-color: #050505;

	/* Texture de bruit numérique vert */
	background-image:
		repeating-linear-gradient(
			45deg,
			rgba(0, 255, 204, 0.05) 0%,
			rgba(0, 255, 204, 0.05) 1px,
			transparent 1px,
			transparent 2px
		),
		url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
	background-size:
		100px 100px,
		400px 400px;
	background-blend-mode: color-burn;

	/* Vitesse d'allumage (Animate In) */
	transition:
		opacity 0.4s ease-in-out,
		transform 0.4s ease-in-out;
	transform: scaleY(1);
}

/* Allumage de l'écran : le voile s'efface */
.sys-overlay-loader.loaded {
	opacity: 0;
	transform: scaleY(0); /* Simulation d'ouverture de ligne horizontale */
	pointer-events: none;
}

/* Extinction de l'écran : le Glitch CRT se lance */
.sys-overlay-loader.fade-out {
	opacity: 1 !important;
	transform: scaleY(1) !important;
	pointer-events: auto;
	animation: transitionGlitchOut 0.4s steps(1) infinite;
}

@keyframes transitionGlitchOut {
	0%,
	100% {
		background-color: #050505;
		clip-path: inset(0 0 0 0);
	}
	10% {
		background-color: #00ffcc;
		clip-path: inset(48% 0 51% 0); /* Ligne CRT */
	}
	25% {
		background-color: #050505;
		clip-path: inset(0 0 0 0);
	}
	40% {
		background-color: #00ffcc;
		clip-path: inset(12% 0 82% 0);
	}
	55% {
		background-color: #050505;
		transform: scaleY(0.005) scaleX(1.3); /* Écrasement total */
	}
	70% {
		background-color: #00ffcc;
		transform: scaleY(1);
	}
	85% {
		background-color: #050505;
		transform: scaleY(0.001);
	}
}
