/* =========================================================
   Mistmint Dark — aggregator-style novel theme for 98novels.com
   ========================================================= */

:root {
	--bg:            #0b0d14;
	--bg-2:          #12151f;
	--bg-card:       #171b28;
	--bg-header:     #161a2c;
	--border:        rgba(255,255,255,0.08);
	--text:          #e7e9f0;
	--text-soft:     #a6acc0;
	--text-faint:    #6b7086;
	--accent:        #7c8dff;
	--accent-2:      #9b7cff;
	--ongoing:       #4ade80;
	--completed:     #60a5fa;
	--discord:       #5865f2;
	--radius:        14px;
	--radius-sm:     8px;
	--shadow:        0 10px 30px rgba(0,0,0,0.35);
	--font-head:     'Poppins', sans-serif;
	--font-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
	margin: 0; padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	line-height: 1.6;
}

body.light-mode { --bg: #f5f6fb; --bg-2: #ffffff; --bg-card: #ffffff; --bg-header: #ffffff; --text: #1c1f2b; --text-soft: #565c72; --text-faint: #8a90a6; --border: rgba(0,0,0,0.08); }

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--text); margin: 0 0 0.5em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.screen-reader-text { position: absolute; left: -9999px; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: 12px 26px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-login { background: var(--accent); color: #fff; padding: 8px 20px; border-radius: 8px; font-weight: 600; font-size: 0.85rem; }
.btn-discord { background: var(--discord); color: #fff; }
.btn-discord:hover { background: #4752c4; color: #fff; }

.icon-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; width: 36px; height: 36px; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Header ---------- */
.site-header { background: var(--bg-header); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; background-image: radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4) 1px, transparent 0), radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.3) 1px, transparent 0); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; gap: 24px; }
.site-title { font-family: var(--font-head); font-weight: 700; font-size: 1.4rem; color: var(--text); }
.primary-nav ul { list-style: none; display: flex; gap: 28px; margin: 0; padding: 0; }
.primary-nav a { font-weight: 600; color: var(--text-soft); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.03em; }
.primary-nav a:hover { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }

