/* Styles for the V3 library page: page layout, empty state, hero,
   list/grid/categorized results, and responsive overrides. */

/* === Page Layout === */

.v3-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.v3-container > .min-vh-110 {
    flex: 1 0 auto;
    min-height: 0;
}

.library-page__container {
    padding: 0 var(--space-large);
}

/* === Hero === */

.library-page-hero {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
    position: relative;
    display: grid;
    grid-template-columns: fit-content(574px) 1fr fit-content(40%);
    gap: var(--space-xl);
    align-items: center;
    grid-template-areas:
        "a . c"
        "b . c"
    ;
}

.library-page-hero .hero-search-bar {
    grid-area: b;
    width: 75%;
}

.library-page-hero .hero-image-container {
    grid-area: c;
}

.library-page-hero .hero-image,
.library-page-hero .hero-image img {
    height: 160px;
    width: auto;
}

.library-page-hero .hero-image-dark {
    display: none;
}

html.dark .library-page-hero .hero-image-light {
    display: none;
}

html.dark .library-page-hero .hero-image-dark {
    display:block
}

.library-page-hero .hero-title {
    grid-area: a;
    margin: 0;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: var(--font-size-2xl);
    font-style: normal;
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
}

/* === List & Grid View === */

.library-item-list {
    border: 1px solid var(--color-stroke-weak);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-xxl);
}

.library-item-card-grid {
    margin-bottom: var(--space-xxl);
}

.library-item-list .library-item--list:last-child {
    border-bottom: none;
}

.library-item-list.grouped {
    margin-bottom: var(--space-large);
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.library-page__list-header {
    display: grid;
    width: 100%;
    border-bottom: 1px solid var(--color-stroke-weak);
    background: var(--color-surface-weak);
    padding: var(--space-large);
}

.library-page__list-header-flex {
    display: flex;
    gap: var(--space-large);
    align-items: center;
}

.library-page__list-header-justify {
    justify-self: center;
    padding-left: calc(16px + var(--space-large));
}

.library-page__list-header-text {
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-relaxed);
    letter-spacing: var(--letter-spacing-tight);
}

/* === Categorized & Grading View === */

.library-page__category-header {
    grid-column: 1 / -1;
    padding: var(--space-large);
    border-bottom: 1px solid var(--color-stroke-weak);
    background: var(--color-surface-mid);
    width: 100%;
    margin: 0;
    max-width: 1408px;
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--letter-spacing-tight);
    line-height: var(--line-height-tight);
    font-size: var(--font-size-large);
    font-family: var(--font-display);
    border-top-left-radius: var(--border-radius-xl);
    border-top-right-radius: var(--border-radius-xl);
    border: 1px solid var(--color-stroke-weak);
}

.library-page__category-header .icon {
    display: inline-block;
    margin-left: var(--space-large);
}

.grouped .library-item--list:first-child {
    border-radius: 0;
    border-top: none;
}


/* === Empty State (no search/filter results) === */

.library-page__empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-medium);
    background-color: var(--color-surface-weak);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--color-stroke-weak);
    padding: var(--space-large);
    padding-bottom: calc(var(--space-large) + var(--space-medium));
    margin-bottom: var(--space-xxl);
}

.library-page__empty-state[hidden] {
    display: none;
}

.library-page__empty-state-image {
    width: 488px;
    height: auto;
    aspect-ratio: 488 / 416;
    max-width: 100%;
}

.library-page__empty-state-image--dark {
    display: none;
}

html.dark .library-page__empty-state-image--light {
    display: none;
}

html.dark .library-page__empty-state-image--dark {
    display: block;
}

.library-page__empty-state-message {
    margin: 0;
    padding: 0;
    text-align: center;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: var(--font-size-medium);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-default);
    letter-spacing: var(--letter-spacing-tight);
}

.library-page__empty-state--in-list {
    list-style: none;
    width: 100%;
    grid-column: 1 / -1;
    padding: var(--space-xl) 0;
    border: none;
    margin-bottom: 0;
}


/* === Mobile Overrides (< 768px) === */

@media (max-width: 767px) {
    .library-page__list-header {
        display: none;
    }

    .library-page-hero .hero-search-bar {
        width: 100%;
    }

    .library-page-hero {
        grid-template-areas:
            "c"
            "a"
            "b"
        ;
        grid-template-columns: 100%;
        justify-items: start;
    }

    .library-page__container {
        margin-left: var(--space-medium);
        margin-right: var(--space-medium);
    }

    .library-page__empty-state-image {
        width: 100%;
    }
}
