/* TD ET Filtres : archive des plateformes.
 * Mobile first, un seul breakpoint à 1000px.
 * Les couleurs se surchargent depuis le thème : .tdetf-scope { --tdetf-accent: ... } */

.tdetf-scope {
    --tdetf-accent: #a4002f;
    --tdetf-accent-dark: #7a0023;
    --tdetf-text: #1b1d22;
    --tdetf-muted: #4f5563;
    --tdetf-border: #d5d9e0;
    --tdetf-border-strong: #7f8696;
    --tdetf-soft: #f2f4f7;
    --tdetf-chip: #e9ecf1;
    --tdetf-radius: 10px;
}

/* texte réservé aux lecteurs d'écran */
.tdetf-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tdetf-scope :focus-visible {
    outline: 3px solid var(--tdetf-accent);
    outline-offset: 2px;
}

.tdetf-icon {
    flex: none;
}

/* bandeau de titre */
.tdetf-hero {
    padding: 2rem 1rem 1.5rem;
    background:
        linear-gradient(90deg, #fff 30%, rgba(255, 255, 255, 0) 100%),
        var(--tdetf-hero-image, linear-gradient(135deg, #e7e9ee, #cdd2da));
    background-size: cover;
    background-position: center;
}

.tdetf-hero::before {
    content: "";
    display: block;
    width: 4.5rem;
    height: 2px;
    margin-bottom: 1.5rem;
    background: var(--tdetf-accent);
}

.tdetf-hero > * {
    margin-block: 0;
    max-width: none;
}

.tdetf-scope .tdetf-title {
    margin: 0;
    font-size: clamp(1.75rem, 6vw, 3rem);
    line-height: 1.15;
    overflow-wrap: break-word;
    color: var(--tdetf-text);
}

/* mise en page : panneau puis résultats */
.tdetf-layout {
    display: grid;
    gap: 0;
    padding: 0;
    max-width: none;
}

.tdetf-layout > * {
    margin-block: 0;
    min-width: 0;
}

/* barre latérale : fond sur toute la hauteur, collée au bord gauche de l'écran */
.tdetf-aside {
    padding: 1.5rem 1rem 2rem;
    background: var(--tdetf-soft);
    color: var(--tdetf-text);
}

.tdetf-main {
    padding: 1.5rem 1rem 3rem;
}

/* panneau de filtres : sans cadre, l'espacement structure les groupes */
.tdetf-panel {
    color: var(--tdetf-text);
}

.tdetf-search {
    display: flex;
    overflow: hidden;
    border: 1px solid var(--tdetf-border-strong);
    border-radius: 6px;
    background: #fff;
}

.tdetf-search input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 0;
    background: transparent;
    color: var(--tdetf-text);
    font: inherit;
    font-size: 1rem;
}

.tdetf-search input:focus-visible {
    outline-offset: -3px;
}

.tdetf-search button {
    display: grid;
    place-items: center;
    width: 3rem;
    border: 0;
    background: var(--tdetf-accent);
    color: #fff;
    cursor: pointer;
}

.tdetf-search button:hover {
    background: var(--tdetf-accent-dark);
}

.tdetf-active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-top: 1.5rem;
}

.tdetf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tdetf-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: #fff;
    color: var(--tdetf-text);
    font-size: 0.9375rem;
    text-decoration: none;
}

.tdetf-chip:hover {
    box-shadow: inset 0 0 0 1px var(--tdetf-accent);
}

.tdetf-chip .tdetf-icon {
    width: 14px;
    height: 14px;
}

.tdetf-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--tdetf-accent);
    font-size: 0.9375rem;
}

.tdetf-clear .tdetf-icon {
    width: 16px;
    height: 16px;
}

.tdetf-groups {
    margin-top: 1.5rem;
}

.tdetf-group + .tdetf-group {
    margin-top: 0.5rem;
}

.tdetf-group summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    font-size: 1.125rem;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.tdetf-group summary::-webkit-details-marker {
    display: none;
}

.tdetf-group summary::after {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.2rem) rotate(45deg);
    transition: transform 0.2s;
}

.tdetf-group[open] summary::after {
    transform: translateY(0.2rem) rotate(-135deg);
}

