/* =========================================================================
   1. ГЛОБАЛЬНЫЙ МАТОВЫЙ КАРКАС СТРАНИЦЫ АРХИВА
   ========================================================================= */
.arch-wrapper {
    min-height: 100vh;
    padding-bottom: 50px;
    font-family: sans-serif;
    box-sizing: border-box;
    display: block;
    background: url('../lab_background.jpg') no-repeat center center fixed !important;
    background-size: cover !important;
}

.arch-wrapper *, 
.arch-wrapper *::before, 
.arch-wrapper *::after {
    box-sizing: border-box;
}

/* Белоснежная плиточная карточка с мягкой объёмной тенью */
.arch-wrapper .arch-card {
    background: #ffffff; 
    border: 1px solid #cbd5e1; 
    border-radius: 12px;
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.12), 0 6px 8px -5px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.2s, 
                background-color 0.2s; 
    overflow: hidden; /* КРИТИЧЕСКИ: Фиксирует картинку внутри рамок при наведении */
}

/* Общий стиль для кнопок скачивания/открытия PDF */
.arch-footer a,
.arch-list-footer-button a {
    display: inline-block; 
    padding: 6px 14px; 
    color: #0066cc;
    text-decoration: none; 
    border: 1px solid #0066cc; 
    border-radius: 6px;
    background: #ffffff;
    transition: background-color 0.2s, color 0.2s;
}
.arch-footer a:hover,
.arch-list-footer-button a:hover { 
    background-color: #0066cc; 
    color: #ffffff; 
}

/* Панель переключателей видов хедера */
.arch-sticky-bar {
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    background: #E5E5E5; 
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05); 
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px; 
    display: flex; 
    align-items: center; 
    gap: 15px;
}
.arch-view-btn { 
    padding: 6px 16px; 
    cursor: pointer; 
    border: 1px solid #0066cc; 
    background: #ffffff; 
    border-radius: 6px; 
    font-size: 0.9em; 
    color: #0066cc; 
    transition: all 0.2s ease; 
}
.arch-view-btn.is-active { 
    background: #0066cc; 
    color: #ffffff; 
}
.arch-view-btn:hover:not(.is-active) { 
    background: #e0f2fe; 
}

/* Базовый текстовый стиль журнала */
.arch-journal {
    font-size: 1.2em; 
    color: #000; 
    margin-top: auto;
    word-break: break-word;
}

/* =========================================================================
   2. ОТОБРАЖЕНИЕ В РЕЖИМЕ СЕТКИ ПЛИТОК (.arch-grid)
   ========================================================================= */
.arch-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); 
    gap: 25px; 
    padding: 25px;
}
.arch-grid .arch-card {
    display: flex;
    flex-direction: row; 
    flex-wrap: wrap; 
    height: auto; 
}

/* Эффект плавного взлёта и подсвечивания плитки при наведении мыши */
.arch-grid .arch-card:hover {
    transform: translateY(-6px); 
    box-shadow: 0 25px 35px -10px rgba(15, 23, 42, 0.25);
    border-color: #0066cc; 
}

/* Левая превью-ячейка */
.arch-grid .arch-preview {
    display: flex; 
    flex: 0 0 35%; 
    width: 35%;
    min-width: 160px;
    background: #f8fafc; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-between; 
    border-right: 1px solid #cbd5e1; 
    overflow: hidden; 
    padding: 15px 10px;
}
.arch-grid .arch-img-holder {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    margin-bottom: 12px;
}

/* Обложка А4 первого листа публикации */
.arch-grid .arch-preview img { 
    width: 100%; 
    height: auto; 
    max-width: 100%; 
    max-height: 280px; 
    object-fit: contain; 
    box-shadow: 0 8px 16px -2px rgba(0, 0, 0, 0.15); 
    border: 1px solid #94a3b8; 
    cursor: pointer;
    transition: transform 0.4s ease; /* Плавность для эффекта рассмотрения */
}

/* ИСПРАВЛЕНИЕ: Восстановлен эффект увеличения обложки при наведении на плитку */
.arch-grid .arch-card:hover .arch-preview img {
    transform: scale(1.06); /* Плавный зум обложки на 6% */
}

/* Правая информационная часть с описанием (режим плитки) */
.arch-grid .arch-info { 
    padding: 24px 20px; 
    flex: 10 1 280px; 
    display: flex;
    flex-direction: column; 
    justify-content: flex-start; 
    gap: 10px; 
    background: #fffff0; 
}
.arch-grid .arch-info h4 {
    margin: 0 0 4px 0;
    font-size: 1.4em;
    line-height: 1.4;
    color: #0f172a; 
}
.arch-grid .arch-authors {
    margin: 0;
    font-size: 1.25em;
    color: #0000FF;
}
.arch-grid .arch-year {
    font-weight: bold; 
    color: #FF1E00;
    font-size: 1.9em;
}
.arch-grid .arch-footer {
    margin-top: auto; 
    padding-top: 0; 
    font-size: 1.1em; 
    width: 100%;
    display: flex;
    flex-direction: column; 
    align-items: center;    
    gap: 6px;               
}
.arch-grid .arch-footer a {
    display: inline-block;
    width: 100%;
    max-width: 140px; 
    text-align: center;
    margin: 0 auto;        
}
.arch-grid .arch-footer span, 
.arch-grid .arch-footer div {
    display: block;
    width: 100%;
    text-align: center;
    margin: 0;
    font-size: 0.85em;    
    color: #64748b;       
}

/* По умолчанию скрываем строчную кнопку списка внутри сетки */
.arch-list-footer-button {
    display: none;
}



