:root {
    --library-ink: #16363a;
    --library-muted: #617377;
    --library-surface: #ffffff;
    --library-soft: #f5f7f8;
    --library-navy: #16176b;
    --library-purple: #4f1387;
    --library-orange: #ff6b35;
    --library-gold: #d6a72b;
    --library-border: #dfe6e8;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.library-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.library-kicker {
    display: inline-block;
    color: var(--library-orange);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .18em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.library-hero {
    background: linear-gradient(135deg, #17196c 0%, #52148b 100%);
    color: #fff;
    padding: clamp(56px, 7vw, 90px) 0;
}

.library-hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, .65fr);
    gap: clamp(32px, 6vw, 80px);
    align-items: center;
}

.library-hero h1 {
    margin: 0 0 20px;
    font-size: clamp(2.3rem, 5vw, 4.7rem);
    line-height: 1.02;
    letter-spacing: -.045em;
    max-width: 900px;
}

.library-hero__copy > p {
    max-width: 780px;
    font-size: clamp(1rem, 1.5vw, 1.18rem);
    line-height: 1.75;
    color: rgba(255,255,255,.84);
}

.library-hero__actions,
.library-path__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.library-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 800;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.library-button:hover { transform: translateY(-2px); }
.library-button--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--library-orange), var(--library-gold));
    box-shadow: 0 12px 28px rgba(255,107,53,.18);
}
.library-button--secondary {
    color: inherit;
    border: 1px solid currentColor;
    background: transparent;
}

.library-hero__summary {
    display: grid;
    gap: 12px;
}

.library-hero__summary > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.14);
}

.library-hero__summary strong { font-size: 1.8rem; }
.library-hero__summary span { color: rgba(255,255,255,.74); font-size: .9rem; text-align: right; }

.library-catalogue {
    background: var(--library-soft);
    padding: clamp(58px, 7vw, 88px) 0;
}

.library-section-heading {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.library-section-heading h2,
.library-path h2 {
    margin: 0 0 10px;
    color: var(--library-ink);
    font-size: clamp(2rem, 3.5vw, 3.1rem);
    line-height: 1.08;
}

.library-section-heading p,
.library-path p {
    margin: 0;
    color: var(--library-muted);
    line-height: 1.65;
    max-width: 780px;
}

.library-toolbar {
    display: grid;
    gap: 16px;
    margin-bottom: 30px;
}

.library-search input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--library-border);
    border-radius: 10px;
    background: #fff;
    color: var(--library-ink);
    font: inherit;
    padding: 0 16px;
    outline: none;
}

.library-search input:focus {
    border-color: var(--library-purple);
    box-shadow: 0 0 0 3px rgba(79,19,135,.1);
}

.library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.library-filter {
    border: 1px solid var(--library-border);
    background: #fff;
    color: var(--library-ink);
    border-radius: 999px;
    padding: 9px 13px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.library-filter span {
    color: var(--library-muted);
    font-size: .76rem;
    margin-left: 4px;
}

.library-filter.is-active {
    background: var(--library-navy);
    color: #fff;
    border-color: var(--library-navy);
}
.library-filter.is-active span { color: rgba(255,255,255,.7); }

.library-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px;
    align-items: stretch;
}

.library-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: 16px;
    overflow: hidden;
    background: var(--library-surface);
    border: 1px solid var(--library-border);
    box-shadow: 0 12px 32px rgba(22,54,58,.08);
    transition: transform .22s ease, box-shadow .22s ease;
}

.library-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px rgba(22,54,58,.12);
}

.library-card[hidden] { display: none !important; }

.library-card__cover,
.library-card__media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 250px;
    overflow: hidden;
    text-decoration: none;
    background: #0c2a42;
}

.library-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #0c2a42;
}

.library-card__media {
    min-height: 280px;
    flex-direction: column;
    gap: 10px;
    color: #fff;
    text-align: center;
}
.library-card__media--audio { background: linear-gradient(135deg, #172069, #23529a); }
.library-card__media--video { background: linear-gradient(135deg, #76202b, #b33b35); }
.library-card__media--articles { background: linear-gradient(135deg, #17545a, #27838c); }
.library-card__media--training { background: linear-gradient(135deg, #5a3c10, #b47b15); }
.library-card__media--other { background: linear-gradient(135deg, #333, #666); }

.library-card__media-icon { font-size: 4.2rem; }
.library-card__media-type { font-size: .82rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }

.library-card__access {
    position: absolute;
    left: 14px;
    bottom: 14px;
    color: #fff;
    background: rgba(6,27,42,.86);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .06em;
}

.library-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px;
}

.library-card__eyebrow {
    color: var(--library-orange);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 7px;
}

.library-card h3 {
    margin: 0 0 10px;
    font-size: 1.13rem;
    line-height: 1.35;
    color: var(--library-ink);
}

.library-card h3 a { color: inherit; text-decoration: none; }
.library-card h3 a:hover { color: var(--library-purple); }

.library-card__body > p {
    color: var(--library-muted);
    font-size: .9rem;
    line-height: 1.58;
    margin: 0 0 18px;
}

.library-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--library-border);
}

.library-card__stats,
.library-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.library-card__stats { color: var(--library-muted); font-size: .78rem; }
.library-card__actions a { color: var(--library-navy); text-decoration: none; font-size: .82rem; font-weight: 900; }
.library-card__actions a:hover { color: var(--library-orange); }

.library-state,
.library-no-results {
    text-align: center;
    padding: 48px 24px;
    border-radius: 14px;
    background: #fff;
    border: 1px dashed var(--library-border);
    color: var(--library-muted);
}
.library-state strong,
.library-no-results strong { display: block; color: var(--library-ink); font-size: 1.2rem; margin-bottom: 5px; }
.library-state--error { border-color: #e3a2a2; }

.library-path {
    padding: clamp(48px, 6vw, 76px) 0;
    background: #fff;
}
.library-path__grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 36px;
    align-items: center;
}
.library-path__actions { margin-top: 0; justify-content: flex-end; }
.library-path .library-button--secondary { color: var(--library-navy); }

@media (max-width: 980px) {
    .library-hero__inner { grid-template-columns: 1fr; }
    .library-hero__summary { grid-template-columns: repeat(3, 1fr); }
    .library-hero__summary > div { flex-direction: column; align-items: flex-start; }
    .library-hero__summary span { text-align: left; }
    .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .library-path__grid { grid-template-columns: 1fr; }
    .library-path__actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
    .library-shell { width: min(100% - 28px, 1180px); }
    .library-hero { padding: 46px 0; }
    .library-hero__summary { grid-template-columns: 1fr; }
    .library-grid { grid-template-columns: 1fr; }
    .library-card__cover, .library-card__media { min-height: 230px; }
    .library-card__footer { align-items: flex-start; flex-direction: column; }
    .library-button { width: 100%; }
}
