/*
 * AH-WEB 2027 – Cloudrexx News / Wissen Overrides
 * v0.33
 * Wird bewusst NACH {STYLE_FILE} geladen, damit die vom Cloudrexx-News-Modul
 * nachgeladenen Bootstrap-/Modulstyles nicht wieder über AH-WEB schreiben.
 * Ausschliesslich auf Wissen/News begrenzt; Header, Footer und globale Buttons
 * bleiben unangetastet.
 */

/* ==========================================================
   WISSEN – ÜBERSICHT / KATEGORIEFILTER
   ========================================================== */

/* Das Cloudrexx-Formular steht nativ als eigenes Element vor #news.
   Deshalb direkt stylen und nicht von einer JS-Umsortierung abhängig machen. */
body.ahw-site:has(#news) #filter-form {
    float: none !important;
    width: min(calc(100% - 48px), 1180px) !important;
    margin: 38px auto 18px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    background: transparent !important;
    border: 0 !important;
}

body.ahw-site:has(#news) #filter-form::before {
    content: "Beiträge filtern";
    flex: 0 0 auto;
    color: #172038;
    font-family: var(--ahw-font);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
}

body.ahw-site:has(#news) #filter-form select {
    display: block !important;
    width: 330px !important;
    max-width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 42px 0 14px !important;
    border: 1px solid #cfd5df !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 48px !important;
    box-shadow: 0 8px 24px rgba(3,6,23,.05) !important;
}

body.ahw-site:has(#news) #filter-form select:focus {
    outline: 3px solid rgba(248,183,0,.24) !important;
    outline-offset: 2px !important;
    border-color: #f8b700 !important;
}

/* Falls das ältere JS den Select bereits in eine Toolbar verschoben hat,
   sieht dieselbe Komponente identisch aus. */
body.ahw-site:has(#news) .ahw-news-toolbar {
    width: min(calc(100% - 48px), 1180px) !important;
    margin: 38px auto 18px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
}

body.ahw-site:has(#news) .ahw-news-toolbar::before {
    content: "Beiträge filtern";
    color: #172038;
    font-family: var(--ahw-font);
    font-size: 15px;
    font-weight: 800;
}

body.ahw-site:has(#news) .ahw-news-toolbar select {
    width: 330px !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 42px 0 14px !important;
    border: 1px solid #cfd5df !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
}

