/* Global CSS Variables & Layout */
:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-color: #333333;  /* style.css compatibility variable */
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --card-bg: #1e1e1e;
        --text-main: #e0e0e0;
        --text-color: #e0e0e0;  /* style.css compatibility variable for dark mode */
    }
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.portal-container {
    text-align: center;
    max-width: 800px;
    padding: 20px;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.portal-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.portal-card h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--accent-color);
}

.portal-card .card-meta {
    margin-top: 8px;
    font-size: 0.9rem;
    opacity: 0.7;
}

.portal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

/* Chapter List UX Improvements */
.chapter-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
}

.chapter-item {
    margin-bottom: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.chapter-item:hover {
    background-color: rgba(0,0,0,0.05);
}

@media (prefers-color-scheme: dark) {
    .chapter-item:hover {
        background-color: rgba(255,255,255,0.05);
    }
}

.chapter-link {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
}

.chapter-title {
    display: block;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--accent-color);
}

.chapter-desc {
    display: block;
    font-size: 0.85rem;
    margin-top: 4px;
    opacity: 0.8;
}

footer {
    margin-top: 50px;
    font-size: 0.9rem;
    opacity: 0.7;
}
