/*
Theme Name: FF Muenichsthal
Theme URI: https://www.ff-muenichsthal.at/
Author: FF Muenichsthal
Description: Eigenstaendiges Theme fuer die FF Muenichsthal, nachgebaut auf Basis des bisherigen SeedProd-Layouts. Zweispaltiger Blog-Loop mit Sidebar-Widgets (Einsatzstatus, Einsatzstatistik, Termine, Warnungen, Spenden).
Version: 1.0.0
Text Domain: ff-muenichsthal
*/

/* =========================================================
   1. FARBPALETTE (aus Screenshot-Analyse, per Pixel-Sampling)
   ========================================================= */
:root {
    --color-primary: #B10C1F;       /* Nav-Leiste Hintergrund - jetzt per Pixel-Messung verifiziert */
    --color-accent: #BD121C;        /* Links/Buttons/Chart - aus Screenshot verifiziert */
    --color-accent-hover: #970E17;
    --color-text: #1a1a1a;          /* Ueberschriften, aus Screenshot verifiziert (reines Schwarz) */
    --color-text-body: #333333;     /* Fliesstext - Annahme, Standard-Dunkelgrau */
    --color-bg: #ffffff;
    --color-bg-card: #F3F3F1;       /* Card-/Sidebar-Widget-Hintergrund, aus Screenshot verifiziert */
    --color-border: #e2e2e0;
    --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* Annahme, exakte Font unbekannt */
    --container-width: 1140px;
    --gap: 24px;
}

/* =========================================================
   2. RESET & BASICS
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-base);
    color: var(--color-text-body);
    background: var(--color-bg);
    line-height: 1.55;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }
h1, h2, h3, h4 { color: var(--color-text); font-weight: 700; line-height: 1.25; margin: 0 0 12px; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; }

/* =========================================================
   3. HEADER: EINZELNES BANNERBILD (1140x300)
   ========================================================= */
