.tmf-library {
    --tmf-library-bg: #181818;
    --tmf-library-shell: #262626;
    --tmf-library-panel: #202020;
    --tmf-library-panel-raised: #252525;
    --tmf-library-text: #dedede;
    --tmf-library-muted: #999999;
    --tmf-library-line: #414141;
    --tmf-library-red: #f05454;
    --tmf-library-cream: #f4efe6;
    --tmf-library-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    display: grid;
    max-width: 1200px;
    gap: 46px;
    margin: 30px auto;
    padding: 25px;
    border-radius: 10px;
    background: var(--tmf-library-shell);
    color: var(--tmf-library-text);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.tmf-library *,
.tmf-library *::before,
.tmf-library *::after {
    box-sizing: border-box;
}

.tmf-library a {
    color: inherit;
}

.tmf-library-kicker,
.tmf-library-collection-eyebrow {
    margin: 0 0 8px;
    color: var(--tmf-library-red);
    font-size: 0.71rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* Hero */
.tmf-library-hero {
    position: relative;
    display: flex;
    min-height: 360px;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--tmf-library-line);
    border-radius: 8px;
    background:
        radial-gradient(circle at 80% 35%, rgba(240, 84, 84, 0.12), transparent 34%),
        #171717;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.tmf-library-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 4;
    border-top: 3px solid var(--tmf-library-red);
    pointer-events: none;
}

.tmf-library-hero-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 32%;
}

.tmf-library-hero-shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        90deg,
        rgba(14, 14, 14, 0.99) 0%,
        rgba(14, 14, 14, 0.96) 28%,
        rgba(14, 14, 14, 0.82) 50%,
        rgba(14, 14, 14, 0.35) 76%,
        rgba(14, 14, 14, 0.15) 100%
    );
}

.tmf-library-hero:not(.has-art) .tmf-library-hero-shade {
    background: linear-gradient(120deg, rgba(240, 84, 84, 0.08), transparent 55%);
}

.tmf-library-hero-copy {
    position: relative;
    z-index: 2;
    max-width: 690px;
    padding: 43px;
}

.tmf-library-hero h1 {
    max-width: 650px;
    margin: 8px 0 15px;
    color: #ffffff;
    font-size: clamp(2.35rem, 4.3vw, 3.45rem);
    line-height: 1.03;
    letter-spacing: -0.025em;
}

.tmf-library-lead {
    max-width: 625px;
    margin: 0;
    color: #d0d0d0;
    font-size: 1.04rem;
    line-height: 1.72;
}

/* Section headings */
.tmf-library-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--tmf-library-red);
}

.tmf-library-section-head h2 {
    margin: 5px 0 0;
    color: var(--tmf-library-red);
    font-size: clamp(1.7rem, 2.8vw, 1.95rem);
    line-height: 1.05;
}

/* Latest */
.tmf-library-latest-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.tmf-library-latest-card {
    display: flex;
    min-width: 0;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--tmf-library-line);
    border-radius: 8px;
    background: linear-gradient(180deg, #252525, var(--tmf-library-panel));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tmf-library-latest-card:hover {
    border-color: #625050;
    transform: translateY(-3px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.tmf-library-latest-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111111;
}

.tmf-library-latest-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.tmf-library-latest-card:hover .tmf-library-latest-media img {
    opacity: 0.9;
    transform: scale(1.025);
}

.tmf-library-content-type {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 8px;
    border-radius: 3px;
    background: rgba(18, 18, 18, 0.9);
    color: #ffffff;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tmf-library-latest-card--article .tmf-library-content-type {
    background: rgba(240, 84, 84, 0.94);
}

.tmf-library-latest-card--short .tmf-library-content-type {
    border: 1px solid rgba(240, 84, 84, 0.72);
}

.tmf-library-latest-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 17px 18px 18px;
}

.tmf-library-latest-body h3 {
    margin: 0 0 9px;
    color: #eeeeee;
    font-size: 1.04rem;
    line-height: 1.35;
}

