astro_avtourist/frontend/src/components/services/HeroServices.astro

241 lines
6.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
import Button from '@components/base/Button.astro';
const badgeText = "АВТОЮРИСТ СУРГУТ & ЮГРА";
const titleWhite = "Наши юридические";
const titleGold = "услуги";
const description = "Мы обеспечиваем экспертную защиту прав водителей в Сургуте и Ханты-Мансийском автономном округе. Профессиональный подход к сложным дорожным спорам с акцентом на результат.";
const btnPrimary = "Получить помощь";
const bgImageUrl = "/images/services/office.png";
---
<section class="hero-section">
<div class="hero-overlay"></div>
<div class="site-container">
<div class="hero-content">
<div class="badge animate-load" data-delay="100">
<span class="status-dot"></span>
{badgeText}
</div>
<h1 class="hero-title">
<span class="text-white animate-load" data-delay="300">{titleWhite}</span>
<br />
<span class="text-gold animate-load" data-delay="500">{titleGold}</span>
</h1>
<p class="hero-description animate-load" data-delay="700">{description}</p>
<div class="hero-actions animate-load" data-delay="900">
<Button variant="gold" size="lg" href="#contact">
{btnPrimary}
</Button>
</div>
</div>
</div>
</section>
<script>
// Анимация при загрузке страницы
const initAnimations = () => {
const animatedElements = document.querySelectorAll('.animate-load');
animatedElements.forEach((el) => {
const delay = parseInt((el as HTMLElement).dataset.delay || '0');
setTimeout(() => {
el.classList.add('is-visible');
}, delay);
});
};
// Пробуем сразу, если DOM готов
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initAnimations);
} else {
initAnimations();
}
</script>
<style define:vars={{ bgImageUrl: `url("${bgImageUrl}")` }}>
.hero-section {
position: relative;
width: 100%;
min-height: 80vh;
display: flex;
align-items: center;
background-image: var(--bgImageUrl);
background-size: cover;
background-position: center;
margin: 0 !important;
padding: 60px 0;
box-sizing: border-box;
overflow: hidden;
}
.hero-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(90deg, #0a2540 0%, rgba(10, 37, 64, 0.9) 50%, rgba(10, 37, 64, 0.7) 100%);
z-index: 1;
}
.site-container {
position: relative;
z-index: 2;
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
width: 100%;
}
.hero-content {
max-width: 700px;
}
/* --- АНИМАЦИИ ПРИ ЗАГРУЗКЕ --- */
.animate-load {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
will-change: opacity, transform;
}
.animate-load.is-visible {
opacity: 1;
transform: translateY(0);
}
.badge {
display: inline-flex;
align-items: center;
gap: 0.6rem;
background-color: rgba(234, 194, 110, 0.15);
border: 1px solid rgba(234, 194, 110, 0.3);
color: #eac26e;
padding: 0.5rem 1rem;
border-radius: 6px;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 1.5px;
margin-bottom: 2.5rem;
}
/* Мерцающая точка "На связи" */
.status-dot {
width: 10px;
height: 10px;
background: #22c55e;
border-radius: 50%;
animation: pulse 2s ease-in-out infinite;
box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
flex-shrink: 0;
}
@keyframes pulse {
0% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
}
70% {
transform: scale(1);
box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
}
100% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
}
}
.hero-title {
font-size: clamp(2.5rem, 5vw, 4rem);
font-weight: 800;
line-height: 1.1;
margin: 0 0 24px 0;
}
.text-white {
color: #ffffff;
}
.text-gold {
color: #eac26e;
}
.hero-description {
color: rgba(255, 255, 255, 0.85);
font-size: 1.15rem;
line-height: 1.6;
margin-bottom: 40px;
max-width: 600px;
}
.hero-actions {
display: flex;
gap: 1.5rem;
align-items: stretch;
}
.hero-actions > * {
display: flex;
align-items: center;
}
/* Мобильная адаптация */
@media (max-width: 768px) {
.hero-section {
text-align: center;
min-height: 60vh;
}
.hero-overlay {
background: rgba(10, 37, 64, 0.85);
}
.hero-content {
margin: 0 auto;
}
.badge {
justify-content: center;
}
.hero-actions {
justify-content: center;
}
}
@media (max-width: 480px) {
.hero-section {
padding: 40px 0;
min-height: 50vh;
}
.hero-title {
font-size: 2rem;
}
.hero-description {
font-size: 1rem;
}
}
/* Уважаем prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
.animate-load {
opacity: 1;
transform: none;
transition: none;
}
.status-dot {
animation: none;
}
}
</style>