/* =====================================================
   GLOBAL
===================================================== */

body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #141E30, #243B55);
    color: #fff;
}

.page-title {
    text-align: center;
    padding: 40px 0;
    font-size: 42px;
    letter-spacing: 2px;
}

.story-container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
}

/* =====================================================
   THEME SELECTOR
===================================================== */

.theme-selector {
    text-align: center;
    margin-bottom: 25px;
}

.theme-selector button {
    border: none;
    padding: 8px 16px;
    margin: 5px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Cinematic */
body.cinematic .theme-selector button {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* App */
body.app .theme-selector button {
    background: #222;
    color: #fff;
}

/* Magazine */
body.magazine .theme-selector button {
    background: #111;
    color: #fff;
}

.theme-selector button.active {
    background: #ff9800 !important;
    color: #000 !important;
}

/* =====================================================
   CATEGORY FILTER
===================================================== */

.category-filter {
    text-align: center;
    margin-bottom: 25px;
}

.category-filter button {
    border: none;
    padding: 6px 14px;
    margin: 4px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.3s;
}

/* Theme based category styling */
body.cinematic .category-filter button {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

body.app .category-filter button {
    background: #ddd;
    color: #111;
}

body.magazine .category-filter button {
    background: #e5e0d8;
    color: #111;
}

.category-filter button:hover {
    transform: translateY(-2px);
}

/* =====================================================
   STORY GRID & CARD
===================================================== */

.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.story-card {
    position: relative;
    height: 220px;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.story-card:hover {
    transform: scale(1.06);
}

/* Image */
.card-image,
.card-image img {
    width: 100%;
    height: 100%;
}

.card-image img {
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.story-card:hover img {
    transform: scale(1.25);
}

/* Gradient overlay */
.story-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        rgba(255,0,150,0.4),
        rgba(0,204,255,0.4),
        rgba(255,255,0,0.4)
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    mix-blend-mode: overlay;
}

.story-card:hover::after {
    opacity: 1;
}

/* Title overlay */
.card-title {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    box-sizing: border-box;

    background: linear-gradient(
        to top,
        rgba(0,0,0,0.85),
        rgba(0,0,0,0.4),
        transparent
    );

    text-shadow:
        0 2px 4px rgba(0,0,0,0.8),
        0 0 10px rgba(0,0,0,0.6);
}

/* Theme specific title text */

body.app .card-title {
    color: #fff;
}

body.magazine .card-title {
    color: #fff;
    font-family: Georgia, serif;
}

/* =====================================================
   STORY PAGE
===================================================== */

.story-page {
    width: 85%;
    max-width: 900px;
    margin: 60px auto;
    padding: 40px;
    border-radius: 20px;
    animation: slideUp 0.6s ease;
}

/* Cinematic */
body.cinematic .story-page {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    color: #fff;
}

/* App */
body.app .story-page {
    background: #fff;
    color: #111;
}

/* Magazine */
body.magazine .story-page {
    background: #fff;
    color: #111;
    font-family: Georgia, serif;
}

.story-title {
    text-align: center;
    margin-bottom: 30px;
}

.story-content {
    line-height: 1.8;
    font-size: 18px;
    text-align: justify;
}
.story-content p {
    margin-bottom: 18px;
}
/* =========================
   DROP CAP
========================= */

.story-content p:first-of-type::first-letter {
    float: left;
    font-size: 60px;
    line-height: 1;
    padding-right: 10px;
    font-weight: bold;
    color: #ff9800;
}

.story-content::after {
    content: "";
    display: block;
    clear: both;
}

/* Story images */
.story-image {
    width: 260px;
    margin: 10px 20px 10px 0;
    float: left;
    opacity: 0;
    transform: translateY(20px);
    transition: 0.6s ease;
}

.story-image.visible {
    opacity: 1;
    transform: translateY(0);
}

.story-image.right {
    float: right;
    margin: 10px 0 10px 20px;
}

.story-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    object-fit: cover;
}

/* Links */
.story-link {
    display: inline;
}

.story-link a {
    display: inline-block;
    padding: 4px 10px;
    font-size: 14px;
    border-radius: 14px;
    background: #0072ff;
    color: #fff;
    text-decoration: none;
    margin: 0 4px;
    vertical-align: middle;
    transition: 0.2s ease;
}

.story-link a:hover {
    background: #0056cc;
}

/* Back button */
.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-bottom: 20px;
}

body.cinematic .back-btn { color: #fff; }
body.app .back-btn,
body.magazine .back-btn { color: #111; }

/* =====================================================
   BADGES & BOOKMARK
===================================================== */

.reading-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 12px;
}

/* =========================
   READING PROGRESS BAR
========================= */

#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    z-index: 9999;
    transition: width 0.1s linear;
}

.bookmark-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
}

.bookmark-btn.active {
    color: gold;
}

/* =====================================================
   ANIMATION
===================================================== */

@keyframes slideUp {
    from { transform: translateY(30px); opacity:0; }
    to   { transform: translateY(0); opacity:1; }
}
@media (max-width: 768px) {

    .story-image,
    .story-image.right {
        float: none;
        width: 100%;
        margin: 20px 0;
    }

}

/* =========================
   LIGHTBOX
========================= */

#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#lightbox img {
    max-width: 85%;
    max-height: 85%;
    border-radius: 12px;
}

#close-lightbox {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
}