.tmf-library-latest-body h3 a {
    text-decoration: none;
}

.tmf-library-latest-body h3 a:hover,
.tmf-library-latest-body h3 a:focus-visible {
    color: #ffffff;
}

.tmf-library-latest-body > p {
    display: -webkit-box;
    margin: 0 0 16px;
    overflow: hidden;
    color: #9a9a9a;
    font-size: 0.84rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.tmf-library-latest-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    color: #747474;
    font-size: 0.72rem;
}

.tmf-library-empty {
    padding: 22px;
    border: 1px solid var(--tmf-library-line);
    border-radius: 8px;
    background: var(--tmf-library-panel);
    color: var(--tmf-library-muted);
    text-align: center;
}

/* Explore The ManaForge */
.tmf-library-collection-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.tmf-library-collection {
    position: relative;
    display: flex;
    min-height: 286px;
    overflow: hidden;
    flex-direction: column;
    padding: 26px 28px 23px;
    border: 1px solid #4b4b4b;
    border-radius: 10px;
    background: linear-gradient(180deg, #252525, #1e1e1e);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    isolation: isolate;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.tmf-library-collection::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 3;
    width: 3px;
    background: var(--tmf-library-red);
    opacity: 0.82;
    pointer-events: none;
}

.tmf-library-collection:hover {
    border-color: #6d5353;
    transform: translateY(-4px);
    box-shadow: 0 17px 34px rgba(0, 0, 0, 0.3);
}

.tmf-library-collection-art {
    position: absolute;
    top: 0;
    right: 0;
    z-index: -3;
    width: 50%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.55) 6%, #000 14%, #000 100%);
    mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.55) 6%, #000 14%, #000 100%);
    filter: saturate(0.94) brightness(0.88);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.tmf-library-collection:hover .tmf-library-collection-art {
    transform: scale(1.025);
    filter: saturate(1.02) brightness(0.94);
}

#articles .tmf-library-collection-art { object-position: 48% center; }
#videos .tmf-library-collection-art { object-position: 52% center; }
#lorewalkers .tmf-library-collection-art { object-position: 50% center; }
#digest .tmf-library-collection-art { object-position: 50% center; }
#tools .tmf-library-collection-art { object-position: 52% center; }
#resources .tmf-library-collection-art { object-position: 50% center; }

.tmf-library-collection-shade {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: linear-gradient(
        90deg,
        rgba(30, 30, 30, 1) 0%,
        rgba(30, 30, 30, 0.99) 42%,
        rgba(30, 30, 30, 0.88) 58%,
        rgba(30, 30, 30, 0.42) 78%,
        rgba(30, 30, 30, 0.18) 100%
    );
}

.tmf-library-collection:not(.has-art) .tmf-library-collection-shade {
    background: linear-gradient(180deg, rgba(240, 84, 84, 0.025), transparent 55%);
}

.tmf-library-collection-copy,
.tmf-library-primary-link {
    position: relative;
    z-index: 1;
    width: min(64%, 600px);
}

.tmf-library-collection-eyebrow {
    margin-bottom: 7px;
}

.tmf-library-collection h3 {
    margin: 0 0 11px;
    color: #ffffff;
    font-size: 1.55rem;
    line-height: 1.12;
}

.tmf-library-collection-copy > p:not(.tmf-library-collection-eyebrow) {
    margin: 0;
    color: #b5b5b5;
    font-size: 0.9rem;
    line-height: 1.58;
}

