/* Middle-earth Archive Master Stylesheet */

:root {
    --bg-color: #0a0a0a;
    --accent-gold: #d4af37;
    --text-main: #e0e0e0;
    --panel-bg: rgba(20, 20, 20, 0.95);
    --stone-grey: #2b2b2e;
}

/* 1. GLOBAL RESET & BASE */
* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

body {
    background: #0a0a0a url('../img/background.webp') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main);
    font-family: 'Georgia', serif;
}

/* 2. LAYOUT CONTAINERS */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(to bottom, #000, transparent);
}

header h1 {
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 6px;
    font-size: 2.5rem;
    margin: 0;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

/* 3. WIKI ENGINE LAYOUT */
.wiki-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    background: var(--panel-bg);
    border: 1px solid #333;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    padding: 40px;
    margin-top: 20px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
}

/* 4. NAVIGATION */
nav {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Target only top-level links */
nav>a,
.dropbtn,
.nav-dropdown-toggle {
    background: var(--stone-grey);
    color: var(--accent-gold);
    text-decoration: none;
    padding: 12px 20px;
    border: 1px solid #444;
    border-bottom: 3px solid var(--accent-gold);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: 'Georgia', serif;
}

nav>a:hover,
.dropbtn:hover,
.nav-dropdown-toggle:hover {
    background: var(--accent-gold);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

/* 5. DROPDOWN SYSTEM */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #1a1a1a;
    min-width: 220px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 1);
    z-index: 1000;
    border: 1px solid #444;
    right: 0;
    top: 100%;
    /* This padding-top acts as an invisible bridge for the mouse */
    padding-top: 5px;
}

/* Reset dropdown links so they don't look like main buttons */
.dropdown-content a {
    color: #ccc !important;
    padding: 14px 20px !important;
    text-decoration: none !important;
    display: block !important;
    font-size: 0.85rem !important;
    text-transform: none !important;
    border: none !important;
    border-bottom: 1px solid #333 !important;
    background: transparent !important;
    transition: 0.2s;
    font-weight: normal !important;
    letter-spacing: 0px !important;
}

.dropdown-content a:hover {
    background-color: #2a2a2a !important;
    color: var(--accent-gold) !important;
    padding-left: 25px !important;
    /* Slight nudge on hover */
    transform: none !important;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* 6. TYPOGRAPHY & LINKS */
.article-body {
    text-align: justify;
    font-size: 1.15rem;
    color: #ccc;
}

.main-content a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: 0.3s;
}

.wiki-link {
    font-weight: bold;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.main-content a:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--accent-gold);
    border-bottom: 1px solid var(--accent-gold);
}

/* 7. INFOBOX */
.infobox {
    background: #111;
    border: 1px solid var(--accent-gold);
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.5);
}

.infobox-title {
    background: var(--accent-gold);
    color: #000;
    text-align: center;
    font-weight: bold;
    padding: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.infobox-table {
    width: 100%;
    padding: 10px;
}

.infobox-table th {
    text-align: left;
    color: var(--accent-gold);
    font-size: 0.8rem;
    text-transform: uppercase;
    width: 40%;
}

.infobox-table td {
    font-size: 0.9rem;
    padding: 5px;
}

/* 8. TIMELINE CUSTOMS */
.timeline-container {
    position: relative;
    padding-left: 40px;
    border-left: 2px solid var(--accent-gold);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -47px;
    top: 5px;
    width: 12px;
    height: 12px;
    background: var(--accent-gold);
    border-radius: 50%;
    border: 2px solid #000;
}

/* 9. MOBILE RESPONSIVENESS */
@media (max-width: 900px) {
    .wiki-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }
}

.featured-subject {
    position: relative;
    padding: 30px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
    transition: transform 0.3s ease;
}

.featured-subject:hover {
    transform: scale(1.01);
}

.archive-counter {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-family: 'Garamond', serif;
    font-style: italic;
    color: #555;
    border-top: 1px double #333;
    letter-spacing: 1px;
    text-transform: lowercase;
}

.count-number {
    color: var(--accent-gold);
    font-weight: bold;
}

/* Divider for the dropdown menu */
.admin-divider {
    height: 1px;
    background: #444;
    margin: 5px 15px;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    cursor: pointer;
    user-select: none;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    border: 1px solid #d4af37;
    border-radius: 6px;
    min-width: 200px;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 10px 18px;
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-dropdown-menu a:hover {
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
    padding-left: 22px;
}