﻿/* Codex Section */
.codex-section {
    padding-bottom: 5rem;
}

.codex-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

/* Sidebar */
.codex-filter {
    position: sticky;
    top: 6rem;
    padding: 1.25rem;
    border-radius: var(--mp-radius);
}

.codex-filter-header h2 {
    margin: .75rem 0 .45rem;
    font-size: 2rem;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -.045em;
}

.codex-filter-header p {
    color: var(--mp-muted);
    margin-bottom: 1.25rem;
    font-size: .95rem;
}

.codex-filter-list {
    display: grid;
    gap: .65rem;
}

/* Filter Buttons */
.filter-pill {
    width: 100%;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem .95rem;
    border-radius: 999px;
    border: 1px solid var(--mp-border);
    color: var(--mp-text);
    background: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .035)), rgba(13, 13, 26, .82);
    font-weight: 850;
    text-align: left;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

    .filter-pill i {
        color: var(--mp-gold);
        font-size: 1rem;
    }

    .filter-pill:hover {
        transform: translateY(-2px);
        border-color: rgba(246, 200, 95, .55);
        background: rgba(255, 255, 255, .09);
        box-shadow: 0 14px 38px rgba(0, 0, 0, .22);
    }

    .filter-pill.active {
        color: #111122;
        border-color: transparent;
        background: linear-gradient(135deg, var(--mp-gold), #fff2b8);
        box-shadow: 0 16px 42px rgba(246, 200, 95, .18);
    }

        .filter-pill.active i {
            color: #111122;
        }

/* Content */
.codex-content {
    min-width: 0;
}

.codex-list {
    display: grid;
    gap: 1rem;
}

/* Entry Card */
.codex-entry {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 1.25rem;
    min-height: 220px;
    padding: 1.25rem;
    border-radius: var(--mp-radius);
    background: rgba(255, 255, 255, .065);
    border: 1px solid var(--mp-border);
    box-shadow: 0 16px 44px rgba(0, 0, 0, .18);
    overflow: hidden;
    transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

    .codex-entry::before {
        content: "";
        position: absolute;
        inset: auto 1.25rem 0;
        height: 3px;
        border-radius: 999px 999px 0 0;
        background: linear-gradient(90deg, var(--mp-gold), var(--mp-purple), var(--mp-blue));
        opacity: .85;
    }

    .codex-entry:hover {
        transform: translateY(-4px);
        border-color: rgba(124, 140, 255, .55);
        background: rgba(255, 255, 255, .09);
        box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
    }

.codex-entry-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.codex-entry h3 {
    margin: .7rem 0 .7rem;
    font-size: clamp(1.35rem, 3vw, 2rem);
    line-height: 1;
    font-weight: 950;
    letter-spacing: -.035em;
}

.codex-entry p {
    max-width: 760px;
    color: var(--mp-muted);
    margin-bottom: 1.25rem;
}

/* Tags */
.tag {
    display: inline-flex;
    width: fit-content;
    padding: .38rem .7rem;
    border-radius: 999px;
    color: #111122;
    background: linear-gradient(135deg, var(--mp-gold), #fff2b8);
    font-size: .72rem;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Meta */
.codex-meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.meta {
    display: inline-flex;
    width: fit-content;
    padding: .45rem .7rem;
    border-radius: 999px;
    color: var(--mp-muted);
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .1);
    font-size: .82rem;
    font-weight: 800;
}

/* Image */
.codex-image-wrap {
    position: relative;
    z-index: 2;
    border-radius: calc(var(--mp-radius) - .35rem);
    overflow: hidden;
    background: rgba(0, 0, 0, .22);
    border: 1px solid rgba(255, 255, 255, .1);
}

.codex-img {
    width: 100%;
    height: 100%;
    min-height: 180px;
    object-fit: cover;
    display: block;
    transition: transform .25s ease, opacity .25s ease;
}

.codex-entry:hover .codex-img {
    transform: scale(1.04);
    opacity: .92;
}

/* Entry with no image */
.codex-entry:not(:has(.codex-image-wrap)) {
    grid-template-columns: 1fr;
}

/* Responsive */
@media (max-width: 991.98px) {
    .codex-layout {
        grid-template-columns: 1fr;
    }

    .codex-filter {
        position: relative;
        top: auto;
    }

    .codex-filter-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .filter-pill {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 767.98px) {
    .codex-entry {
        grid-template-columns: 1fr;
    }

    .codex-image-wrap {
        order: -1;
    }

    .codex-img {
        max-height: 260px;
    }
}

@media (max-width: 575.98px) {
    .codex-filter,
    .codex-entry {
        border-radius: var(--mp-radius);
    }

    .codex-filter-list {
        grid-template-columns: 1fr;
    }
}
