:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --gold-color: #ffd700;
    --gap: 0.5rem;
    --transition: all 0.3s ease;
}

/* Hero секція */
.biblio_hero {
    position: relative;
    min-height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, rgba(25, 28, 38, 0.9), rgba(45, 52, 72, 0.8)),
    url('https://images.unsplash.com/photo-1497633762265-9d179a990aa6?ixlib=rb-1.2.1&auto=format&fit=crop&w=1952&q=80');
    background-size: cover;
    background-position: center;
    color: #fff;
    text-align: center;
}

.biblio_hero__content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.biblio_hero__title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.biblio_highlight {
    color: var(--gold-color);
    position: relative;
    display: inline-block;
}

.biblio_highlight::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: currentColor;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.biblio_hero__subtitle {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    margin-bottom: 2.5rem;
    opacity: 0.9;
}

/* Анімації */
@keyframes biblio_slide-down {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes biblio_fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes biblio_scale-up {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.biblio_animate-slide-down {
    animation: biblio_slide-down 1s ease forwards;
}

.biblio_animate-fade-in {
    animation: biblio_fade-in 1s ease 0.3s forwards;
    opacity: 0;
}

.biblio_animate-scale-up {
    animation: biblio_scale-up 0.5s ease 0.6s forwards;
    opacity: 0;
}

/* Топ зображення */
.biblio_top-image {
    width: 100%;
    display: flex;
    justify-content: center;
    background-color: #f0f0f0;
}

.biblio_top-image img {
    width: 100%;
    max-width: 1000px;
    height: auto;
    display: block;
}

/* Бібліотекарі */
.biblio_librarians {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 4rem 2rem;
}

.biblio_card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    max-width: 350px;
}

.biblio_card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.biblio_card img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: contain;
    border-radius: 10px;
}

.biblio_card h2 {
    margin-top: 1rem;
    color: var(--primary-color);
}

.biblio_card p {
    color: var(--secondary-color);
    margin-top: 0.5rem;
}

/* Про бібліотеку */
.biblio_about {
    max-width: 800px;
    margin: 4rem auto;
    padding: 2rem;
    line-height: 1.6;
    color: var(--secondary-color);
    background-color: #f8f9fa;
    border-radius: 10px;
}

.biblio_about h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.biblio_about p {
    text-align: justify;
    text-indent: 2em;
    margin-bottom: 1.5em;
    font-size: 1.1em;
}

/* ОНОВЛЕНА ГАЛЕРЕЯ З ТАБАМИ */
.biblio_gallery-wrapper {
    background: var(--primary-color);
    padding: 3rem 1rem;
    color: white;
}

.biblio_gallery-wrapper h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* Табова навігація */
.biblio_gallery-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.biblio_tab-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.biblio_tab-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.biblio_tab-button.biblio_active {
    background: var(--gold-color);
    border-color: var(--gold-color);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.biblio_tab-icon {
    font-size: 1.1rem;
}

/* Адаптивні тексти для табів */
.biblio_tab-text-short {
    display: none;
}

.biblio_tab-text-full {
    display: inline;
}

/* Стрілочка dropdown - CSS трикутник */
.biblio_dropdown-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: auto;
    /*padding-left: 0.5rem;*/
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease;
    vertical-align: middle;
}

.biblio_dropdown-wrapper:has(.biblio_dropdown-menu.biblio_show) .biblio_dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.biblio_dropdown-wrapper {
    position: relative;
}

.biblio_dropdown-toggle {
    position: relative;
}

.biblio_dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 280px;
    background: rgba(44, 62, 80, 0.98);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    max-height: 400px;
    overflow-y: auto;
}

.biblio_dropdown-menu.biblio_show {
    display: flex;
}

.biblio_dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.biblio_dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.biblio_dropdown-item.biblio_active {
    background: rgba(255, 215, 0, 0.2);
    color: var(--gold-color);
}

/* Контент табів */
.biblio_gallery-content {
    position: relative;
    min-height: 400px;
}

.biblio_gallery-tab-content {
    display: none;
    animation: biblio_fadeInTab 0.5s ease;
}

.biblio_gallery-tab-content.biblio_active {
    display: block;
}

@keyframes biblio_fadeInTab {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Заголовок події */
.biblio_event-header {
    max-width: 900px;
    margin: 0 auto 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.biblio_event-header h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--gold-color);
    text-align: center;
    line-height: 1.4;
}

.biblio_event-description {
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.9;
    font-style: italic;
}

