/*
Theme Name: FDP Ortsverband
Description: Eigenes WordPress-Theme für einen FDP-Ortsverband
Version: 1.27
Text Domain: fdp-ortsverband
*/

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    background: #fff;
    color: #111;
}

.site-header {
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #e7e7e7;
}

.site-header__inner {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.site-branding {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.site-branding img,
.custom-logo {
    display: block;
    width: auto;
    max-width: 260px;
    max-height: 72px;
    height: auto;
}

.site-nav {
    margin-left: auto;
}

.site-nav ul {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    color: #0b2748;
    text-decoration: none;
    font-weight: 700;
}

.site-nav a:hover,
.site-nav a:focus {
    text-decoration: underline;
}

main {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

article { margin: 0 0 40px; }

.site-footer {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
    border-top: 1px solid #ddd;
}

@media (max-width: 800px) {
    .site-header__inner {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 0;
        gap: 18px;
    }

    .site-nav {
        margin-left: 0;
        width: 100%;
    }

    .site-nav ul {
        gap: 14px 18px;
    }

    .site-branding img,
    .custom-logo {
        max-width: 220px;
        max-height: 64px;
    }
}

/* Mobile off-canvas navigation */
.menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border: 0;
    background: transparent;
    padding: 7px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    margin: 6px 0;
    background: #0b2748;
}

.mobile-overlay {
    display: none;
}

.drawer-close {
    display: none;
}

@media (max-width: 860px) {
    body.menu-open {
        overflow: hidden;
    }

    .site-header__inner {
        min-height: 72px;
        flex-direction: row;
        align-items: center;
        padding: 10px 0;
        gap: 16px;
        position: relative;
    }

    .site-branding img,
    .custom-logo {
        max-width: 190px;
        max-height: 54px;
    }

    .menu-toggle {
        display: block;
        margin-left: auto;
        flex: 0 0 auto;
        position: relative;
        z-index: 1002;
    }

    .mobile-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.34);
        opacity: 0;
        visibility: hidden;
        transition: opacity .28s ease, visibility .28s ease;
        z-index: 999;
    }

    .mobile-overlay.is-open {
        opacity: 1;
        visibility: visible;
    }

    .site-nav {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: min(78vw, 420px);
        height: 100vh;
        margin: 0;
        padding: 96px 28px 32px;
        background: #fff;
        border: 0;
        box-shadow: 10px 0 28px rgba(0, 0, 0, 0.10);
        transform: translateX(-105%);
        transition: transform .32s ease;
        z-index: 1000;
        overflow-y: auto;
    }

    .site-nav.is-open {
        transform: translateX(0);
    }

    .drawer-close {
        display: block;
        position: absolute;
        top: 18px;
        right: 20px;
        width: 48px;
        height: 48px;
        border: 0;
        background: transparent;
        cursor: pointer;
        padding: 0;
    }

    .drawer-close::before,
    .drawer-close::after {
        content: "";
        position: absolute;
        left: 23px;
        top: 8px;
        width: 3px;
        height: 32px;
        background: #111;
    }

    .drawer-close::before {
        transform: rotate(45deg);
    }

    .drawer-close::after {
        transform: rotate(-45deg);
    }

    .site-nav::before {
        content: "Menü";
        display: block;
        margin: 0 0 22px;
        font-size: 1.55rem;
        font-weight: 400;
        color: #333;
    }

    .site-nav ul {
        display: block;
        padding: 0;
        margin: 0;
    }

    .site-nav li {
        border-bottom: 1px solid #dedede;
        margin: 0;
    }

    .site-nav li:first-child {
        border-top: 1px solid #dedede;
    }

    .site-nav a {
        display: block;
        position: relative;
        padding: 19px 34px 19px 0;
        font-size: 1.15rem;
        font-weight: 700;
        text-transform: uppercase;
        color: #071f49;
        text-decoration: none;
    }

    .site-nav a::after {
        content: "›";
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-54%);
        font-size: 2rem;
        line-height: 1;
        font-weight: 400;
    }
}


