/*
  Responsive Darstellung für Layout 3_fsao_neu (web48CMS)
  Stand: 23.11.2026

    bis 1047 px  Tablet / kleines Fenster: Seite über die volle Breite, Kopf skaliert mit
    bis  760 px  Smartphone: einspaltig, Navigation hinter "Menü"-Button (js/mobil.js)
*/

/* Kopie der Unternavigation im Hauptmenü (js/mobil.js): nur Smartphone */
#menu ul.unternavi {
    display: none;
}


/* ============================================================
   TABLET (bis 1047 px)
   ============================================================ */
@media screen and (max-width: 1047px) {

    #page_margins {
        margin: 0;
    }
    #page {
        border-radius: 0;
        box-shadow: none;
    }
    #pre-header .innen {
        padding: 0 12px;
    }

    /* Kopf skaliert proportional (1000 x 309) */
    #header {
        height: auto;
        aspect-ratio: 1000 / 309;
    }
    #header h1 {
        width: 100%;
        height: 38.835%;            /* 120 / 309 */
        background-size: 100% auto;
    }
    #header #slideshow {
        top: 19.094%;               /* 59 / 309 */
        width: 100%;
        height: 80.906%;            /* 250 / 309 */
    }
    #header #slideshow img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    #menu {
        padding-left: 10px;
        padding-right: 10px;
    }
    #menu > ul {
        gap: 4px;
    }
    #menu > ul > li > a {
        padding-left: 13px;
        padding-right: 13px;
        font-size: 14px;
    }

    #main {
        grid-template-columns: 190px minmax(0, 1fr);
        column-gap: 24px;
        padding: 24px 20px 40px 14px;
    }
}


/* ============================================================
   SMARTPHONE (bis 760 px)
   ============================================================ */
