/* Přehled + filtr nad mřížkou (příběhy, postavy, …) */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page-main.js-listing-root .page-heading::after {
    content: none;
    display: none;
}

.page-main.js-listing-root .page-heading {
    margin-bottom: clamp(2rem, 5vw, 3rem);
    padding-top: clamp(0.75rem, 2.5vw, 1.5rem);
}

.page-list-summary {
    --page-list-pad-x: clamp(16px, 4vw, 36px);
    width: 100%;
    max-width: 1420px;
    margin: 0.7rem auto 1.25rem;
    padding: 0 var(--page-list-pad-x);
    box-sizing: border-box;
}

.page-list-intro {
    margin: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-muted);
    text-align: justify;
}

/* Oddělení úvodu od filtrů — plná šířka vnitřku shellu (gutter řeší rodič .page-list-intro-section) */
.page-list-intro::after {
    content: "";
    display: block;
    width: 100%;
    max-width: 100%;
    height: 1px;
    margin: 1.1rem 0 1.35rem;
    border-radius: 0;
    background: var(--border-soft);
    box-shadow: none;
}

.page-list-summary__title {
    font-family: var(--font-body);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.85rem;
    text-align: center;
}

.page-list-summary__hint {
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0.65rem 0 0;
    opacity: 0.88;
    line-height: 1.4;
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

.page-list-summary__chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.65rem;
    width: 100%;
    box-sizing: border-box;
}

