.stories-hero,
.story-detail-hero {
    background: var(--bs-body-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    padding: 2.75rem 0;
}

.stories-hero-copy,
.story-detail-heading {
    max-width: 780px;
    margin: 0 auto;
    text-align: center;
}

.stories-hero-copy h1,
.story-detail-heading h1 {
    color: var(--bs-heading-color, var(--bs-body-color));
    font-size: clamp(2rem, 3.2vw, 2.75rem) !important;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
    text-wrap: balance;
    margin: 0;
}

.stories-hero-copy p,
.story-detail-heading p {
    color: var(--bs-secondary-color);
    font-size: 1.08rem;
    line-height: 1.7;
    margin: 1rem auto 0;
    max-width: 680px;
}

.stories-section {
    padding: 2.75rem 0 1rem;
}

.stories-category-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Match the subtle category treatment on content_post. */
.story-hero-badge,
.story-card-meta a,
.story-card-meta span {
    display: inline-block;
    max-width: 100%;
    padding: .35rem .75rem;
    border-radius: var(--bs-border-radius-pill);
    background-color: #cfe9ff;
    color: #0067c2;
    font-size: .75rem;
    font-weight: 400;
    line-height: 1.4;
    text-decoration: none;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.story-hero-badge,
.story-card-meta a {
    background-image: linear-gradient(to right, #0067c2 50%, transparent 50%);
    background-size: 200% 100%;
    background-position: right center;
    background-repeat: no-repeat;
    transition: background-position .35s ease, color .35s ease;
}

.story-hero-badge {
    margin-bottom: 1rem;
}

.story-hero-badge:hover,
.story-hero-badge:focus-visible,
.story-card-meta a:hover,
.story-card-meta a:focus-visible {
    background-position: left center;
    color: #fff;
    text-decoration: none !important;
}

.story-hero-badge:focus-visible,
.story-card a:focus-visible {
    outline: 2px solid #0067c2;
    outline-offset: 3px;
}

.stories-category-strip .btn {
    padding: .5rem 1.25rem;
    white-space: normal;
}

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

.stories-grid-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.story-card {
    background: var(--bs-body-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.story-card-image {
    background: var(--bs-tertiary-bg);
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

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

@media (hover: hover) {
    .story-card:hover .story-card-image img {
        transform: scale(1.035);
    }
}

.story-card-body {
    padding: 1.25rem;
}

.story-card-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.story-card-meta time {
    color: var(--bs-secondary-color);
    font-size: 0.86rem;
}

.story-card h2,
.story-card h3 {
    font-size: 1.3rem !important;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 0.7rem;
}

.story-card h2 a,
.story-card h3 a {
    color: var(--bs-primary-text-emphasis);
    text-decoration: none;
}

.story-card p {
    color: var(--bs-body-color);
    line-height: 1.65;
    margin: 0;
}

.stories-empty {
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin: 0 auto;
    max-width: 680px;
    padding: 2rem;
    text-align: center;
}

.story-featured-image {
    margin: 2rem auto;
    max-width: 980px;
}

.story-featured-image img {
    border-radius: 12px;
    display: block;
    height: auto;
    width: 100%;
}

.story-content,
.story-category-content {
    margin: 0 auto;
    max-width: 820px;
}

.story-content figure,
.story-category-content figure {
    margin: 1.75rem 0;
}

.story-content figure img,
.story-category-content figure img {
    border-radius: 12px;
    height: auto;
    max-width: 100%;
}

.story-content figcaption,
.story-category-content figcaption {
    color: var(--bs-secondary-color);
    font-size: 0.92rem;
    margin-top: 0.55rem;
    text-align: center;
}

.story-related {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 3rem;
    padding-top: 2rem;
}

.story-related > h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    text-align: center;
}

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

@media (max-width: 575.98px) {
    .stories-hero-copy h1,
    .story-detail-heading h1 {
        font-size: 2rem !important;
    }

    .stories-grid,
    .stories-grid-compact {
        grid-template-columns: 1fr;
    }

    .stories-hero,
    .story-detail-hero {
        padding: 2rem 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .story-hero-badge,
    .story-card-meta a,
    .story-card-image img {
        transition: none;
    }

    .story-card:hover .story-card-image img {
        transform: none;
    }
}
