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

:root {
    --bg-dark: #1a1a1a;
    --bg-card: #252525;
    --bg-card-hover: #2f2f2f;
    --bg-hero: #111;
    --text-primary: #e8e0d0;
    --text-secondary: #a09880;
    --text-muted: #6a6258;
    --accent: #c9a959;
    --accent-hover: #dfc070;
    --accent-dim: rgba(201, 169, 89, 0.15);
    --accent-border: rgba(201, 169, 89, 0.3);
    --danger: #e74c3c;
    --success: #27ae60;
    --border: #3a3530;
    --radius: 6px;
    --shadow: 0 2px 16px rgba(0,0,0,0.4);
    --transition: 0.25s ease;
}

html { scroll-behavior: smooth; }
body { font-family: 'Source Sans Pro', -apple-system, sans-serif; background: var(--bg-dark); color: var(--text-primary); line-height: 1.7; font-size: 16px; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4, h5, h6 { font-family: 'Playfair Display', Georgia, serif; color: var(--text-primary); line-height: 1.3; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.section-pad { padding: 3rem 0 4rem; }
.section { display: none; }
.section.active { display: block; }

/* ===== NAVBAR ===== */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(17,17,17,0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; height: 56px;
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.15rem; color: var(--accent) !important; }
.nav-icon { font-size: 1.3rem; }
.nav-links { display: flex; gap: 1.8rem; }
.nav-links a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; transition: color var(--transition); }
.nav-links a:hover { color: var(--accent); }
.nav-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; }

/* ===== HERO ===== */
.hero {
    position: relative;
    background: linear-gradient(135deg, #1a1510 0%, #2a2018 50%, #1a1a1a 100%);
    padding: 5rem 1.5rem 4rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a959' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}
.hero-content { position: relative; z-index: 1; max-width: 750px; margin: 0 auto; }
.hero-title { font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 900; margin-bottom: 1rem; color: var(--accent); letter-spacing: -0.5px; }
.hero-subtitle { font-size: clamp(1rem, 2.5vw, 1.25rem); color: var(--text-secondary); max-width: 600px; margin: 0 auto 2rem; line-height: 1.8; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2.5rem; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    background: transparent;
    color: var(--accent);
    transition: all var(--transition);
}
.btn:hover { background: var(--accent); color: var(--bg-dark); }
.btn-primary { background: var(--accent); color: var(--bg-dark); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { border-color: var(--text-muted); color: var(--text-secondary); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-lg { padding: 1rem 2.5rem; font-size: 1.05rem; }

/* ===== STATS ===== */
.hero-stats { display: flex; gap: 2.5rem; justify-content: center; flex-wrap: wrap; }
.stat { text-align: center; }
.stat span:first-child { display: block; font-family: 'Playfair Display', serif; font-size: 2.5rem; font-weight: 900; color: var(--accent); }
.stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 0.25rem; }

/* ===== SECTION TITLES ===== */
.section-title { text-align: center; margin-bottom: 2.5rem; }
.section-title h2 { font-size: 2rem; margin-bottom: 0.5rem; color: var(--accent); }
.section-title p { color: var(--text-secondary); font-size: 1.05rem; max-width: 600px; margin: 0 auto; }

/* ===== FEATURED CARD ===== */
.featured-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}
.featured-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, var(--accent), transparent);
}
.featured-category { display: inline-block; background: var(--accent-dim); color: var(--accent); padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.75rem; }
.featured-question { font-size: 1.2rem; font-weight: 400; margin-bottom: 0.75rem; line-height: 1.6; }
.featured-answer { font-size: 1rem; color: var(--accent); font-weight: 600; margin-bottom: 1rem; font-family: 'Playfair Display', serif; }
.featured-detail { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.8; }
.difficulty { display: inline-flex; gap: 3px; margin-top: 1rem; }
.difficulty .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.difficulty .pip.active { background: var(--accent); }

/* ===== STORIES GRID ===== */
.stories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.story-card-home {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.story-card-home::before {
    content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
    background: var(--accent); transform: scaleY(0); transform-origin: bottom;
    transition: transform var(--transition);
}
.story-card-home:hover { border-color: var(--accent-border); background: var(--bg-card-hover); transform: translateY(-2px); box-shadow: var(--shadow); }
.story-card-home:hover::before { transform: scaleY(1); }
.story-card-home h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-primary); line-height: 1.4; }
.story-card-home .story-excerpt { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story-meta { display: flex; gap: 1rem; margin-top: 0.75rem; font-size: 0.8rem; color: var(--text-muted); }
.story-meta span { display: flex; align-items: center; gap: 0.25rem; }

/* ===== STORIES LIST ===== */
.stories-list { display: flex; flex-direction: column; gap: 1rem; }
.story-row {
    display: flex; align-items: center; gap: 1.25rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem 1.5rem; cursor: pointer;
    transition: all var(--transition);
}
.story-row:hover { border-color: var(--accent-border); background: var(--bg-card-hover); transform: translateX(4px); }
.story-row-num { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: var(--accent); min-width: 40px; text-align: center; opacity: 0.6; }
.story-row-body { flex: 1; }
.story-row-body h4 { font-size: 1.05rem; margin-bottom: 0.25rem; }
.story-row-body .row-excerpt { color: var(--text-secondary); font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.story-row-meta { font-size: 0.8rem; color: var(--text-muted); text-align: right; min-width: 120px; }

/* ===== TOOLBAR ===== */
.toolbar { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; align-items: center; }
.search-box { flex: 1; min-width: 250px; }
.search-box input {
    width: 100%; padding: 0.75rem 1rem; font-size: 0.95rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-primary); font-family: inherit;
    transition: border-color var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-muted); }
