/* ==========================================================================
   MOBILE-PAKET 2026 (Handy & kleine Tablets)
   Wird nach design-2026.css geladen. Zum Rueckgaengigmachen: Datei loeschen
   oder die Zeile "oerv-mobile" in functions.php entfernen.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. SEITE DARF NIE SEITLICH VERRUTSCHEN
   -------------------------------------------------------------------------- */
html, body { overflow-x: clip; max-width: 100%; }
html body iframe,
html body video,
html body embed,
html body object { max-width: 100% !important; }
html body img { max-width: 100%; height: auto; }
html body .content, html body #content { overflow-wrap: anywhere; }

html body .newsitem { margin-top: 0 !important; }
html body .newsitem > p:first-child { margin-top: 0 !important; margin-bottom: 0 !important; padding: 0 !important; }

/* Textseiten (alle ausser Startseite): Abstand unter der Kopfzeile auch am Desktop kompakt */
html body:not(.home) div.body.row,
html body:not(.home) .body.row.scroll-y { padding-top: 0 !important; margin-top: 0 !important; }
html body:not(.home) .body.row .content.col,
html body:not(.home) .content.col { padding-top: 12px !important; margin-top: 0 !important; }
html body:not(.home) .content .newsitem,
html body:not(.home) .content .newsitem.clear { padding-top: 0 !important; margin-top: 0 !important; }
html body:not(.home) .newsitem > :first-child,
html body:not(.home) .newsitem > p:first-child > :first-child { margin-top: 0 !important; }
html body:not(.home) .header.row { margin-bottom: 0 !important; }

/* Desktop: erste Ueberschrift-Box der Seite ohne zusaetzlichen Aussenabstand oben */
@media screen and (min-width: 851px) {
    html body:not(.home) .body.row .content.col,
    html body:not(.home) .content.col { padding-top: 18px !important; }
    html body:not(.home) .content .oerv-section-header-box:first-child { margin-top: 0 !important; }
}
@media screen and (max-width: 850px) {
    html body:not(.home) .body.row .content.col,
    html body:not(.home) .content.col { padding-top: 6px !important; }
}