.site-header { background: #fff; text-align: center; }
.header-image img { max-width: 100%; height: auto; margin: 0 auto; }
.header-image-placeholder { height: 200px; background: #d9d9d7; }

/* =========================================================
   4. HAUPTNAVIGATION (inkl. Social-Icons + Suche in einer Zeile)
   ========================================================= */
.main-navigation {
    background: var(--color-primary);
    max-width: var(--container-width);
    margin: 0 auto;
}
.nav-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.nav-menu ul {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap;
}
.nav-menu > ul > li { position: relative; }
.nav-menu > ul > li > a {
    display: flex; align-items: center; gap: 4px;
    padding: 16px 16px;
    color: #fff; font-weight: 600; text-decoration: none;
    letter-spacing: .2px;
}
.nav-menu > ul > li > a:hover,
.nav-menu > ul > li.current-menu-item > a { background: var(--color-accent); }
.nav-menu ul ul {
    display: none; position: absolute; top: 100%; left: 0;
    background: var(--color-primary); min-width: 220px; z-index: 50;
    box-shadow: 0 8px 16px rgba(0,0,0,.15);
}
.nav-menu ul ul li a { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.15); color: #fff; display: block; }
.nav-menu ul ul li a:hover { background: var(--color-accent); }

/* Pfeil bei Menuepunkten mit Untermenue, sonst nicht erkennbar dass da
   noch was aufklappt. Zeigt nach unten, dreht sich beim Aufklappen
   (Desktop-Hover bzw. Mobile-Klick per submenu-open-Klasse aus JS). */
.nav-menu li.menu-item-has-children > a::after {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 4px;
    transition: transform .15s ease;
}
.nav-menu li.submenu-open > a::after {
    transform: rotate(-135deg);
}
/* Untermenue-Eintraege selbst bekommen keinen Pfeil (nur eine Ebene tief) */
.nav-menu ul ul li a::after { display: none; }

/* Hover-Oeffnen NUR am Desktop (ab 881px). Auf Touch-Geraeten simuliert
   der erste Tap sonst nur den :hover-Zustand, der Klick zaehlt erst beim
   zweiten Antippen, daher hier bewusst per min-width ausgeschlossen,
   mobil regelt ausschliesslich der JS-Klick-Handler das Aufklappen. */
@media (min-width: 881px) {
    .nav-menu ul li:hover > ul { display: block; }
    .nav-menu > ul > li.menu-item-has-children:hover > a::after { transform: rotate(-135deg); }
}


.nav-right { display: flex; align-items: center; gap: 16px; padding: 10px 0; }

.social-icons { display: flex; gap: 10px; align-items: center; }
.social-icons a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,.15); color: #fff;
}
.social-icons a:hover { background: #fff; color: var(--color-primary); text-decoration: none; }

.nav-search { display: flex; align-items: center; background: #fff; border-radius: 3px; overflow: hidden; }
.nav-search input {
    border: none; padding: 9px 12px; font-size: .95rem; outline: none; width: 160px;
}
.nav-search button {
    border: none; background: #fff; color: var(--color-primary);
    padding: 0 12px; cursor: pointer; display: flex; align-items: center;
}
.nav-search button:hover { color: var(--color-accent); }

.ffm-404-search { border: 1px solid var(--color-border); margin-top: 12px; }
.ffm-404-search input { color: var(--color-text); width: 240px; }

#ffm-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, background .15s ease;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#ffm-back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
#ffm-back-to-top:hover { background: var(--color-accent); }

.ffm-breadcrumbs {
    font-size: .85rem;
    color: #888;
    margin-bottom: 16px;
}
.ffm-breadcrumbs a { color: #888; text-decoration: underline; }
.ffm-breadcrumbs a:hover { color: var(--color-accent); }
.ffm-breadcrumbs span { color: var(--color-text); }

.ffm-red-alert {
    max-width: 480px;
    margin: 0 0 20px;
}

/* Hamburger-Button mit Textbeschriftung, nur mobil sichtbar */
.nav-toggle {
    display: none;
    align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    color: #fff; padding: 12px 4px;
}
.nav-toggle-bars { display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.nav-toggle-bar { width: 24px; height: 3px; background: #fff; border-radius: 2px; }
.nav-toggle-label { font-weight: 600; font-size: .95rem; letter-spacing: .2px; }

@media (max-width: 880px) {
    /* Headerbild wird komplett angezeigt, nur responsiv verkleinert */

    .nav-bar {
        flex-direction: row; flex-wrap: wrap;
        justify-content: center; align-items: center;
        gap: 10px 14px; padding: 12px 0;
    }

    /* Hamburger mit Beschriftung, Menue eingeklappt bis Klick */
    .nav-toggle { display: flex; }
    .nav-menu { display: none; width: 100%; order: 10; }
    .nav-menu.is-open { display: block; }
    .nav-menu > ul { flex-direction: column; align-items: center; }
    .nav-menu > ul > li { text-align: center; }
    .nav-menu > ul > li > a { justify-content: center; padding: 12px 20px; }

    /* Untermenues per Klick (submenu-open Klasse aus JS), zentriert */
    .nav-menu ul ul {
        position: static; box-shadow: none; display: none;
        text-align: center; min-width: 0;
    }
    .nav-menu li.submenu-open > ul { display: block; }

    /* Social-Icons und Suche in derselben Zeile wie der Hamburger */
    .nav-right {
        width: auto; flex-direction: row; flex-wrap: wrap;
        justify-content: center; align-items: center;
        gap: 10px 14px; padding: 0;
    }
    .social-icons { justify-content: center; }
    .nav-search { width: auto; }
    .nav-search input { width: 110px; }
}

/* =========================================================
   4b. POST-META-ZEILE (Kategorien, Datum, Autor) - reiner Text, keine
   Icons/Emojis, Magazin-Byline-Optik ueber Typografie statt Symbole.
   ========================================================= */
.post-meta {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0;
    margin: 0 0 22px; padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}
.post-meta > * {
    padding: 0 14px;
}
.post-meta > *:first-child { padding-left: 0; }
.post-meta > *:not(:first-child) { border-left: 1px solid var(--color-border); }

.post-meta .meta-cats a {
    color: #888;
    font-weight: 600;
    font-size: .85rem;
}
.post-meta .meta-cats a:hover { color: var(--color-accent); }

.post-meta .meta-date {
    color: #888;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}
.post-meta .meta-author {
    color: var(--color-text);
    font-size: .85rem;
    font-weight: 600;
}

/* =========================================================
   5. LAYOUT: ZWEI SPALTEN (CONTENT + SIDEBAR)
   ========================================================= */
.site-content-wrap {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--gap);
    padding: 32px 0;
}
@media (max-width: 880px) {
    .site-content-wrap { grid-template-columns: 1fr; }
}

/* =========================================================
   6. BEITRAGS-LOOP (Einsatzberichte etc.)
   ========================================================= */
.post-card {
    display: grid;
    grid-template-columns: 240px 1fr;
    overflow: hidden;
    margin-bottom: var(--gap);
}
/* Bildspalte: kein Rahmen, kein Innenabstand, streckt sich automatisch
   auf die volle Zeilenhoehe (CSS-Grid-Default align-items: stretch) */
.post-card .post-thumb { display: block; }
.post-card .post-thumb img {
    width: 100%;
    height: 100%;
    min-height: 200px;
    object-fit: cover;
    display: block;
}
/* Textspalte: nur hier grauer Hintergrund, wird durch die Grid-Zeile
   automatisch exakt so hoch wie das Bild daneben */
.post-card .post-body {
    background: var(--color-bg-card);
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
}
.post-card .post-title { font-size: 1.25rem; margin-bottom: 8px; }
.post-card .post-title a { color: var(--color-text); }
.post-card .post-excerpt { margin-bottom: 10px; }
.post-card .read-more { color: var(--color-accent); font-weight: 700; }

/* Ohne Beitragsbild: Karte auf eine Spalte, Text nutzt die volle Breite
   statt in der schmalen Bildspalte eingequetscht zu werden. Zusaetzlich
   eine Mindesthoehe (entspricht min-height 200px bei .post-thumb img),
   damit Karten mit und ohne Bild in der Liste gleich hoch wirken. */
.post-card.post-card--no-image {
    grid-template-columns: 1fr;
    min-height: 200px;
}

/* Termine-Uebersicht: Bild rechts statt links (nur Desktop) */
.post-card.post-card--img-right { grid-template-columns: 1fr 240px; }
.post-card.post-card--img-right .post-thumb { order: 2; }
.post-card.post-card--img-right .post-body { order: 1; }
@media (max-width: 880px) {
    /* Text zuerst, Bild darunter in voller Breite und Groesse (Flyer muss lesbar bleiben) */
    .post-card.post-card--img-right { grid-template-columns: 1fr; }
    .post-card.post-card--img-right .post-thumb { order: 2; }
    .post-card.post-card--img-right .post-body { order: 1; }
}

/* Kombination "Bild rechts" + "kein Bild vorhanden": muss immer einspaltig
   bleiben, unabhaengig von der Reihenfolge der beiden Regeln oben. */
.post-card.post-card--img-right.post-card--no-image {
    grid-template-columns: 1fr;
}

/* Termine-Archiv (taxonomy-tribe_events_cat.php) */
.archive-title { margin-bottom: 20px; }
.search-term { color: var(--color-accent); }
.search-count { color: #666; margin: -10px 0 20px; }
.event-meta-line {
    color: #666; font-size: .9rem; margin: 0 0 8px;
    line-height: 1.4;
}
.event-meta-line strong { color: var(--color-text); }

/* Mobile-Override steht bewusst NACH der Basis-Definition oben, sonst
   gewinnt bei gleicher Spezifitaet die spaeter im Dokument stehende
   Regel und die Karte bleibt faelschlich zweispaltig. */
@media (max-width: 880px) {
    .post-card { grid-template-columns: 1fr; }
    .post-card .post-thumb img { min-height: 0; height: 220px; }
    /* Termine-Flyer nicht zuschneiden, volle Groesse zeigen statt 220px-Crop */
    .post-card.post-card--img-right .post-thumb img {
        height: auto;
        object-fit: contain;
    }
}

@media (max-width: 560px) {
    .container { padding: 0 14px; }
    .post-card .post-body { padding: 14px 16px; }
    .site-content-wrap { padding: 20px 0; gap: 16px; }
    .einsatzbericht .post-content img { width: 120px; height: 120px; }
}


.pagination { margin-top: 8px; font-weight: 600; }
.pagination a, .pagination span { margin-right: 10px; color: var(--color-accent); }
.pagination .current { color: var(--color-text); }

/* =========================================================
   7. SIDEBAR WIDGETS
   Die gesamte Sidebar-Spalte bekommt den grauen Hintergrund,
   nicht mehr jede Widget-Box einzeln, wirkt so wie eine
   durchgehende Flaeche statt einzelner Kaesten.
   ========================================================= */
.sidebar {
    background: var(--color-bg-card);
    border-radius: 4px;
    padding: 20px;
}
.widget {
    margin-bottom: var(--gap);
    padding-bottom: var(--gap);
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.widget:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.widget-title { font-size: 1.2rem; margin-bottom: 14px; }

/* Einsatzstatus */
.widget-einsatzstatus img { border-radius: 3px; }

/* Einsatzstatistik (Chart.js Canvas) */
.widget-einsatzstatistik canvas { width: 100% !important; max-height: 220px; }

/* Termine */
.widget-termine .event-item {
    background: #fff; border-radius: 3px; padding: 12px 14px; margin-bottom: 10px;
}
.widget-termine .event-item:last-child { margin-bottom: 0; }
.widget-termine .event-title { font-weight: 700; color: var(--color-text); display: block; margin-bottom: 4px; }
.widget-termine .event-date { color: #666; font-size: .9rem; }
.widget-termine .event-flyer img { border-radius: 3px; margin-top: 8px; }

/* Warnungen */
.widget-warnungen img { border-radius: 3px; }
.warnung-keine { color: #666; font-size: .9rem; margin: 0; }
.warnung-item {
    background: #fff;
    border-left: 4px solid #999;
    border-radius: 3px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
.warnung-item:last-of-type { margin-bottom: 12px; }
.warnung-stufe {
    display: inline-block;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: 20px;
    margin-right: 6px;
}
.warnung-typ { color: var(--color-text); font-size: .95rem; }
.warnung-text { margin: 6px 0; font-size: .88rem; color: #444; line-height: 1.4; }
.warnung-zeit { color: #888; font-size: .78rem; }
.warnung-quelle { margin: 0; font-size: .78rem; }
.warnung-quelle a { color: #999; }

.wetter-keine { color: #666; font-size: .9rem; margin: 0; }
.wetter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.wetter-kachel {
    background: #fff;
    border-radius: 3px;
    padding: 10px 8px;
    text-align: center;
}
.wetter-wert { display: block; font-size: 1.1rem; font-weight: 700; color: var(--color-text); }
.wetter-label { display: block; font-size: .72rem; color: #888; margin-top: 2px; }
.wetter-zeit { color: #888; font-size: .78rem; margin: 0 0 4px; }
.wetter-sonne { color: #888; font-size: .78rem; margin: 0 0 10px; }
.sonne-icon { display: inline-flex; vertical-align: middle; margin: 0 3px 0 8px; }
.sonne-icon:first-child { margin-left: 0; }
.wetter-quelle { margin: 0; font-size: .78rem; }
.wetter-quelle a { color: #999; }

.niederschlag-chart { overflow-x: auto; margin-bottom: 8px; }
.niederschlag-titel { margin: 0 0 10px; font-size: 1rem; color: var(--color-text); }

.vorschau-tage { display: flex; gap: 8px; margin-bottom: 10px; }
.vorschau-tag {
    flex: 1;
    background: #fff;
    border-radius: 3px;
    padding: 10px 6px;
    text-align: center;
}
.vorschau-label { display: block; font-size: .72rem; color: #888; margin-bottom: 4px; }
.vorschau-icon { display: block; margin: 0 auto 4px; }
.vorschau-temp { display: block; font-size: .85rem; font-weight: 700; color: var(--color-text); }
.vorschau-regen { display: block; font-size: .72rem; color: #4a90d9; margin-top: 2px; }

/* Spenden */
.widget-spenden p { margin-top: 0; }
.widget-spenden img { max-width: 160px; margin: 10px 0; }

/* =========================================================
   7b. EINZELBEITRAG: EINSATZBERICHT
   ========================================================= */
.einsatzbericht h1 { margin-bottom: 10px; }

/* Bilder im Beitragstext: Kernproblem war, dass die globale Regel weiter
   oben (img { display:block }) jedes Bild einzeln auf eine neue Zeile
   zwingt, egal ob es in einem Absatz/figure steckt oder gar nicht
   eingepackt ist. Hier direkt am img selbst uebersteuert, deckt damit
   auch nackte <img>-Tags ohne umschliessendes <p>/<figure> ab.
   Bewusst nur auf .einsatzbericht beschraenkt (Blog-Einzelbeitraege),
   NICHT auf normale Seiten (.ffm-page), sonst werden dort alle Bilder
   faelschlich auf 150x150 gezwungen, egal welche Groesse im Editor
   eingestellt wurde. */
.einsatzbericht .post-content img {
    display: inline-block;
    width: 150px;
    height: 150px;
    object-fit: cover;
    vertical-align: top;
    border-radius: 3px;
    margin: 0 6px 6px 0;
}

/* Wrapper (falls vorhanden) sollen sich dem Bild anpassen statt volle
   Breite zu erzwingen, damit mehrere nebeneinander in eine Zeile passen. */
.einsatzbericht .post-content p:has(> img:only-child),
.einsatzbericht .post-content figure.wp-block-image {
    display: inline-block;
    width: auto;
    vertical-align: top;
    margin: 0;
}
.einsatzbericht .post-content p:has(> img:only-child) img,
.einsatzbericht .post-content figure.wp-block-image img { margin: 0 6px 6px 0; }


.einsatz-nav {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}
.einsatz-nav .zurueck-link {
    display: inline-block;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 16px;
}

.prev-next-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.prev-next-row a {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-card);
    border-radius: 4px;
    padding: 12px 16px;
    text-decoration: none;
}
.prev-next-row .older-post-link { text-align: right; grid-column: 2; }
.prev-next-row .pn-label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}
.prev-next-row .pn-title { color: var(--color-text); font-weight: 600; font-size: .95rem; }

@media (max-width: 560px) {
    .prev-next-row { grid-template-columns: 1fr; }
    .prev-next-row .older-post-link { grid-column: 1; text-align: left; }
}

/* =========================================================
   7c. SEITEN (page.php): Technische-Daten-Tabelle, Bildunterschrift,
   Fahrzeug-Einsaetze-Liste
   ========================================================= */
.ffm-page .post-content figcaption,
.ffm-page .wp-caption-text {
    color: #444; font-size: .9rem; margin: 4px 0 20px;
}

/* Jede Tabelle im Seiteninhalt bekommt automatisch die
   "Technische Daten"-Box-Optik: graue Karte, Label fett links. */
.ffm-page .post-content table {
    background: var(--color-bg-card);
    border-radius: 4px;
    border-collapse: collapse;
    width: 100%;
    max-width: 560px;
    margin: 20px 0;
}
.ffm-page .post-content table td,
.ffm-page .post-content table th {
    padding: 10px 20px;
    text-align: left;
    border: none;
}
.ffm-page .post-content table td:first-child,
.ffm-page .post-content table th:first-child {
    font-weight: 700; width: 180px;
}

.fahrzeug-einsaetze { list-style: disc; margin: 10px 0 16px 20px; padding: 0; }
.fahrzeug-einsaetze li { margin-bottom: 6px; }
.fahrzeug-einsaetze li a { color: var(--color-accent); font-weight: 600; }
.alle-einsaetze-link { color: var(--color-accent); font-weight: 700; }

/* =========================================================
   8. FOOTER
   ========================================================= */
.site-footer {
    background: transparent;
    color: #888;
    text-align: center;
    padding: 24px 0;
    font-size: .9rem;
    max-width: var(--container-width);
    margin: 0 auto;
    border-top: 1px solid var(--color-border);
}
.site-footer a { color: #888; text-decoration: underline; }
