/* All case studies page (case-studies.html): title and topics, a featured story, then
   every story in a grid that filters by topic or search. */

.stories-head {
    padding: clamp(120px, 8vw + 72px, 176px) 0 clamp(40px, 4vw, 64px);
    border-bottom: 1px solid var(--color-line);
    background: var(--color-paper-soft);
}

.stories-head-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: center;
}

.stories-head h1 {
    margin: 0 0 var(--space-3);
    color: var(--color-ink);
    font-size: clamp(44px, 4.4vw + 12px, 80px);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -.035em;
}

.stories-head h1 em,
.stories-explore h2 em {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -.01em;
}

/* Lime is too light to read on paper, so the italic accent uses the deep green. */
.stories-head h1 em {
    color: var(--color-accent-deep);
}

.stories-lede {
    max-width: 560px;
    margin: 0;
    color: var(--color-ink);
    font-size: 18px;
    line-height: 1.5;
}

.stories-label {
    margin: 0 0 var(--space-2);
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.stories-label--accent {
    color: var(--color-accent-deep);
}

/* Topic chips: square-ish tags, uppercase, in the browse list at the top. */
.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    background: var(--color-paper);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.topic-chip:hover {
    border-color: var(--color-ink);
}

.topic-chip[aria-current="true"] {
    border-color: var(--color-ink);
    color: #fff;
    background: var(--color-ink);
}

/* Featured story ------------------------------------------------------------------ */

.stories-feature {
    padding: clamp(40px, 4vw, 64px) 0;
    background: var(--color-paper-soft);
}

.feature {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: clamp(32px, 4vw, 64px);
    align-items: center;
}

.feature-media {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--color-night);
}

.feature-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(24px, 3vw, 48px);
    background-image: radial-gradient(circle at 15% 85%, rgba(124, 252, 0, .18), transparent 55%), linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: auto, 32px 32px, 32px 32px;
}

.feature-kicker {
    margin: 0 0 var(--space-2);
    color: var(--color-accent);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.feature-panel-title {
    margin: 0;
    color: #fff;
    font-size: clamp(24px, 1.8vw + 12px, 44px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.feature-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s var(--ease-out);
}

.feature-media:hover img {
    transform: scale(1.03);
}

.feature-body h2 {
    margin: var(--space-2) 0;
    font-size: clamp(30px, 1.6vw + 18px, 44px);
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -.025em;
}

.feature-body h2 a:hover,
.story-title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.feature-desc {
    margin: 0 0 var(--space-3);
    color: var(--color-muted);
    font-size: 16px;
    line-height: 24px;
}

.feature-result {
    margin: 0 0 var(--space-3);
    color: var(--color-ink);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
}

.feature-result mark {
    padding: 0 4px;
    color: inherit;
    background: rgba(124, 252, 0, .32);
}

/* Meta line: topic tag, divider, read time. Shared by the featured story and the cards. */
.story-meta,
.story-byline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--color-muted);
    font-size: 14px;
    line-height: 20px;
}

.story-meta > * + *::before,
.story-byline > * + *::before {
    content: "";
    display: inline-block;
    width: 1px;
    height: 12px;
    margin-right: 12px;
    vertical-align: -1px;
    background: var(--color-line);
}

.story-tag {
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--color-ink);
    background: rgba(124, 252, 0, .32);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* Explore: controls and the grid ------------------------------------------------------- */

.stories-explore {
    scroll-margin-top: 72px;
    padding: clamp(56px, 4vw + 32px, 96px) 0 var(--space-section);
    border-top: 1px solid var(--color-line);
}

.stories-explore h2 {
    margin: 0 0 var(--space-5);
    font-size: clamp(40px, 2.4vw + 22px, 64px);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -.045em;
}

.stories-controls {
    display: grid;
    grid-template-columns: minmax(240px, 520px) auto;
    justify-content: space-between;
    gap: var(--space-3);
    padding-bottom: var(--space-5);
    margin-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-line);
}

.stories-controls[hidden] {
    display: none;
}

.stories-filter {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topic-select {
    min-width: 240px;
    min-height: 48px;
    padding: 0 44px 0 16px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    background: var(--color-paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%231a191f' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 16px center;
    font: inherit;
    font-size: 16px;
    appearance: none;
    cursor: pointer;
}

.stories-clear,
.stories-empty button {
    min-height: 44px;
    padding: 0;
    border: 0;
    color: var(--color-muted);
    background: none;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
}

.stories-clear:hover,
.stories-empty button:hover {
    color: var(--color-ink);
}

.stories-search {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 4px 4px 4px 16px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    background: var(--color-paper);
}

/* The whole box shows focus, so the input inside drops the global focus ring. */
.stories-search:focus-within {
    border-color: var(--color-ink);
    box-shadow: 0 0 0 1px var(--color-ink);
}

.stories-search input:focus-visible {
    box-shadow: none;
    border-radius: 0;
}

.stories-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--color-ink);
    background: none;
    font: inherit;
    font-size: 16px;
}

.stories-search button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: var(--color-ink);
    cursor: pointer;
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-8) var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.story-item[hidden] {
    display: none;
}

.story-thumb {
    display: block;
    aspect-ratio: 16 / 10;
    margin-bottom: 4px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--color-night);
}

.story-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s var(--ease-out);
}

.story-item:hover .story-thumb img {
    transform: scale(1.04);
}

.story-title {
    margin: 0;
    color: var(--color-ink);
    font-size: 20px;
    font-weight: 500;
    line-height: 28px;
    letter-spacing: -.01em;
}

.story-byline {
    margin-top: auto;
}

/* Stand-in picture for the research article, which has no photo. */
.story-art {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 100%;
    color: #fff;
    background-image: radial-gradient(circle at 70% 30%, rgba(124, 252, 0, .22), transparent 55%), linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: auto, 24px 24px, 24px 24px;
    font-size: clamp(24px, 1.4vw + 10px, 36px);
    letter-spacing: .04em;
}

.story-art b {
    color: var(--color-accent);
    font-weight: 400;
}

.stories-empty {
    margin: 0;
    color: var(--color-muted);
    font-size: 18px;
}

.stories-empty button {
    margin-left: var(--space-1);
    color: var(--color-accent-deep);
}

@media (max-width: 1100px) {
    .stories-head-layout,
    .feature {
        grid-template-columns: 1fr;
    }

    .story-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .stories-controls {
        grid-template-columns: 1fr;
    }

    .stories-filter {
        justify-content: space-between;
    }

    .topic-select {
        flex: 1;
        min-width: 0;
    }

    .feature-media {
        grid-template-columns: 1fr;
        aspect-ratio: auto;
    }

    .feature-media img {
        aspect-ratio: 16 / 10;
    }
}

@media (max-width: 600px) {
    .story-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .topic-chips {
        gap: var(--space-1);
    }

    .topic-chip {
        padding: 0 14px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .feature-media img,
    .story-thumb img {
        transition: none;
    }
}
