/* CSS Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Светлая тема (по умолчанию) */
    --bg-color: #f8f9fa;
    --text-color: #2c3e50;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --border-color: #e0e0e0;
    --accent-color: #d35400; /* Сдержанный оранжевый */
    --accent-hover: #a84300;
    --header-bg: rgba(255, 255, 255, 0.95);
    --footer-bg: #f1f3f5;
    --link-color: #2980b9;
    --link-hover: #1a5276;
    --disabled-color: #95a5a6;
    --blockquote-bg: #f8f9fa;
    --blockquote-border: #d0d7de;
    --code-bg: #f1f3f4;
    --theme-toggle-bg: #ecf0f1;
}

[data-theme="dark"] {
    /* Темная тема */
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --border-color: #333;
    --accent-color: #ff8c42;
    --accent-hover: #ff6b00;
    --header-bg: rgba(30, 30, 30, 0.95);
    --footer-bg: #1a1a1a;
    --link-color: #64b5f6;
    --link-hover: #90caf9;
    --disabled-color: #666;
    --blockquote-bg: #252525;
    --blockquote-border: #444;
    --code-bg: #2d2d2d;
    --theme-toggle-bg: #333;
}

/* Инверсия логотипа для темной темы */
[data-theme="dark"] .logo {
    filter: invert(1) brightness(1.2);
}

/* Основные стили */
html {
    font-size: 18px; /* Увеличенный для десктопа */
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* Вот эту строку */
}

body {
    font-family: 'PT Serif', serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Шапка */
header {
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

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

.logo-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
padding-left: 0.5rem;
}

.logo {
    height: 70px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

h1 {
    font-family: "Oswald", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 2rem;
    position: relative;
    padding-bottom: 0.5rem;
    line-height: 1.3;
    margin: 0;
}

h1 a {
    color: inherit;
    text-decoration: none;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #c62828;
    border-radius: 2px;
}

[data-theme="dark"] h1::after {
    background-color: #ef5350;
}
/* Меню для десктопа */
.desktop-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
	padding-right: 10px; /* Добавляем отступ справа */
}

.desktop-menu a {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-color);
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s;
}

.desktop-menu a:hover {
    color: var(--accent-color);
}

.desktop-menu a.disabled {
    color: var(--disabled-color);
    cursor: not-allowed;
}

/* Кнопка переключения темы */
.theme-toggle {
    background: var(--theme-toggle-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background-color: var(--accent-color);
    color: white;
    transform: scale(1.05);
}

/* Кнопка меню для мобильных (скрыта на десктопе) */

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    background-color: var(--card-bg);
    flex-shrink: 0;
    /* Убираем margin-left: 10px; */
}

/* Мобильное меню (popover) */
#main-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 300px;
    box-shadow: var(--card-shadow);
    margin: 10px;
    display: none;
    z-index: 1000;
}

#main-menu:popover-open {
    display: flex;
    flex-direction: column;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-header h2 {
    font-size: 1.3rem;
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
}

.close-menu {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#main-menu a {
    padding: 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: background-color 0.2s;
}

#main-menu a:last-child {
    border-bottom: none;
}

#main-menu a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] #main-menu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.mobile-theme-btn {
    background: none;
    border: none;
    padding: 1rem;
    text-align: left;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
}

/* Основное содержимое */
main {
    padding: 2rem 0;
    flex: 1;
}

.intro {
    max-width: 800px;
    margin: 0 auto 3rem;
    font-size: 1.1rem;
    text-align: center;
    color: var(--text-color);
    opacity: 0.9;
}

/* Сетка документов */
.documents-list h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.doc-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .doc-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.doc-card-content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.doc-card-content h3 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.doc-card-content h3 a:hover {
    color: var(--accent-color);
}

.doc-card-content time {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--disabled-color);
    font-weight: 500;
}

.no-docs {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--disabled-color);
    font-style: italic;
}

/* Страница документа */
.document-view .container {
    max-width: 900px;
}

.document-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.bottom-controls {
    margin-top: 2rem;
    margin-bottom: 0;
    padding-top: 1rem;
    padding-bottom: 0;
    border-top: 1px solid var(--border-color);
    border-bottom: none;
}

.back-link {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-decoration: none;
    color: var(--link-color);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--link-hover);
}

