bobsmith1010's picture
```
0b1db27 verified
class HeroSection extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
height: 100vh;
position: relative;
overflow: hidden;
}
.hero-container {
position: relative;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding: 0 1rem;
}
.hero-video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
z-index: -1;
}
.hero-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(to bottom, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.9));
z-index: 1;
}
.hero-content {
position: relative;
z-index: 2;
max-width: 900px;
padding: 2rem;
}
.hero-title {
font-size: 3rem;
font-weight: 700;
margin-bottom: 1rem;
line-height: 1.2;
opacity: 0;
transform: translateY(20px);
animation: fadeInUp 1s ease forwards 0.5s;
}
.hero-subtitle {
font-size: 1.25rem;
color: #CBD5E1;
margin-bottom: 2rem;
opacity: 0;
transform: translateY(20px);
animation: fadeInUp 1s ease forwards 0.7s;
}
.hero-cta {
display: inline-flex;
align-items: center;
gap: 0.75rem;
background: linear-gradient(45deg, #D4AF37, #F8FAFC);
color: #0F172A;
padding: 1rem 2rem;
border-radius: 30px;
font-weight: 600;
text-decoration: none;
transition: all 0.3s ease;
opacity: 0;
transform: translateY(20px);
animation: fadeInUp 1s ease forwards 0.9s;
}
.hero-cta:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
}
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
@media (max-width: 768px) {
.hero-title {
font-size: 2rem;
}
.hero-subtitle {
font-size: 1rem;
}
}
</style>
<div class="hero-container">
<video autoplay muted loop class="hero-video">
<source src="https://assets.mixkit.co/videos/preview/mixkit-man-sailing-in-a-yacht-on-the-sea-40381-large.mp4" type="video/mp4">
</video>
<div class="hero-overlay"></div>
<div class="hero-content">
<h1 class="hero-title">Master the Sea with the UK's #1 RYA Training Centre – Since 1998</h1>
<p class="hero-subtitle">5β˜… Rated | Immaculate Fleet | Expert Instructors | Book Instantly</p>
<a href="#courses" class="hero-cta">
<span>Book Your Course</span>
<i data-feather="arrow-right"></i>
</a>
</div>
</div>
`;
// Initialize feather icons
import('https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js').then(() => {
feather.replace({ icons: this.shadowRoot.querySelectorAll('[data-feather]') });
});
}
}
customElements.define('hero-section', HeroSection);