/* MCR Stories hub - discovery controls, 2026-08-10.
 *
 * Additive only. This file styles the parts the hub did not previously have:
 * the search and filter bar, facet counts, real pagination, honest empty
 * states, and the story counts on the neighbourhood and writer tiles.
 *
 * It does not restyle a single existing element of the magazine design. Every
 * selector is nested under .stories-hub and every colour is taken from that
 * component's own custom properties, so the dark canvas, the red accent and the
 * serif display face are inherited rather than redeclared.
 *
 * No shared stylesheet is touched. Loaded only on the Stories page template.
 */

/* =========================================================================
   Masthead story count
   ========================================================================= */

.stories-hub .sh-masthead-count {
    display: block;
    margin-top: 6px;
    color: var(--sh-muted);
}

.stories-hub .sh-masthead-count strong {
    color: var(--sh-text);
    font-weight: 700;
}

/* =========================================================================
   Category rail - facet counts
   ========================================================================= */

.stories-hub .sh-cat-pill .cp-count {
    margin-left: 7px;
    font-size: 0.72em;
    font-weight: 700;
    color: var(--sh-muted);
    font-variant-numeric: tabular-nums;
}

.stories-hub .sh-cat-pill.active .cp-count {
    color: inherit;
    opacity: 0.72;
}

/* =========================================================================
   Search + filter bar
   ========================================================================= */

.stories-hub .sh-filterbar {
    max-width: var(--sh-max);
    margin: 0 auto;
    padding: 18px 24px 4px;
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(auto-fit, minmax(140px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.stories-hub .sh-fb-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.stories-hub .sh-fb-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sh-muted);
}

.stories-hub .sh-fb-input,
.stories-hub .sh-fb-select {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: var(--sh-surface);
    color: var(--sh-text);
    font-family: var(--sh-sans);
    font-size: 0.86rem;
    -webkit-appearance: none;
    appearance: none;
}

.stories-hub .sh-fb-select {
    /* Chevron drawn inline so the control needs no image asset. */
    background-image: linear-gradient(45deg, transparent 50%, #9a9a9a 50%),
                      linear-gradient(135deg, #9a9a9a 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.stories-hub .sh-fb-input::placeholder { color: #6a6a6a; }

.stories-hub .sh-fb-input:focus,
.stories-hub .sh-fb-select:focus {
    outline: none;
    border-color: var(--sh-red);
}

.stories-hub .sh-fb-input:focus-visible,
.stories-hub .sh-fb-select:focus-visible,
.stories-hub .sh-fb-btn:focus-visible,
.stories-hub .sh-fb-clear:focus-visible,
.stories-hub .sh-pagination a:focus-visible {
    outline: 2px solid var(--sh-red);
    outline-offset: 2px;
}

.stories-hub .sh-fb-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stories-hub .sh-fb-btn {
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--sh-radius);
    background: var(--sh-red);
    color: #fff;
    font-family: var(--sh-sans);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.18s ease;
}

.stories-hub .sh-fb-btn:hover { opacity: 0.88; }

.stories-hub .sh-fb-clear {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    color: var(--sh-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.stories-hub .sh-fb-clear:hover { color: var(--sh-text); border-color: #333; }

@media (max-width: 900px) {
    .stories-hub .sh-filterbar {
        grid-template-columns: 1fr 1fr;
        padding-left: 16px;
        padding-right: 16px;
    }
    .stories-hub .sh-fb-search { grid-column: 1 / -1; }
    .stories-hub .sh-fb-actions { grid-column: 1 / -1; }
    .stories-hub .sh-fb-btn { flex: 1; }
}

/* =========================================================================
   Result line on the filtered view
   ========================================================================= */

.stories-hub .sh-result-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 24px;
    font-size: 0.9rem;
    color: var(--sh-muted);
}

.stories-hub .sh-result-line strong {
    color: var(--sh-text);
    font-weight: 700;
}

.stories-hub .sh-result-clear {
    color: var(--sh-red);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}

.stories-hub .sh-result-clear:hover { text-decoration: underline; }

/* =========================================================================
   Neighbourhood + writer counts
   ========================================================================= */

.stories-hub .sh-hood-count {
    position: relative;
    z-index: 2;
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.stories-hub .sh-hood-tile.is-active {
    outline: 2px solid var(--sh-text);
    outline-offset: 2px;
}

.stories-hub .sh-writer-count {
    display: block;
    margin-top: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--sh-muted);
    font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Honest empty states
   ========================================================================= */

.stories-hub .sh-empty--inline {
    grid-column: 1 / -1;
    padding: 34px 24px;
    border: 1px dashed var(--sh-border);
    border-radius: var(--sh-radius);
    background: rgba(255, 255, 255, 0.015);
    text-align: center;
}

.stories-hub .sh-empty--inline p {
    margin: 0;
    color: var(--sh-text);
    font-size: 0.94rem;
    font-weight: 600;
}

.stories-hub .sh-empty-note {
    margin-top: 8px !important;
    color: var(--sh-muted) !important;
    font-size: 0.82rem !important;
    font-weight: 400 !important;
    line-height: 1.55;
    max-width: 52ch;
    margin-left: auto !important;
    margin-right: auto !important;
}

.stories-hub .sh-empty-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

/* =========================================================================
   Pagination
   ========================================================================= */

.stories-hub .sh-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 34px;
}

.stories-hub .sh-pagination-count {
    font-size: 0.76rem;
    color: var(--sh-muted);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.stories-hub .sh-pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.stories-hub .sh-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: var(--sh-surface);
    color: var(--sh-text);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.stories-hub .sh-pagination .page-numbers:hover { border-color: #3a3a3f; }

.stories-hub .sh-pagination .page-numbers.current {
    background: var(--sh-red);
    border-color: var(--sh-red);
    color: #fff;
}

.stories-hub .sh-pagination .page-numbers.dots {
    border-color: transparent;
    background: transparent;
    color: var(--sh-muted);
    min-width: 24px;
    padding: 0;
}

@media (prefers-reduced-motion: reduce) {
    .stories-hub .sh-fb-btn,
    .stories-hub .sh-pagination .page-numbers { transition: none; }
}
