/* Основные стили */
:root {
    --primary-color: #8B4513;
    --secondary-color: #D2691E;
    --accent-color: #CD853F;
    --text-color: #4A3728;
    --light-bg: #FFF8DC;
    --dark-bg: #DEB887;
    --white: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.animate {
    opacity: 1;
    animation: fadeIn 0.6s ease forwards;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comfortaa', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--light-bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Шапка сайта */
.header {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: var(--white);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo-text h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.logo-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Навигация */
.nav-list {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Кнопка мобильного меню */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--white);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Герой секция */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('images/image_1.jpg');
    background-size: cover;
    background-position: center;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-content p {
    font-size: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Секции */
.section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 50px;
    color: var(--primary-color);
    font-family: 'Merriweather', serif;
}

.section-subtitle {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 40px;
    color: var(--secondary-color);
}

.bg-light {
    background-color: var(--light-bg);
}

/* Новости */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.news-card {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.news-card:hover {
    transform: translateY(-5px);
}

.news-date {
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 15px;
}

.news-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* История села */
.history-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: start;
}

.history-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.history-images {
    display: grid;
    gap: 20px;
}

.history-image {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.history-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.history-image:hover img {
    transform: scale(1.05);
}

.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: 10px;
    text-align: center;
}

/* Захоронения */
.burials-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.burials-main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.burials-map-section {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.burials-map-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-family: 'Merriweather', serif;
}

.cemetery-map-section {
    background-color: var(--light-bg);
    border: 2px solid var(--dark-bg);
    border-radius: 5px;
    padding: 20px;
}

.map-container-section {
    margin-bottom: 20px;
}

.sectors-grid-section {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.sector-section {
    position: relative;
    background-color: var(--white);
    border: 2px solid var(--dark-bg);
    border-radius: 5px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sector-section:hover {
    background-color: var(--dark-bg);
    color: var(--white);
    transform: scale(1.05);
}

.sector-section.selected {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.sector-section.has-burials::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    background-color: var(--secondary-color);
    border-radius: 50%;
}

.sector-info {
    background-color: var(--light-bg);
    border-radius: 5px;
    padding: 15px;
    min-height: 100px;
}

.sector-info h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-family: 'Merriweather', serif;
}

.sector-info-list {
    list-style: none;
    margin-top: 10px;
}

.sector-info-item {
    padding: 10px;
    border-bottom: 1px solid var(--dark-bg);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.sector-info-item:hover {
    background-color: var(--dark-bg);
    color: var(--white);
}

.sector-info-item:last-child {
    border-bottom: none;
}

.burials-map {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.map-legend {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-bg);
}

.map-legend h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.legend-marker.veteran {
    background-color: var(--secondary-color);
}

.cemetery-map {
    position: relative;
    background-color: var(--light-bg);
    border: 2px solid var(--dark-bg);
    border-radius: 5px;
    padding: 20px;
    min-height: 400px;
}

.cemetery-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
}

.grave {
    background-color: var(--dark-bg);
    border-radius: 3px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.grave:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

.grave.veteran {
    background-color: var(--secondary-color);
}

.grave-tooltip {
    position: absolute;
    background: var(--white);
    padding: 10px;
    border-radius: 5px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 10;
    min-width: 200px;
}

.burials-info {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.burials-info h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.burials-list {
    max-height: 400px;
    overflow-y: auto;
}

.burial-item {
    padding: 15px;
    border-bottom: 1px solid var(--light-bg);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.burial-item:hover {
    background-color: var(--light-bg);
}

.burial-item:last-child {
    border-bottom: none;
}

.burial-name {
    font-weight: 600;
    color: var(--primary-color);
}

.burial-info {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-top: 5px;
}

/* Стили для поиска */
.search-container {
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
}

#searchInput {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--dark-bg);
    border-radius: 5px;
    font-family: 'Comfortaa', sans-serif;
    font-size: 1rem;
}

#searchButton {
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Comfortaa', sans-serif;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

#searchButton:hover {
    background-color: var(--secondary-color);
}

/* Стили для алфавитного указателя */
.alphabet-container {
    margin-bottom: 30px;
}

.alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.alphabet-letter {
    width: 40px;
    height: 40px;
    border: 1px solid var(--dark-bg);
    background-color: var(--white);
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Comfortaa', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.alphabet-letter:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.alphabet-letter.all {
    width: auto;
    padding: 0 15px;
}

/* Стили для результатов поиска */
.results-container {
    margin-top: 30px;
}

.no-results {
    text-align: center;
    color: var(--text-color);
    font-size: 1.1rem;
    padding: 20px;
}

/* Стили для модального окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: var(--primary-color);
}

#modalTitle {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-family: 'Merriweather', serif;
}

.burial-info p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.burial-photo {
    margin-bottom: 20px;
    text-align: center;
}

.burial-photo img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Стили для карты кладбища */
.cemetery-map {
    margin-top: 30px;
}

.map-container {
    margin-top: 20px;
}

.sectors-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.sector {
    position: relative;
    background-color: var(--light-bg);
    border: 2px solid var(--dark-bg);
    border-radius: 5px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sector:hover {
    background-color: var(--dark-bg);
    color: var(--white);
}

.sector.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.sector-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.sector-details {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 400;
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10% auto;
    }

    .sectors-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .sector {
        height: 60px;
        font-size: 1rem;
    }

    .sector-number {
        font-size: 1.2rem;
    }

    .sector-details {
        font-size: 0.7rem;
    }
}

@media (max-width: 576px) {
    .sectors-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sector {
        height: 50px;
        font-size: 0.9rem;
    }

    .sector-number {
        font-size: 1rem;
    }

    .sector-details {
        font-size: 0.65rem;
    }
}

/* Участники ВОВ */
.veterans-carousel {
    max-width: 900px;
    margin: 0 auto;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.veteran-card {
    min-width: 100%;
    padding: 20px;
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.veteran-photo {
    width: 300px;
    height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.veteran-info {
    text-align: center;
}

.veteran-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.veteran-details {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.veteran-description {
    font-size: 1rem;
    color: var(--text-color);
    max-width: 600px;
    margin: 0 auto;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: var(--white);
    border: none;
    font-size: 2rem;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-btn.prev {
    left: 0;
}

.carousel-btn.next {
    right: 0;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--dark-bg);
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-dot.active {
    background: var(--secondary-color);
}

/* Книга памяти */
.memory-book-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.memory-book-gallery {
    position: relative;
    perspective: 2000px;
    margin-bottom: 20px;
}

/* Книга (два листа) */
.memory-book-track {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0;
    height: 650px;
    background: #f8f4ec;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15), inset 0 0 0 2px rgba(0,0,0,0.05);
    overflow: hidden;
}

.book-spread {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.book-page {
    position: relative;
    overflow: hidden;
    background: #fffdf7;
}

.book-page-inner {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

/* Листы, которые перелистываются поверх */
.page-flip {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    transform-origin: left center;
    background: #fffdf7;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    pointer-events: none;
    display: none;
}

.page-flip.right {
    right: 0;
    left: auto;
    transform-origin: right center;
}

.page-shadow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0.15), rgba(0,0,0,0));
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

/* Разделительная тень по центру книги */
.book-gutter-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 30px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.15) 20%, rgba(0,0,0,0.05) 60%, transparent 75%);
    pointer-events: none;
}

/* Кнопки */
.memory-book-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(139, 69, 19, 0.7);
    color: var(--white);
    border: none;
    font-size: 2rem;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

.memory-book-btn:hover {
    background: rgba(139, 69, 19, 0.9);
}

.memory-book-btn.prev {
    left: 5px;
}

.memory-book-btn.next {
    right: 5px;
}

.memory-book-info {
    text-align: center;
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.memory-book-info h3 {
    color: var(--primary-color);
    font-family: 'Merriweather', serif;
    margin-bottom: 10px;
}

.memory-book-info p {
    color: var(--text-color);
}

/* Простой слайдер для всех устройств */
.memory-book-track {
    display: none;
}

.memory-book-gallery::after {
    content: "";
    display: block;
    width: 100%;
    height: 650px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-image: var(--current-page-image, url('images/memory-page-1.jpg'));
}

.memory-book-btn {
    top: 50%;
    transform: translateY(-50%);
}

.memory-book-btn.prev {
    left: 5px;
}

.memory-book-btn.next {
    right: 5px;
}

/* Адаптив для слайдера */
@media (max-width: 992px) {
    .memory-book-gallery::after { height: 520px; }
}

@media (max-width: 768px) {
    .memory-book-gallery::after { height: 400px; }
}

@media (max-width: 576px) {
    .memory-book-gallery::after { height: 300px; }
}

/* Дополнительная мобильная адаптация */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .hero { height: 360px; padding: 0 10px; }
    .search-container { flex-direction: column; }
    #searchButton { width: 100%; }
    .history-image img { height: 200px; }
    .sectors-grid-section { grid-template-columns: repeat(4, 1fr); }
    .sector-section { height: 60px; font-size: 1rem; }
}

@media (max-width: 576px) {
    .hero { height: 300px; }
    .alphabet-letter { width: 32px; height: 32px; font-size: 0.9rem; }
    .sectors-grid-section { grid-template-columns: repeat(3, 1fr); }
    .sector-section { height: 50px; font-size: 0.9rem; }
}

/* Кнопка наверх */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-5px);
}

/* Подвал */
.footer {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 40px 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    margin-bottom: 20px;
    font-family: 'Merriweather', serif;
}

.footer-section p {
    margin-bottom: 10px;
}

/* Адаптивность */
@media (max-width: 992px) {
    .history-content {
        grid-template-columns: 1fr;
    }

    .burials-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background-color: var(--primary-color);
        transition: right 0.3s ease;
        padding: 80px 20px 20px;
        z-index: 100;
    }

    .nav.active {
        right: 0;
    }

    .nav-list {
        flex-direction: column;
        gap: 15px;
    }

    .nav-link {
        display: block;
        padding: 15px;
        border-radius: 10px;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .veteran-photo {
        width: 250px;
        height: 350px;
    }
}

@media (max-width: 576px) {
    .news-grid {
        grid-template-columns: 1fr;
    }

    .carousel-btn {
        padding: 5px 10px;
        font-size: 1.5rem;
    }

    .veteran-photo {
        width: 200px;
        height: 300px;
    }
}