astro_avtourist/frontend/src/components/home/Hero.astro

326 lines
9.8 KiB
Text
Raw Normal View History

2026-03-31 22:53:39 +05:00
---
import Button from '@components/base/Button.astro';
// Текстовые константы для удобного редактирования
const badgeText = "ЗАЩИТА ПРАВ ВОДИТЕЛЕЙ В СУРГУТЕ";
const titleWhite = "Защитите свои права";
const titleGold = "и водительское удостоверение";
const description = "Профессиональная юридическая помощь при ДТП, спорах с ГИБДД и страховыми компаниями. Работаем на результат в судах ХМАО-Югры.";
const btnPrimary = "Бесплатная консультация";
const btnSecondary = "Наши услуги";
// Пути к изображениям (замените на свои локальные файлы в папке public/ или src/assets/)
// Для демо я использую плейсхолдеры
const bgImageUrl = "/images/home/bg_hero.png";
const lawyerImageUrl = "/images/home/heroImg.jpg";
---
<section class="hero-section">
<!-- Оверлей для синего оттенка фона -->
<div class="hero-overlay"></div>
<div class="site-container hero-grid">
2026-03-31 22:53:39 +05:00
<!-- Левая колонка: Текст -->
<div class="hero-content">
<!-- Верхняя плашка -->
<div class="badge">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
</svg>
{badgeText}
</div>
<!-- Заголовок -->
<h1 class="hero-title">
<span class="text-white">{titleWhite}</span>
<br />
<span class="text-gold">{titleGold}</span>
</h1>
<!-- Описание -->
<p class="hero-description">{description}</p>
<!-- Кнопки -->
<div class="hero-actions">
<Button variant="gold" size="lg" id="consultation-btn" data-modal-target="consultation-modal">
{btnPrimary}
</Button>
<a href="/services" class="btn btn-secondary">{btnSecondary}</a>
</div>
</div>
<!-- Правая колонка: Изображение -->
<div class="hero-image-wrapper">
<!-- Композиция с фото -->
<div class="image-composition">
<img src={lawyerImageUrl} alt="Юрист" class="main-image" />
<!-- Плавающая плашка с опытом -->
<div class="experience-badge">
<span class="exp-number">20+</span>
<span class="exp-text">ЛЕТ ОПЫТА В ХМАО</span>
</div>
</div>
</div>
</div>
</section>
<style define:vars={{ bgImageUrl: `url("${bgImageUrl}")` }}>
/* Основная секция с фоном */
.hero-section {
position: relative;
width: 100%;
min-height: 85vh; /* Высота на весь экран или минимум 85% */
display: flex;
align-items: center;
background-image: var(--bgImageUrl);
background-size: cover;
background-position: center;
font-family: system-ui, -apple-system, sans-serif;
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.85) 50%, rgba(10, 37, 64, 0.6) 100%);
z-index: 1;
}
/* Сетка для контента Hero */
.hero-grid {
2026-03-31 22:53:39 +05:00
position: relative;
z-index: 2; /* Поверх оверлея */
display: flex;
justify-content: space-between;
align-items: center;
gap: 4rem;
padding: 2rem;
2026-03-31 22:53:39 +05:00
}
/* --- Левая часть (Текст) --- */
.hero-content {
flex: 1;
max-width: 650px;
}
/* Плашка сверху (Badge) */
.badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
background-color: rgba(209, 176, 107, 0.15); /* Прозрачный золотой фон */
border: 1px solid rgba(209, 176, 107, 0.3);
color: #d1b06b;
padding: 0.4rem 0.8rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 1px;
margin-bottom: 2rem;
}
/* Заголовок */
.hero-title {
font-size: clamp(2.5rem, 4vw, 4rem); /* Адаптивный размер шрифта */
line-height: 1.1;
margin: 0 0 1.5rem 0;
font-weight: 800;
letter-spacing: -1px;
}
.text-white {
color: #ffffff;
}
.text-gold {
color: #e2c07b; /* Золотистый/желтый цвет из макета */
}
/* Описание */
.hero-description {
color: rgba(255, 255, 255, 0.8);
font-size: 1.05rem;
line-height: 1.6;
margin-bottom: 3rem;
max-width: 550px;
}
/* Блок кнопок */
.hero-actions {
display: flex;
gap: 1.5rem;
align-items: center;
}
.btn {
display: inline-flex;
justify-content: center;
align-items: center;
text-decoration: none;
padding: 0.8rem 2rem;
border-radius: 4px;
font-weight: 600;
font-size: 0.95rem;
transition: all 0.3s ease;
}
.btn-primary {
background: linear-gradient(180deg, #eac26e 0%, #ce9f40 100%);
color: #ffffff;
border: none;
}
.btn-primary:hover {
box-shadow: 0 4px 15px rgba(206, 159, 64, 0.4);
transform: translateY(-2px);
}
.btn-secondary {
background-color: rgba(255, 255, 255, 0.08); /* Полупрозрачный синий/белый */
backdrop-filter: blur(5px);
color: #ffffff;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover {
background-color: rgba(255, 255, 255, 0.15);
}
/* --- Правая часть (Картинка) --- */
.hero-image-wrapper {
flex: 1;
display: flex;
justify-content: flex-end;
align-items: center;
position: relative;
}
/* Обертка для фото и белой подложки */
.image-composition {
position: relative;
width: 100%;
max-width: 450px;
z-index: 2;
}
/* Имитация повернутой белой карточки на заднем фоне */
.image-composition::before {
content: '';
position: absolute;
top: -15px;
left: 25px;
right: -25px;
bottom: 15px;
background-color: #ffffff;
border-radius: 12px;
transform: rotate(4deg);
z-index: -1;
}
/* Основное фото */
.main-image {
width: 100%;
height: auto;
object-fit: cover;
border-radius: 12px;
border: 6px solid #ffffff; /* Белая рамка */
filter: grayscale(100%); /* Делаем фото черно-белым, как на макете */
box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
/* Плашка "15+ лет" */
.experience-badge {
position: absolute;
bottom: 20px;
left: -40px; /* Сдвигаем влево за пределы фото */
background: #ffffff;
padding: 1.2rem;
border-radius: 6px;
display: flex;
flex-direction: column;
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
z-index: 3;
min-width: 160px;
}
.exp-number {
font-size: 2rem;
font-weight: 900;
color: #1e3050; /* Темно-синий */
line-height: 1;
margin-bottom: 0.3rem;
}
.exp-text {
font-size: 0.65rem;
font-weight: 700;
color: #6c7a8c;
letter-spacing: 0.5px;
}
/* --- Адаптивность --- */
@media (max-width: 1024px) {
.hero-grid {
2026-03-31 22:53:39 +05:00
flex-direction: column;
text-align: center; /* Центрируем контент на планшетах */
padding: 4rem 2rem;
}
.hero-content {
display: flex;
flex-direction: column;
align-items: center;
}
.hero-description {
margin: 0 auto 3rem auto;
}
.hero-actions {
justify-content: center;
}
.hero-image-wrapper {
justify-content: center;
margin-top: 2rem;
}
.experience-badge {
left: -10px; /* Сдвигаем внутрь, чтобы не вылазило за экран */
}
}
@media (max-width: 640px) {
.hero-actions {
flex-direction: column;
width: 100%;
}
.btn {
width: 100%;
}
.image-composition::before {
display: none; /* Убираем повернутую подложку на мобилках для простоты */
}
.experience-badge {
bottom: -20px;
left: 20px;
right: 20px;
text-align: center;
}
}
</style>