/*
Theme Name: Novel Reader
Theme URI: https://example.com/novel-reader
Author: Marvis
Author URI: https://example.com
Description: A clean, mobile-first WordPress theme for English novel reading sites. Features homepage carousel, novel grids, category sidebar, detail pages, and chapter reading pages.
Version: 1.0.0
License: GPL v2 or later
Text Domain: novel-reader
*/

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: #58a6ff; text-decoration: none; }
a:hover { color: #79c0ff; }
img { max-width: 100%; height: auto; display: block; }

/* ========== Layout ========== */
.site-header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0f6fc;
}
.site-title a { color: #f0f6fc; }
.header-search input {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 16px;
    color: #c9d1d9;
    font-size: 0.9rem;
    width: 280px;
}
.header-search input::placeholder { color: #484f58; }

.main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 24px;
    padding: 24px;
}

/* Sidebar */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.sidebar h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8b949e;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #21262d;
}
.sidebar ul { list-style: none; }
.sidebar ul li { margin-bottom: 6px; }
.sidebar ul li a {
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #8b949e;
    transition: all 0.15s;
}
.sidebar ul li a:hover,
.sidebar ul li a.active {
    background: #1f242e;
    color: #f0f6fc;
}

.content-area { flex: 1; min-width: 0; }

/* ========== Homepage Carousel ========== */
.hero-carousel {
    position: relative;
    margin-bottom: 40px;
    border-radius: 12px;
    overflow: hidden;
    background: #161b22;
}
.carousel-slide {
    display: none;
    position: relative;
    min-height: 380px;
    align-items: end;
}
.carousel-slide.active { display: flex; }
.carousel-slide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
}
.carousel-info {
    position: relative;
    z-index: 2;
    padding: 40px;
    max-width: 600px;
}
.carousel-info .tag {
    display: inline-block;
    background: #238636;
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.carousel-info h2 { font-size: 2rem; color: #fff; margin-bottom: 8px; }
.carousel-info p { color: #b1bac4; margin-bottom: 16px; }
.carousel-nav { position: absolute; bottom: 20px; right: 40px; z-index: 3; display: flex; gap: 8px; }
.carousel-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #484f58; border: none; cursor: pointer;
}
.carousel-dot.active { background: #58a6ff; }

/* ========== Novel Grid Sections ========== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.section-header h2 { font-size: 1.3rem; color: #f0f6fc; }
.section-header a { font-size: 0.85rem; color: #58a6ff; }

.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.novel-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}
.novel-card:hover { transform: translateY(-4px); border-color: #58a6ff; }
.novel-card-cover {
    aspect-ratio: 2/3;
    background: #21262d;
    position: relative;
    overflow: hidden;
}
.novel-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.novel-card-cover .status-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.75);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #fff;
    text-transform: uppercase;
}
.novel-card-info { padding: 12px; }
.novel-card-info h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.novel-card-info h3 a { color: #f0f6fc; }
.novel-card-info .author { font-size: 0.8rem; color: #8b949e; }
.novel-card-info .meta { font-size: 0.75rem; color: #484f58; margin-top: 4px; display: flex; gap: 8px; }

/* ========== Single Novel Detail ========== */
.novel-detail { display: flex; gap: 32px; }
.novel-detail-cover {
    width: 260px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #161b22;
}
.novel-detail-cover img { width: 100%; }
.novel-detail-body { flex: 1; }
.novel-detail-body h1 { font-size: 2rem; color: #f0f6fc; margin-bottom: 4px; }
.novel-detail-body .author { font-size: 1.05rem; color: #58a6ff; margin-bottom: 12px; }
.novel-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #8b949e;
}
.novel-meta span { display: flex; align-items: center; gap: 4px; }
.status-ongoing { color: #3fb950; }
.status-completed { color: #58a6ff; }
.synopsis { margin-bottom: 24px; }
.synopsis h3, .characters h3, .scenes h3 { font-size: 1rem; color: #f0f6fc; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #21262d; }
.synopsis p { color: #b1bac4; line-height: 1.8; }
.read-btn {
    display: inline-block;
    background: #238636;
    color: #fff;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 24px;
    transition: background 0.2s;
}
.read-btn:hover { background: #2ea043; color: #fff; }

.character-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.character-card {
    text-align: center;
    width: 90px;
}
.character-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 6px;
    border: 2px solid #30363d;
}
.character-card span { font-size: 0.8rem; color: #8b949e; }
.scene-gallery {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.scene-gallery img {
    width: 160px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #21262d;
}

.chapter-list { margin-bottom: 32px; }
.chapter-list h3 { font-size: 1rem; color: #f0f6fc; margin-bottom: 10px; }
.chapter-list select {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #0d1117;
    color: #c9d1d9;
    font-size: 0.9rem;
}

/* Comments */
.comments-area { margin-top: 40px; padding-top: 24px; border-top: 1px solid #21262d; }

/* ========== Chapter Reading Page ========== */
.chapter-reading {
    max-width: 780px;
    margin: 0 auto;
    padding: 40px 20px;
}
.chapter-header {
    text-align: center;
    margin-bottom: 32px;
}
.chapter-header .novel-title { font-size: 0.9rem; color: #58a6ff; margin-bottom: 4px; }
.chapter-header h1 { font-size: 1.4rem; color: #f0f6fc; }
.chapter-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 12px 0;
    border-bottom: 1px solid #21262d;
}
.chapter-controls-top select {
    padding: 6px 12px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #0d1117;
    color: #c9d1d9;
    font-size: 0.85rem;
}
.chapter-nav { display: flex; gap: 12px; }
.chapter-nav a {
    padding: 8px 18px;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #c9d1d9;
    transition: all 0.15s;
}
.chapter-nav a:hover { background: #1f242e; border-color: #58a6ff; }
.chapter-content {
    font-size: 1.1rem;
    line-height: 1.9;
    color: #c9d1d9;
    margin-bottom: 32px;
}
.chapter-content p { margin-bottom: 1em; }
.chapter-controls-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid #21262d;
}

/* ========== Category / Archive Page ========== */
.archive-header { margin-bottom: 32px; }
.archive-header h1 { font-size: 1.8rem; color: #f0f6fc; }
.archive-header p { color: #8b949e; margin-top: 6px; }

/* ========== Footer ========== */
.site-footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid #21262d;
    color: #484f58;
    font-size: 0.85rem;
    margin-top: 60px;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .main-wrapper { flex-direction: column; }
    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
        display: flex;
        gap: 12px;
        overflow-x: auto;
        padding-bottom: 12px;
    }
    .sidebar ul { display: flex; gap: 8px; flex-wrap: wrap; }
    .sidebar h3 { display: none; }
    .novel-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (max-width: 768px) {
    .header-search input { width: 180px; }
    .hero-carousel .carousel-slide { min-height: 260px; }
    .carousel-info { padding: 24px; }
    .carousel-info h2 { font-size: 1.3rem; }
    .novel-detail { flex-direction: column; }
    .novel-detail-cover { width: 180px; }
    .chapter-reading { padding: 20px 12px; }
    .chapter-content { font-size: 1rem; }
}
