world-game/src/views/Home.svelte

165 lines
3.1 KiB
Svelte
Raw Normal View History

<script>
import { onMount } from 'svelte'
import { fade } from 'svelte/transition'
import VideoBackground from '@components/ui/VideoBackground.svelte'
import Button from '@components/ui/Button.svelte'
import { navigateTo } from '@lib/router'
import { pageEnter } from '@lib/animations'
export let data
let contentElement
onMount(() => {
if (contentElement) {
pageEnter(contentElement)
}
})
function handleExplore() {
navigateTo(data?.hero?.cta_link || '/portfolio')
}
$: hero = data?.hero || {}
$: backgroundVideo = data?.background_video
$: floatingBubbles = data?.floating_bubbles || []
</script>
<div class="home" transition:fade>
{#if backgroundVideo}
<VideoBackground src={backgroundVideo} />
{/if}
<div class="home__content" bind:this={contentElement}>
<h1 class="home__title">
{@html hero.title || 'PLAY TO ENGAGE'}
</h1>
{#if hero.subtitle}
<p class="home__subtitle">
{@html hero.subtitle}
</p>
{/if}
{#if hero.cta_text}
<Button on:click={handleExplore} variant="primary" size="large">
{hero.cta_text}
</Button>
{/if}
</div>
{#if floatingBubbles.length > 0}
<div class="home__bubbles">
{#each floatingBubbles as bubble}
<div class="bubble bubble--{bubble.position}">
{bubble.text}
</div>
{/each}
</div>
{/if}
</div>
<style>
.home {
position: relative;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: 6rem 2rem 2rem;
}
.home__content {
position: relative;
z-index: 10;
text-align: center;
max-width: 1200px;
color: white;
}
.home__title {
font-size: clamp(3rem, 8vw, 8rem);
font-family: 'Danzza', sans-serif;
font-weight: 700;
margin: 0 0 1.5rem;
line-height: 1.1;
text-transform: uppercase;
}
.home__title :global(.highlight) {
color: #04fea0;
}
.home__subtitle {
font-size: clamp(1.2rem, 3vw, 2rem);
margin: 0 0 3rem;
opacity: 0.9;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
.home__bubbles {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 5;
}
.bubble {
position: absolute;
background: rgba(4, 254, 160, 0.1);
border: 1px solid rgba(4, 254, 160, 0.3);
border-radius: 50%;
padding: 1rem 1.5rem;
font-size: 0.9rem;
color: #04fea0;
backdrop-filter: blur(10px);
animation: float 6s ease-in-out infinite;
}
.bubble--top-left {
top: 15%;
left: 10%;
}
.bubble--top-right {
top: 20%;
right: 15%;
animation-delay: -2s;
}
.bubble--bottom-left {
bottom: 25%;
left: 15%;
animation-delay: -4s;
}
.bubble--bottom-right {
bottom: 20%;
right: 10%;
animation-delay: -3s;
}
@keyframes float {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-20px);
}
}
@media (max-width: 768px) {
.home {
padding: 5rem 1rem 2rem;
}
.bubble {
font-size: 0.7rem;
padding: 0.75rem 1rem;
}
}
</style>