.site-search-bar { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; background: var(--bg-2); }
.site-search-bar.is-open { max-height: 80px; }
.site-search-bar form { display: flex; gap: 8px; padding: 12px 24px; }
.site-search-bar input { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; color: var(--text); }
.site-search-bar button { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 0 20px; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(180deg, rgba(11,13,20,0.4), var(--bg) 90%), var(--bg-2); background-size: cover; background-position: center; padding: 100px 0; text-align: center; }
.hero-heading { font-size: 2.6rem; max-width: 800px; margin: 0 auto 24px; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-title { font-size: 1.4rem; margin-bottom: 24px; }
.page-title { font-size: 1.8rem; }
.empty-note { color: var(--text-faint); font-style: italic; }

/* ---------- Trending carousel ---------- */
.trending-carousel { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.trending-card { display: flex; gap: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.trending-cover { flex: 0 0 90px; aspect-ratio: 3/4.2; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-2); }
.trending-cover img, .novel-cover-img { width: 100%; height: 100%; object-fit: cover; }
.novel-cover-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; background: var(--bg-2); color: var(--text-soft); font-size: 0.8rem; }
.trending-body h3 { font-size: 1rem; margin-bottom: 6px; }
.trending-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.trending-excerpt { font-size: 0.82rem; color: var(--text-soft); }

.tag-pill { background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; font-size: 0.72rem; color: var(--text-soft); }
.tag-pill.is-active, .tag-pill:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Updates + sidebar ---------- */
.updates-layout { display: grid; grid-template-columns: 2.2fr 1fr; gap: 40px; align-items: start; }
.updates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.update-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.update-card-cover { aspect-ratio: 3/4.2; background: var(--bg-2); overflow: hidden; }
.update-card-body { padding: 12px; }
.update-card-time { font-size: 0.7rem; color: var(--text-faint); }
.update-card-title { font-size: 0.9rem; margin: 4px 0; }
.update-card-chapter { font-size: 0.78rem; color: var(--text-soft); }
.view-all { margin-top: 24px; }

.updates-sidebar { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.sidebar-title { font-size: 1rem; margin-bottom: 16px; }
.popular-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.popular-item { display: flex; align-items: center; gap: 12px; }
.popular-rank { font-family: var(--font-head); font-weight: 700; color: var(--text-faint); width: 20px; flex-shrink: 0; }
.popular-cover { flex: 0 0 40px; aspect-ratio: 3/4.2; border-radius: 6px; overflow: hidden; }
.popular-info a { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); }
.popular-info .status-badge { font-size: 0.65rem; margin-top: 2px; }

/* ---------- Status badges ---------- */
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.status-badge.status-ongoing { background: rgba(74,222,128,0.15); color: var(--ongoing); }
.status-badge.status-completed { background: rgba(96,165,250,0.15); color: var(--completed); }

/* ---------- Random row ---------- */
.random-row { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 8px; }
.random-item { flex: 0 0 140px; }
.random-item img, .random-item .novel-cover-placeholder { border-radius: var(--radius-sm); aspect-ratio: 3/4.2; }
.random-item-title { display: block; margin-top: 8px; font-size: 0.82rem; color: var(--text); }

/* ---------- Genre pills ---------- */
.genre-pills, .library-filters { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Announcements ---------- */
.announcements-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.announcement-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.announcement-card h3 { font-size: 1rem; }
.announcement-card p { color: var(--text-soft); font-size: 0.85rem; }

/* ---------- Community / Discord block ---------- */
.community-block { background: linear-gradient(135deg, rgba(124,141,255,0.12), rgba(155,124,255,0.12)); padding: 56px 0; text-align: center; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.community-title { font-size: 1.6rem; }
.community-stats { color: var(--text-soft); margin-bottom: 20px; }

/* ---------- Library page ---------- */
.filter-toggle { margin-bottom: 16px; }
.library-filters { display: none; margin-bottom: 24px; }
.library-filters.is-open { display: flex; }
.novel-list { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.novel-list-item { display: flex; gap: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.novel-list-cover { flex: 0 0 90px; aspect-ratio: 3/4.2; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-2); }
.novel-list-title { font-size: 1rem; margin-bottom: 6px; }
.novel-list-excerpt { font-size: 0.82rem; color: var(--text-soft); margin: 8px 0; }
.novel-list-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Novel detail page ---------- */
.novel-detail-inner { display: flex; gap: 40px; align-items: flex-start; }
.novel-detail-cover { flex: 0 0 260px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.novel-detail-title { font-size: 2rem; }
.novel-detail-meta-row { display: flex; align-items: center; gap: 14px; color: var(--text-soft); font-size: 0.85rem; margin-bottom: 8px; }
.other-name { color: var(--text-faint); font-size: 0.85rem; }
.novel-detail-genres { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.synopsis-title { font-size: 1rem; margin-top: 24px; }
.novel-detail-synopsis { color: var(--text-soft); }
.novel-detail-actions { margin-top: 20px; display: flex; gap: 12px; }

.chapter-grid-section { background: var(--bg-2); }
.chapter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chapter-grid-item { display: flex; justify-content: space-between; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; color: var(--text); }
.chapter-grid-item:hover { border-color: var(--accent); }
.chapter-grid-date { color: var(--text-faint); font-size: 0.8rem; }

/* ---------- Reader ---------- */
.reader-topbar { position: sticky; top: 0; z-index: 90; background: var(--bg-header); border-bottom: 1px solid var(--border); }
.reader-topbar-inner { display: flex; align-items: center; gap: 16px; padding: 14px 24px; }
.reader-back { font-size: 1.3rem; }
.reader-title { flex: 1; font-size: 1.1rem; margin: 0; }
.reader-topbar-actions { display: flex; gap: 8px; }

.reader-layout { display: flex; }
.reader-article { flex: 1; max-width: 760px; margin: 0 auto; padding: 40px 24px; }
.reader-content { font-size: 1.1rem; line-height: 1.9; }
.reader-content p { margin: 0 0 1.4em; }
.reader-nav { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }

.chapter-panel { position: fixed; top: 0; right: -340px; width: 340px; height: 100%; background: var(--bg-card); border-left: 1px solid var(--border); transition: right 0.25s ease; z-index: 110; display: flex; flex-direction: column; }
.chapter-panel.is-open { right: 0; }
.chapter-panel-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px; border-bottom: 1px solid var(--border); }
.chapter-panel-list { list-style: none; margin: 0; padding: 12px; overflow-y: auto; flex: 1; }
.chapter-panel-list li a { display: flex; justify-content: space-between; padding: 12px; border-radius: var(--radius-sm); color: var(--text-soft); }
.chapter-panel-list li.is-current a, .chapter-panel-list li a:hover { background: rgba(124,141,255,0.12); color: var(--accent); }
.chapter-panel-date { font-size: 0.75rem; color: var(--text-faint); }

/* ---------- Comments ---------- */
.comments-section, .comments-wrap { margin-top: 40px; }
.comments-login-note { color: var(--text-soft); }

/* ---------- Footer ---------- */
.footer-cta { display: flex; align-items: center; justify-content: space-between; padding: 32px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 16px; }
.footer-cta-title { font-weight: 600; margin: 0; }
.site-footer { background: var(--bg-2); border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; padding: 32px 24px; }
.footer-social { display: flex; gap: 16px; }
.footer-bottom { text-align: center; padding: 16px 24px; font-size: 0.8rem; color: var(--text-faint); border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.updates-layout, .novel-detail-inner, .novel-list { grid-template-columns: 1fr; display: block; }
	.novel-list-item { margin-bottom: 20px; }
	.novel-detail-cover { width: 200px; margin-bottom: 24px; }
}
@media (max-width: 782px) {
	.primary-nav { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: var(--bg-header); border-bottom: 1px solid var(--border); }
	.primary-nav.is-open { display: block; }
	.primary-nav ul { flex-direction: column; padding: 16px 24px; gap: 14px; }
	.menu-toggle { display: inline-flex; }
	.chapter-grid { grid-template-columns: 1fr; }
	.chapter-panel { width: 85%; right: -85%; }
}
