diff --git a/assets/css/style.css b/assets/css/style.css index aee3ece..1fe1e48 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -225,6 +225,18 @@ img { display: block; } +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + a { color: var(--accent); text-decoration: none; @@ -1944,6 +1956,187 @@ a:hover { line-height: 1; } +/* ============================================ + TERMINAL SECRET — KONAMI CODE + ============================================ */ + +.retro-terminal { + position: fixed; + inset: 0; + z-index: 30000; + display: flex; + align-items: center; + justify-content: center; + padding: 1.5rem; + background: rgba(0, 0, 0, 0.78); + opacity: 0; + visibility: hidden; + pointer-events: none; + transition: opacity 0.2s ease, visibility 0.2s ease; +} + +.retro-terminal.is-open { + opacity: 1; + visibility: visible; + pointer-events: auto; +} + +.retro-terminal__window { + width: min(720px, 100%); + max-height: min(620px, 90vh); + display: flex; + flex-direction: column; + overflow: hidden; + border: 1px solid #1f8f4d; + border-radius: 8px; + background: #050805; + box-shadow: 0 0 0 1px rgba(44, 255, 112, 0.12), 0 24px 80px rgba(0, 0, 0, 0.7); + color: #42f477; + font-family: var(--font-mono); + font-size: 0.85rem; +} + +.retro-terminal__header { + display: flex; + align-items: center; + gap: 0.75rem; + min-height: 42px; + padding: 0.65rem 0.85rem; + background: #0c160e; + border-bottom: 1px solid #164e2b; +} + +.retro-terminal__lights { + display: flex; + gap: 0.4rem; +} + +.retro-terminal__light { + width: 10px; + height: 10px; + border-radius: 50%; +} + +.retro-terminal__light--red { background: #ff5f57; } +.retro-terminal__light--yellow { background: #ffbd2e; } +.retro-terminal__light--green { background: #28ca41; } + +.retro-terminal__title { + flex: 1; + color: #9be8ae; + font-size: 0.75rem; + text-align: center; +} + +.retro-terminal__close { + width: 26px; + height: 26px; + padding: 0; + border: 1px solid #1f8f4d; + border-radius: 4px; + background: transparent; + color: #42f477; + cursor: pointer; + font: inherit; + line-height: 1; +} + +.retro-terminal__close:hover, +.retro-terminal__close:focus-visible { + background: #123b20; +} + +.retro-terminal__body { + min-height: 260px; + max-height: 55vh; + padding: 1.25rem; + overflow-y: auto; + line-height: 1.65; + text-shadow: 0 0 8px rgba(66, 244, 119, 0.45); +} + +.retro-terminal__body p { + margin: 0 0 0.25rem; +} + +.retro-terminal__command { + display: grid; + grid-template-columns: 8.5rem minmax(0, 1fr); + gap: 1rem; +} + +.retro-terminal__command-name { + color: #b5ffc5; +} + +.retro-terminal__command-description { + min-width: 0; +} + +.retro-terminal__body strong { + color: #b5ffc5; +} + +.retro-terminal__prompt { + position: relative; + z-index: 1; + display: flex; + align-items: center; + gap: 0.65rem; + padding: 0 1.25rem 1.25rem; + color: #b5ffc5; +} + +.retro-terminal__prompt input { + flex: 1; + min-width: 0; + position: relative; + z-index: 2; + padding: 0; + border: 0; + outline: 0; + background: transparent; + color: #42f477; + font: inherit; + caret-color: #42f477; + cursor: text; + pointer-events: auto; + text-shadow: 0 0 8px rgba(66, 244, 119, 0.45); +} + +@media (max-width: 640px) { + .retro-terminal { + padding: 0.75rem; + } + + .retro-terminal__window { + max-height: 92vh; + } + + .retro-terminal__body { + min-height: 220px; + max-height: 65vh; + padding: 1rem; + font-size: 0.75rem; + } + + .retro-terminal__command { + grid-template-columns: 6rem minmax(0, 1fr); + gap: 0.5rem; + } + + .retro-terminal__prompt { + align-items: flex-start; + flex-direction: column; + gap: 0.35rem; + padding: 0 1rem 1rem; + } + + .retro-terminal__prompt input { + width: 100%; + } +} + /* ============================================ REVEAL ANIMATIONS ============================================ */ diff --git a/assets/js/main.js b/assets/js/main.js index 914d79e..293e92b 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -280,6 +280,129 @@ var lerpCurrent = 0; console.log('%cTony AVERTY%c\nDéveloppeur web freelance — CodeBzh\n\nLe code est propre, les détails sont cachés.\nPour accéder au terminal secret, saisissez : ↑ ↑ ↓ ↓ ← → ← → B A', 'color: #6366f1; font-size: 18px; font-weight: 700;', 'color: inherit; font-size: 12px;'); + var retroTerminal = document.getElementById('retroTerminal'); + var retroTerminalClose = document.getElementById('retroTerminalClose'); + var retroTerminalForm = document.getElementById('retroTerminalForm'); + var retroTerminalInput = document.getElementById('retroTerminalInput'); + var retroTerminalOutput = document.getElementById('retroTerminalOutput'); + var terminalHistory = []; + var terminalHistoryIndex = -1; + + function writeTerminalLine(text, className) { + var line = document.createElement('p'); + line.textContent = text; + if (className) line.className = className; + retroTerminalOutput.appendChild(line); + retroTerminalOutput.scrollTop = retroTerminalOutput.scrollHeight; + } + + function writeTerminalCommand(command, description) { + var line = document.createElement('p'); + var commandElement = document.createElement('span'); + var descriptionElement = document.createElement('span'); + + line.className = 'retro-terminal__command'; + commandElement.className = 'retro-terminal__command-name'; + descriptionElement.className = 'retro-terminal__command-description'; + commandElement.textContent = command; + descriptionElement.textContent = description; + line.appendChild(commandElement); + line.appendChild(descriptionElement); + retroTerminalOutput.appendChild(line); + retroTerminalOutput.scrollTop = retroTerminalOutput.scrollHeight; + } + + function openRetroTerminal() { + retroTerminal.classList.add('is-open'); + retroTerminal.setAttribute('aria-hidden', 'false'); + document.body.style.overflow = 'hidden'; + window.setTimeout(function () { retroTerminalInput.focus(); }, 0); + } + + function closeRetroTerminal() { + retroTerminal.classList.remove('is-open'); + retroTerminal.setAttribute('aria-hidden', 'true'); + document.body.style.overflow = ''; + } + + function runTerminalCommand(rawCommand) { + var command = rawCommand.trim().toLowerCase(); + if (!command) return; + + writeTerminalLine('portfolio@tony:~$ ' + rawCommand); + + var commands = { + help: function () { + writeTerminalLine('Commandes disponibles :'); + writeTerminalCommand('help', 'Afficher cette aide'); + writeTerminalCommand('about', 'En savoir plus sur Tony et CodeBzh'); + writeTerminalCommand('skills', 'Voir la stack technique'); + writeTerminalCommand('services', 'Découvrir les prestations'); + writeTerminalCommand('contact', 'Aller au formulaire de contact'); + writeTerminalCommand('clear', 'Nettoyer le terminal'); + writeTerminalCommand('whoami', 'Afficher votre identité système'); + writeTerminalCommand('deploy coffee', 'Déployer une nouvelle dose de café'); + writeTerminalCommand('sudo pet cat', 'Vérifier les permissions pour caresser un chat'); + writeTerminalCommand('ping bzh', 'Tester la connexion avec la Bretagne'); + writeTerminalCommand('fix everything', 'Réparer absolument tout'); + }, + about: function () { window.location.hash = 'about'; closeRetroTerminal(); }, + skills: function () { window.location.hash = 'skills'; closeRetroTerminal(); }, + services: function () { window.location.hash = 'services'; closeRetroTerminal(); }, + contact: function () { window.location.hash = 'contact'; closeRetroTerminal(); }, + clear: function () { retroTerminalOutput.innerHTML = ''; }, + whoami: function () { writeTerminalLine('Visiteur curieux. Profil validé.'); }, + 'deploy coffee': function () { + var productivityIncrease = Math.floor(Math.random() * 99) + 1; + writeTerminalLine('Déploiement du café... terminé. Productivité augmentée de ' + productivityIncrease + ' %.'); + }, + 'sudo pet cat': function () { writeTerminalLine('Permission refusée : aucun chat détecté sur ce serveur.'); }, + 'ping bzh': function () { writeTerminalLine('PING bzh : réponse reçue. Pluie détectée, connexion excellente.'); }, + 'fix everything': function () { writeTerminalLine('Analyse terminée : tout est réparé. Sauf le lundi.'); } + }; + + if (commands[command]) commands[command](); + else writeTerminalLine('Commande inconnue. Tapez "help" pour voir la liste.'); + } + + if (retroTerminal && retroTerminalClose && retroTerminalForm) { + retroTerminalClose.addEventListener('click', closeRetroTerminal); + + retroTerminal.addEventListener('click', function (e) { + if (e.target === retroTerminal) closeRetroTerminal(); + else retroTerminalInput.focus(); + }); + + retroTerminalForm.addEventListener('submit', function (e) { + e.preventDefault(); + var command = retroTerminalInput.value; + if (command.trim()) { + terminalHistory.unshift(command); + terminalHistoryIndex = -1; + } + runTerminalCommand(command); + retroTerminalInput.value = ''; + }); + + retroTerminalInput.addEventListener('keydown', function (e) { + if (e.key === 'ArrowUp') { + e.preventDefault(); + if (terminalHistory.length) { + terminalHistoryIndex = Math.min(terminalHistoryIndex + 1, terminalHistory.length - 1); + retroTerminalInput.value = terminalHistory[terminalHistoryIndex]; + } + } else if (e.key === 'ArrowDown') { + e.preventDefault(); + terminalHistoryIndex = Math.max(terminalHistoryIndex - 1, -1); + retroTerminalInput.value = terminalHistoryIndex === -1 ? '' : terminalHistory[terminalHistoryIndex]; + } + }); + + document.addEventListener('keydown', function (e) { + if (e.key === 'Escape' && retroTerminal.classList.contains('is-open')) closeRetroTerminal(); + }); + } + var konamiSequence = [ 'ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', @@ -288,6 +411,8 @@ var lerpCurrent = 0; var konamiProgress = 0; document.addEventListener('keydown', function (e) { + if (retroTerminal && retroTerminal.classList.contains('is-open')) return; + var expectedKey = konamiSequence[konamiProgress]; var pressedKey = e.key.length === 1 ? e.key.toLowerCase() : e.key; @@ -295,8 +420,8 @@ var lerpCurrent = 0; konamiProgress += 1; if (konamiProgress === konamiSequence.length) { - showToast('Konami Code activé. Bien joué.', 'success'); - console.log('%cKonami Code activé.%c Vous avez trouvé le passage secret.', 'color: #22c55e; font-weight: 700;', 'color: inherit;'); + openRetroTerminal(); + console.log('%cTerminal secret ouvert.%c Tapez help pour commencer.', 'color: #22c55e; font-weight: 700;', 'color: inherit;'); konamiProgress = 0; } } else { diff --git a/includes/footer.php b/includes/footer.php index 8b7c740..3d70d4b 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -120,6 +120,30 @@ + + +