.tdetf-group__title {
    flex: 1;
}

.tdetf-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--tdetf-accent);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
}

.tdetf-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0.25rem 0 0.75rem;
    border: 0;
}

.tdetf-options {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tdetf-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2rem;
    cursor: pointer;
}

.tdetf-option input {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--tdetf-accent);
}

.tdetf-option__count {
    margin-left: auto;
    color: var(--tdetf-muted);
    font-size: 0.875rem;
}

.tdetf-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 0;
    padding: 0;
}

.tdetf-summary .tdetf-icon {
    width: 24px;
    height: 24px;
}

.tdetf-reset,
.tdetf-apply {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-sizing: border-box;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.8rem 1rem;
    border: 2px solid var(--tdetf-accent);
    border-radius: 6px;
    background: transparent;
    color: var(--tdetf-accent);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.tdetf-reset:hover,
.tdetf-apply:hover {
    background: var(--tdetf-accent);
    color: #fff;
}

/* barre d'outils : compteur, tri, vue */
.tdetf-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 2rem;
}

.tdetf-count {
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 700;
}

.tdetf-tools,
.tdetf-sort {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.tdetf-select {
    min-height: 2.75rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--tdetf-border-strong);
    border-radius: 6px;
    background-color: #fff;
    color: var(--tdetf-text);
    font: inherit;
    font-size: 1rem;
}

.tdetf-views {
    display: flex;
    gap: 0.5rem;
}

.tdetf-view-btn {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--tdetf-border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--tdetf-text);
    cursor: pointer;
}

.tdetf-view-btn[aria-pressed="true"] {
    border-color: var(--tdetf-accent);
    background: var(--tdetf-accent);
    color: #fff;
}

/* résultats */
.tdetf-results.is-loading {
    opacity: 0.55;
    transition: opacity 0.2s;
}

@media (prefers-reduced-motion: reduce) {
    .tdetf-results.is-loading,
    .tdetf-group summary::after {
        transition: none;
    }
}

.tdetf-results .wp-block-post-template {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tdetf-results.is-list .wp-block-post-template {
    grid-template-columns: 1fr;
}

.tdetf-empty {
    padding: 1.5rem;
    border-radius: var(--tdetf-radius);
    background: var(--tdetf-soft);
}

/* carte plateforme */
.tdetf-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: var(--tdetf-radius);
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.07);
}

.tdetf-card .wp-block-post-featured-image {
    margin: 0;
}

.tdetf-card .wp-block-post-featured-image img {
    display: block;
    width: 100%;
    object-fit: cover;
}

.tdetf-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
}

.tdetf-card__body > * {
    margin-block: 0;
}

.tdetf-scope .tdetf-card__title {
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    line-height: 1.2;
    overflow-wrap: break-word;
}

.tdetf-scope .tdetf-card__title a {
    color: var(--tdetf-text);
    text-decoration: none;
}

.tdetf-scope .tdetf-card__title a:hover {
    text-decoration: underline;
    text-decoration-color: var(--tdetf-accent);
    text-underline-offset: 0.2em;
}

.tdetf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tdetf-tags .wp-block-post-terms__separator {
    display: none;
}

.tdetf-scope .tdetf-tags a {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: var(--tdetf-chip);
    color: var(--tdetf-text);
    font-size: 0.875rem;
    text-decoration: none;
}

.tdetf-scope .tdetf-tags a:hover {
    background: #dde1e8;
}

.tdetf-card__excerpt {
    color: var(--tdetf-text);
}

.tdetf-card__excerpt p {
    margin: 0;
}

.tdetf-themes {
    position: relative;
    margin-top: 0.5rem;
    padding: 0.25rem 0 0 2.25rem;
    color: var(--tdetf-muted);
    font-size: 0.9375rem;
}

.tdetf-themes::before {
    content: "";
    position: absolute;
    top: 0.35rem;
    left: 0;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--tdetf-text);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3h6M10 3v6l-5 9a2 2 0 0 0 1.8 3h10.4a2 2 0 0 0 1.8-3l-5-9V3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3h6M10 3v6l-5 9a2 2 0 0 0 1.8 3h10.4a2 2 0 0 0 1.8-3l-5-9V3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tdetf-themes .wp-block-post-terms__prefix {
    display: block;
    color: var(--tdetf-text);
    font-weight: 700;
}

