/* Общие стили и сброс настроек */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #fff8fd;
    color: #333;
    line-height: 1.6;
}

/* Навигационное меню */
header {
    background: linear-gradient(135deg, #a83279 0%, #3d155f 100%);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.logo {
    color: #fff;
    font-size: 26px;
    font-weight: bold;
    text-decoration: none;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
}

.nav-links a {
    color: #f0e6f5;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 5px;
}

.nav-links a:hover, .nav-links a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* Главный контейнер */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

h1.page-title {
    text-align: center;
    color: #511845;
    margin-bottom: 40px;
    font-size: 38px;
    position: relative;
}

/* Эффектная Главная страница */
.hero {
    /* Красивый и надежный градиент вместо серого фона */
    background: linear-gradient(135deg, #a83279 0%, #3d155f 50%, #1f0b24 100%);
    height: 450px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    border-radius: 20px;
    margin-bottom: 50px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(74, 20, 140, 0.2);
    animation: fadeIn 1.2s ease-in-out;
}


.hero h2 {
    font-size: 48px;
    margin-bottom: 15px;
    text-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.hero p {
    font-size: 20px;
    max-width: 700px;
    font-weight: 300;
}

/* Сетка карточек */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.card {
    background: white;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.04);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-left: 5px solid #d81b60;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(168, 50, 121, 0.2);
}

.card h3 {
    color: #4a2040;
    margin-bottom: 15px;
    font-size: 22px;
}

/* Секция фактов с кастомными маркерами */
.fun-facts {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.03);
    margin-top: 40px;
}

.fun-facts h3 {
    color: #4a148c;
    font-size: 26px;
    margin-bottom: 25px;
    text-align: center;
}

.facts-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

.facts-list li {
    position: relative;
    padding-left: 45px;
    font-size: 16px;
    margin-bottom: 10px;
}

.facts-list li::before {
    content: "🦋";
    position: absolute;
    left: 10px;
    top: 0;
    font-size: 22px;
    animation: flap 2s infinite ease-in-out;
}

/* Страница Галереи */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    height: 280px;
    background: #e0e0e0;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.gallery-desc {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(51, 15, 45, 0.95));
    color: white;
    padding: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.15);
}

.gallery-item:hover .gallery-desc {
    opacity: 1;
    transform: translateY(0);
}

/* Страница Статей */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.article-item {
    display: flex;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.article-item:hover {
    transform: translateY(-3px);
}

.article-img {
    flex: 1;
    min-width: 350px;
    max-width: 350px;
}

.article-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-content {
    flex: 2;
    padding: 35px;
}

.article-content h2 {
    color: #a83279;
    margin-bottom: 12px;
    font-size: 24px;
}

.article-date {
    display: inline-block;
    font-size: 13px;
    color: #fff;
    background: #3d155f;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 15px;
}

/* Подвал сайта */
footer {
    background-color: #1f0b24;
    color: #bfaec4;
    text-align: center;
    padding: 30px;
    margin-top: 80px;
    font-size: 14px;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes flap {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(-10deg); }
}

/* Адаптивность */
@media (max-width: 900px) {
    .article-item { flex-direction: column; }
    .article-img { min-width: 100%; max-width: 100%; height: 250px; }
    .facts-list { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .navbar { flex-direction: column; gap: 15px; }
    .hero h2 { font-size: 32px; }
    .hero p { font-size: 16px; }
}
/* Новые стили для анимации и цветных блоков в статьях */
.animated-butterfly-box {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

/* Яркие фоновые градиенты под цвет тематики бабочек */
.bg-orange { background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); }
.bg-blue   { background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%); }
.bg-green  { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.bg-purple { background: linear-gradient(135deg, #7f00ff 0%, #e100ff 100%); }

/* Настройка размера иконки бабочки */
.svg-butterfly {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.15));
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
}

/* Анимация взмаха крыльев и взлета при наведении на карточку статьи */
.article-item:hover .svg-butterfly {
    animation: flyFlap 0.6s infinite ease-in-out alternate;
}

.article-item:hover .animated-butterfly-box {
    filter: brightness(1.05);
}

/* CSS Анимация: эффект полета в 3D пространстве */
@keyframes flyFlap {
    0% {
        transform: scale(0.9) rotateY(0deg) translateY(0px);
    }
    100% {
        transform: scale(1.1) rotateY(40deg) translateY(-10px);
    }
}
/* Яркие градиенты для карточек галереи вместо серых фонов */
.item-monarch { background: linear-gradient(135deg, #ff512f 0%, #dd2476 100%); }
.item-morpho  { background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%); }
.item-machaon { background: linear-gradient(135deg, #f9d423 0%, #ff4e50 100%); }
.item-peacock { background: linear-gradient(135deg, #f857a6 0%, #ff5858 100%); }
.item-zebra   { background: linear-gradient(135deg, #3a7bd5 0%, #3a6073 100%); }
.item-atlas   { background: linear-gradient(135deg, #4776e6 0%, #8e54e9 100%); }

/* Центрирование и анимация больших эмодзи-символов в галерее */
.gallery-icon-wrap {
    font-size: 80px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-item:hover .gallery-icon-wrap {
    transform: scale(1.3) rotate(-10deg);
}

.gallery-item {
    cursor: pointer;
}

/* Стили для всплывающего модального окна */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(31, 11, 36, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 35px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #d81b60;
}

.modal-icon {
    font-size: 70px;
    margin-bottom: 15px;
    animation: flap 2s infinite ease-in-out;
}

.modal h2 {
    color: #3d155f;
    margin-bottom: 15px;
}

.modal p {
    color: #555;
    font-size: 16px;
    line-height: 1.6;
}