/* Übersichtskarten in derselben Achse wie der Filter halten. */
body.ahw-site:has(#news) #news {
    width: min(calc(100% - 48px), 1180px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.ahw-site:has(#news) #news > li {
    padding: 24px !important;
}

body.ahw-site:has(#news) #news > li > a,
body.ahw-site:has(#news) #news h2 a,
body.ahw-site:has(#news) #news h3 a,
body.ahw-site:has(#news) #news .news-title a {
    font-size: 21px !important;
    line-height: 1.28 !important;
}

body.ahw-site:has(#news) #news .news-teaser {
    font-size: 17px !important;
    line-height: 1.62 !important;
}

body.ahw-site:has(#news) #news .news-info {
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* ==========================================================
   WISSEN – NEWS DETAILSEITE
   v0.40: Detailseite nutzt dieselbe Standard-Contentbreite wie die
   übrigen AH-WEB-Inhaltsseiten. Keine separate 920px-Lesespalte mehr.
   ========================================================== */

/* Cloudrexx liefert die Detailansicht in Bootstrap-Containern. Diese Achse
   wird hier nur für News-Detailseiten auf AH-WEB-Breite gebracht. */
body.ahw-site:has(#news-content) #services1 {
    width: 100% !important;
    padding: 0 !important;
}

body.ahw-site:has(#news-content) #services1 > .container {
    width: 100% !important;
    max-width: calc(var(--ahw-container) + (var(--ahw-gutter) * 2)) !important;
    margin: 0 auto !important;
    padding-left: var(--ahw-gutter) !important;
    padding-right: var(--ahw-gutter) !important;
}

body.ahw-site:has(#news-content) #services1 .row,
body.ahw-site:has(#news-content) #services1 .row.margin-40 {
    margin: 0 !important;
}

body.ahw-site:has(#news-content) #services1 .col-sm-12,
body.ahw-site:has(#news-content) #services1 .col-md-12 {
    float: none !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 48px 0 72px !important;
}

/* Metadaten und Teaser bilden den redaktionellen Einstieg. */
body.ahw-site:has(#news-content) #news-date {
    float: none !important;
    width: 100% !important;
    margin: 0 auto 12px !important;
    padding: 0 !important;
    color: #737c90 !important;
    font-family: var(--ahw-font) !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

body.ahw-site:has(#news-content) #news-teaser-text {
    float: none !important;
    width: 100% !important;
    margin: 0 auto 34px !important;
    padding: 0 0 26px !important;
    border-bottom: 1px solid #dce0e7 !important;
    color: #39445c !important;
    font-family: var(--ahw-font) !important;
    font-size: 21px !important;
    font-weight: 450 !important;
    line-height: 1.62 !important;
}

/* Der eigentliche Beitrag: bewusst px-basiert, weil Cloudrexx/Bootstrap nach
   dem Theme html{font-size:10px} einspielt. Rem wäre hier sichtbar zu klein. */
body.ahw-site:has(#news-content) #news-content {
    float: none !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 0 !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 18px !important;
    line-height: 1.75 !important;
}

body.ahw-site:has(#news-content) #news-content p,
body.ahw-site:has(#news-content) #news-content li,
body.ahw-site:has(#news-content) #news-content td,
body.ahw-site:has(#news-content) #news-content th {
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 18px !important;
    line-height: 1.75 !important;
}

body.ahw-site:has(#news-content) #news-content p {
    margin: 0 0 18px !important;
}

body.ahw-site:has(#news-content) #news-content > br {
    display: none !important;
}

/* In alten Beiträgen liegt der Artikeltitel häufig als erstes h3 im Inhalt. */
body.ahw-site:has(#news-content) #news-content > h3:first-of-type {
    margin: 0 0 22px !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 34px !important;
    font-weight: 850 !important;
    line-height: 1.16 !important;
    letter-spacing: -.025em !important;
}

body.ahw-site:has(#news-content) #news-content h2 {
    margin: 44px 0 16px !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 30px !important;
    font-weight: 850 !important;
    line-height: 1.2 !important;
    letter-spacing: -.02em !important;
}

body.ahw-site:has(#news-content) #news-content h3:not(:first-of-type) {
    margin: 38px 0 14px !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 27px !important;
    font-weight: 800 !important;
    line-height: 1.24 !important;
    letter-spacing: -.015em !important;
}

body.ahw-site:has(#news-content) #news-content h4 {
    margin: 30px 0 10px !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
}

body.ahw-site:has(#news-content) #news-content h5,
body.ahw-site:has(#news-content) #news-content h6 {
    margin: 24px 0 8px !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 19px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}

body.ahw-site:has(#news-content) #news-content ul,
body.ahw-site:has(#news-content) #news-content ol {
    margin: 10px 0 24px 26px !important;
    padding: 0 !important;
}

body.ahw-site:has(#news-content) #news-content li {
    margin: 0 0 7px !important;
}

body.ahw-site:has(#news-content) #news-content hr {
    height: 1px !important;
    margin: 38px 0 !important;
    border: 0 !important;
    background: #dce0e7 !important;
}

body.ahw-site:has(#news-content) #news-content > div[style*="text-align: center"] {
    margin: 0 0 34px !important;
    text-align: center !important;
}

body.ahw-site:has(#news-content) #news-content img {
    display: block !important;
    width: auto !important;
    max-width: min(100%, 760px) !important;
    height: auto !important;
    margin: 0 auto !important;
    border-radius: 8px !important;
}

body.ahw-site:has(#news-content) #news-content a {
    color: #6f5200 !important;
    font-weight: 650 !important;
    text-decoration: underline !important;
    text-decoration-color: rgba(248,183,0,.75) !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px !important;
}

/* Navigation zwischen Beiträgen wird zu zwei klaren Karten statt kleiner
   Modulschrift. */
body.ahw-site:has(#news-content) #news-link-blocks-cont {
    float: none !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
    width: 100% !important;
    margin: 54px auto 22px !important;
    padding: 26px 0 0 !important;
    border-top: 1px solid #dce0e7 !important;
    border-bottom: 0 !important;
}

body.ahw-site:has(#news-content) #news-previous-link-block,
body.ahw-site:has(#news-content) #news-next-link-block {
    float: none !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 18px 20px !important;
    border: 1px solid #dce0e7 !important;
    border-radius: 8px !important;
    background: #f4f6f9 !important;
    text-align: left !important;
}

body.ahw-site:has(#news-content) #news-link-blocks-cont a {
    display: block !important;
    color: #172038 !important;
    text-decoration: none !important;
}

body.ahw-site:has(#news-content) .news-link-label,
body.ahw-site:has(#news-content) .news-link-label.news-link-label-next,
body.ahw-site:has(#news-content) .news-link-label.news-link-label-prev {
    float: none !important;
    display: block !important;
    width: auto !important;
    margin: 0 0 7px !important;
    color: #7a6500 !important;
    font-family: var(--ahw-font) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.4 !important;
    text-align: left !important;
    text-transform: uppercase !important;
    letter-spacing: .05em !important;
}

body.ahw-site:has(#news-content) .news-title-label,
body.ahw-site:has(#news-content) .news-title-label.news-title-label-next,
body.ahw-site:has(#news-content) .news-title-label.news-title-label-prev {
    float: none !important;
    display: block !important;
    width: auto !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 17px !important;
    font-weight: 750 !important;
    line-height: 1.45 !important;
    text-align: left !important;
}

/* Modul-Fussbereich lesbar, aber bewusst untergeordnet. */
body.ahw-site:has(#news-content) #news-links,
body.ahw-site:has(#news-content) #news-no-comments,
body.ahw-site:has(#news-content) #news-comment-form,
body.ahw-site:has(#news-content) #news-toggle {
    float: none !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    font-family: var(--ahw-font) !important;
    font-size: 16px !important;
    line-height: 1.55 !important;
}

body.ahw-site:has(#news-content) #news-links {
    margin-top: 18px !important;
    margin-bottom: 24px !important;
    padding: 14px 18px !important;
    border: 1px solid #dce0e7 !important;
    border-radius: 8px !important;
    background: #f4f6f9 !important;
}

body.ahw-site:has(#news-content) #news-links ul {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

body.ahw-site:has(#news-content) #news-links a {
    color: #172038 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
}

body.ahw-site:has(#news-content) #news-toggle,
body.ahw-site:has(#news-content) #news-comment-form input[type="submit"] {
    width: auto !important;
    min-height: 44px !important;
    padding: 10px 18px !important;
    border: 1px solid #f8b700 !important;
    border-radius: 6px !important;
    background: #f8b700 !important;
    color: #172038 !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    box-shadow: none !important;
}

body.ahw-site:has(#news-content) #news-no-comments {
    margin-top: 18px !important;
    color: #566078 !important;
}

@media (max-width: 760px) {
    body.ahw-site:has(#news) #filter-form,
    body.ahw-site:has(#news) .ahw-news-toolbar,
    body.ahw-site:has(#news) #news {
        width: min(calc(100% - 32px), 1180px) !important;
    }

    body.ahw-site:has(#news-content) #services1 > .container {
        width: 100% !important;
        max-width: calc(var(--ahw-container) + (var(--ahw-gutter) * 2)) !important;
        padding-left: var(--ahw-gutter) !important;
        padding-right: var(--ahw-gutter) !important;
    }

    body.ahw-site:has(#news) #filter-form,
    body.ahw-site:has(#news) .ahw-news-toolbar {
        align-items: stretch !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin-top: 24px !important;
    }

    body.ahw-site:has(#news) #filter-form select,
    body.ahw-site:has(#news) .ahw-news-toolbar select {
        width: 100% !important;
    }

    body.ahw-site:has(#news-content) #services1 .col-sm-12,
    body.ahw-site:has(#news-content) #services1 .col-md-12 {
        padding: 30px 0 48px !important;
    }

    body.ahw-site:has(#news-content) #news-teaser-text {
        font-size: 19px !important;
        margin-bottom: 26px !important;
    }

    body.ahw-site:has(#news-content) #news-content,
    body.ahw-site:has(#news-content) #news-content p,
    body.ahw-site:has(#news-content) #news-content li,
    body.ahw-site:has(#news-content) #news-content td,
    body.ahw-site:has(#news-content) #news-content th {
        font-size: 17px !important;
        line-height: 1.68 !important;
    }

    body.ahw-site:has(#news-content) #news-content > h3:first-of-type {
        font-size: 29px !important;
    }

    body.ahw-site:has(#news-content) #news-content h2 {
        font-size: 26px !important;
    }

    body.ahw-site:has(#news-content) #news-content h3:not(:first-of-type) {
        font-size: 23px !important;
    }

    body.ahw-site:has(#news-content) #news-content h4 {
        font-size: 20px !important;
    }

    body.ahw-site:has(#news-content) #news-link-blocks-cont {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================
   v0.35 – Utility-Links unter Newsartikeln ruhiger integrieren
   ========================================================== */
body.ahw-site:has(#news-content) #news-links {
    margin-top: 20px !important;
    margin-bottom: 28px !important;
    padding: 16px 0 0 !important;
    border: 0 !important;
    border-top: 1px solid #dce0e7 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

body.ahw-site:has(#news-content) #news-links ul {
    gap: 12px 24px !important;
}

body.ahw-site:has(#news-content) #news-links li {
    margin: 0 !important;
}

body.ahw-site:has(#news-content) #news-links a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    color: #172038 !important;
    font-family: var(--ahw-font) !important;
    font-size: 16px !important;
    font-weight: 750 !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
}

body.ahw-site:has(#news-content) #news-links a::after {
    content: "→";
    color: #b78300;
    font-weight: 900;
}

body.ahw-site:has(#news-content) #news-links a:hover {
    color: #6f5200 !important;
}
