/* ============================================================
   INDEKS BIBLIOTEKI — przycisk w top-nav + wysuwany dropdown
   Wspólny moduł stylów dla wszystkich podstron biblioteki.
   Tag <link rel="stylesheet" href="css/library-index.css"> w head.
   ============================================================ */
.library-toggle {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--ink-gold);
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 0.22rem;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.library-toggle:hover,
.library-toggle[aria-expanded="true"] {
    background: rgba(201, 169, 97, 0.08);
    border-color: rgba(201, 169, 97, 0.35);
    box-shadow: 0 0 12px rgba(201, 169, 97, 0.25);
    color: var(--ink-cream);
}

#library-index-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 250;
    background: linear-gradient(180deg,
        rgba(10, 5, 8, 0.97) 0%,
        rgba(15, 8, 12, 0.96) 70%,
        rgba(10, 5, 8, 0.0) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(201, 169, 97, 0.25);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 420ms cubic-bezier(0.4, 0, 0.2, 1), opacity 320ms ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
#library-index-dropdown.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.lib-dropdown-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 80px clamp(20px, 4vw, 48px) 32px;
}

#library-index-close {
    position: absolute;
    top: 18px;
    right: clamp(18px, 4vw, 36px);
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid rgba(201, 169, 97, 0.35);
    color: var(--ink-gold);
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}
#library-index-close:hover,
#library-index-close:focus-visible {
    color: var(--ink-cream);
    border-color: var(--ink-gold);
    background: rgba(201, 169, 97, 0.12);
    box-shadow: 0 0 14px rgba(201, 169, 97, 0.35);
    outline: none;
    transform: rotate(90deg);
}

.lib-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px dashed rgba(201, 169, 97, 0.2);
}
.lib-filters-label {
    font-family: 'IM Fell English SC', serif;
    color: var(--ink-dim);
    font-style: italic;
    font-size: 0.78rem;
    letter-spacing: 0.18rem;
    text-transform: uppercase;
    margin-right: 8px;
}
.lib-filter {
    background: transparent;
    border: 1px solid rgba(201, 169, 97, 0.3);
    color: var(--ink-amber);
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 0.18rem;
    text-transform: uppercase;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.25s ease;
    min-width: 38px;
}
.lib-filter:hover {
    color: var(--ink-cream);
    border-color: var(--ink-gold);
    background: rgba(201, 169, 97, 0.06);
}
.lib-filter.active {
    color: var(--ink-cream);
    border-color: var(--ink-gold);
    background: rgba(201, 169, 97, 0.15);
    box-shadow: 0 0 10px rgba(201, 169, 97, 0.3);
}

#lib-dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 60vh;
    overflow-y: auto;
}
#lib-dropdown-list li {
    border-bottom: 1px dashed rgba(201, 169, 97, 0.12);
}
#lib-dropdown-list li:last-child { border-bottom: none; }
#lib-dropdown-list li.hidden { display: none; }

#lib-dropdown-list a {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 10px 6px;
    color: var(--ink-amber);
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: 'IM Fell English', serif;
}
#lib-dropdown-list a:hover,
#lib-dropdown-list a:focus-visible {
    color: var(--ink-cream);
    background: rgba(201, 169, 97, 0.05);
    padding-left: 14px;
    outline: none;
}
#lib-dropdown-list .lib-list-counter {
    font-family: 'Cinzel', serif;
    color: var(--ink-dim);
    font-size: 0.85rem;
    letter-spacing: 0.08rem;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}
#lib-dropdown-list a:hover .lib-list-counter { color: var(--ink-gold); }
#lib-dropdown-list .lib-list-title {
    font-family: 'Cinzel', serif;
    font-size: 0.92rem;
    letter-spacing: 0.16rem;
    text-transform: uppercase;
    flex: 1;
    font-weight: 600;
}
#lib-dropdown-list .lib-list-class {
    font-family: 'IM Fell English SC', serif;
    font-style: italic;
    color: var(--ink-blood);
    font-size: 0.72rem;
    letter-spacing: 0.18rem;
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid rgba(168, 50, 50, 0.4);
    border-radius: 2px;
    flex-shrink: 0;
}

#lib-dropdown-list::-webkit-scrollbar { width: 6px; }
#lib-dropdown-list::-webkit-scrollbar-track { background: rgba(201, 169, 97, 0.05); }
#lib-dropdown-list::-webkit-scrollbar-thumb { background: rgba(201, 169, 97, 0.3); border-radius: 3px; }

.lib-classes-legend {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px dashed rgba(201, 169, 97, 0.2);
    font-family: 'IM Fell English', serif;
    font-style: italic;
    color: var(--ink-dim);
    font-size: 0.78rem;
    line-height: 1.7;
    text-align: center;
}
.lib-classes-legend strong {
    color: var(--ink-amber);
    font-style: normal;
    font-family: 'Cinzel', serif;
    margin-right: 0.2em;
    letter-spacing: 0.1em;
}

#library-index-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 240;
    opacity: 0;
    pointer-events: none;
    transition: opacity 320ms ease;
}
#library-index-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 600px) {
    .lib-dropdown-inner { padding: 70px 16px 24px; }
    #lib-dropdown-list a { gap: 10px; padding: 12px 6px; }
    #lib-dropdown-list .lib-list-counter { font-size: 0.78rem; min-width: 40px; }
    #lib-dropdown-list .lib-list-title { font-size: 0.82rem; letter-spacing: 0.12rem; }
    #lib-dropdown-list .lib-list-class { font-size: 0.66rem; padding: 2px 6px; }
}
