/* Stories — bookstore / library catalog using branding palette */

.stories-section.stories-library {
    --st-red: var(--brand-red, #c00000);
    --st-green: var(--brand-green, #11802b);
    --st-gold: var(--brand-gold, #e3a008);
    --st-brown: var(--brand-green, #11802b);
    --st-blue: var(--brand-blue, #0973a1);
    --st-cream: #f7f1e6;
    padding: 0.5rem 0 2rem;
    max-width: 1120px;
    margin: 0 auto;
}

.stories-library .stories-hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
    align-items: center;
    background: linear-gradient(135deg, #fffaf2 0%, #f3ebe0 100%);
    border: 1px solid rgba(17, 128, 43, 0.12);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 1.75rem;
    overflow: hidden;
    position: relative;
}

.stories-library .stories-hero::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(227, 160, 8, 0.14);
}

.stories-library .stories-hero-copy h2 {
    font-family: 'Baloo 2', Georgia, serif;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    color: var(--st-brown);
    margin: 0 0 0.5rem;
    line-height: 1.15;
}

.stories-library .stories-hero-copy p {
    color: rgba(61, 38, 26, 0.7);
    margin: 0 0 1.1rem;
    max-width: 36ch;
    line-height: 1.55;
}

.stories-library .stories-hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--st-red);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(192, 0, 0, 0.22);
}

.stories-library .stories-hero-visual {
    min-height: 180px;
    border-radius: 18px;
    background:
        linear-gradient(145deg, rgba(17, 128, 43, 0.12), rgba(9, 115, 161, 0.1)),
        url('../Multimedia/Images/Molas - Guna/Mola 3.jpg') center/cover;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    position: relative;
    z-index: 1;
}

.stories-library .stories-perks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.stories-library .stories-perk {
    background: #fff;
    border: 1px solid rgba(17, 128, 43, 0.1);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
}

.stories-library .stories-perk i {
    color: var(--st-green);
    margin-top: 0.15rem;
}

.stories-library .stories-perk strong {
    display: block;
    color: var(--st-brown);
    font-size: 0.88rem;
}

.stories-library .stories-perk span {
    color: rgba(61, 38, 26, 0.6);
    font-size: 0.78rem;
}

.stories-library .story-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1.35rem;
}

.stories-library .category-filter {
    border: 1px solid rgba(17, 128, 43, 0.14);
    background: #fff;
    color: var(--st-brown);
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.stories-library .category-filter.active,
.stories-library .category-filter:hover {
    background: var(--st-green);
    border-color: var(--st-green);
    color: #fff;
}

.stories-library .stories-section-title {
    text-align: center;
    margin: 0.5rem 0 1.25rem;
}

.stories-library .stories-section-title h3 {
    margin: 0;
    font-family: 'Baloo 2', Georgia, serif;
    color: var(--st-brown);
    font-size: 1.55rem;
}

.stories-library .stories-section-title h3::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: var(--st-red);
    margin: 0.45rem auto 0;
    border-radius: 999px;
}

.stories-library .stories-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.stories-library .story-book-card {
    background: #fff;
    border: 1px solid rgba(17, 128, 43, 0.1);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(17, 128, 43, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.stories-library .story-book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 30px rgba(17, 128, 43, 0.14);
}

.stories-library .story-book-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    background: linear-gradient(160deg, var(--st-green), var(--st-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.stories-library .story-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stories-library .story-book-cover .story-cover-icon {
    font-size: 2.6rem;
    color: rgba(255, 255, 255, 0.92);
}

.stories-library .story-book-badge {
    position: absolute;
    top: 0.7rem;
    left: 0.7rem;
    background: var(--st-gold);
    color: #2a1c12;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
}

.stories-library .story-book-body {
    padding: 1rem 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
}

.stories-library .story-book-title {
    margin: 0;
    font-size: 1.05rem;
    color: var(--st-brown);
    line-height: 1.25;
    font-family: 'Baloo 2', Georgia, serif;
}

.stories-library .story-book-author {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(61, 38, 26, 0.55);
}

.stories-library .story-book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: rgba(61, 38, 26, 0.65);
}

.stories-library .story-book-stars {
    color: var(--st-gold);
}

.stories-library .story-book-price {
    font-weight: 800;
    color: var(--st-green);
}

.stories-library .story-book-desc {
    margin: 0;
    font-size: 0.82rem;
    color: rgba(61, 38, 26, 0.68);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stories-library .story-book-actions {
    margin-top: auto;
    display: flex;
    gap: 0.45rem;
}

.stories-library .story-book-btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 0.7rem 0.75rem;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.stories-library .story-book-btn.primary {
    background: var(--st-red);
    color: #fff;
}

.stories-library .story-book-btn.secondary {
    background: rgba(9, 115, 161, 0.1);
    color: var(--st-blue);
}

.stories-library .story-book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.stories-library .story-book-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    background: rgba(17, 128, 43, 0.1);
    color: var(--st-green);
}

.stories-library .stories-shelf-strip {
    margin-top: 2rem;
    background: linear-gradient(180deg, #e2c49a, #b8956a);
    border-radius: 14px;
    padding: 1.25rem 1rem 1.5rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 8px 18px rgba(61, 31, 10, 0.15);
    position: relative;
}

.stories-library .stories-shelf-strip::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -7px;
    height: 10px;
    background: linear-gradient(180deg, #0c5c1f, #094a19);
    border-radius: 0 0 6px 6px;
}

.stories-library .stories-shelf-books {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
}

.stories-library .stories-shelf-book {
    flex: 0 0 72px;
    height: 104px;
    border-radius: 4px 7px 7px 4px;
    overflow: hidden;
    border: none;
    padding: 0;
    cursor: pointer;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.25);
    background: var(--st-green);
}

.stories-library .stories-shelf-book img,
.stories-library .stories-shelf-book span {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
}

.story-reader-overlay .story-reader-body {
    padding: 1.25rem 1.5rem 1.75rem;
    overflow: auto;
    background: linear-gradient(180deg, #fffef9, #f8f3ea);
}

.story-reader-article {
    max-width: 720px;
    margin: 0 auto;
    color: #1e293b;
    line-height: 1.7;
    font-size: 1.05rem;
}

.story-reader-article h2,
.story-reader-article h3 {
    color: #0c5c1f;
    margin-top: 1.25rem;
}

.story-reader-actions {
    max-width: 720px;
    margin: 1.5rem auto 0;
    display: flex;
    justify-content: flex-end;
}

body.dark-mode .story-reader-overlay .story-reader-body,
html[data-theme="dark"] .story-reader-overlay .story-reader-body {
    background: linear-gradient(180deg, #12261a, #0d1a12);
}

body.dark-mode .story-reader-article h2,
body.dark-mode .story-reader-article h3,
html[data-theme="dark"] .story-reader-article h2,
html[data-theme="dark"] .story-reader-article h3 {
    color: #ffffff;
}

body.dark-mode .stories-library .story-book-btn.secondary,
html[data-theme="dark"] .stories-library .story-book-btn.secondary {
    background: #163222;
    color: #ffffff;
    border-color: #2a4a34;
}

@media (max-width: 960px) {
    .stories-library .stories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stories-library .stories-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stories-library .stories-grid,
    .stories-library .stories-perks {
        grid-template-columns: 1fr;
    }
}