@media screen and (max-width: 850px) {

    /* ----------------------------------------------------------------------
       1. KOPFBEREICH: schlanker, mehr Platz fuer Inhalt
       ---------------------------------------------------------------------- */
    html body .header,
    html body .header.row,
    html body div.header.row {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
        min-height: 0 !important;
    }
    html body .header img.mein-logo,
    html body .mein-logo { height: 46px !important; }
    html body .header > a { gap: 10px !important; }
    html body .header > a::after { font-size: 0.92em !important; padding-left: 10px !important; line-height: 1.25 !important; }
    html body button.mobile-menu-toggle { width: 40px !important; height: 40px !important; }
    html body .oerv-mobile-popup-card { top: 64px !important; }

    /* ----------------------------------------------------------------------
       2. STARTSEITE: HERO
       ---------------------------------------------------------------------- */
    html body .oerv-hero-box { padding: 16px 16px 20px !important; border-radius: 18px !important; }
    html body .oerv-hero-layout { grid-template-columns: 1fr !important; gap: 16px !important; }

    /* Foto oben, kompakt (statt auszublenden) */
    html body .oerv-hero-media { display: block !important; order: -1; }
    html body .oerv-hero-img { aspect-ratio: 16 / 10 !important; border-radius: 14px !important; box-shadow: 0 8px 20px rgba(20, 123, 113, 0.18) !important; }

    html body .oerv-hero-badge {
        display: inline-block !important;
        font-size: 0.7em !important;
        letter-spacing: 0.04em !important;
        padding: 6px 12px !important;
        line-height: 1.3 !important;
        margin-bottom: 10px !important;
    }
    html body .oerv-hero-title { font-size: 1.75em !important; line-height: 1.2 !important; margin-bottom: 6px !important; }
    html body .oerv-hero-subtitle { font-size: 1.05em !important; line-height: 1.4 !important; margin: 0 0 10px !important; }
    html body .oerv-hero-description { font-size: 0.98em !important; line-height: 1.6 !important; margin: 0 0 16px !important; }

    /* Knoepfe: untereinander, gleich breit, gut tippbar */
    html body .oerv-hero-buttons { display: flex !important; flex-direction: column !important; gap: 10px !important; width: 100% !important; }
    html body .oerv-hero-buttons .oerv-hero-btn,
    html body .oerv-hero-buttons a.oerv-hero-btn,
    html body .oerv-hero-buttons button.oerv-hero-btn {
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: center !important;
        text-align: center !important;
        min-height: 48px !important;
        margin: 0 !important;
    }

    /* Vorteile: kleine Chips, mehrere pro Zeile */
    html body .oerv-hero-trust { display: flex !important; flex-wrap: wrap !important; gap: 6px !important; margin-top: 14px !important; padding-top: 0 !important; }
    html body .oerv-hero-trust .trust-item { font-size: 0.8em !important; padding: 5px 10px !important; line-height: 1.2 !important; }

    /* ----------------------------------------------------------------------
       3. ABSCHNITTE UND UEBERSCHRIFTEN
       ---------------------------------------------------------------------- */
    html body .oerv-saeulen-main-title { font-size: 1.45em !important; line-height: 1.25 !important; }
    html body .oerv-saeulen-main-sub { font-size: 0.98em !important; line-height: 1.55 !important; }
    html body .oerv-section-header-box { padding: 12px 4px !important; }
    html body .oerv-section-header-box p { line-height: 1.55 !important; }

    /* Saeulen-Karten: etwas flacheres Bild, kompaktere Texte */
    html body .oerv-saeule-img { aspect-ratio: 16 / 9 !important; }
    html body .oerv-saeule-desc { font-size: 0.97em !important; line-height: 1.55 !important; }

    /* ----------------------------------------------------------------------
       4. KARTEN: Kurse, Seminare, Team
       ---------------------------------------------------------------------- */
    html body .kurs-card,
    html body .termin-card,
    html body .team-card,
    html body .oerv-news-card { border-width: 1.5px !important; border-radius: 14px !important; }
    html body .kurs-card { padding: 16px 14px !important; }
    html body .termin-card { padding: 14px !important; }
    html body .kurs-title { font-size: 1.15em !important; }
    html body .termin-title { font-size: 1.1em !important; }

    /* Seminar-/Termin-Angaben dichter, ohne die grossen Zeilenabstaende */
    html body .termin-meta { padding: 8px 10px !important; font-size: 0.93em !important; line-height: 1.4 !important; }
    html body .termin-meta p,
    html body .termin-meta .oerv-meta-group { margin: 0 0 4px 0 !important; }
    html body .termin-meta p:last-child { margin-bottom: 0 !important; }
    html body .termin-card-excerpt { font-size: 0.92em !important; line-height: 1.5 !important; }
    /* doppelter Link "Details & Anmeldung" + "Details »": nur einer */
    html body .termin-footer .termin-footer-details { display: none !important; }
    html body .termin-footer { justify-content: flex-start !important; }

    /* Kurs-Karten: Trainer-Chips kompakter */
    html body .kurs-badge { font-size: 0.8em !important; padding: 3px 9px !important; }

    /* Team: zwei Spalten statt einer sehr langen Liste */
    html body .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; margin: 18px 0 !important; }
    html body .team-card { padding: 14px 10px !important; }
    html body .team-card-avatar { width: 84px !important; height: 84px !important; margin-bottom: 8px !important; }
    html body .team-card-title { font-size: 1.02em !important; line-height: 1.25 !important; }
    html body .team-card-function { font-size: 0.84em !important; line-height: 1.35 !important; }
    html body .team-card-link { font-size: 0.82em !important; }

    /* ----------------------------------------------------------------------
       5. POPUP-FENSTER (Kurs, Seminar, Anmeldung, PDF)
       ---------------------------------------------------------------------- */
    html body .kurs-modal-overlay,
    html body [class*="-modal-overlay"] { padding: 8px !important; }
    html body .kurs-modal-content,
    html body .team-modal-content,
    html body [class*="-modal-content"] {
        padding: 18px 14px 16px !important;
        max-height: calc(100vh - 20px) !important;
        max-height: calc(100dvh - 20px) !important;
        border-radius: 14px !important;
    }
    html body .kurs-modal-title { font-size: 1.25em !important; line-height: 1.25 !important; margin-bottom: 14px !important; padding-right: 44px !important; }
    html body .kurs-modal-close,
    html body .team-modal-close,
    html body [class*="-modal-close"] {
        width: 40px !important; height: 40px !important;
        min-width: 40px !important; max-width: 40px !important;
        min-height: 40px !important; max-height: 40px !important;
        border: 2px solid #147b71 !important;
    }
    /* Angaben-Boxen im Popup: weniger Rand und Abstand */
    html body .kurs-detail-row { margin-bottom: 6px !important; }
    html body .kurs-modal-content .kurs-anfrage-btn,
    html body .kurs-modal-content .oerv-hero-btn,
    html body .oerv-modal-actions-wrap > * { width: 100% !important; box-sizing: border-box !important; justify-content: center !important; text-align: center !important; }

    /* PDF-Fenster: Vorschau flacher, Download-Knopf gross und volle Breite */
    html body .pdf-modal-content iframe { width: 100% !important; height: 50vh !important; min-height: 260px !important; }
    html body .oerv-btn-pdf-download { width: 100% !important; box-sizing: border-box !important; justify-content: center !important; text-align: center !important; }
    html body .oerv-center-margin-top { margin-top: 12px !important; }

    /* ----------------------------------------------------------------------
       6. FORMULARE
       ---------------------------------------------------------------------- */
    html body input[type="text"],
    html body input[type="email"],
    html body input[type="tel"],
    html body input[type="number"],
    html body input[type="date"],
    html body select,
    html body textarea { font-size: 16px !important; min-height: 46px; box-sizing: border-box !important; width: 100%; }
    html body textarea { min-height: 96px; }

    /* ----------------------------------------------------------------------
       7. FOOTER
       ---------------------------------------------------------------------- */
    html body .footer-column h3,
    html body .footer-column h4 { font-size: 1.15em !important; }

    /* ----------------------------------------------------------------------
       8. TEXTSEITEN: kleinerer Abstand unter der Kopfzeile, ruhigere Schrift
       ---------------------------------------------------------------------- */
    html body > #main,
    html body > #content,
    html body > .content,
    html body > .site-content,
    html body > #primary { margin-top: 0 !important; padding-top: 4px !important; }
    html body .entry-content,
    html body article,
    html body .page { margin-top: 0 !important; padding-top: 0 !important; }
    /* Echter Aufbau: .body.row > .content.col > .newsitem > p */
    html body div.body.row,
    html body .body.row.scroll-y { padding-top: 0 !important; margin-top: 0 !important; }
    html body .body.row .content.col,
    html body .content.col { padding-top: 6px !important; margin-top: 0 !important; }
    html body .content .newsitem,
    html body .content .newsitem.clear { padding-top: 0 !important; margin-top: 0 !important; }
    html body .newsitem > :first-child,
    html body .newsitem > p:first-child > :first-child { margin-top: 0 !important; }
    html body .header.row { margin-bottom: 0 !important; }

    /* Kartenraster aus dem Seitentext: auf dem Handy immer eine Spalte */
    html body .content div[style*="minmax(280px"] { grid-template-columns: minmax(0, 1fr) !important; gap: 14px !important; }

    html body .content > :first-child,
    html body #content > :first-child,
    html body .entry-content > :first-child,
    html body article > :first-child { margin-top: 0 !important; }
    html body .entry-title:empty,
    html body .page-title:empty,
    html body .content p:empty { display: none !important; margin: 0 !important; padding: 0 !important; }

    html body .content h1,
    html body #content h1,
    html body .entry-content h1 { font-size: 1.55em !important; line-height: 1.25 !important; margin: 6px 0 10px !important; }
    html body .content h2,
    html body #content h2 { font-size: 1.3em !important; line-height: 1.3 !important; }
    html body .content h3,
    html body #content h3 { font-size: 1.15em !important; line-height: 1.3 !important; }
    html body .oerv-section-header-box { margin: 8px 0 14px !important; }
    html body .oerv-section-header-box h1,
    html body .oerv-section-header-box h2,
    html body .oerv-section-header-box h3,
    html body .oerv-section-header-box .oerv-section-header-title { font-size: 1.45em !important; line-height: 1.25 !important; }

    html body .content p,
    html body #content p,
    html body .content li,
    html body #content li { font-size: 15.5px !important; line-height: 1.55 !important; }
    html body .content p,
    html body #content p { margin: 0 0 0.8em !important; }

    /* Boxen mit festem Rahmen direkt im Seitentext (z. B. Kontaktseite) */
    html body .content div[style*="border: 2px solid"],
    html body .content div[style*="border:2px solid"],
    html body .content div[style*="border: 3px solid"],
    html body .content div[style*="border:3px solid"],
    html body #content div[style*="border: 2px solid"],
    html body #content div[style*="border: 3px solid"] {
        border-width: 1.5px !important;
        border-radius: 14px !important;
        padding: 16px 14px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
    }
}

