/* Story Module Styles */
/*
Theme Name: MangaDrive
Version: 3.1 — Cleaned (removed duplicates from main.css)
*/

/* Root variables inherited from main.css — do not duplicate */

/* --- FIX: Title color adaptive for dark/light mode --- */
.single-post h1.fw-black {
    color: var(--td-text-color);
}

/* --- BOOTSTRAP RATIO CUSTOM FIX --- */
.ratio-2x3 {
    --bs-aspect-ratio: 150%;
}

/* FIX LỖI ẢNH HEIGHT 0 */
.object-fit-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
    display: block;
}

/* --- SINGLE STORY COVER --- */
.single-story-cover-wrapper {
    position: relative;
    border-radius: var(--td-radius);
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    border: 3px solid var(--td-border-color);
    background: var(--td-card-bg);
    margin: 0 auto;
    aspect-ratio: 2/3;
    width: 100%;
}

@media (min-width: 992px) {
    .single-story-cover-wrapper {
        width: 300px;
        height: 400px;
        aspect-ratio: auto;
    }
}

/* --- BOOK COVER FALLBACK --- */
.book-cover-fallback {
    width: 100%;
    height: 100%;
    background-color: #faebd7;
    border: 1px solid #e0d0b8;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.book-cover-fallback::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 2px solid #fff;
    border-radius: 8px;
    pointer-events: none;
}

.book-cover-fallback span {
    font-family: 'Merriweather', serif;
    font-weight: 800;
    color: #5d4037;
    font-size: 1.25rem;
    line-height: 1.4;
    text-transform: uppercase;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    z-index: 1;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.group:hover .book-cover-fallback {
    transform: scale(1.05);
}

/* Story Card (Listing) */
.story-card-img {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: var(--td-radius);
    background: #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.story-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1rem;
    z-index: 2;
}

.group:hover .story-card-overlay {
    opacity: 1;
}

.story-card-btn {
    background: white;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.group:hover .story-card-btn {
    transform: translateY(0);
}

/* Chapter List */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.chap-item {
    transition: all 0.2s;
    font-size: 0.95rem;
    color: var(--td-text-muted);
}

.chap-item:hover {
    background-color: var(--td-bg-light);
    color: var(--td-primary) !important;
}

/* Reading Settings */
.bg-sepia {
    background-color: #f4ecd8 !important;
    color: #5b4636 !important;
}

.reading-container {
    transition: background-color 0.3s, color 0.3s;
}

/* Sticky Bar Auto Hide */
.reading-bar {
    transition: transform 0.3s;
}

.reading-bar.hidden {
    transform: translateY(-100%);
}

/* Utilities */
.blur-lg {
    filter: blur(20px);
}

.scale-110 {
    transform: scale(1.1);
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Image Resizing Support */
.chapter-content img {
    max-width: 100%;
    width: 100%;
    height: auto !important;
    display: block;
    margin: 0 auto;
    transition: width 0.3s ease, max-width 0.3s ease;
}

.chapter-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    text-align: justify;
}

/* Đảm bảo truyện tranh (có chứa ảnh) không bị viền khoảng trống */
.chapter-content p:has(img) {
    margin-bottom: 0;
    text-align: center;
}