/* ============================================================
   Stories page styles  (css/stories.css)
   Depends on the shared tokens in css/main.css
   ============================================================ */

/* ---------- Layout ---------- */
.stories-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 28px 90px 28px;
}

.category-tag {
    display: inline-block;
    background: var(--herb-soft);
    border: 1px solid rgba(168, 208, 124, 0.4);
    color: var(--herb);
    /* nth-child variants below rotate this through the food palette */
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    width: fit-content;
}

/* ---------- Featured story ---------- */
.featured-story {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    overflow: hidden;
    margin-bottom: 30px;
}

.featured-img {
    min-height: 320px;
}

.featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-text {
    padding: 46px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.featured-text h2 {
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    font-weight: 700;
    margin-bottom: 14px;
}

.featured-text p {
    font-size: 0.98rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 24px;
}

/* ---------- Story cards ---------- */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}

.story-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
}

/* Story category tags rotate through the food palette */
.stories-grid .story-card:nth-child(3n+2) .category-tag {
    background: var(--chili-soft);
    border-color: rgba(255, 122, 92, 0.4);
    color: var(--chili);
}
.stories-grid .story-card:nth-child(3n) .category-tag {
    background: var(--butter-soft);
    border-color: rgba(255, 217, 138, 0.4);
    color: var(--butter);
}

.story-card:hover {
    transform: translateY(-3px) scale(1.01);
}

.story-card .card-img {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.story-card .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.story-card:hover .card-img img {
    transform: scale(1.05);
}

.story-card .card-body {
    padding: 22px 24px 26px 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.story-card h3 {
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
}

.story-card p {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 16px;
    flex-grow: 1;
}

.link-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--amber);
    cursor: pointer;
    text-align: left;
    width: fit-content;
}

.link-btn:hover {
    text-decoration: underline;
}

/* ---------- Reader modal ---------- */
.story-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 7, 4, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.story-modal {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
    animation: fadeUp 0.3s ease;
}

.story-modal img {
    width: 100%;
    height: 260px;
    object-fit: cover;
}

.story-modal-body {
    padding: 28px 34px 38px 34px;
}

.story-modal-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 8px 0 16px 0;
}

.story-modal-body p {
    font-size: 0.97rem;
    line-height: 1.75;
    color: var(--cream);
    opacity: 0.9;
    margin-bottom: 15px;
}

.story-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(23, 11, 7, 0.75);
    color: var(--cream);
    font-size: 0.95rem;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s ease;
}

.story-close-btn:hover {
    background: var(--amber);
    color: #1a1207;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .stories-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
        margin: 0 auto;
        gap: 20px;
    }

    .featured-story {
        grid-template-columns: 1fr;
    }

    .featured-img {
        min-height: 220px;
    }
}

@media (max-width: 576px) {
    .category-tag { font-size: 0.66rem; padding: 4px 10px; }
    .featured-text { padding: 26px 22px; }
    .featured-text h2 { font-size: clamp(1.3rem, 6.5vw, 1.6rem); }
    .featured-text p { font-size: 0.9rem; margin-bottom: 20px; }
    .featured-img { min-height: 180px; }

    .story-card .card-body { padding: 16px 18px 20px 18px; }
    .story-card h3 { font-size: 0.98rem; }
    .story-card p { font-size: 0.86rem; margin-bottom: 14px; }

    .story-modal-body { padding: 22px 20px 26px 20px; }
    .story-modal img { height: 170px; }
    .story-modal-body h2 { font-size: 1.24rem; }
    .story-modal-body p { font-size: 0.9rem; margin-bottom: 13px; }
}