/* Animated hamburger -> X */
.menu-toggle span {
    transform-origin: center;
    transition:
        transform .28s ease,
        opacity .2s ease,
        background-color .2s ease;
}

.menu-toggle.is-open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0.35);
}

.menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}


/* v1.5: only the animated header hamburger/X closes the drawer */
.drawer-close {
    display: none !important;
}


/* v1.6: Logo im geöffneten mobilen Menü */
@media (max-width: 860px) {
    .site-nav {
        padding: 18px 28px 32px;
    }

    .site-nav::before {
        content: none;
        display: none;
    }

    .drawer-logo {
        display: flex;
        align-items: center;
        min-height: 58px;
        margin: 0 70px 14px 0;
    }

    .drawer-logo img {
        display: block;
        width: auto;
        height: auto;
        max-width: 190px;
        max-height: 54px;
    }

    .drawer-menu-title {
        margin: 8px 0 18px;
        font-size: 1.35rem;
        font-weight: 400;
        color: #333;
    }
}


/* v1.7: Mobile-drawer elements must stay hidden on desktop */
.drawer-logo,
.drawer-menu-title {
    display: none;
}

@media (max-width: 860px) {
    .drawer-logo {
        display: flex;
    }

    .drawer-menu-title {
        display: block;
    }
}


/* v1.8: softer separation below the header */
.site-header {
    border-bottom: 0;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 998;
}


/* v1.9: typographic hierarchy inspired by the FDP visual structure */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    font-weight: 700;
    line-height: 1.12;
}

h1 {
    color: #000;
    font-size: clamp(2.35rem, 5vw, 3.5rem);
    margin-bottom: 1.25rem;
}

h2 {
    color: #073b78;
    font-size: clamp(1.8rem, 3.5vw, 2.35rem);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h3 {
    color: #073b78;
    font-size: clamp(1.4rem, 2.8vw, 1.8rem);
    margin-top: 2rem;
    margin-bottom: 0.85rem;
}

h4 {
    color: #073b78;
    font-size: 1.2rem;
    margin-top: 1.75rem;
    margin-bottom: 0.7rem;
}

h5,
h6 {
    color: #111;
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
}

/* Keep WordPress content typography readable */
article p,
main p {
    margin-top: 0;
    margin-bottom: 1.25rem;
}


/* v1.10: Fix mobile overlay stacking so menu links remain clickable */
@media (max-width: 860px) {
    .site-header {
        z-index: auto;
    }

    .site-nav {
        z-index: 1001;
    }

    .menu-toggle {
        z-index: 1002;
    }

    .mobile-overlay {
        z-index: 1000;
    }
}


/* v1.11: subtle scroll reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity .6s ease,
        transform .6s ease;
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal.is-visible {
        opacity: 1;
        transform: none;
        transition: none;
    }
}


/* v1.12: keep desktop header/navigation visible while scrolling */
@media (min-width: 861px) {
    .site-header {
        position: sticky;
        top: 0;
        z-index: 1100;
        background: #fff;
    }
}


/* v1.14: Startseiten-Hero mit Mitglied-werden-CTA */
.home-hero {
    width: min(1200px, calc(100% - 32px));
    margin: 54px auto 28px;
}

.home-hero__stage {
    position: relative;
    min-height: 490px;
    overflow: visible;
}

.home-hero__media {
    min-height: 490px;
    background: linear-gradient(135deg, #e8eef5, #c7d7e8);
    overflow: hidden;
}

.home-hero__media img {
    display: block;
    width: 100%;
    height: 490px;
    object-fit: cover;
}

.home-hero__card {
    position: absolute;
    top: 50%;
    right: 54px;
    transform: translateY(-50%);
    width: min(420px, calc(100% - 108px));
    padding: 30px;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12);
}

.home-hero__card h2 {
    margin: 0 0 14px;
    color: #073b78;
    font-size: 1.55rem;
}

.home-hero__card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 0 0 24px;
}

