/* =========================
   TOLKIEN ENCYCLOPEDIA UI
   Refined dark fantasy appearance
   ========================= */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'Georgia', serif;
    background: radial-gradient(circle at top, #19231a, #090c08 62%);
    color: #e8eadf;
    line-height: 1.6;
}

#app {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 22px 42px;
}

header {
    padding: 52px 0 18px;
    text-align: center;
}

header h1 {
    font-size: clamp(2.4rem, 4vw, 4rem);
    letter-spacing: 0.24em;
    color: #d1af4e;
    text-shadow: 0 0 20px rgba(209, 175, 78, 0.2);
}

header p {
    margin-top: 12px;
    color: #b5b99c;
    font-size: 1rem;
}

#search {
    display: block;
    width: min(760px, 100%);
    margin: 28px auto 34px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(19, 26, 19, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #eef0dd;
    font-size: 1rem;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#search::placeholder {
    color: #8f9b77;
}

#search:focus {
    border-color: #d1af4e;
    box-shadow: 0 0 24px rgba(209, 175, 78, 0.18);
}

section {
    margin-bottom: 42px;
}

h2 {
    margin-bottom: 22px;
    color: #d1af4e;
    font-size: 1.85rem;
    border-left: 5px solid rgba(209, 175, 78, 0.8);
    padding-left: 12px;
}

.grid {
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
    background: rgba(21, 29, 23, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
    background: rgba(29, 39, 31, 0.96);
    border-color: rgba(209, 175, 78, 0.28);
}

.card h3 {
    color: #f4df86;
    margin-bottom: 14px;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
}

.card p {
    color: #c8caaa;
    font-size: 0.98rem;
    line-height: 1.72;
    min-height: 74px;
}

.badge {
    display: inline-flex;
    align-items: center;
    margin-top: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    background: rgba(209, 175, 78, 0.12);
    color: #e7d896;
    border: 1px solid rgba(209, 175, 78, 0.22);
}

.timeline {
    position: relative;
    padding-left: 32px;
    border-left: 2px solid rgba(255, 255, 255, 0.08);
}

.timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, rgba(209, 175, 78, 0.9), rgba(209, 175, 78, 0.05));
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
    padding-left: 28px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d1af4e;
    box-shadow: 0 0 16px rgba(209, 175, 78, 0.22);
}

.timeline-year {
    display: inline-block;
    margin-bottom: 6px;
    color: #f4df86;
    font-weight: 700;
    font-size: 1rem;
}

.timeline-item p {
    color: #b8bca1;
    font-size: 0.98rem;
    line-height: 1.7;
}

.empty-state {
    margin: 50px auto;
    max-width: 680px;
    padding: 26px;
    border-radius: 16px;
    background: rgba(23, 30, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.empty-state p {
    color: #c7c9ad;
    font-size: 1rem;
    line-height: 1.7;
}

footer {
    text-align: center;
    margin-top: 18px;
    padding: 28px 0 12px;
    color: #9ca289;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

a {
    color: #d1af4e;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

@media (max-width: 800px) {
    #search {
        width: 100%;
    }

    .card p {
        min-height: auto;
    }
}

@media (max-width: 640px) {
    h2 {
        font-size: 1.55rem;
    }

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