.document-container {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.document-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.document-content > * {
    margin-bottom: 1.5rem;
}

.document-content h2 {
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.document-content h3 {
    font-size: 1.5rem;
    margin-top: 1.8rem;
    margin-bottom: 1rem;
}

.document-content h4, 
.document-content h5, 
.document-content h6 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: var(--disabled-color);
    font-weight: 600;
}

.document-content p {
    text-align: justify;
    hyphens: auto;
}

.document-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5rem;
    margin-left: 0;
    font-style: italic;
    background-color: var(--blockquote-bg);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    border: 1px solid var(--blockquote-border);
    border-left-width: 4px;
}

.document-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 2rem auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.document-content a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.document-content a:hover {
    color: var(--link-hover);
}

.document-content ul, 
.document-content ol {
    padding-left: 2rem;
    margin-bottom: 1.5rem;
}

.document-content code {
    font-family: 'Courier New', monospace;
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Подвал */
footer {
    background-color: var(--footer-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

footer p {
    margin-bottom: 0.5rem;
    color: var(--text-color);
    opacity: 0.8;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
}

.footer-note {
    font-size: 0.9rem !important;
    font-style: italic;
    opacity: 0.7 !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    html {
        font-size: 16px; /* Стандартный размер на мобильных */
    }
    
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .logo-title {
        order: 1;
    }
    
    .menu-toggle {
        display: flex;
        margin-left: 0; /* Убираем отступ слева */
        margin-right: 0.5rem; /* Добавляем отступ справа для баланса */
        align-items: center;
        justify-content: center;
        order: 2;
    }
    .desktop-menu {
        display: none; /* Скрываем десктопное меню на мобильных */
    }
    
    .documents-grid {
        grid-template-columns: 1fr; /* Одна колонка на мобильных */
    }
    
    .document-container {
        padding: 1.5rem;
    }
    
    .document-content {
        font-size: 1rem; /* Чуть меньше на мобильных */
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .logo {
        height: 50px;
    }
}

@media (min-width: 769px) {
    #main-menu {
        display: none !important; /* Всегда скрываем popover на десктопе */
    }
}

/* Подчеркивание заголовка H1 красным */
h1 {
    position: relative;
    padding-bottom: 0.5rem;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #c62828; /* Классический насыщенный красный */
    border-radius: 2px;
}

/* Для темной темы сделаем немного светлее */
[data-theme="dark"] h1::after {
    background-color: #ef5350; /* Более светлый красный для темной темы */
}

/* Стилизация логотипа */
.logo {
    height: 120px; /* Увеличиваем с 60px до 80px */
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    background-color: var(--header-bg); /* Фон как у шапки */
    border-radius: 8px; /* Легкое скругление */
    padding: 5px; /* Отступ вокруг логотипа */
    transition: all 0.3s ease; /* Плавные переходы */
}

/* Для светлой темы: делаем черную графику на прозрачном фоне */
[data-theme="light"] .logo {
    filter: none; /* Оставляем как есть */
    background-color: transparent; /* Убираем фон в светлой теме */
    border: 1px solid var(--border-color); /* Добавляем легкую рамку */
}

/* Для темной темы: инвертируем цвета (черное → белое) */
[data-theme="dark"] .logo {
    filter: invert(1) brightness(1.3); /* Инвертируем и немного осветляем */
    background-color: rgba(255, 255, 255, 0.05); /* Легкий светлый фон */
    border: 1px solid var(--border-color);
}

/* Эффект при наведении */
.logo:hover {
    transform: scale(1.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .logo {
        height: 65px; /* Чуть меньше на мобильных */
    }
}

/* ===== Стили для раздела "Персоналии" ===== */
.personalities {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.personalities h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
}

.section-description {
    text-align: center;
    color: var(--disabled-color);
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-style: italic;
}

/* Аккордеон с персоналиями */
.personalities-accordion {
    max-width: 800px;
    margin: 0 auto;
}

.person-details {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: var(--card-bg);
}

.person-details:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .person-details:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.person-details[open] {
    border-color: var(--accent-color);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .person-details[open] {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* Заголовок аккордеона */
.person-summary {
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-color);
    list-style: none; /* Убираем стандартный маркер */
    transition: background-color 0.2s;
}

.person-summary:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .person-summary:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Убираем стандартную стрелку */
.person-summary::-webkit-details-marker {
    display: none;
}

/* Кастомная стрелка */
.person-summary::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: var(--accent-color);
}

.person-details[open] .person-summary::after {
    transform: rotate(180deg);
}

.person-name {
    flex: 1;
}

.doc-count {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--disabled-color);
    margin-left: 1rem;
    background-color: var(--theme-toggle-bg);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

/* Список документов внутри аккордеона */
.person-documents {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.person-doc-link {
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-left: 3px solid var(--accent-color);
}

[data-theme="dark"] .person-doc-link {
    background-color: rgba(255, 255, 255, 0.03);
}

.person-doc-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateX(5px);
    color: var(--accent-color);
}

[data-theme="dark"] .person-doc-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.no-docs {
    padding: 1rem;
    text-align: center;
    color: var(--disabled-color);
    font-style: italic;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
}

[data-theme="dark"] .no-docs {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Адаптивность для раздела */
@media (max-width: 768px) {
    .personalities {
        margin-top: 3rem;
        padding-top: 2rem;
    }
    
    .person-summary {
        padding: 1rem;
        font-size: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .doc-count {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .person-documents {
        padding: 1rem;
    }
    
    .person-doc-link {
        padding: 0.7rem;
    }
}

/* Якорная ссылка для плавного скролла */
html {
    scroll-padding-top: 100px; /* Учитываем высоту фиксированной шапки */
}
/* ===== Стили для галереи и фотоальбома ===== */

/* Общие стили для страницы галереи */
.gallery-container {
    max-width: 1200px;
}

.gallery-main {
    padding: 2rem 0;
}

/* Хлебные крошки */
.breadcrumbs {
    margin-bottom: 2rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
}

.breadcrumbs a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    color: var(--disabled-color);
    margin: 0 0.5rem;
}

/* Заголовок галереи */
.gallery-header {
    text-align: center;
    margin-bottom: 3rem;
}

.gallery-header h2 {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Сетка альбомов */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.album-card {
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.album-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

[data-theme="dark"] .album-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.album-preview {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.album-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Для превью оставляем cover */
    transition: transform 0.5s ease;
}

.album-card:hover .album-preview img {
    transform: scale(1.05);
}

.album-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background-color: var(--theme-toggle-bg);
    color: var(--disabled-color);
}

.album-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 1rem;
    color: white;
    text-align: right;
}

.album-count {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    display: inline-block;
}

.album-info {
    padding: 1.2rem;
    flex: 1;
}

.album-info h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    margin: 0;
    line-height: 1.4;
}

/* Заголовок альбома */
.album-header {
    margin-bottom: 2rem;
}

.album-header h2 {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.album-info-text {
    color: var(--disabled-color);
    font-style: italic;
}

/* Сетка фотографий */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.photo-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.photo-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

[data-theme="dark"] .photo-item:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.photo-thumbnail {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    flex-shrink: 0;
}

/* ФИКС: Убираем object-fit: cover для миниатюр */
.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Изменено с cover на contain */
    background-color: #f5f5f5;
    transition: transform 0.5s ease;
}

[data-theme="dark"] .photo-thumbnail img {
    background-color: #2a2a2a;
}

.photo-item:hover .photo-thumbnail img {
    transform: scale(1.05);
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

.view-icon {
    font-size: 2rem;
    color: white;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.photo-info {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.photo-info h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    margin-bottom: 0.3rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em;
}

.photo-info time {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--disabled-color);
    margin-top: 0.3rem;
}

/* Кнопка назад */
.back-to-albums {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Сообщение об отсутствии альбомов */
.no-albums {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.no-albums p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.hint {
    font-size: 0.9rem !important;
    color: var(--disabled-color);
    font-style: italic;
    margin-top: 1.5rem !important;
}

/* Модальное окно для просмотра фото */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.photo-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    z-index: 2001;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    max-width: 90vw; /* Изменил на vw */
    max-height: 90vh; /* Изменил на vh */
    width: auto; /* Убрал фиксированную ширину */
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 50vh;
    background-color: rgba(0, 0, 0, 0.2);
    overflow: auto; /* Добавил auto для прокрутки если нужно */
}

#modal-image {
    max-width: calc(90vw - 40px); /* Учитываем padding */
    max-height: calc(90vh - 200px); /* Учитываем высоту инфо-панели */
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.modal-info {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    max-height: 30vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.modal-info h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.meta-item {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.meta-label {
    font-weight: 600;
    color: var(--disabled-color);
    min-width: 80px;
    flex-shrink: 0;
}

.meta-item span:last-child {
    flex: 1;
    word-break: break-word;
}

.image-info {
    display: flex;
    gap: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--disabled-color);
    flex-wrap: wrap;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#modal-download {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    margin-left: auto;
}

#modal-download:hover {
    text-decoration: underline;
}

/* Кнопки модального окна */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 2002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-nav:hover {
    background: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

/* Активная ссылка в меню */
.desktop-menu a.active,
#main-menu a.active {
    color: var(--accent-color);
    font-weight: 600;
}

/* Адаптивность галереи */
@media (max-width: 768px) {
    .gallery-main {
        padding: 1.5rem 0;
    }
    
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.5rem;
    }
    
    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 95%;
        width: 95%;
        flex-direction: column;
    }
    
    .modal-image-container {
        padding: 1rem;
        min-height: 50vh;
        max-height: 60vh;
        flex: none;
    }
    
    .modal-info {
        max-height: 40vh;
        padding: 1rem;
        overflow-y: auto;
    }
    
    .modal-info h3 {
        font-size: 1.2rem;
    }
    
    .meta-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .modal-prev {
        left: 10px;
    }
    
    .modal-next {
        right: 10px;
    }
    
    .photo-info h3 {
        -webkit-line-clamp: 3;
        min-height: 4.2em;
    }
}

@media (max-width: 480px) {
    .albums-grid {
        grid-template-columns: 1fr;
    }
    
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .photo-info h3 {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
        min-height: 2.8em;
    }
}

@media (max-height: 700px) {
    .modal-image-container {
        min-height: 50vh;
        max-height: 60vh;
        padding: 1rem;
    }
    
    .modal-info {
        max-height: 40vh;
        padding: 1rem;
    }
}


/* Стили для описания альбома в карточке */
.album-info {
    padding: 1.2rem;
    flex: 1;
}

.album-info h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.album-description {
    font-size: 0.9rem;
    color: var(--disabled-color);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Ограничиваем 2 строками */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Адаптивность для описания альбома */
@media (max-width: 768px) {
    .album-description {
        -webkit-line-clamp: 3; /* На мобильных можно 3 строки */
    }
}

/* Описание альбома на странице альбома */
.album-description-page {
    color: var(--disabled-color);
    font-style: italic;
    margin-bottom: 1rem;
    max-width: 800px;
    line-height: 1.5;
}

/* ===== УЛУЧШЕННЫЕ СТИЛИ ДЛЯ ПЕЧАТИ ===== */
@media print {
    /* Базовые настройки печати */
    @page {
        margin: 2cm;
        size: A4;
    }
    
    body {
        font-size: 14pt !important; /* Увеличиваем шрифт */
        line-height: 1.6 !important;
        color: #000 !important;
        background: white !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Убираем все ненужные элементы */
    header, nav, footer, 
    .menu-toggle, .desktop-menu, .theme-toggle,
    .back-link, .document-controls, .photo-overlay,
    .modal-overlay, .modal-content, .person-summary::after,
    .doc-count, .breadcrumbs, .album-overlay,
    .view-icon, .modal-nav, .modal-close,
    .no-print {
        display: none !important;
    }
    
    /* Контейнер для печати */
    .container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
    }
    
    /* Документы - улучшаем читаемость */
    .document-container {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        page-break-inside: avoid;
        orphans: 3;
        widows: 3;
    }
    
    .document-content {
        font-size: 14pt !important;
        line-height: 1.7 !important;
        text-align: justify !important;
        hyphens: auto !important;
    }
    
    /* Заголовки для печати */
    h1 {
        font-size: 24pt !important;
        color: #000 !important;
        border-bottom: 2pt solid #000 !important;
        margin-top: 0 !important;
        margin-bottom: 20pt !important;
        page-break-after: avoid;
    }
    
    h2 {
        font-size: 18pt !important;
        color: #000 !important;
        margin-top: 20pt !important;
        margin-bottom: 15pt !important;
        page-break-after: avoid;
        border-bottom: 1pt solid #ccc !important;
        padding-bottom: 5pt !important;
    }
    
    h3 {
        font-size: 16pt !important;
        margin-top: 15pt !important;
        margin-bottom: 10pt !important;
        page-break-after: avoid;
    }
    
    h4, h5, h6 {
        font-size: 14pt !important;
        margin-top: 12pt !important;
        margin-bottom: 8pt !important;
        page-break-after: avoid;
        color: #333 !important;
    }
    
    /* Параграфы */
    p {
        margin-bottom: 12pt !important;
        text-align: justify !important;
        hyphens: auto !important;
        widows: 2;
        orphans: 2;
    }
    
    /* Изображения в документах - ОБТЕКАНИЕ */
    .document-content img {
        max-width: 45% !important; /* Уменьшаем для обтекания */
        height: auto !important;
        page-break-inside: avoid;
        break-inside: avoid;
        margin: 10pt !important;
        float: left !important; /* Обтекание слева */
        clear: both !important;
    }
    
    /* Для изображений справа */
    .document-content img.right {
        float: right !important;
        margin-left: 15pt !important;
        margin-right: 0 !important;
    }
    
    /* Для изображений по центру */
    .document-content img.center {
        float: none !important;
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 70% !important;
    }
    
    /* Подписи к изображениям */
    .document-content img + em,
    .document-content img + p.caption {
        display: block !important;
        text-align: center !important;
        font-style: italic !important;
        font-size: 11pt !important;
        color: #666 !important;
        margin-top: 5pt !important;
        margin-bottom: 15pt !important;
        float: none !important;
        clear: both !important;
        width: 100% !important;
    }
    
    /* Обтекание текста вокруг изображений */
    .document-content p:has(+ img) {
        margin-right: 50% !important;
    }
    
    /* Списки */
    ul, ol {
        margin-left: 20pt !important;
        margin-bottom: 12pt !important;
        page-break-inside: avoid;
    }
    
    li {
        margin-bottom: 5pt !important;
        page-break-inside: avoid;
    }
    
    /* Блоки и цитаты */
    blockquote {
        border-left: 3pt solid #666 !important;
        background: #f9f9f9 !important;
        padding: 10pt 15pt !important;
        margin: 15pt 0 !important;
        page-break-inside: avoid;
        break-inside: avoid;
        font-style: italic !important;
    }
    
    /* Таблицы */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 15pt 0 !important;
        page-break-inside: avoid;
    }
    
    th, td {
        border: 1pt solid #ccc !important;
        padding: 8pt !important;
        text-align: left !important;
        vertical-align: top !important;
    }
    
    /* Ссылки */
    a {
        color: #000 !important;
        text-decoration: underline !important;
        font-weight: normal !important;
    }
    
    /* URL после ссылок */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
        word-break: break-all;
    }
    
    /* Для внутренних ссылок не показываем URL */
    a[href^="#"]:after,
    a[href^="/"]:after,
    a[href^="viewer.php"]:after,
    a[href^="index.php"]:after {
        content: "" !important;
    }
    
    /* Галерея - упорядочиваем печать */
    .photo-gallery {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15pt !important;
        page-break-inside: avoid;
        margin-bottom: 20pt !important;
    }
    
    .photo-item {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1pt solid #ddd !important;
        padding: 10pt !important;
        margin-bottom: 15pt !important;
        background: white !important;
    }
    
    .photo-thumbnail {
        height: auto !important;
        max-height: 200pt !important;
        overflow: hidden !important;
        margin-bottom: 8pt !important;
    }
    
    .photo-thumbnail img {
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        float: none !important;
        margin: 0 !important;
    }
    
    .photo-info h3 {
        font-size: 12pt !important;
        margin: 5pt 0 !important;
        color: #000 !important;
        font-weight: bold !important;
    }
    
    .photo-info time {
        font-size: 10pt !important;
        color: #666 !important;
    }
    
    /* Карточки документов */
    .doc-card {
        border: 1pt solid #ddd !important;
        padding: 15pt !important;
        margin-bottom: 15pt !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Разрывы страниц */
    .page-break {
        page-break-before: always;
        margin-top: 30pt !important;
    }
    
    .break-before {
        page-break-before: always;
    }
    
    .break-after {
        page-break-after: always;
    }
    
    .break-avoid {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Логотип */
    .logo {
        height: 80pt !important;
        filter: none !important;
        margin-bottom: 20pt !important;
        float: none !important;
    }
    
    /* Убираем все тени и фоны */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
        background: white !important;
    }
    
    /* Специальные классы для печати */
    .print-only {
        display: block !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    /* Информация для печати */
    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        font-size: 10pt;
        color: #666;
        text-align: center;
        border-top: 1pt solid #ccc;
        padding: 5pt;
        background: white;
    }
    
    .print-url {
        font-size: 9pt;
        color: #999;
        text-align: center;
        margin-top: 10pt;
        font-style: italic;
    }
}

/* Дополнительные стили для лучшего обтекания */
@media screen {
    .document-content img.left {
        float: left;
        margin-right: 20px;
        margin-bottom: 10px;
        max-width: 50%;
    }
    
    .document-content img.right {
        float: right;
        margin-left: 20px;
        margin-bottom: 10px;
        max-width: 50%;
    }
    
    .document-content img.center {
        display: block;
        margin: 20px auto;
        max-width: 80%;
    }
    
    /* Очистка обтекания */
    .clearfix::after {
        content: "";
        clear: both;
        display: table;
    }
}