/* --- VARIABLES --- */
:root {
    --bg-dark: #121212;
    --bg-panel: #1E1E1E;
    --crimson: #D32F2F;
    --red-accent: #C0392B;
    --gold: #F1C40F;
    --green: #2ECC71;
    --text-main: #E0E0E0;
    --text-muted: #A0A0A0;
    --font-header: 'Cinzel', serif;
    --font-body: 'Lato', sans-serif;
}

/* --- GLOBAL --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
a { text-decoration: none; transition: color 0.2s; }
.hidden { display: none !important; }

/* --- NAV --- */
/* Added relative positioning so mobile dropdown sits flush underneath */
nav { padding: 20px 0; background: #0a0a0a; border-bottom: 1px solid #333; position: relative; z-index: 10; }
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.brand { font-family: var(--font-header); font-weight: 900; font-size: 1.5rem; color: var(--gold); text-shadow: 2px 2px 0px #000; }

/* Mobile Toggle - Hidden on desktop */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 1.6rem;
    cursor: pointer;
    transition: color 0.3s;
}
.mobile-menu-toggle:hover {
    color: var(--crimson);
}

.nav-links a { color: var(--text-main); margin-left: 20px; font-weight: bold; text-transform: uppercase; font-size: 0.9rem; }
.nav-links a:hover { color: var(--crimson); }

/* --- LAYOUT --- */
.blog-layout {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    margin-bottom: 80px;
    align-items: flex-start;
}
.blog-main { flex: 1; min-width: 0; }
.blog-sidebar { width: 320px; flex-shrink: 0; position: sticky; top: 20px; }

/* --- LISTING VIEW --- */
.listing-header { border-bottom: 1px solid #333; margin-bottom: 30px; padding-bottom: 10px; }
.page-title { font-family: var(--font-header); color: var(--gold); font-size: 2.2rem; line-height: 1.2; }
.page-subtitle { color: var(--text-muted); font-size: 1rem; }

.post-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }

/* Post Card */
.post-card {
    background: linear-gradient(to bottom, #2A2A2A, #101010);
    border: 1px solid #444; border-radius: 12px;
    overflow: hidden; display: flex; flex-direction: column;
    transition: transform 0.2s, border-color 0.2s;
}
.post-card:hover { transform: translateY(-5px); border-color: var(--gold); }

.hero-card { grid-column: 1 / -1; flex-direction: row; border-color: var(--crimson); }
.hero-card .card-img { width: 55%; padding-top: 0; min-height: 300px; }
.hero-card .card-content { width: 45%; justify-content: center; padding: 40px; }

.card-img {
    width: 100%; padding-top: 56.25%; /* 16:9 */
    background-size: cover; background-position: center;
    border-bottom: 1px solid #333;
}
.card-content { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.card-content h2 { font-family: var(--font-header); color: #fff; font-size: 1.3rem; margin: 10px 0; line-height: 1.3; }
.card-content p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 15px; flex-grow: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 0.8rem; color: #777; font-style: italic; margin-top: auto; }
.hero-card .card-content p { -webkit-line-clamp: 5; }

/* Tags */
.card-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.tag {
    background: rgba(241, 196, 15, 0.1); color: var(--gold);
    border: 1px solid var(--gold); padding: 2px 8px; border-radius: 4px;
    font-size: 0.7rem; font-weight: bold; text-transform: uppercase;
}
.tag:hover, .tag.active { background: var(--gold); color: #000; }

/* Special Pinned Tag Styling */
.tag.pinned-badge { background: var(--crimson); color: #fff; border-color: var(--crimson); }
.tag.pinned-badge:hover { background: var(--red-accent); color: #fff; }

/* --- SIDEBAR WIDGETS --- */
.sidebar-widget {
    background: #1E1E1E; border: 1px solid #333;
    border-radius: 12px; padding: 20px; margin-bottom: 25px;
}
.sidebar-widget h3 {
    font-family: var(--font-header); color: var(--text-main);
    margin-bottom: 15px; border-bottom: 1px solid #444; padding-bottom: 8px;
    font-size: 1.2rem;
}

/* Tag Cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag .count { opacity: 0.6; font-size: 0.7em; margin-left: 3px; }

/* Leaderboard Widget */
.leaderboard-widget { padding: 0; overflow: hidden; }
.leaderboard-widget h3 { margin: 15px 15px 10px; }

.lb-tabs { display: flex; border-bottom: 1px solid #444; }
.lb-tab {
    flex: 1; background: #222; border: none; color: #888;
    padding: 10px; font-weight: bold; cursor: pointer;
    font-family: var(--font-header); font-size: 0.8rem;
    transition: all 0.2s;
}
.lb-tab:hover { background: #333; color: #ccc; }
.lb-tab.active { background: #1E1E1E; color: var(--gold); border-bottom: 2px solid var(--gold); }

.lb-list { padding: 10px; min-height: 100px; }
.lb-loading { text-align: center; color: #666; font-size: 0.9rem; padding: 20px 0; font-style: italic; }

.lb-row {
    display: flex; align-items: center; padding: 8px;
    border-radius: 6px; margin-bottom: 5px; background: rgba(0,0,0,0.2);
    border: 1px solid #333; font-size: 0.9rem;
}
.lb-rank { width: 25px; font-weight: bold; color: #666; font-family: var(--font-header); }
.lb-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.lb-score { font-weight: bold; color: var(--text-main); font-family: var(--font-header); }

/* Rank Colors */
.lb-row.gold { border-color: var(--gold); background: rgba(241, 196, 15, 0.1); }
.lb-row.gold .lb-rank, .lb-row.gold .lb-score { color: var(--gold); }
.lb-row.silver { border-color: #C0C0C0; }
.lb-row.silver .lb-rank { color: #C0C0C0; }
.lb-row.bronze { border-color: #CD7F32; }
.lb-row.bronze .lb-rank { color: #CD7F32; }

.lb-footer {
    text-align: center; padding: 10px; background: #151515; border-top: 1px solid #333;
}
.lb-footer a { color: var(--text-muted); font-size: 0.8rem; }
.lb-footer a:hover { color: var(--gold); }

/* --- SINGLE ARTICLE --- */
.single-post {
    background: #1a1a1a; border: 1px solid #333; border-radius: 12px; padding: 40px;
}
.back-link { display: inline-block; margin-bottom: 15px; color: var(--gold); font-size: 0.9rem; font-weight: bold; }
.post-header h1 { font-family: var(--font-header); color: var(--gold); font-size: 2.5rem; margin-bottom: 10px; line-height: 1.1; }
.post-meta { display: flex; flex-wrap: wrap; gap: 20px; color: #888; border-bottom: 1px solid #333; padding-bottom: 20px; margin-bottom: 30px; align-items: center; }
.meta-tags { margin-left: auto; display: flex; gap: 5px; }
.meta-tag { background: #333; color: #ccc; font-size: 0.7rem; padding: 2px 6px; border-radius: 3px; }

.single-hero-img {
    width: 100%; height: 350px; border-radius: 8px;
    background-size: cover; background-position: center;
    border: 1px solid #444; margin-bottom: 30px;
}

/* CONTENT STYLING */
.post-content { font-size: 1.1rem; color: #ddd; line-height: 1.8; display: flow-root; }

/* Headers */
.post-content h3 { 
    font-family: var(--font-header); color: var(--crimson); 
    margin: 40px 0 15px; font-size: 1.6rem; 
    border-bottom: 1px solid #333; padding-bottom: 5px; 
    display: inline-block; clear: both; 
}

.post-content a {
    color: #BE93FD;
    text-decoration: underline;
    text-decoration-color: rgba(190, 147, 253, 0.4);
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.post-content a:hover {
    color: var(--gold);
    text-decoration-color: var(--gold);
}

/* Paragraphs & Text */
.post-content p { margin-bottom: 20px; }
.post-content strong { color: #fff; }
.post-content em { font-style: italic; color: var(--text-muted); }

/* Lists */
.post-content ul {
    margin-bottom: 25px;
    margin-left: 0px; 
    padding-left: 0;
    list-style: none; 
}
.post-content li {
    display: table; 
    color: #ccc;
    position: relative;
}
.post-content li::before {
    content: "■";
    color: var(--gold);
    display: table-cell; 
    padding-right: 12px;
    font-size: 0.8rem;
    vertical-align: top;
    padding-top: 4px;
}

/* Shortcode Images */
.post-img-wrapper { margin: 0; }

.post-img-caption {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: left;
    padding: 0 10px;
    border-left: 2px solid var(--crimson); /* Adds a nice "dungeon" detail */
}

/* Adjustments for floated images to ensure captions don't break the layout */
.align-left .post-img-caption, .align-right .post-img-caption {
    font-size: 0.8rem;
}

.post-img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid #444; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.align-center { text-align: center; }
.align-left { float: left; margin: 5px 30px 15px 0; max-width: 45%; }
.align-right { float: right; margin: 5px 0 15px 30px; max-width: 45%; }

/* --- CTA BLOCK --- */
.post-cta { 
    margin-top: 60px; padding: 30px; text-align: center; 
    background: linear-gradient(to right, #1E1E1E, rgba(211,47,47,0.1), #1E1E1E); 
    border: 1px solid var(--crimson); border-radius: 12px; 
    clear: both; 
}
.post-cta h3 { font-family: var(--font-header); color: #fff; margin-bottom: 10px; font-size: 1.4rem; }
.cta-group { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-top: 20px; }

/* Buttons */
.btn { 
    padding: 12px 25px; border-radius: 6px; 
    text-decoration: none; font-weight: bold; font-size: 1.1rem; 
    display: inline-flex; align-items: center; gap: 8px; 
    transition: transform 0.2s, box-shadow 0.2s; font-family: var(--font-header); 
}
.btn:hover { transform: translateY(-3px); }
.btn-primary { background: linear-gradient(135deg, var(--gold), #d4ac0d); color: #1a1a1a; box-shadow: 0 5px 15px rgba(241,196,15,0.3); }
.btn-secondary { background: transparent; border: 2px solid var(--crimson); color: var(--crimson); }
.btn-secondary:hover { background: var(--crimson); color: #fff; box-shadow: 0 5px 15px rgba(211,47,47,0.4); }

/* --- FOOTER --- */
footer { padding: 60px 0 20px; text-align: center; background: #0a0a0a; border-top: 1px solid #333; margin-top: auto; }
footer h3 { font-family: var(--font-header); color: var(--text-main); margin-bottom: 10px; }
.contact-link { color: var(--gold); font-size: 1.2rem; font-weight: bold; text-decoration: none; }
.footer-bottom { margin-top: 40px; font-size: 0.8rem; color: #555; }

/* --- PAGINATION --- */
.pagination { display: flex; justify-content: center; gap: 15px; margin-top: 40px; align-items: center; }
.btn-page { background: #333; color: #ccc; padding: 8px 15px; border-radius: 4px; border: 1px solid #555; font-size: 0.9rem; font-weight: bold; }
.btn-page:hover { border-color: var(--gold); color: var(--gold); }
.page-info { color: #666; font-size: 0.9rem; }

/* --- RESPONSIVE --- */

/* Mobile Nav Query (added specifically for Dropdown nav) */
@media (max-width: 768px) {
    .mobile-menu-toggle { display: block; }
    
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #0a0a0a;
        border-bottom: 1px solid #333;
        flex-direction: column;
        text-align: center;
        box-shadow: 0 10px 20px rgba(0,0,0,0.8);
    }
    .nav-links.active { display: flex; }
    .nav-links a {
        margin: 0;
        padding: 15px 0;
        border-bottom: 1px solid #222;
        display: block;
    }
    .nav-links a:last-child { border-bottom: none; }
}

@media (max-width: 900px) {
    .blog-layout { flex-direction: column; }
    .blog-sidebar { width: 100%; position: static; }
    .hero-card { flex-direction: column; }
    .hero-card .card-img, .hero-card .card-content { width: 100%; }
}

@media (max-width: 600px) {
    .post-grid { grid-template-columns: 1fr; }
    .single-post { padding: 20px; }
    .align-left, .align-right { float: none; max-width: 100%; margin: 20px auto; display: block; }
    .post-header h1 { font-size: 2rem; }
    .cta-group { flex-direction: column; width: 100%; }
    .btn { width: 100%; justify-content: center; }
}