diff --git a/src/SimpleLanding.css b/src/SimpleLanding.css index 3be4fc9..f46cc3d 100644 --- a/src/SimpleLanding.css +++ b/src/SimpleLanding.css @@ -1,5 +1,54 @@ /* Simple Lightbot-style Landing Styles for SpidoCode */ +/* Motion Experience V1: contenido visible por defecto, sin capas que intercepten enlaces. */ +.motion-label { position:relative; display:inline-block; } +.motion-label > span:first-child { opacity:0; } +.motion-label-display { position:absolute; inset:0; } +.motion-experience .motion-title-text, .motion-experience .motion-title-text span { color:inherit; } +.motion-title-word { display:inline-block; white-space:nowrap; } +.motion-title-glyph { position:relative; display:inline-block; } +.motion-title-reserve { visibility:hidden; } +.motion-title-display { position:absolute; inset:0; text-align:center; } +.motion-title-accessible { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; } +.motion-experience a:focus-visible, +.motion-experience button:focus-visible { outline:3px solid var(--color-soft-green-dark); outline-offset:5px; } +.motion-star-border { position:relative; isolation:isolate; } +.motion-star-border::before { content:''; position:absolute; inset:-3px; border-radius:inherit; padding:3px; pointer-events:none; background:linear-gradient(110deg,#7cbb8966 20%,#d6eedc 45%,#7cbb89 52%,#7cbb8966 75%); background-size:250% 100%; mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0); mask-composite:exclude; } +@media (prefers-reduced-motion:no-preference) { + .motion-experience .sec-hero-title { animation:motion-hero-title 850ms cubic-bezier(.2,.7,.3,1) both; } + .motion-experience .sec-hero-subtitle { animation:motion-arrive 650ms 200ms ease-out both; } + .motion-experience .sec-hero-actions { animation:motion-arrive 650ms 380ms ease-out both; } + .motion-experience .sec-hero-face-standalone { animation:motion-float 6s ease-in-out infinite; } + .motion-experience .motion-star-border::before { animation:motion-star 4.5s linear infinite; } + .motion-experience a, + .motion-experience button { transition:background-color 180ms ease,color 180ms ease,box-shadow 180ms ease,transform 180ms ease; } + .motion-experience a:active, + .motion-experience button:active { transform:translateY(1px); } + .motion-experience .sec-hero-copy:focus-within .sec-hero-actions { animation:none; } +} +@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) { + .motion-experience [data-motion-card] { transform:perspective(950px) translateY(0) rotateX(0deg) rotateY(0deg); transition:transform 260ms ease-out,box-shadow 260ms ease-out; } + .motion-experience [data-motion-card]:hover { transform:perspective(950px) translateY(0) rotateX(0deg) rotateY(0deg); } + .motion-experience .game-app-card { transform-style:preserve-3d; } + .motion-experience .game-app-card:hover, + .motion-experience .lightbot-four-image-frame[data-motion-card]:hover { box-shadow:var(--motion-shadow-x,0px) var(--motion-shadow-y,16px) 34px #1618212b; } + .motion-experience .lightbot-card[data-motion-card]:hover { box-shadow:var(--motion-shadow-x,0px) var(--motion-shadow-y,16px) 38px #0005; } + .motion-experience .game-app-icon-placeholder { transition:transform 260ms ease-out; } + .motion-experience .game-app-card:hover .game-app-icon-placeholder { transform:translateZ(10px); } + .motion-experience .game-app-card:has(:focus-visible) .game-app-icon-placeholder { transform:none; } + .motion-experience [data-motion-card]:focus-visible, + .motion-experience [data-motion-card]:has(:focus-visible) { transform:none !important; } +} +@keyframes motion-hero-title { from { opacity:0; filter:blur(8px); transform:translateY(14px); } to { opacity:1; filter:blur(0); transform:translateY(0); } } +@keyframes motion-arrive { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } } +@keyframes motion-float { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-8px); } } +@keyframes motion-star { to { background-position:150% 0; } } +@media (prefers-reduced-motion:reduce) { + .motion-experience { scroll-behavior:auto; } + .motion-experience *, .motion-experience *::before, .motion-experience *::after { animation:none !important; transition:none !important; } + .motion-experience [data-motion-card] { transform:none !important; } +} + :root { --color-light-gray: #9ea0b3; --color-light-bg: #eef1f6; @@ -280,12 +329,13 @@ } .game-app-card:hover { - transform: translateY(-4px); background: #ffffff; border-color: rgba(124, 187, 137, 0.85); box-shadow: 0 18px 40px rgba(76, 81, 95, 0.12); } +.game-app-card:not([data-motion-card]):hover { transform:translateY(-4px); } + .game-app-icon-slot { flex-shrink: 0; } @@ -307,7 +357,7 @@ transition: all 0.25s ease; } -.game-app-card:hover .game-app-icon-placeholder { +.game-app-card:not([data-motion-card]):hover .game-app-icon-placeholder { border-color: var(--color-soft-green-dark); border-style: solid; transform: scale(1.04); @@ -498,7 +548,7 @@ transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease; } -.lightbot-four-image-frame:hover { +.lightbot-four-image-frame:not([data-motion-card]):hover { transform: translateY(-4px) scale(1.015); box-shadow: 0 22px 48px rgba(76, 81, 95, 0.22); border-color: var(--color-soft-green); @@ -761,7 +811,7 @@ transition: all 0.3s ease; } -.lightbot-card:hover { +.lightbot-card:not([data-motion-card]):not(.motion-info-block):hover { transform: translateY(-3px); border-color: rgba(0, 255, 102, 0.5); box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 255, 102, 0.15); diff --git a/src/SimpleLanding.tsx b/src/SimpleLanding.tsx index de4f7b8..7aa2215 100644 --- a/src/SimpleLanding.tsx +++ b/src/SimpleLanding.tsx @@ -7,6 +7,60 @@ const BETA_DOWNLOAD_URL = 'https://github.com/SpidoCode/spido-code/releases/download/v1.0.0-beta/SPIDOCODE-Windows-x64-v1.0.0-beta.zip' const BETA_RELEASE_URL = 'https://github.com/SpidoCode/spido-code/releases/tag/v1.0.0-beta' +// El texto real siempre permanece en el árbol accesible; solo cambia su copia decorativa. +function EncryptedLabel({ text, duration = 405, immediate = false, title = false }: { + text: string; duration?: number; immediate?: boolean; title?: boolean +}) { + const label = useRef(null) + const [display, setDisplay] = useState(text) + useEffect(() => { + const element = label.current + const reduced = window.matchMedia('(prefers-reduced-motion: reduce)') + if (!element || reduced.matches) return + let timer: ReturnType | undefined + let started = false + const finish = () => { clearInterval(timer); setDisplay(text) } + const steps = Math.ceil(duration / 45) + const scramble = (step: number) => setDisplay([...text].map((character, index) => + /\s/.test(character) || index < text.length * step / steps + ? character : 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'[Math.floor(Math.random() * 36)]).join('')) + const play = () => { + if (started) return + started = true + let step = 0 + scramble(step) + timer = setInterval(() => { + step += 1 + if (step >= steps) { finish(); return } + scramble(step) + }, 45) + } + let observer: IntersectionObserver | undefined + if (immediate) play() + else if ('IntersectionObserver' in window) { + observer = new IntersectionObserver(entries => { + if (!entries.some(entry => entry.isIntersecting)) return + observer?.disconnect() + play() + }, { threshold: 0.15 }) + observer.observe(element) + } + const onPreference = () => { if (reduced.matches) { observer?.disconnect(); finish() } } + reduced.addEventListener('change', onPreference) + return () => { observer?.disconnect(); clearInterval(timer); reduced.removeEventListener('change', onPreference) } + }, [text, duration, immediate]) + if (title) { + let offset = 0 + return {text} + } + return {text} +} + // Generador de pintas y destellos verdes neón para la Sección 3 function NeonSpeckles({ count = 16 }: { count?: number }) { const speckles = useMemo( @@ -92,7 +146,7 @@ function Nav() { return (
- + SPIDOCODE @@ -135,12 +189,95 @@ function Nav() { } export default function SimpleLanding() { + const site = useRef(null) + useEffect(() => { + const root = site.current + if (!root) return + const reduced = window.matchMedia('(prefers-reduced-motion: reduce)') + const pointer = window.matchMedia('(hover: hover) and (pointer: fine)') + const revealed = new WeakSet() + let dispose = () => {} + const setup = () => { + dispose() + if (reduced.matches) { dispose = () => {}; return } + const animations: Animation[] = [] + const cleanups: Array<() => void> = [] + if ('IntersectionObserver' in window && typeof root.animate === 'function') { + const observer = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (!entry.isIntersecting) return + observer.unobserve(entry.target) + if (revealed.has(entry.target)) return + revealed.add(entry.target) + if (entry.target.contains(document.activeElement)) return + animations.push(entry.target.animate([ + { opacity: 0.15, transform: 'translateY(22px)' }, + { opacity: 1, transform: 'translateY(0)' }, + ], { duration: 700, easing: 'cubic-bezier(.2,.7,.3,1)' })) + }) + }, { threshold: 0.15 }) + // Solo contenido: las secciones y sus degradados nunca se vuelven transparentes. + root.querySelectorAll([ + '.sec-section-header', '.game-app-info', '.game-app-icon-slot', + '.lightbot-four-title', '.lightbot-four-img', + '.lightbot-learn-list-clean', '.sec-download-btn-group', + '.lightbot-card > img', '.lightbot-companion-face img', '.lightbot-speech-bubble', + '.lightbot-card > h3', '.lightbot-card > p', '.lightbot-card > a', + ].join(',')).forEach(content => observer.observe(content)) + cleanups.push(() => observer.disconnect()) + } + if (pointer.matches) root.querySelectorAll('[data-motion-card]:not(.motion-info-block)').forEach(card => { + const maximum = Math.min(5, Math.max(0, Number(card.dataset.motionCard) || 3)) + const lift = card.classList.contains('game-app-card') ? 4 : 2 + let frame = 0 + let bounds: DOMRect | undefined + const reset = () => { + cancelAnimationFrame(frame) + card.style.removeProperty('transform') + card.style.removeProperty('--motion-shadow-x') + card.style.removeProperty('--motion-shadow-y') + bounds = undefined + } + const move = (event: PointerEvent) => { + if (event.pointerType !== 'mouse') { reset(); return } + if (card.matches(':focus-visible') || card.querySelector(':focus-visible')) return + bounds ??= card.getBoundingClientRect() + const x = Math.max(-1, Math.min(1, (event.clientX - bounds.left) / bounds.width * 2 - 1)) + const y = Math.max(-1, Math.min(1, (event.clientY - bounds.top) / bounds.height * 2 - 1)) + cancelAnimationFrame(frame) + frame = requestAnimationFrame(() => { + card.style.transform = `perspective(950px) translateY(-${lift}px) rotateX(${-y * maximum}deg) rotateY(${x * maximum}deg)` + card.style.setProperty('--motion-shadow-x', `${-x * 7}px`) + card.style.setProperty('--motion-shadow-y', `${16 - y * 4}px`) + }) + } + card.addEventListener('pointermove', move) + card.addEventListener('pointerleave', reset) + card.addEventListener('pointercancel', reset) + card.addEventListener('focusin', reset) + cleanups.push(() => { + reset() + card.removeEventListener('pointermove', move) + card.removeEventListener('pointerleave', reset) + card.removeEventListener('pointercancel', reset) + card.removeEventListener('focusin', reset) + }) + }) + const stopOnFocus = () => animations.forEach(animation => animation.cancel()) + root.addEventListener('focusin', stopOnFocus) + dispose = () => { cleanups.forEach(cleanup => cleanup()); stopOnFocus(); root.removeEventListener('focusin', stopOnFocus) } + } + setup() + reduced.addEventListener('change', setup) + pointer.addEventListener('change', setup) + return () => { dispose(); reduced.removeEventListener('change', setup); pointer.removeEventListener('change', setup) } + }, []) function scrollToTop() { window.scrollTo({ top: 0, behavior: 'smooth' }) } return ( -
+