/* ==========================================================================
   WP Akkordeon – Frontend Styles
   Übernimmt Theme-Farben (MH Magazine), lässt sich per Block-Einstellungen
   oder CSS Custom Properties überschreiben.
   ========================================================================== */

.wp-akkordeon {
    /* Standard-Farben – werden vom Theme oder Block-Einstellungen überschrieben */
    --wp-akkordeon-header-bg: #2a2a2a;
    --wp-akkordeon-header-text: #ffffff;
    --wp-akkordeon-btn-bg: #e64946;
    --wp-akkordeon-btn-text: #ffffff;
    --wp-akkordeon-accent: #e64946;

    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
    font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}

/* Header / Trigger Button */
.wp-akkordeon__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    margin: 0;
    border: none;
    background: var(--wp-akkordeon-header-bg);
    cursor: pointer;
    text-align: left;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--wp-akkordeon-header-text);
    line-height: 1.4;
    font-family: inherit;
    transition: opacity 0.2s ease;
}

.wp-akkordeon__header:hover {
    opacity: 0.9;
}

.wp-akkordeon__header:focus-visible {
    outline: 2px solid var(--wp-akkordeon-accent);
    outline-offset: -2px;
}

/* Icon (Plus/Minus) */
.wp-akkordeon__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-left: 12px;
    position: relative;
}

.wp-akkordeon__icon::before,
.wp-akkordeon__icon::after {
    content: '';
    position: absolute;
    background: var(--wp-akkordeon-header-text);
    border-radius: 1px;
    transition: transform 0.3s ease;
}

.wp-akkordeon__icon::before {
    top: 50%;
    left: 2px;
    right: 2px;
    height: 2px;
    transform: translateY(-50%);
}

.wp-akkordeon__icon::after {
    left: 50%;
    top: 2px;
    bottom: 2px;
    width: 2px;
    transform: translateX(-50%);
}

.wp-akkordeon--open .wp-akkordeon__icon::after {
    transform: translateX(-50%) scaleY(0);
}

/* Content */
.wp-akkordeon__content {
    padding: 0 20px;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
}

.wp-akkordeon__content[hidden] {
    display: block !important;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    visibility: hidden;
}

.wp-akkordeon--open .wp-akkordeon__content {
    padding: 20px;
    max-height: 5000px;
    visibility: visible;
}

/* Kategorie-Beschreibung */
.wp-akkordeon__category-desc {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
    color: #555;
    font-size: 0.95em;
    line-height: 1.7;
}

.wp-akkordeon__category-desc p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Beitrags-Karten (Magazin-Layout à la MH Magazine)
   ========================================================================== */

.wp-akkordeon__posts {
    margin: 0;
    padding: 0;
}

/* Einzelne Karte */
.wp-akkordeon__post-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 20px 0;
    border-bottom: 1px solid #ebebeb;
}

.wp-akkordeon__post-item:first-child {
    padding-top: 0;
}

.wp-akkordeon__post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Nur-Titel-Modus */
.wp-akkordeon__posts--title .wp-akkordeon__post-item {
    padding: 10px 0;
    display: block;
}

/* Beitragsbild */
.wp-akkordeon__post-thumbnail {
    flex-shrink: 0;
    width: 200px;
}

.wp-akkordeon__post-thumbnail a {
    display: block;
    overflow: hidden;
}

.wp-akkordeon__post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.2s ease;
}

.wp-akkordeon__post-thumbnail a:hover img {
    opacity: 0.85;
}

.wp-akkordeon__post-no-image {
    display: block;
    width: 100%;
    padding-bottom: 66%;
    background: #f0f0f0;
}

/* Textbereich */
.wp-akkordeon__post-content {
    flex: 1;
    min-width: 0;
}

/* Meta-Zeile (Datum, Autor) */
.wp-akkordeon__post-meta {
    font-size: 0.8em;
    color: #999;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wp-akkordeon__post-date,
.wp-akkordeon__post-author {
    display: inline;
}

.wp-akkordeon__meta-sep {
    margin: 0 2px;
}

/* Titel */
.wp-akkordeon__post-title {
    margin: 0 0 8px;
    font-size: 1.4em;
    font-weight: 700;
    line-height: 1.3;
}

.wp-akkordeon__post-title a {
    color: #000;
    text-decoration: none;
}

.wp-akkordeon__post-title a:hover {
    color: var(--wp-akkordeon-accent);
}

.wp-akkordeon__posts--title .wp-akkordeon__post-title {
    margin-bottom: 0;
}

/* Auszug / Beitragsanfang (formatiert) */
.wp-akkordeon__post-excerpt {
    margin: 0 0 12px;
    color: #444;
    font-size: 0.9em;
    line-height: 1.6;
}

.wp-akkordeon__post-excerpt p {
    margin: 0 0 0.6em;
}

.wp-akkordeon__post-excerpt p:last-child {
    margin-bottom: 0;
}

.wp-akkordeon__post-excerpt strong,
.wp-akkordeon__post-excerpt b {
    color: #000;
}

.wp-akkordeon__post-excerpt em,
.wp-akkordeon__post-excerpt i {
    font-style: italic;
}

/* Überschriften im Excerpt auf einheitliche Größe bringen */
.wp-akkordeon__post-excerpt h1,
.wp-akkordeon__post-excerpt h2,
.wp-akkordeon__post-excerpt h3,
.wp-akkordeon__post-excerpt h4,
.wp-akkordeon__post-excerpt h5,
.wp-akkordeon__post-excerpt h6 {
    font-size: inherit;
    margin: 0 0 0.4em;
    line-height: 1.3;
}

/* Weiterlesen-Button */
.wp-akkordeon__read-more {
    display: block;
    text-align: right;
    width: fit-content;
    margin-left: auto;
    padding: 7px 20px;
    background: var(--wp-akkordeon-btn-bg);
    color: var(--wp-akkordeon-btn-text);
    font-size: 0.8em;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: opacity 0.2s ease;
}

.wp-akkordeon__read-more:hover {
    opacity: 0.85;
    color: var(--wp-akkordeon-btn-text);
}

/* ==========================================================================
   Schriftgröße vom Theme übernehmen
   ========================================================================== */

.wp-akkordeon--inherit-font .wp-akkordeon__category-desc,
.wp-akkordeon--inherit-font .wp-akkordeon__post-excerpt,
.wp-akkordeon--inherit-font .wp-akkordeon__post-title,
.wp-akkordeon--inherit-font .wp-akkordeon__post-meta,
.wp-akkordeon--inherit-font .wp-akkordeon__read-more {
    font-size: inherit;
}

/* Keine Beiträge */
.wp-akkordeon__no-posts {
    color: #999;
    font-style: italic;
    margin: 0;
}

/* Fehler */
.wp-akkordeon-error {
    color: #d63638;
    padding: 12px;
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    border-radius: 4px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media ( max-width: 600px ) {
    .wp-akkordeon__header {
        padding: 12px 16px;
        font-size: 0.95em;
    }

    .wp-akkordeon--open .wp-akkordeon__content {
        padding: 12px 16px;
    }

    .wp-akkordeon__post-item {
        flex-direction: column;
        gap: 12px;
    }

    .wp-akkordeon__post-thumbnail {
        width: 100%;
    }
}
