/* ==================================================
   AKTUELLES - DOWNLOADMATERIALIEN
   Der Dateiblock der Artikelkarte (Feld col-aktuelles_files, Beschriftung
   in module/filegallery/show_filegallery.inc.php: Ueberschrift
   "Downloadmaterialien", Link "Herunterladen").

   Drei Punkte regelt diese Datei:
   1. Der Block steht am Ende des Artikels, nicht neben dem Bild.
   2. Sichtbar ist er erst, wenn die Karte aufgeklappt ist.
   3. Der Link bleibt anklickbar - die Klickflaeche der Karte liegt sonst
      darueber und faengt den Klick ab.
   ================================================== */

body.aktuelles {

    /* ==================================================
       NUR IN DER AUFGEKLAPPTEN KARTE
       ================================================== */

    .collection_list.col-aktuelles .collection_content.col-aktuelles_files {
        display: none;
    }

    .collection_list.col-aktuelles.active .collection_content.col-aktuelles_files {
        display: block;

        /* bc.min.js haengt den Block als letztes in .col-aktuelles_right,
           damit steht er unter dem Text. */
        width: 100%;
        margin-top: 18px;
        padding-top: 14px;
        border-top: 1px solid var(--clr-primary-grey, #e2e2e2);
    }

    /* Leerer Block (Artikel ohne Datei) soll auch aufgeklappt nichts zeigen */
    .collection_list.col-aktuelles.active .collection_content.col-aktuelles_files:not(:has(a[target])) {
        display: none;
    }


    /* ==================================================
       UEBERSCHRIFT UND LINK
       ================================================== */

    .col-aktuelles_files .filegallery_title {
        margin: 0 0 8px;

        color: var(--clr-primary-dark, #4B4B4B);
        font-size: 17px;
        font-weight: 700;
    }

    .col-aktuelles_files .filegallery_content_file {
        margin: 0 0 4px;
    }

    .col-aktuelles_files .filegallery_content_file > a[target] {
        display: inline-flex;
        align-items: center;
        gap: 8px;

        color: var(--primary-accent, #275b91);
        font-size: 15px;
        text-decoration: underline;

        /* In der Aktuelles-Karte gilt global
           ".aktuelles .collection_list.col-aktuelles a { pointer-events: none }".
           Ohne diese Gegenregel liesse sich der Download nicht anklicken -
           dieselbe Ausnahme gibt es im Projekt schon fuer den Opener-Knopf. */
        pointer-events: auto !important;
    }

    .col-aktuelles_files .filegallery_content_file > a[target]:hover {
        text-decoration: none;
    }

    /* Der Wrapper-Link auf die Vollansicht kommt ohne target und wuerde als
       leerer Anker mitzaehlen. */
    .col-aktuelles_files .filegallery_content_file > a:not([target]) {
        display: none;
    }
}


/* ==================================================
   VOLLANSICHT DES ARTIKELS
   Dort gibt es kein Aufklappen: der Block steht immer am Ende.
   ================================================== */

body.aktuelles_a .collection_full.col-aktuelles .collection_content.col-aktuelles_files {
    display: block;
    width: 100%;

    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--clr-primary-grey, #e2e2e2);

    clear: both;
}

body.aktuelles_a .col-aktuelles_files .filegallery_title {
    margin: 0 0 8px;

    color: var(--clr-primary-dark, #4B4B4B);
    font-size: 17px;
    font-weight: 700;
}

body.aktuelles_a .col-aktuelles_files .filegallery_content_file > a[target] {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: var(--primary-accent, #275b91);
    font-size: 15px;
    text-decoration: underline;
}

body.aktuelles_a .col-aktuelles_files .filegallery_content_file > a:not([target]) {
    display: none;
}

/* Anrisse ausserhalb von /dg/de/aktuelles/ (z. B. Startseite): Dateien
   ("Downloadmaterialien") und Bildergalerie gibt es erst im Artikel. */
body:not(.aktuelles) .collection_list.col-aktuelles .col-aktuelles_files,
body:not(.aktuelles) .collection_list.col-aktuelles .col-aktuelles_gallery,
body:not(.aktuelles) .collection_list.col-aktuelles .bc-gallery {
    display: none !important;
}

/* /dg/de/aktuelles/: Bildergalerie nur in der aufgeklappten Karte, unter dem
   Text (bc.min.js haengt sie in .col-aktuelles_right). Zugeklappt stand sie
   sonst als eigene Zeile zwischen den Artikeln. */
body.aktuelles .collection_list.col-aktuelles .collection_content.col-aktuelles_gallery {
    display: none;
}

body.aktuelles .collection_list.col-aktuelles.active .collection_content.col-aktuelles_gallery:has(img) {
    display: block;
    width: 100%;
    margin-top: 18px;
}

/* Das Owl-Karussell misst die Breite seines Elternelements; ohne min-width: 0
   waechst die Flex-Spalte mit dem Karussell mit (zehntausende Pixel breit). */
body.aktuelles .collection_list.col-aktuelles .col-aktuelles_right {
    min-width: 0;
}

body.aktuelles .collection_list.col-aktuelles .collection_content.col-aktuelles_gallery {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* Startseite, Kachel "Aktuelles / Aus dem Rathaus": Ueberschriften mittig
   neben dem Bild (bc-style.min.css schob sie mit margin-top: 20px nach unten). */
body.home .aktuelles_k_groupe .herzlich_right_top {
    align-items: center;
}

body.home .aktuelles_k_groupe .herzlich_right {
    margin-top: 0;
}

body.home .aktuelles_k_groupe .herzlich_title .textcontent > :first-child,
body.home .aktuelles_k_groupe .herzlich_text .textcontent > :first-child {
    margin-top: 0;
}

body.home .aktuelles_k_groupe .herzlich_title .textcontent > :last-child,
body.home .aktuelles_k_groupe .herzlich_text .textcontent > :last-child {
    margin-bottom: 0;
}

/* Im mysyde beginnen beide Texte mit einem Zeilenumbruch
   (<span><br>Aktuelles<br></span>) - das gab eine Leerzeile darueber. */
body.home .aktuelles_k_groupe .herzlich_title .textcontent br:first-child,
body.home .aktuelles_k_groupe .herzlich_text .textcontent br:first-child {
    display: none;
}

/* "Bild:" (bc-style.min.css, ::before an der Bildunterschrift) nur zeigen,
   wenn es eine Bildunterschrift gibt - auch leere <p><br></p> aus dem Editor
   zaehlen als leer. */
.collection_content.col-aktuelles_desc:empty,
.collection_content.col-aktuelles_desc:not(:has(img)):has(> p:only-child > br:only-child),
.collection_content.col-aktuelles_desc:not(:has(img)):has(> p:only-child:empty) {
    display: none !important;
}