/* sehr schmale Handys */
@media screen and (max-width: 380px) {
    html body .header > a::after { font-size: 0.85em !important; }
    html body .oerv-hero-title { font-size: 1.55em !important; }
    html body .team-card-avatar { width: 72px !important; height: 72px !important; }
}

/* ==========================================================================
   MOBILMENUE (ab 1250 px): helles Blatt unter der Kopfzeile statt gruener Flaeche
   ========================================================================== */
@media screen and (max-width: 1250px) {
    html body.oerv-menu-open { overflow: hidden !important; }
    /* Hintergrund abdunkeln; Tippen darauf schliesst das Menue */
    html body.oerv-menu-open::after {
        content: "";
        position: fixed;
        left: 0; right: 0; bottom: 0;
        top: var(--oerv-header-h, 64px);
        background: rgba(14, 38, 36, 0.5);
        z-index: 9999998;
        animation: oervFadeIn 0.2s ease-out;
    }
    @keyframes oervFadeIn { from { opacity: 0; } to { opacity: 1; } }

    html body .oerv-mobile-popup-card {
        position: fixed !important;
        top: var(--oerv-header-h, 64px) !important;
        left: 0 !important; right: 0 !important;
        width: 100% !important; min-width: 0 !important; max-width: none !important;
        max-height: calc(100vh - var(--oerv-header-h, 64px)) !important;
        max-height: calc(100dvh - var(--oerv-header-h, 64px)) !important;
        background: #ffffff !important;
        border: none !important;
        border-radius: 0 0 20px 20px !important;
        box-shadow: 0 18px 30px rgba(14, 38, 36, 0.28) !important;
        padding: 6px 0 8px !important;
    }
    html body .oerv-mobile-popup-card.is-open { animation: oervSheetIn 0.22s ease-out !important; }
    @keyframes oervSheetIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

    html body .oerv-mobile-popup-card li { border-bottom: 1px solid #e3efed !important; }
    html body .oerv-mobile-popup-card li:last-child { border-bottom: none !important; }
    html body .oerv-mobile-popup-card a {
        color: #1d3a37 !important;
        font-weight: 600 !important;
        font-size: 1.05em !important;
        padding: 15px 22px !important;
        white-space: normal !important;
        justify-content: space-between !important;
        background: transparent !important;
    }
    html body .oerv-mobile-popup-card a::after {
        content: "";
        width: 8px; height: 8px;
        border-top: 2px solid #147b71; border-right: 2px solid #147b71;
        transform: rotate(45deg);
        opacity: 0.55;
        flex: 0 0 auto;
    }
    html body .oerv-mobile-popup-card li.is-current > a {
        background: #e8f4f3 !important;
        color: #147b71 !important;
        box-shadow: inset 4px 0 0 #147b71 !important;
    }
    html body .oerv-mobile-popup-card li.is-current > a::after { opacity: 1; }
    html body .oerv-mobile-popup-card a:active { background: #f1f8f7 !important; }

    /* Login / Trainer-Bereich: ein einziger gefuellter Knopf */
    html body .oerv-mobile-popup-card li[class*="login"] > a,
    html body .oerv-mobile-popup-card li[class*="intern"] > a,
    html body .oerv-mobile-popup-card li[class*="trainer"] > a,
    html body .oerv-mobile-popup-card li[class*="user"] > a,
    html body .oerv-mobile-popup-card a[href*="login"],
    html body .oerv-mobile-popup-card a[href*="trainer-bereich"],
    html body .oerv-mobile-popup-card a[href*="mein-bereich"] {
        background: #147b71 !important;
        color: #ffffff !important;
        box-shadow: none !important;
        margin: 12px 18px 10px !important;
        padding: 13px 20px !important;
        border-radius: 999px !important;
        justify-content: center !important;
        text-align: center !important;
    }
    html body .oerv-mobile-popup-card a[href*="login"]::after,
    html body .oerv-mobile-popup-card a[href*="trainer-bereich"]::after,
    html body .oerv-mobile-popup-card a[href*="mein-bereich"]::after { display: none !important; }
    html body .oerv-mobile-popup-card li:has(> a[href*="trainer-bereich"]),
    html body .oerv-mobile-popup-card li:has(> a[href*="login"]) { border-bottom: none !important; }
}
