/* xanadu.wiki — Encyclopedia of Ideal Worlds */

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

/* ===== BASE ===== */
html {
    scroll-behavior: smooth;
}

body {
    background: #FFFFFF;
    color: #1A1A1A;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
}

/* ===== COMPASS ICON ===== */
.compass-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.section-marker {
    margin-right: 0.5rem;
    position: relative;
    top: -1px;
}

/* ===== HERO / PORTAL ===== */
.hero {
    padding: 4rem 2rem 3rem;
    text-align: center;
    border-bottom: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.hero-inner {
    max-width: 640px;
    margin: 0 auto;
}

.hero-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.hero-compass {
    width: 22px;
    height: 22px;
    animation: compassPulse 3s ease-in-out infinite;
}

@keyframes compassPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.hero-title {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 30px;
    color: #1A1A1A;
    letter-spacing: -0.01em;
}

.hero-sub {
    font-size: 1.1rem;
    color: #444444;
    margin-bottom: 1.5rem;
}

/* ===== SEARCH ===== */
.search-bar {
    margin-bottom: 1.25rem;
    position: relative;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-size: 0.95rem;
    font-family: 'Source Sans Pro', sans-serif;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background: #F5F5F5;
    color: #1A1A1A;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
    background: #FFFFFF;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    margin-top: 4px;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 280px;
    overflow-y: auto;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #444444;
    border-bottom: 1px solid #F5F5F5;
    transition: background 0.15s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #EDE9FE;
    color: #7C3AED;
}

.search-result-item strong {
    color: #7C3AED;
}

/* ===== CATEGORY NAV ===== */
.category-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.cat-link {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #444444;
    text-decoration: none;
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    border: 1px solid #E5E7EB;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.cat-link:hover {
    color: #7C3AED;
    border-color: #7C3AED;
    background: #EDE9FE;
}

.cat-link.active {
    color: #FFFFFF;
    background: #7C3AED;
    border-color: #7C3AED;
}

/* ===== FEATURED CARD ===== */
.featured-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    padding: 1.5rem;
    text-align: left;
    border-radius: 6px;
    transition: box-shadow 0.25s ease;
}

.featured-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.featured-badge {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    background: #FEF3C7;
    color: #92400E;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.featured-title {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 22px;
    color: #1A1A1A;
    margin-bottom: 0.4rem;
}

.featured-text {
    font-size: 0.95rem;
    color: #444444;
    margin-bottom: 0.75rem;
}

.featured-read-more {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #7C3AED;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s ease;
}

.featured-read-more:hover {
    color: #5B21B6;
}

/* ===== CONTENT LAYOUT (TWO-COLUMN) ===== */
.content-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    max-width: 1060px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    gap: 2.5rem;
}

/* ===== SIDEBAR / TOC ===== */
.sidebar {
    position: sticky;
    top: 2rem;
    align-self: start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.toc {
    background: #F5F5F5;
    padding: 1.25rem;
    border-radius: 6px;
}

.toc-heading {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 14px;
    color: #1A1A1A;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toc-link {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #444444;
    text-decoration: none;
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.1rem;
    border-left: 3px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.toc-link:hover {
    color: #7C3AED;
    background: #EDE9FE;
}

.toc-link.active {
    color: #7C3AED;
    border-left-color: #7C3AED;
    background: #EDE9FE;
    font-weight: 500;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 720px;
    min-width: 0;
}

.article-section {
    scroll-margin-top: 2rem;
}

.article-heading {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 22px;
    color: #1A1A1A;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
}

.article-text {
    font-size: 17px;
    color: #444444;
    margin-bottom: 1rem;
    max-width: 72ch;
}

.article-text em {
    font-style: italic;
}

.article-text strong {
    font-weight: 600;
    color: #1A1A1A;
}

/* ===== DIVIDER ===== */
.divider {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 2.5rem 0;
}

/* ===== CROSS-REFERENCES ===== */
.crossref {
    border-left: 3px solid #7C3AED;
    padding: 0.85rem 1.25rem;
    margin: 1.25rem 0;
    background: #F5F5F5;
    border-radius: 0 6px 6px 0;
}

.crossref-title {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #1A1A1A;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crossref-link {
    display: block;
    font-size: 0.9rem;
    color: #7C3AED;
    text-decoration: none;
    margin-bottom: 0.25rem;
    padding: 0.15rem 0;
    transition: color 0.2s ease;
}

.crossref-link:hover {
    color: #5B21B6;
    text-decoration: underline;
}

/* ===== COMPARISON TABLE ===== */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

.compare-table th {
    background: #7C3AED;
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 0.7rem 0.85rem;
    text-align: center;
    white-space: nowrap;
}

.compare-table th:first-child {
    text-align: left;
}

.compare-table td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid #E5E7EB;
    text-align: center;
    color: #444444;
}

.compare-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: #1A1A1A;
}

.compare-table tbody tr:nth-child(even) {
    background: #EDE9FE;
}