/* Rozcestník: jeden řádek, pole se dělí podle počtu (--listing-chip-count z PHP) */
.page-list-summary__chips--signpost {
    --listing-chip-count: 3;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.page-list-summary__chips--signpost .list-chip--signpost {
    flex: 1 1 calc(100% / var(--listing-chip-count, 3));
    min-width: 0;
    justify-content: center;
    text-align: center;
}

.list-chip {
    font-family: var(--font-body);
    font-size: 0.82rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--color-paper);
    color: var(--color-ink-soft);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.list-chip--signpost {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.08rem;
    height: 2.4rem;
    min-height: 2.4rem;
    padding: 0.42rem 0.85rem;
    border-radius: var(--radius-pill);
    font-size: clamp(0.84rem, 1.05vw, 0.95rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
    border-width: 1px;
    background: var(--panel-soft, #2d343a);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}

.list-chip:hover,
.list-chip:focus-visible {
    border-color: var(--accent-blue-soft);
    color: #fff;
    outline: none;
}

.list-chip--signpost:hover,
.list-chip--signpost:focus-visible {
    border-color: rgba(58, 83, 100, 0.95);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.list-chip.is-active {
    background: var(--accent-blue-soft);
    border-color: var(--accent-blue-soft);
    color: #fff;
}

.list-chip--signpost.is-active {
    background: var(--accent-blue-soft);
    border-color: rgba(147, 180, 200, 0.45);
    box-shadow: 0 0 0 1px rgba(147, 180, 200, 0.2), 0 3px 12px rgba(0, 0, 0, 0.28);
}

/* --- Hloubkový filtr (rozbalovací) --- */
.page-list-filter-details {
    width: 100%;
    max-width: 1420px;
    margin: 0 auto 1.5rem;
    padding: 0 clamp(16px, 4vw, 36px);
    box-sizing: border-box;
}

.page-list-filter-details__summary {
    list-style: none;
    cursor: pointer;
    /* 1fr | obsah (lupa + text) | 1fr — stejná rezerva vlevo i vpravo, šipka vpravo; střed vizuálně uprostřed řádku */
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--border-soft);
    border-radius: 1px;
    background: rgba(33, 38, 43, 0.9);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.24);
    user-select: none;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(58, 83, 100, 0.25);
    touch-action: manipulation;
}

.page-list-filter-details__summary-inner {
    grid-column: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-width: 0;
    max-width: 100%;
}

.page-list-filter-details__summary::-webkit-details-marker {
    display: none;
}

.page-list-filter-details__summary::after {
    content: "";
    grid-column: 3;
    justify-self: end;
    align-self: center;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid var(--accent-blue-soft);
    border-bottom: 2px solid var(--accent-blue-soft);
    transform: rotate(45deg);
    margin: 0;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.page-list-filter-details[open] > .page-list-filter-details__summary::after {
    transform: rotate(-135deg);
    margin-top: 0.2rem;
}

.page-list-filter-details[open] > .page-list-filter-details__summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.page-list-filter-details__search-text {
    font-family: var(--font-body);
    font-size: 0.84rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    line-height: 1;
    white-space: nowrap;
}

.page-list-filter-details__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--accent);
    opacity: 0.95;
}

.page-list-filter {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.15rem clamp(14px, 3vw, 28px) 1.35rem;
    box-sizing: border-box;
    border: 1px solid var(--border-soft);
    border-top: 0;
    border-radius: 0 0 1px 1px;
    background: rgba(0, 0, 0, 0.22);
}

.page-list-filter-details[open] .page-list-filter {
    animation: page-filter-slide-down 220ms ease;
    transform-origin: top center;
}

@keyframes page-filter-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-list-filter__title {
    font-family: var(--font-body);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.page-list-filter__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 0.75rem 1rem;
    align-items: start;
}

.page-list-filter__field--wide {
    grid-column: 1 / -1;
}

.page-list-filter__field label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.page-list-filter__field input,
.page-list-filter__field select {
    width: 100%;
    height: 2.4rem;
    min-height: 2.4rem;
    padding: 0.45rem 0.65rem;
    border-radius: 1px;
    border: 1px solid var(--border-soft);
    background: var(--panel-bg);
    color: var(--accent);
    font-family: var(--font-body);
    font-size: clamp(0.84rem, 1.05vw, 0.95rem);
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.page-list-filter__field input:focus,
.page-list-filter__field select:focus {
    outline: none;
    border-color: var(--accent-blue-soft);
    box-shadow: 0 0 0 3px rgba(58, 83, 100, 0.25);
}

.page-list-filter__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.15rem;
    align-items: flex-end;
}

.page-list-filter__reset {
    font-family: var(--font-body);
    font-size: 0.82rem;
    padding: 0.42rem 0.95rem;
    min-height: 2.4rem;
    border-radius: 1px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: #d08383;
    cursor: pointer;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.page-list-filter__reset:hover,
.page-list-filter__reset:focus-visible {
    border-color: #d08383;
    color: #ffd9d9;
    outline: none;
}

.page-subsection-divider {
    width: min(
        calc(1420px - (2 * clamp(16px, 4vw, 36px))),
        calc(100% - (2 * clamp(16px, 4vw, 36px)))
    );
    max-width: 100%;
    height: 1px;
    margin: 0 auto 1.7rem;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

.js-listing-card.is-filtered-out {
    display: none !important;
}

/* Scroll reveal karet (postavy/příběhy) */
.listing-reveal-ready .js-listing-card {
    opacity: 0;
    transform: translate3d(var(--reveal-x, 0), var(--reveal-y, 120px), 0);
    transition: opacity 1.8s ease, transform 2.6s cubic-bezier(0.16, 1, 0.3, 1);
    visibility: hidden;
}

.listing-reveal-ready .js-listing-card.reveal-from-left {
    --reveal-x: -120px;
    --reveal-y: 0px;
}

.listing-reveal-ready .js-listing-card.reveal-from-right {
    --reveal-x: 120px;
    --reveal-y: 0px;
}

.listing-reveal-ready .js-listing-card.reveal-from-bottom {
    --reveal-x: 0px;
    --reveal-y: 120px;
}

.listing-reveal-ready.reveal-armed .js-listing-card {
    visibility: visible;
    position: relative;
    z-index: 0;
}

.listing-reveal-ready.reveal-armed .js-listing-card.has-entered {
    opacity: 1;
}

.listing-reveal-ready .js-listing-card.has-entered:not(.is-revealed) {
    opacity: 0;
    transform: translate3d(var(--reveal-x, 0), var(--reveal-y, 120px), 0);
}

.listing-reveal-ready .js-listing-card.is-revealed {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Desktop: interpolace reveal při scrollu kolečkem (postavy) */
@media (min-width: 1025px) {
    .listing-reveal-ready[data-listing-reveal-smooth='desktop'].listing-reveal-smooth.reveal-armed .js-listing-card {
        transition: none;
        visibility: visible;
    }

    .listing-reveal-ready[data-listing-reveal-smooth='desktop'].listing-reveal-smooth .js-listing-card.is-revealed {
        opacity: var(--listing-reveal-opacity, 0);
        transform: var(--listing-reveal-transform, none);
    }
}

@media (prefers-reduced-motion: reduce) {
    .listing-reveal-ready .js-listing-card {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Mobil/tablet: návrat zpět je skutečně "mimo obraz", ne jen lehké odskočení */
@media (max-width: 1024px) {
    .listing-reveal-ready:not(.page-stories-archive) .js-listing-card.reveal-from-left {
        --reveal-x: -90%;
        --reveal-y: 0px;
    }

    .listing-reveal-ready:not(.page-stories-archive) .js-listing-card.reveal-from-right {
        --reveal-x: 90%;
        --reveal-y: 0px;
    }
}

/* --- Mobilní úpravy --- */
@media (max-width: 768px) {
    .page-list-intro {
        max-width: 100%;
        margin-bottom: 0;
        font-size: 0.9375rem;
        line-height: 1.5;
        text-align: justify;
        text-align-last: left;
    }

    .page-list-intro-section .page-list-intro {
        max-width: var(--intro-text-max-ch, 100%);
        text-align: left;
        text-align-last: left;
    }

    .page-list-intro::after {
        margin: 0.95rem auto 1.15rem;
    }

    .page-list-summary {
        --page-list-pad-x: var(--page-gutter);
        margin-bottom: 0.95rem;
    }

    .page-list-summary__title {
        font-size: 0.68rem;
        margin-bottom: 0.65rem;
    }

    .page-list-summary__hint {
        font-size: 0.68rem;
        margin-top: 0.5rem;
    }

    .page-list-summary__chips--signpost {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-list-summary__chips--signpost .list-chip--signpost {
        flex: 1 1 calc(50% - 0.35rem);
        min-width: calc(50% - 0.35rem);
        height: 2.35rem;
        min-height: 2.35rem;
        font-size: 0.95rem;
        padding: 0.42rem 0.75rem;
    }

    /* „Vše“ přes celou šířku jako první řádek */
    .page-list-summary__chips--signpost .list-chip--all {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .page-list-filter-details {
        padding: 0;
        padding-left: var(--page-gutter-left);
        padding-right: var(--page-gutter-right);
        margin-bottom: 1.05rem;
    }

    /* Stejná mřížka jako na desktopu — symetrické 1fr, střed opticky uprostřed */
    .page-list-filter-details__summary {
        grid-template-columns: 1fr auto 1fr;
        min-height: 2.75rem;
        padding: 0.8rem clamp(0.55rem, 3.2vw, 1rem);
    }

    .page-list-filter-details__summary-inner {
        gap: 0.75rem;
    }

    .page-list-filter-details__summary::after {
        justify-self: end;
        align-self: center;
        margin-right: 0.15rem;
    }

    .page-list-filter-details__search-text {
        font-size: 0.8rem;
        letter-spacing: 0.1em;
    }

    .page-list-filter-details__icon {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .page-list-filter-details[open] > .page-list-filter-details__summary::after {
        margin-top: 0.18rem;
    }

    .page-list-filter {
        padding: 1rem 0.9rem 1.15rem;
    }

    .page-list-filter__grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .page-list-filter__field--wide {
        grid-column: 1;
    }

    .page-list-filter__field input,
    .page-list-filter__field select {
        height: 2.35rem;
        min-height: 2.35rem;
        font-size: 0.95rem;
    }

    .page-list-filter__actions {
        justify-content: stretch;
    }

    .page-list-filter__reset {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .page-list-summary__chips--signpost .list-chip--signpost:not(.list-chip--all) {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .page-list-filter-details__summary {
        min-height: 3rem;
        padding: 0.75rem clamp(0.45rem, 2.8vw, 0.85rem);
    }

    .page-list-filter-details__summary-inner {
        gap: 0.65rem;
    }

    .page-list-filter-details__search-text {
        font-size: 0.78rem;
        letter-spacing: 0.08em;
    }

    .page-list-filter-details__icon {
        width: 19px;
        height: 19px;
    }
}
