
.lore-hero {
    min-height: 380px;
    background:
        linear-gradient(rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.9)),
        url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?q=80&w=1470&auto=format&fit=crop')
        center/cover no-repeat scroll;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--accent-gold);
    position: relative;
}

.lore-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(251, 191, 36, 0.04) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

.lore-hero-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
}

.lore-hero-content {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.lore-hero-content h1 {
    font-family: 'Cinzel', serif;
    font-size: 3.2rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
    text-shadow: 0 2px 20px rgba(251, 191, 36, 0.3);
}

.lore-hero-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}


.search-container {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

#loreSearch {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    color: var(--primary-dark);
    outline: none;
}

#loreSearchBtn {
    padding: 1rem 1.5rem;
    background: var(--accent-purple);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

#loreSearchBtn:hover {
    background: var(--accent-gold);
}

.lore-filter-controls {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.filter-group h3 {
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-tag {
    padding: 0.5rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--text-light);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.filter-tag:hover {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.1);
}

.filter-tag.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

.lore-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/*  340px minimum keeps cards readable.*/
.lore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}


.lore-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-left: 4px solid var(--accent-gold); /* overridden per category by JS */
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    transform: translateY(20px);
    animation: loreCardIn 0.5s forwards;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.lore-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-purple);
}

@keyframes loreCardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hidden state for show-more feature */
.lore-card.hidden-card {
    display: none !important;
}

.lore-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lore-category-tag {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    /* color and background set by JS per category */
}

.lore-read-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}


.lore-card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--accent-gold);
    line-height: 1.3;
    margin: 0;
}


.lore-card-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}


.lore-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
}

.lore-card-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lore-read-btn {
    background: transparent;
    border: 1.5px solid var(--accent-purple);
    color: var(--accent-purple);
    padding: 0.45rem 1.1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lore-read-btn:hover {
    background: var(--accent-purple);
    color: white;
}


.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-results i {
    color: var(--accent-purple);
    margin-bottom: 1rem;
    display: block;
}


.show-more-btn {
    display: block;
    margin: 2rem auto 0;
    padding: 0.8rem 2.5rem;
    background: transparent;
    border: 2px solid var(--accent-purple);
    color: var(--accent-purple);
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.show-more-btn:hover {
    background: var(--accent-purple);
    color: white;
}


.lore-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1001;
    overflow-y: auto;
    padding: 2rem 1rem;
}


.lore-modal-content {
    background: #1a2540;
    max-width: 720px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    border: 1px solid rgba(251, 191, 36, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}


.lore-modal-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.lore-modal-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--accent-gold), var(--accent-purple));
}

.lore-modal-category {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 1rem;
}

.lore-modal-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.lore-modal-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.lore-modal-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}


.lore-modal-text {
    padding: 2rem;
}

.lore-story-body {
    font-family: 'Roboto', sans-serif;
    font-size: 1.05rem;
    line-height: 1.95;
    color: #c8d6e5;
    max-width: 65ch;
    margin: 0 auto;
}

.lore-story-body p {
    margin-bottom: 1.4rem;
}


.lore-story-body p:first-child::first-letter {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--accent-gold);
    float: left;
    line-height: 0.8;
    margin: 0.1em 0.1em 0 0;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}


.lore-story-body p + p {
    text-indent: 1.5em;
    margin-bottom: 1.4rem;
}

.lore-inline-image {
    width: 100%;
    max-width: 500px;
    display: block;
    margin: 1.5rem auto;
    border-radius: var(--border-radius);
    border: 1px solid rgba(251, 191, 36, 0.2);
    opacity: 0.9;
}


.close-lore-modal {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: var(--text-light);
    font-size: 1.4rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 1100;
    line-height: 1;
}

.close-lore-modal:hover {
    background: var(--accent-gold);
    color: var(--primary-dark);
    border-color: var(--accent-gold);
}


@media (max-width: 768px) {
    .lore-hero-content h1 {
        font-size: 2.2rem;
    }

    .lore-hero {
        min-height: auto;
        padding: 3rem 1rem;
    }

    .lore-grid {
        grid-template-columns: 1fr;
    }

    .lore-modal {
        padding: 0;
    }

    .lore-modal-content {
        border-radius: 0;
        min-height: 100dvh;
    }

    .lore-modal-title {
        font-size: 1.5rem;
    }

    .lore-story-body {
        font-size: 1rem;
    }

    .lore-filter-controls {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .lore-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .lore-read-btn {
        width: 100%;
        justify-content: center;
    }

    .lore-story-body p:first-child::first-letter {
        font-size: 2.5rem;
    }
}