/* Колаж галереї */
.biblio_gallery-collage {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 150px;
    gap: 0.5rem;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.biblio_gallery-item {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    transition: var(--transition);
    outline: 1px solid #2996dc;
    outline-offset: 0px;
    cursor: pointer;
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Розміри елементів */
.biblio_gallery-item.biblio_size1 {
    grid-row: span 1;
    grid-column: span 1;
}

.biblio_gallery-item.biblio_size2 {
    grid-row: span 2;
    grid-column: span 1;
}

.biblio_gallery-item.biblio_size3 {
    grid-row: span 1;
    grid-column: span 2;
}

.biblio_gallery-item.biblio_size4 {
    grid-row: span 2;
    grid-column: span 2;
}

.biblio_gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
    z-index: 1;
}

/* Lightbox */
.biblio_lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: hidden;
}

.biblio_lightbox-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
}

.biblio_lightbox-img {
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.biblio_close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.biblio_close-lightbox:hover {
    background: rgba(255, 215, 0, 0.8);
    color: var(--primary-color);
    transform: rotate(90deg);
}

.biblio_lightbox-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    box-sizing: border-box;
    pointer-events: none;
}

.biblio_lightbox-nav button {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.biblio_lightbox-nav button:hover {
    background: var(--gold-color);
    color: var(--primary-color);
    border-color: var(--gold-color);
    transform: scale(1.1);
}

.biblio_lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    font-size: 1.1rem;
}

/* Адаптивність */
@media (max-width: 768px) {
    .biblio_hero {
        min-height: 25vh;
        padding: 1rem;
    }

    /* Адаптація табів - ВИПРАВЛЕНО */
    .biblio_gallery-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .biblio_tab-button {
        width: 100%;
        justify-content: flex-start;
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Показати короткий текст на мобілці */
    .biblio_tab-text-full {
        display: none;
    }

    .biblio_tab-text-short {
        display: inline;
    }

    .biblio_tab-icon {
        font-size: 1rem;
        margin-right: 0.5rem;
    }

    /* Dropdown mobile */
    .biblio_dropdown-wrapper {
        width: 100%;
    }

    .biblio_dropdown-toggle {
        justify-content: flex-start;
    }

    .biblio_dropdown-menu {
        position: absolute;
        top: calc(100% + 0.5rem);
        left: 0;
        right: 0;
        /*min-width: 100%;*/
        max-height: 60vh;
        border-radius: 15px;
        /*padding: 1rem;*/
    }

    .biblio_dropdown-item {
        padding: 1rem;
        font-size: 1rem;
        justify-content: flex-start;
    }

    /* Адаптація події */
    .biblio_event-header {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .biblio_event-header h3 {
        font-size: 1.2rem;
    }

    .biblio_event-description {
        font-size: 0.95rem;
    }

    /* Адаптація галереї*/
    .biblio_gallery-collage {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        grid-auto-rows: 100px;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .biblio_gallery-item {
        width: 100%;
        height: 100%;
    }

    /* Зберігаємо розміри на мобілці */
    .biblio_gallery-item.biblio_size1 {
        grid-row: span 1;
        grid-column: span 1;
    }

    .biblio_gallery-item.biblio_size2 {
        grid-row: span 2;
        grid-column: span 1;
    }

    .biblio_gallery-item.biblio_size3 {
        grid-row: span 1;
        grid-column: span 2;
    }

    .biblio_gallery-item.biblio_size4 {
        grid-row: span 2;
        grid-column: span 2;
    }

    /* Перенесення карточок бібліотекарів */
    .biblio_librarians {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        padding: 2rem 1rem;
    }

    /* Lightbox мобільний */
    .biblio_lightbox-img {
        max-width: 95%;
        max-height: 85%;
    }

    .biblio_lightbox-caption {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    .biblio_lightbox-nav {
        padding: 0 10px;
    }

    .biblio_lightbox-nav button {
        font-size: 24px;
        width: 45px;
        height: 45px;
    }

    .biblio_close-lightbox {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .biblio_about p {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .biblio_hero__title {
        font-size: 2rem;
    }

    .biblio_tab-button {
        font-size: 0.85rem;
        padding: 0.7rem 1rem;
    }

    .biblio_event-header h3 {
        font-size: 1.1rem;
    }

    /* Галерея зберігає auto-fill grid навіть на малих екранах */
    .biblio_gallery-collage {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        grid-auto-rows: 80px;
    }
}