.filter-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
select {
    padding: 0.7rem 1rem; font-size: 0.9rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-primary); font-family: inherit;
}
select option { background: var(--bg-card); }

/* ===== TRIVIA CARDS ===== */
.trivia-cards { display: flex; flex-direction: column; gap: 1.25rem; }
.trivia-card-item {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem 1.75rem; cursor: pointer;
    transition: all var(--transition);
}
.trivia-card-item:hover { border-color: var(--accent-border); background: var(--bg-card-hover); }
.trivia-card-item .tq { font-size: 1.05rem; margin-bottom: 0.5rem; line-height: 1.5; color: var(--text-primary); }
.trivia-card-item .ta-preview { color: var(--accent); font-weight: 600; font-family: 'Playfair Display', serif; }
.no-results { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 1.1rem; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.pagination button {
    padding: 0.5rem 0.85rem; font-size: 0.85rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--transition);
}
.pagination button:hover, .pagination button.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ===== MODAL ===== */
.modal { display: none; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; background: rgba(0,0,0,0.7); padding: 1.5rem; overflow-y: auto; }
.modal.open { display: flex; }
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; max-width: 750px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-close {
    position: absolute; top: 0.75rem; right: 1rem;
    background: none; border: none; color: var(--text-muted);
    font-size: 1.8rem; line-height: 1;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--accent); }

/* Story Detail Modal */
.story-detail-modal .story-title { font-size: 1.5rem; margin-bottom: 1rem; color: var(--accent); }
.story-detail-modal .story-body { font-size: 1rem; color: var(--text-secondary); line-height: 1.9; }
.story-detail-modal .story-body p { margin-bottom: 1rem; }
.story-detail-modal .story-person { font-size: 0.85rem; color: var(--text-muted); margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.story-detail-modal .story-person strong { color: var(--text-secondary); }

/* Trivia Detail Modal */
.trivia-detail-modal .tq-full { font-size: 1.3rem; margin-bottom: 0.75rem; line-height: 1.5; }
.trivia-detail-modal .ta-full { font-size: 1.1rem; font-family: 'Playfair Display', serif; color: var(--accent); font-weight: 700; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.trivia-detail-modal .td-full { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.9; }

/* ===== QUIZ ===== */
.quiz-options { max-width: 400px; margin: 0 auto 2rem; text-align: left; }
.quiz-options label { display: block; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }
.quiz-numbers { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.qn-btn {
    padding: 0.5rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-card); color: var(--text-secondary); font-weight: 600;
    transition: all var(--transition);
}
.qn-btn:hover, .qn-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
#quiz-area { max-width: 750px; margin: 0 auto; text-align: center; }

.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.quiz-progress { flex: 1; }
.quiz-pbar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 0.5rem; }
.quiz-pfill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s ease; }
#quiz-counter { font-size: 0.85rem; color: var(--text-muted); }
.quiz-score { font-size: 1.1rem; font-weight: 700; color: var(--accent); font-family: 'Playfair Display', serif; }

#quiz-question-area { text-align: left; }
.qq-num { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.75rem; }
.qq-text { font-size: 1.2rem; margin-bottom: 1.5rem; line-height: 1.6; }
.qq-input {
    width: 100%; padding: 0.75rem 1rem; font-size: 1rem;
    background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-primary); font-family: inherit; margin-bottom: 1rem;
}
.qq-input:focus { outline: none; border-color: var(--accent); }
.quiz-submit-row { display: flex; gap: 0.5rem; }
.quiz-submit-row .btn { flex: 1; }

#quiz-answer-area { background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-top: 1rem; text-align: left; }
.quiz-correct { border-left: 4px solid var(--success) !important; }
.quiz-wrong { border-left: 4px solid var(--danger) !important; }
.quiz-answer-label { font-weight: 700; margin-bottom: 0.5rem; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }
.quiz-correct .quiz-answer-label { color: var(--success); }
.quiz-wrong .quiz-answer-label { color: var(--danger); }
.quiz-detail { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.8; }

/* Results */
.quiz-results-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; text-align: center; }
.quiz-results-card .final-score { font-size: 4rem; font-family: 'Playfair Display', serif; font-weight: 900; color: var(--accent); }
.quiz-results-card .final-label { font-size: 1rem; color: var(--text-secondary); margin-bottom: 2rem; }
.quiz-results-card .final-msg { font-size: 1.1rem; color: var(--text-primary); margin-bottom: 2rem; font-style: italic; }

/* ===== FOOTER ===== */
.footer { background: var(--bg-hero); border-top: 1px solid var(--border); padding: 2rem 1.5rem; text-align: center; margin-top: 2rem; }
.footer p:first-child { color: var(--accent); font-family: 'Playfair Display', serif; font-size: 1rem; margin-bottom: 0.5rem; }
.footer-note { color: var(--text-muted); font-size: 0.85rem; font-style: italic; max-width: 500px; margin: 0 auto; }

/* ===== MISC ===== */
.loading-text { color: var(--text-muted); text-align: center; padding: 2rem; }
.category-badge { display: inline-block; background: var(--accent-dim); color: var(--accent); padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .nav-links { display: none; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: rgba(17,17,17,0.98); padding: 1rem; border-bottom: 1px solid var(--border); }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; }
    .hero { padding: 3rem 1.5rem 2.5rem; }
    .hero-stats { gap: 1.5rem; }
    .toolbar { flex-direction: column; }
    .search-box { min-width: auto; }
    .filter-group { width: 100%; }
    .filter-group select { flex: 1; }
    .stories-grid { grid-template-columns: 1fr; }
    .modal-content { padding: 1.5rem; }
    .quiz-options { max-width: 100%; }
    .story-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .story-row-meta { text-align: left; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.8rem; }
    .section-title h2 { font-size: 1.5rem; }
    .featured-card { padding: 1.25rem; }
}