.tdetf-scope .tdetf-themes a {
    color: inherit;
    text-decoration: none;
}

.tdetf-scope .tdetf-themes a:hover {
    text-decoration: underline;
    text-decoration-color: var(--tdetf-accent);
}

.tdetf-scope .wp-block-read-more.tdetf-btn {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 0.6rem;
    margin-top: auto;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    background: var(--tdetf-accent);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.tdetf-scope .wp-block-read-more.tdetf-btn::after {
    content: "";
    width: 1.1rem;
    height: 1.1rem;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tdetf-scope .wp-block-read-more.tdetf-btn:hover {
    background: var(--tdetf-accent-dark);
}

/* pagination : les numéros passent sur leur propre ligne en mobile */
.tdetf-results .wp-block-query-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
}

.tdetf-results .wp-block-query-pagination-numbers {
    display: flex;
    flex: 0 0 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    order: -1;
}

.tdetf-scope .tdetf-results .page-numbers {
    display: inline-grid;
    place-items: center;
    min-width: 2.75rem;
    height: 2.75rem;
    padding: 0 0.5rem;
    border-radius: 6px;
    background: var(--tdetf-soft);
    color: var(--tdetf-text);
    font-weight: 700;
    text-decoration: none;
}

.tdetf-scope .tdetf-results a.page-numbers:hover {
    background: var(--tdetf-chip);
    box-shadow: inset 0 0 0 1px var(--tdetf-accent);
}

.tdetf-scope .tdetf-results .page-numbers.current {
    background: var(--tdetf-accent);
    color: #fff;
}

.tdetf-scope .tdetf-results .page-numbers.dots {
    min-width: auto;
    background: transparent;
}

.tdetf-scope .tdetf-results .wp-block-query-pagination-previous,
.tdetf-scope .tdetf-results .wp-block-query-pagination-next {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0 0.75rem;
    border: 2px solid var(--tdetf-accent);
    border-radius: 6px;
    color: var(--tdetf-accent);
    font-size: 0.9375rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.tdetf-scope .tdetf-results .wp-block-query-pagination-previous:hover,
.tdetf-scope .tdetf-results .wp-block-query-pagination-next:hover {
    background: var(--tdetf-accent);
    color: #fff;
}

/* grand écran : panneau fixe à gauche, résultats à droite */
@media (min-width: 1000px) {
    .tdetf-hero {
        padding: 3.5rem 3.5rem 3rem;
    }

    .tdetf-layout {
        grid-template-columns: minmax(20rem, 28%) minmax(0, 1fr);
    }

    .tdetf-aside {
        padding: 2.5rem 2rem 3rem clamp(2rem, 4vw, 3.5rem);
    }

    .tdetf-main {
        padding: 2.5rem 3.5rem 4rem 3rem;
    }

    /* le panneau reste visible pendant le défilement, le fond de la barre reste pleine hauteur */
    .tdetf-panel {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 2rem);
        margin: -0.25rem;
        padding: 0.25rem;
        overflow-y: auto;
    }

    .tdetf-results .wp-block-query-pagination {
        justify-content: space-between;
    }

    .tdetf-results .wp-block-query-pagination-numbers {
        flex: 0 1 auto;
        order: 0;
    }

    .tdetf-scope .tdetf-results .wp-block-query-pagination-previous,
    .tdetf-scope .tdetf-results .wp-block-query-pagination-next {
        flex: 0 0 auto;
        gap: 0.6rem;
        padding: 0 1.25rem;
        font-size: 1rem;
    }

    /* vue liste : image à gauche, contenu à droite */
    .tdetf-results.is-list .tdetf-card {
        flex-direction: row;
    }

    .tdetf-results.is-list .tdetf-card .wp-block-post-featured-image {
        flex: 0 0 18rem;
    }

    .tdetf-results.is-list .tdetf-card .wp-block-post-featured-image img {
        height: 100%;
        aspect-ratio: auto !important;
    }
}
