/*
 * PokeTeamOn M5.6 R8
 * UX-only hierarchy correction for EXPLAIN.
 *
 * Problem:
 * R1 explanation child panels are appended as siblings of the main <details>.
 * Therefore closing the native EXPLAIN <details> hid its own body but not those
 * sibling child panels.
 *
 * R8 fixes only presentation:
 * - main EXPLAIN collapsed => all child explanation panels hidden
 * - main EXPLAIN expanded => child panels visible again
 * - child expand/collapse state is untouched
 * - child indicator uses the same +/- language as the parent
 */

/* Parent closed means the complete EXPLAIN surface is visually closed. */
.m55-explain-panel >
details[data-m55-explain-details]:not([open]) ~ .m56-explain-panel {
    display: none !important;
}

/*
 * Existing child visibility state still belongs to R1:
 * .m56-explain-toggle[aria-expanded] + .m56-explain-body[hidden].
 * We do not override body[hidden] and do not modify aria-expanded.
 */

/* Hide the legacy child chevron and replace it visually with +/- only. */
.m56-explain-toggle .m56-explain-chevron {
    display: none !important;
}

.m56-explain-toggle::after {
    content: "−";
    width: 1.65rem;
    height: 1.65rem;
    flex: 0 0 1.65rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #D7DCE5;
    border-radius: 999px;
    background: #FFFFFF;
    color: #6D28D9;

    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.m56-explain-toggle[aria-expanded="false"]::after {
    content: "+";
}

.m56-explain-toggle[aria-expanded="true"]::after {
    content: "−";
}