.compare-table tbody tr:hover {
    background: #F5F0FF;
}

/* ===== TIMELINE ===== */
.timeline-list {
    border-left: 2px solid #E5E7EB;
    padding-left: 1.75rem;
    margin-left: 0.5rem;
}

.timeline-era {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7C3AED;
    background: #EDE9FE;
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin: 1.25rem 0 0.5rem -1.75rem;
    position: relative;
    left: -0.5rem;
}

.timeline-era:first-child {
    margin-top: 0;
}

.timeline-item {
    padding: 0.5rem 0;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.95rem;
    top: 0.85rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7C3AED;
    border: 2px solid #FFFFFF;
}

.timeline-year {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #7C3AED;
    font-weight: 500;
    display: block;
    margin-bottom: 0.15rem;
}

.timeline-text {
    font-size: 0.95rem;
    color: #444444;
    line-height: 1.6;
}

/* ===== WORLD MAP ===== */
.world-map-container {
    position: relative;
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
}

.world-map-svg {
    width: 100%;
    height: auto;
    display: block;
}

.map-marker {
    fill: #7C3AED;
    stroke: #FFFFFF;
    stroke-width: 2;
    cursor: pointer;
    transition: r 0.2s ease, fill 0.2s ease;
}

.map-marker:hover {
    fill: #F59E0B;
    r: 9;
}

.map-tooltip {
    position: absolute;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 13px;
    color: #444444;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    pointer-events: none;
    display: none;
    z-index: 50;
    max-width: 260px;
}

.map-tooltip.active {
    display: block;
}

.map-tooltip-name {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 14px;
    color: #1A1A1A;
    margin-bottom: 0.25rem;
}

.map-tooltip-info {
    font-size: 13px;
    color: #444444;
    line-height: 1.5;
}

/* ===== READING LIST GENERATOR ===== */
.reading-list-controls {
    margin-bottom: 1.5rem;
}

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

.interest-tag {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #444444;
    background: #F5F5F5;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.interest-tag:hover {
    color: #7C3AED;
    border-color: #7C3AED;
}

.interest-tag.selected {
    color: #FFFFFF;
    background: #7C3AED;
    border-color: #7C3AED;
}

.reading-list-output {
    min-height: 60px;
}

.reading-list-empty {
    font-size: 0.9rem;
    color: #444444;
    font-style: italic;
}

.reading-list-item {
    padding: 0.85rem 1rem;
    border-left: 3px solid #7C3AED;
    background: #F5F5F5;
    margin-bottom: 0.6rem;
    border-radius: 0 6px 6px 0;
    transition: background 0.2s ease;
}

.reading-list-item:hover {
    background: #EDE9FE;
}

.reading-list-item-title {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 15px;
    color: #1A1A1A;
    margin-bottom: 0.15rem;
}

.reading-list-item-author {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #7C3AED;
    margin-bottom: 0.25rem;
}

.reading-list-item-desc {
    font-size: 14px;
    color: #444444;
    line-height: 1.6;
}

.reading-list-item-tags {
    margin-top: 0.35rem;
}

.reading-list-item-tag {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    background: #FEF3C7;
    color: #92400E;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.3rem;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid #E5E7EB;
    padding: 3rem 2rem 2rem;
    background: #F5F5F5;
}

.footer-inner {
    max-width: 1060px;
    margin: 0 auto;
}

.footer-cols {
    display: flex;
    gap: 3rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.footer-col-title {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #1A1A1A;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.flink {
    display: block;
    font-size: 14px;
    color: #444444;
    text-decoration: none;
    margin-bottom: 0.3rem;
    transition: color 0.2s ease;
}

.flink:hover {
    color: #7C3AED;
}

.footer-citation {
    border-top: 1px solid #E5E7EB;
    padding-top: 1.25rem;
    margin-bottom: 1.25rem;
}

.citation-example {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #444444;
    background: #FFFFFF;
    padding: 0.85rem 1rem;
    border-radius: 4px;
    border: 1px solid #E5E7EB;
    line-height: 1.6;
}

.footer-copy {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #444444;
}

/* ===== FADE-IN ANIMATION ===== */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .content-layout {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem;
        gap: 0;
    }

    .sidebar {
        position: static;
        max-height: none;
        margin-bottom: 1.5rem;
    }

    .hero {
        padding: 2.5rem 1rem 2rem;
    }

    .hero-title {
        font-size: 24px;
    }

    .category-nav {
        gap: 0.35rem;
    }

    .cat-link {
        font-size: 12px;
        padding: 0.25rem 0.6rem;
    }

    .table-wrapper {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .footer-cols {
        flex-direction: column;
        gap: 1.5rem;
    }

    .timeline-era {
        margin-left: 0;
        left: 0;
    }
}

@media (max-width: 480px) {
    .interest-tags {
        gap: 0.35rem;
    }

    .interest-tag {
        font-size: 12px;
        padding: 0.3rem 0.6rem;
    }
}