/* Quiet two-column collection navigation; keep the primary CTA visually dominant. */
.tmf-library .tmf-library-link-list {
    display: grid;
    width: 100%;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin: 18px 0 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.tmf-library-link-list a {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #cccccc;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.45;
    text-decoration: none;
    box-shadow: none;
    transition: color 0.18s ease;
}

.tmf-library-link-list a::before {
    content: '›';
    flex: 0 0 auto;
    color: var(--tmf-library-red);
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1;
    transform: translateX(0);
    transition: color 0.18s ease, transform 0.18s ease;
}

.tmf-library-link-list a:hover,
.tmf-library-link-list a:focus-visible {
    background: transparent;
    color: #ffffff;
}

.tmf-library-link-list a:hover::before,
.tmf-library-link-list a:focus-visible::before {
    color: #ff6b6b;
    transform: translateX(3px);
}

.tmf-library-primary-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: #eeeeee;
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
}

.tmf-library-primary-link span {
    color: var(--tmf-library-red);
    font-size: 1.05rem;
    transition: transform 0.18s ease, color 0.18s ease;
}

.tmf-library-primary-link:hover,
.tmf-library-primary-link:focus-visible {
    color: #ffffff;
}

.tmf-library-primary-link:hover span,
.tmf-library-primary-link:focus-visible span {
    color: #ffffff;
    transform: translateX(4px);
}

.tmf-library-latest-media:focus-visible,
.tmf-library-latest-body h3 a:focus-visible,
.tmf-library-link-list a:focus-visible,
.tmf-library-primary-link:focus-visible {
    outline: 2px solid var(--tmf-library-red);
    outline-offset: 3px;
}

@media (max-width: 980px) {
    .tmf-library-latest-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tmf-library-collection-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .tmf-library {
        gap: 38px;
        margin: 20px auto;
        padding: 18px;
    }

    .tmf-library-hero {
        min-height: 330px;
    }

    .tmf-library-hero-copy {
        padding: 30px 26px;
    }

    .tmf-library-hero h1 {
        font-size: clamp(2.1rem, 9vw, 2.75rem);
    }

    .tmf-library-hero-shade {
        background: linear-gradient(
            90deg,
            rgba(14, 14, 14, 0.98),
            rgba(14, 14, 14, 0.88) 62%,
            rgba(14, 14, 14, 0.48)
        );
    }

    .tmf-library-latest-grid {
        grid-template-columns: 1fr;
    }

    .tmf-library-collection {
        min-height: 270px;
        padding: 24px 22px 21px;
    }

    .tmf-library-collection-art {
        width: 58%;
    }

    .tmf-library-collection-shade {
        background: linear-gradient(
            90deg,
            rgba(30, 30, 30, 1) 0%,
            rgba(30, 30, 30, 0.98) 48%,
            rgba(30, 30, 30, 0.75) 72%,
            rgba(30, 30, 30, 0.28) 100%
        );
    }

    .tmf-library-collection-copy,
    .tmf-library-primary-link {
        width: 70%;
    }
}

@media (max-width: 540px) {
    .tmf-library {
        padding: 14px;
        border-radius: 0;
    }

    .tmf-library-hero {
        min-height: 360px;
    }

    .tmf-library-hero-art {
        object-position: 60% 32%;
    }

    .tmf-library-hero-shade {
        background: linear-gradient(
            180deg,
            rgba(14, 14, 14, 0.46),
            rgba(14, 14, 14, 0.88) 48%,
            rgba(14, 14, 14, 0.98) 100%
        );
    }

    .tmf-library-hero-copy {
        align-self: flex-end;
        padding: 25px 21px;
    }

    .tmf-library-collection {
        min-height: 310px;
    }

    .tmf-library-collection-art {
        width: 100%;
        opacity: 0.65;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .tmf-library-collection-shade {
        background: linear-gradient(
            180deg,
            rgba(30, 30, 30, 0.42),
            rgba(30, 30, 30, 0.92) 55%,
            rgba(30, 30, 30, 1) 100%
        );
    }

    .tmf-library-collection-copy,
    .tmf-library-primary-link {
        width: 100%;
    }

    .tmf-library-collection-copy {
        margin-top: auto;
    }

    .tmf-library .tmf-library-link-list {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .tmf-library-latest-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}