.home-hero__card-links a {
    color: #073b78;
    text-decoration: none;
}

.home-hero__card-links a:hover,
.home-hero__card-links a:focus {
    text-decoration: underline;
}

.membership-form {
    display: grid;
    gap: 14px;
}

.membership-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.membership-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 2px solid #d6dfed;
    border-radius: 5px;
    font: inherit;
}

.membership-form input:focus {
    border-color: #073b78;
    outline: none;
}

.membership-form__privacy {
    margin: 2px 0 0;
    font-size: 0.95rem;
}

.membership-form__privacy a {
    color: #073b78;
    font-weight: 700;
}

.membership-form button {
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    background: #073b78;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.membership-form button:hover,
.membership-form button:focus {
    filter: brightness(1.08);
}

.membership-form__note {
    margin: 0;
    font-size: 0.9rem;
}

.home-hero__intro {
    max-width: 760px;
    margin-top: 20px;
    font-size: 1.12rem;
    line-height: 1.55;
}

.home-hero__intro h1 {
    margin-bottom: 14px;
}

.membership-mobile {
    display: none;
}

.membership-mobile a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 22px;
    border-radius: 6px;
    background: #073b78;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.home-content {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

@media (max-width: 860px) {
    .home-hero {
        margin-top: 24px;
    }

    .home-hero__stage {
        min-height: auto;
    }

    .home-hero__media {
        min-height: 260px;
    }

    .home-hero__media img {
        height: 260px;
    }

    .home-hero__card {
        display: none;
    }

    .home-hero__intro {
        margin-top: 18px;
    }

    .membership-mobile {
        display: block;
        margin-top: 18px;
    }
}


/* v1.15: Mitgliedsformular auch mobil anzeigen, unter dem Hero-Bild */
.membership-mobile {
    display: none !important;
}

@media (max-width: 860px) {
    .home-hero__stage {
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    .home-hero__card {
        display: block;
        position: static;
        width: 100%;
        max-width: none;
        transform: none;
        padding: 24px 20px;
        border-radius: 22px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    }

    .home-hero__card h2 {
        font-size: 1.4rem;
    }

    .home-hero__card-links {
        gap: 12px 18px;
        margin-bottom: 20px;
    }

    .membership-form {
        gap: 12px;
    }
}


/* v1.16: Startseiten-Inhalte wieder kompakter darstellen */
.home-content h1,
.home-content h2,
.home-content h3 {
    line-height: 1.18;
}

.home-content h2 {
    color: #073b78;
    font-size: clamp(1.55rem, 2.6vw, 2rem);
    margin: 1.8rem 0 .7rem;
}

.home-content h3 {
    color: #073b78;
    font-size: clamp(1.3rem, 2.2vw, 1.65rem);
    margin: 1.45rem 0 .6rem;
}

.home-content h2 a,
.home-content h3 a {
    color: inherit;
    text-decoration: none;
}

.home-content h2 a:hover,
.home-content h3 a:hover,
.home-content h2 a:focus,
.home-content h3 a:focus {
    text-decoration: underline;
}

/* WordPress-Block "Neueste Beiträge" */
.home-content .wp-block-latest-posts {
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-content .wp-block-latest-posts li {
    margin: 0 0 1.15rem;
}

.home-content .wp-block-latest-posts__post-title {
    display: inline-block;
    color: #073b78;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    line-height: 1.22;
    font-weight: 700;
    text-decoration: none;
}

.home-content .wp-block-latest-posts__post-title:hover,
.home-content .wp-block-latest-posts__post-title:focus {
    text-decoration: underline;
}

/* Falls Beiträge über Query Loop ausgegeben werden */
.home-content .wp-block-post-title {
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    margin: 0 0 .55rem;
}

.home-content .wp-block-post-title a {
    color: #073b78;
    text-decoration: none;
}


/* v1.17: Startseiten-Beitragsbereich wie zuvor, ohne alle Titel als H1 */
.home-news {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.home-news__site-title {
    margin: 0 0 34px;
    color: #000;
    font-size: clamp(2.2rem, 4vw, 3.2rem);
}

.home-news article {
    margin: 0 0 48px;
}

.home-news article h2 {
    margin: 0 0 14px;
    font-size: clamp(1.65rem, 2.5vw, 2.2rem);
    line-height: 1.15;
    color: #073b78;
}

.home-news article h2 a {
    color: inherit;
    text-decoration: none;
}

.home-news article h2 a:hover,
.home-news article h2 a:focus {
    text-decoration: underline;
}

.home-news article img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 0 18px;
}

.home-news article .entry-excerpt,
.home-news article .entry-content {
    max-width: 820px;
}

@media (max-width: 860px) {
    .home-news {
        padding-top: 20px;
    }

    .home-news__site-title {
        margin-bottom: 24px;
    }

    .home-news article {
        margin-bottom: 36px;
    }
}


/* v1.18: Bilder und kompletter Beitragsinhalt auf der Startseite erhalten */
.home-news article .entry-content {
    max-width: 100%;
}

.home-news article .entry-content img,
.home-news article .wp-block-image img,
.home-news article figure img {
    display: block;
    max-width: 100%;
    height: auto;
}

.home-news article figure,
.home-news article .wp-block-image {
    margin-left: 0;
    margin-right: 0;
}

.home-news article + article {
    margin-top: 54px;
}


/* v1.19: robuste Mitglied-werden-CTA statt extern nachgebautem Formular */
.home-hero__card--cta {
    padding: 34px;
}

.home-hero__card--cta h2 {
    margin-bottom: 12px;
}

.home-hero__card--cta p {
    margin: 0 0 22px;
    line-height: 1.5;
}

.membership-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 24px;
    border-radius: 6px;
    background: #073b78;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.membership-cta:hover,
.membership-cta:focus {
    color: #fff;
    filter: brightness(1.08);
}

@media (max-width: 860px) {
    .home-hero__card--cta {
        display: block;
        position: static;
        width: 100%;
        max-width: none;
        transform: none;
        padding: 24px 20px;
    }

    .membership-cta {
        width: 100%;
    }
}


/* v1.20: Hero-Video statt grauer Platzhalterfläche */
.home-hero__media {
    position: relative;
    background: #dfe5ec;
}

.home-hero__video {
    display: block;
    width: 100%;
    height: 490px;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 860px) {
    .home-hero__video {
        height: auto;
        min-height: 0;
        aspect-ratio: 1140 / 490;
        object-fit: cover;
    }

    .home-hero__media {
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-hero__video {
        /* Browser may still show the first frame; autoplay is disabled in markup via JS below. */
    }
}


/* v1.22: Header auch mobil beim Scrollen sichtbar halten */
@media (max-width: 860px) {
    .site-header {
        position: sticky;
        top: 0;
        z-index: 1100;
        background: #fff;
    }

    .site-header__inner {
        position: relative;
        z-index: 1101;
    }

    .site-nav {
        z-index: 1102;
    }

    .menu-toggle {
        z-index: 1103;
    }

    .mobile-overlay {
        z-index: 1100;
    }
}


/* v1.23: Mobile Header robust fixieren statt sticky */
@media (max-width: 860px) {
    body {
        padding-top: 72px;
    }

    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1200;
        background: #fff;
    }

    .site-header__inner {
        min-height: 72px;
    }

    .site-nav {
        z-index: 1202;
    }

    .menu-toggle {
        z-index: 1203;
    }

    .mobile-overlay {
        z-index: 1201;
    }
}

/* WordPress-Adminleiste berücksichtigen, falls eingeloggt */
@media (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }

    body.admin-bar {
        padding-top: 118px;
    }
}

@media (min-width: 783px) and (max-width: 860px) {
    body.admin-bar .site-header {
        top: 32px;
    }

    body.admin-bar {
        padding-top: 104px;
    }
}


/* v1.24: Mobile Header/Drawer stabilisieren und alte Konflikte überschreiben */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

@media (max-width: 860px) {
    body {
        padding-top: 72px !important;
    }

    .site-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        z-index: 2000 !important;
        background: #fff;
    }

    .site-header__inner {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 72px !important;
        margin: 0 !important;
        padding: 9px 16px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        overflow: visible !important;
    }

    .site-branding {
        min-width: 0;
        max-width: calc(100% - 58px);
        flex: 0 1 auto;
    }

    .site-branding a {
        display: block;
        max-width: 100%;
    }

    .site-branding img,
    .custom-logo {
        width: auto !important;
        height: auto !important;
        max-width: min(190px, 100%) !important;
        max-height: 54px !important;
    }

    .menu-toggle {
        display: block !important;
        position: relative !important;
        margin: 0 0 0 auto !important;
        flex: 0 0 46px !important;
        width: 46px !important;
        height: 46px !important;
        z-index: 2003 !important;
    }

    /* Drawer bleibt sicher innerhalb des Viewports */
    .site-nav {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: auto !important;
        width: min(82vw, 390px) !important;
        max-width: calc(100vw - 48px) !important;
        height: 100dvh !important;
        margin: 0 !important;
        padding: 18px 24px 32px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        background: #fff !important;
        transform: translate3d(-105%, 0, 0) !important;
        transition: transform .32s ease !important;
        z-index: 2002 !important;
        box-shadow: 10px 0 28px rgba(0, 0, 0, .12);
    }

    .site-nav.is-open {
        transform: translate3d(0, 0, 0) !important;
    }

    /*
     * Wichtig: Overlay UNTER Header + Drawer.
     * In v1.23 lag es über dem Header-Stacking-Context und fing die Link-Klicks ab.
     */
    .mobile-overlay {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        z-index: 1990 !important;
        pointer-events: none;
    }

    .mobile-overlay.is-open {
        pointer-events: auto;
    }

    body.menu-open {
        overflow: hidden !important;
    }
}

/* Eingeloggte WordPress-Nutzer: Adminbar nicht überdecken */
@media (max-width: 782px) {
    body.admin-bar {
        padding-top: 118px !important;
    }

    body.admin-bar .site-header {
        top: 46px !important;
    }

    body.admin-bar .site-nav {
        top: 46px !important;
        height: calc(100dvh - 46px) !important;
    }
}

@media (min-width: 783px) and (max-width: 860px) {
    body.admin-bar {
        padding-top: 104px !important;
    }

    body.admin-bar .site-header {
        top: 32px !important;
    }

    body.admin-bar .site-nav {
        top: 32px !important;
        height: calc(100dvh - 32px) !important;
    }
}


/* v1.25: Begrüßungsbereich für den Ortsverband */
.home-welcome {
    width: min(1200px, calc(100% - 32px));
    margin: 34px auto 10px;
}

.home-welcome__inner {
    max-width: 860px;
}

.home-welcome h1 {
    margin: 0 0 12px;
    color: #000;
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    line-height: 1.08;
}

.home-welcome p {
    margin: 0;
    color: #073b78;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    line-height: 1.45;
    font-weight: 500;
}

@media (max-width: 860px) {
    .home-welcome {
        margin-top: 24px;
    }

    .home-welcome h1 {
        font-size: clamp(2rem, 9vw, 2.7rem);
    }

    .home-welcome p {
        font-size: 1.08rem;
    }
}

/* v1.26: Startseite hat nur noch den neuen Begrüßungstitel; automatische Seitentitel entfernt. */