/* =========================================================================
   3. ОТОБРАЖЕНИЕ В РЕЖИМЕ СТРОЧНОГО СПИСКА (.arch-list)
   ========================================================================= */
.arch-list { 
    display: grid; 
    grid-template-columns: 1fr;
    gap: 15px; 
    padding: 25px; 
}

/* В режиме списка левая колонка-обложка полностью скрывается */
.arch-list .arch-preview { 
    display: none; 
}

.arch-list .arch-card {
    display: flex; 
    flex-direction: row; 
    padding: 20px 24px;
    border-radius: 12px;
    border: 1px solid #cbd5e1; 
}

/* Эффект сдвига строки вправо при наведении мыши */
.arch-list .arch-card:hover { 
    background: #e0f2fe; 
    border-color: #0066cc; 
    transform: translateX(6px); 
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.1); 
}

.arch-list .arch-info { 
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    width: 100%; 
    gap: 20px; 
}

.arch-list .arch-year { 
    width: 70px; 
    flex-shrink: 0; 
    font-weight: bold; 
    color: #EEAE00;
}

.arch-list h4 { 
    flex: 3; 
    margin: 0; 
    color: #1e293b; 
}

.arch-list .arch-authors { 
    flex: 2; 
    margin: 0; 
    color: #475569; 
    font-style: italic; 
}

.arch-list .arch-footer { 
    flex: 2; 
}

/* Включаем кнопку только тогда, когда контейнер переходит в режим списка */
.arch-list .arch-list-footer-button {
    display: block;
    flex: 2; 
    text-align: right; 
}
.arch-list .arch-list-footer-button a {
    width: 100%;
    max-width: 140px;
    text-align: center;
}

/* Специфичные стили для журнала только в режиме строки */
.arch-list .arch-journal {
    flex: 2; 
    margin-top: 0; 
    white-space: normal; 
    line-height: 1.4; 
    padding-right: 15px; 
}

/* =========================================================================
   4. ДЕТАЛЬНЫЙ ВИД ОДИНОЧНОЙ ПУБЛИКАЦИИ (.single-focus)
   ========================================================================= */
.single-focus { 
    max-width: 800px; 
    margin: 30px auto; 
    padding: 0 15px; 
}
.single-focus .arch-card { 
    display: flex; 
    flex-direction: column; 
    border: 2px solid #EEAE00; 
}
.single-focus .arch-preview { 
    display: flex; 
    min-height: 400px; 
    background: #f9f9f9; 
}
.single-focus .arch-preview img { 
    width: 100%; 
    height: auto; 
    object-fit: contain; 
    display: block; 
}
.single-focus .arch-info { 
    padding: 35px; 
}
.single-focus h4 { 
    font-size: 1.5em; 
    color: #0066cc; 
}

/* =========================================================================
   5. АДАПТИВНАЯ ОПТИМИЗАЦИЯ ДЛЯ МОБИЛЬНЫХ ЭКРАНОВ СМАРТФОНОВ
   ========================================================================= */
@media (max-width: 768px) {
    /* Мобильная оптимизация сетки плиток */
    .arch-grid { 
        padding: 12px; 
        gap: 15px; 
        grid-template-columns: 1fr;
    }
    .arch-grid .arch-card {
        flex-direction: column;
    }
    .arch-grid .arch-preview { 
        flex: 0 0 auto;
        width: 100%;
        border-right: none; 
        border-bottom: 1px solid #cbd5e1; 
        background: transparent; 
        padding: 15px 0 0 0; 
    }
    .arch-grid .arch-preview img { 
        max-height: 230px; 
        width: auto; 
    }
    
    /* Мобильная оптимизация режима списка */
    .arch-list .arch-card { 
        padding: 15px; 
    }
    .arch-list .arch-info { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 12px; 
    }
    .arch-list .arch-year {
        font-size: 1.5em; 
        width: auto;
    }
    .arch-list .arch-list-footer-button {
        display: block;
        width: 100%; 
        text-align: center; 
        margin-top: 5px;
    }
    .arch-list .arch-list-footer-button a {
        display: block; 
        width: 100%;
        max-width: 100%;
    }
    .arch-list .arch-journal {
        padding-right: 0; 
    }
    .arch-sticky-bar div[style*="display:flex"] {
        display: none !important; /* Скрываем весь правый блок с кнопками и словом "Вид:" */
    }
}
/* =========================================================================
   6. СТИЛИ МОДАЛЬНОГО ОКНА ПРОСМОТРА ОБЛОЖЕК А4 (ДЛЯ OPENMODAL)
   ========================================================================= */
.eq-modal {
    display: none; 
    position: fixed; 
    z-index: 99999 !important; 
    padding-top: 50px; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.9); 
    overflow: auto;
    box-sizing: border-box;
}

/* Контент увеличенной картинки внутри черного экрана */
.modal-content {
    margin: auto;
    display: block;
    width: auto; 
    max-width: 1000px; /* Чтобы на огромных мониторах картинка не рассыпалась */
    max-height: 85vh;
    object-fit: contain; /* Сохраняет пропорции без искажений */
    border: 3px solid white;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

/* Кнопка закрытия (крестик) вверху справа */
.close-modal {
    position: absolute; 
    top: 15px; 
    right: 35px; 
    color: #f1f1f1; 
    font-size: 40px; 
    font-weight: bold; 
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}
.close-modal:hover {
    color: #3498db;
}

/* Фикс подписи под картинкой в модалке */
#modal-caption {
    font-family: sans-serif;
    font-size: 16px;
    margin-top: 15px;
    line-height: 1.4;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}