@media screen and (max-width: 760px) {

    /* Reihenfolge: Kopf, Menü-Button, Menü, Inhalt, Service-Links, Fuß */
    body {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        background: var(--flaeche);
        font-size: 15px;
    }
    #page_margins,
    #page {
        display: contents;
    }
    #header       { order: 1; }
    #nav-schalter { order: 2; }
    #menu         { order: 3; }
    #main         { order: 4; flex: 1 0 auto; }
    #pre-header   { order: 5; }
    #footer       { order: 6; }

    /* ---------- Kopf: rote Leiste mit Logo + Text, darunter Bild ---------- */
    #header {
        aspect-ratio: auto;
    }
    #header h1 {
        position: relative;
        top: auto;
        left: auto;
        width: auto;
        height: auto;
        min-height: 62px;
        padding: 11px 12px 11px 78px;
        background: var(--rot);
        color: #fff;
    }
    #header h1::before {            /* nur das Logo aus kopf.png */
        content: "";
        position: absolute;
        left: 9px;
        top: 4px;
        width: 60px;
        height: 56px;
        background: transparent url(../images/kopf.png) -17px -4px / 500px auto no-repeat;
    }
    #header h1::after {
        content: "Förderkreis der Fachschule für Augenoptik\A Hermann Pistor Jena e.V.";
        white-space: pre-line;
        display: block;
        font-family: var(--schrift);
        font-size: 14px;
        font-weight: 600;
        line-height: 1.3;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, .3);
    }
    #header #slideshow {
        position: relative;
        top: auto;
        height: auto;
        aspect-ratio: 4 / 1;
    }

    /* ---------- Menü-Button ---------- */
    #nav-schalter {
        display: block;
        position: sticky;
        top: 0;
        z-index: 20;
        width: 100%;
        margin: 0;
        padding: 13px 16px;
        border: 0;
        border-bottom: 3px solid var(--rot);
        background: var(--schwarz);
        color: #fff;
        font-family: var(--schrift);
        font-size: 16px;
        font-weight: 600;
        text-align: left;
        cursor: pointer;
    }
    #nav-schalter::before {
        content: "\2630";           /* ☰ */
        display: inline-block;
        width: 1.6em;
    }
    body.nav-offen #nav-schalter::before {
        content: "\2715";           /* ✕ */
    }

    /* ---------- Hauptmenü (zugeklappt, öffnet per Button) ---------- */
    #menu {
        display: none;
        position: static;
        margin-top: 0;
        padding: 0;
        background: var(--flaeche);
    }
    body.nav-offen #menu {
        display: block;
    }
    #menu > ul {
        display: block;
    }
    #menu > ul > li > a,
    #menu > ul > li.aktiv > a,
    #menu > ul > li.pfadaktiv > a,
    #menu > ul > li > a:hover {
        margin: 0;
        padding: 13px 16px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: var(--flaeche);
        border-bottom: 1px solid #ddd;
        border-left: 5px solid transparent;
        font-size: 16px;
    }
    #menu > ul > li.aktiv > a,
    #menu > ul > li.pfadaktiv > a {
        border-left-color: var(--rot);
        background: #fff;
    }

    /* Unternavigation direkt unter dem aktiven Hauptmenüpunkt */
    #menu ul li ul.unternavi {
        display: block;
        margin: 0;
        padding: 0 0 4px;
        list-style: none;
        background: var(--flaeche-2);
        border-bottom: 1px solid #ddd;
    }
    #menu ul.unternavi ul {
        display: block;
        margin: 0;
        padding: 0;
        list-style: none;
    }
    #menu ul.unternavi li {
        margin: 0;
        padding: 0;
        background: none;
    }
    #menu ul.unternavi li a {
        display: block;
        padding: 10px 16px 10px 34px;
        border-left: 5px solid var(--rot);
        color: var(--schwarz);
        font-size: 15px;
        font-weight: normal;
        text-decoration: none;
    }
    #menu ul.unternavi ul li a {
        padding-left: 52px;
        font-size: 14px;
    }
    #menu ul.unternavi li.aktiv > a {
        color: var(--rot);
        font-weight: 700;
    }
    /* Hauptpunkt mit gleicher Zielseite wie sein Unterpunkt: nicht doppelt rot */
    #menu ul.unternavi li.aktiv:has(li.aktiv) > a {
        color: var(--schwarz);
        font-weight: 600;
    }

    /* ---------- Hauptbereich einspaltig ---------- */
    #main,
    body.ohne-navi #main {
        display: flex;
        flex-direction: column;
        padding: 18px 16px 28px;
        min-height: 0;
    }

    /* Unternavigation ohne aktiven Hauptmenüpunkt (z. B. Datenschutz):
       steht bei offenem Menü oberhalb des Inhalts */
    #leftframe {
        order: -1;
        display: none;
        margin: -18px -16px 16px;
    }
    body.nav-offen #leftframe {
        display: block;
    }
    body.hat-unternavi #leftframe,
    body.ohne-navi #leftframe {
        display: none;
    }
    #leftframe_content {
        position: static;
    }
    #leftframe_content > ul {
        padding: 6px 0;
        background: var(--flaeche-2);
        border-bottom: 3px solid var(--rot);
    }
    #leftframe_content > ul::before {
        content: "In diesem Bereich";
        display: block;
        padding: 4px 16px 6px;
        color: #777;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .05em;
    }
    #leftframe_content > ul > li {
        margin: 0;
        padding: 0;
        background: none;
    }
    #leftframe li a {
        border-radius: 0;
        padding: 10px 16px 10px 26px;
    }
    #leftframe li ul {
        margin: 0;
    }
    #leftframe li li a {
        padding-left: 42px;
    }

    /* ---------- Inhalte ---------- */
    #centerframe_content {
        font-size: 15px;
    }
    #centerframe h2 { font-size: 22px; margin: 4px 0 16px; }
    #centerframe h3 { font-size: 18px; }
    #centerframe h4 { font-size: 16px; }

    .rightfloat,
    .leftfloat {
        float: none;
        margin: 0 0 12px;
    }

    .links_50, .rechts_50,
    .links_66, .rechts_66,
    .links_75, .rechts_75,
    .links_25_1, .links_25_2, .rechts_25_1, .rechts_25_2,
    .links_33, .mitte_33, .rechts_33 {
        float: none;
        width: auto;
        margin-left: 0;
        margin-bottom: 16px;
    }

    /* ---------- Service-Links am Seitenende ---------- */
    #pre-header ul {
        justify-content: center;
        padding: 10px 0;
    }
    #pre-header a {
        padding: 6px 10px;
    }

    #footer p {
        padding: 16px 14px;
    }
}
