/* ===========================================================
   Discography library view
   360 releases on one flat grid was unusable. This groups them
   into collapsible year shelves that scroll horizontally, so the
   page stays short and nothing is more than one click away.
   =========================================================== */

.library {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

/* ---- type group (Tracks / Beats) ---- */
.lib-group { margin-bottom: 3rem; }

.lib-group-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #1a365d;
}

.lib-group-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #1a365d;
    margin: 0;
}

.lib-group-count {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a929b;
}

/* ---- year shelf ---- */
.lib-shelf { margin-bottom: 1.25rem; border-bottom: 1px solid #e9ecef; }

.lib-shelf:last-child { border-bottom: none; }

.lib-shelf-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: #1a365d;
    transition: opacity 0.2s ease;
}

.lib-shelf-head:hover { opacity: 0.7; }

.lib-chevron {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
    color: #8a929b;
}

.lib-shelf.is-open .lib-chevron { transform: rotate(90deg); }

.lib-year {
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
}

.lib-shelf-count {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9aa3ad;
}

.lib-viewall {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1a365d;
    background: none;
    border: 1px solid #d7dde4;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-family: inherit;
}

.lib-viewall:hover { background: #1a365d; color: #fff; border-color: #1a365d; }

/* ---- shelf body ---- */
.lib-shelf-body { display: none; padding: 0 0 1.25rem; }
.lib-shelf.is-open .lib-shelf-body { display: block; }

/* horizontal rail (default) */
.lib-rail {
    display: flex;
    gap: 0.9rem;
    overflow-x: auto;
    padding: 0.25rem 0.25rem 0.9rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.lib-rail::-webkit-scrollbar { height: 6px; }
.lib-rail::-webkit-scrollbar-thumb { background: #cfd6de; border-radius: 3px; }

.lib-rail .lib-card { flex: 0 0 168px; scroll-snap-align: start; }

/* expanded grid */
.lib-shelf.is-grid .lib-rail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    overflow: visible;
    gap: 1rem;
}

.lib-shelf.is-grid .lib-rail .lib-card { flex: initial; }

/* ---- card ---- */
.lib-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #e9ecef;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.lib-card:hover {
    border-color: #1a365d;
    box-shadow: 0 8px 22px rgba(26, 54, 93, 0.14);
    transform: translateY(-2px);
}

.lib-card-art {
    aspect-ratio: 16 / 9;
    background: #eef1f4;
    overflow: hidden;
    position: relative;
}

.lib-card-art img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    display: block;
}

.lib-card-type {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.2rem 0.4rem;
    background: rgba(10, 22, 40, 0.82);
    color: #fff;
}

.lib-card-body { padding: 0.6rem 0.7rem 0.75rem; }

.lib-card-title {
    font-family: 'Syne', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1a365d;
    margin: 0 0 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-card-sub {
    font-size: 0.68rem;
    color: #7c848d;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-card-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    font-size: 0.65rem;
    color: #9aa3ad;
}

.lib-card-meta i { font-size: 0.75rem; color: #FF0000; }

/* ---- empty / search states ---- */
.lib-empty {
    text-align: center;
    padding: 3.5rem 1rem;
    color: #7c848d;
}

.lib-searchinfo {
    font-size: 0.8rem;
    color: #7c848d;
    margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
    .library { padding: 0 1rem 3rem; }
    .lib-rail .lib-card { flex: 0 0 140px; }
    .lib-group-title { font-size: 1.2rem; }
    .lib-viewall { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .lib-card, .lib-chevron { transition: none; }
}
