/* 
 * Haupt-Styling für den Details-Block.
*/
details.harsch-accordion {
    padding: 2rem 0;
    /* margin-bottom: 1rem; */
}

/* 
 * Der Summary-Titel.
 */
details.harsch-accordion > summary {
    cursor: pointer;
    position: relative;
    padding: 1rem 1rem 1rem 52px;
    list-style: none;
    border-radius: 0.2rem;
    transition: background-color 0.3s ease;
}

/* 
 * Überschrift im Accordion
*/
details.harsch-accordion .accordion-title {
    font-weight: bold;
    font-size: 1.5em;
    margin: 0;
    margin-left: 2rem;
}

/* 
 * Beschreibung im Accordion
 */
details.harsch-accordion .accordion-description {
    font-weight: normal;
    margin: 0;
}

/* 
 * Content-Container - Basis für Animation
 * Gesteuert via data-state: closed | open
 */
details.harsch-accordion > .wp-block-group:not(.extended-summary) {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

/* 
 * Geöffnetes Accordion
 */
details.harsch-accordion[data-state="open"] > .wp-block-group:not(.extended-summary) {
    max-height: 2000px;
}

/* 
 * Geöffnete Summary mit Hintergrund
 */
details.harsch-accordion[data-state="open"] > summary {
    background-color: var(--color-secondary-100);
}

/* 
 * Container für das Toggle-Icon
 */
details.harsch-accordion > summary::before {
    content: "\F282";
    font-family: "bootstrap-icons";
    position: absolute;
    left: 0.5rem;
    top: 0.5rem;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    border: 2px solid var(--color-secondary-100);
    box-shadow: 0px 2px 4px -2px #0000000F, 0px 4px 8px -2px #0000001A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: var(--color-secondary-900);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

/* 
 * Icon bei Hover: Hintergrund und Drehung
 */
details.harsch-accordion > summary:hover::before {
    background-color: var(--color-primary-500);
    border-color: var(--color-primary-500);
    color: #fff;
    transform: rotate(180deg);
}

/* 
 * Icon geöffnet
 */
details.harsch-accordion[data-state="open"] > summary::before {
    content: "\F286";
}

/* 
 * Bei geöffnetem Accordion: Hover ohne Rotation (ist schon oben)
 */
details.harsch-accordion[data-state="open"] > summary:hover::before {
    transform: rotate(0deg);
}

/* 
 * Hover-Hintergrund für Summary
 */
details.harsch-accordion > summary:hover {
    background-color: var(--color-secondary-200);
}

/* 
 * Flexbox-Styling für die Summary, wenn Inhalte per JavaScript verschoben wurden.
 */
details.harsch-accordion > summary.accordion-summary-flex {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 4rem;
    flex-wrap: wrap;
    padding: 1rem 1rem 1rem 52px;
}

/* 
 * Spezielles Styling für die Überschrift im Flex-Layout auf mobilen Geräten
*/
details.harsch-accordion > summary.accordion-summary-flex .accordion-title {
    margin-left: 4rem;
}
details.harsch-accordion > summary.accordion-summary-flex:hover .accordion-title {
    text-decoration: underline;
}

/* 
 * 1/3 zu 2/3 Aufteilung innerhalb der Summary.
 * Das erste Kind (h2) erhält 1/3, das zweite Kind (wp-block-group) erhält 2/3.
*/
details.harsch-accordion > summary.accordion-summary-flex > *:first-child {
    flex: 1 1 0; /* 1/3 des verfügbaren Platzes */
}

details.harsch-accordion > summary.accordion-summary-flex > *:nth-child(2) {
    flex: 2 1 0; /* 2/3 des verfügbaren Platzes */
}

/* 
 * Die ERSTE Gruppe (der Vorschau-Text).
 * Sie wird per JavaScript in die Summary verschoben.
*/
details.harsch-accordion > summary + .wp-block-group {
    margin-top: 0; /* Standard-Margin entfernen */
}

/* 
 * Die ZWEITE Gruppe (der aufklappbare Inhalt).
*/
details.harsch-accordion > .wp-block-group:last-of-type {
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Standard-Pfeil des Browsers entfernen */
details.harsch-accordion > summary::-webkit-details-marker {
    display: none;
}

/* Layout */

details.harsch-accordion > .wp-block-group>div>div{
    margin-top: 2rem;
}

@media(max-width: 768px){
    details.harsch-accordion {
        margin-bottom: 2rem;

        > .wp-block-group>div{
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        } 
    }
    
    details.harsch-accordion > summary.accordion-summary-flex {
        align-items: start; /* Geändert von center zu start */
        gap: 1rem;
    }

    details.harsch-accordion figure{
        padding: 2rem 0 1rem;
    }
}
