/*
  Mobile Darstellung für Layout 1_fsao (web48CMS)
  Stand: 21.11.2026

  Ergänzt style.css und spalten.css. Am Desktop (ab 1020 px Breite)
  ändert diese Datei nichts außer dem versteckten Menü-Button.

  Stufen:
    bis 1019 px  Tablet / kleines Fenster: Seite fließend, Kopf skaliert mit
    bis  760 px  Smartphone: einspaltig, Navigation hinter "Menü"-Button
*/

/* Menü-Button: nur auf dem Smartphone sichtbar */
#nav-schalter {
    display: none;
}

/* Kopie der Unternavigation im Hauptmenü (js/mobil.js): nur Smartphone */
#menu ul.unternavi {
    display: none;
}


/* ============================================================
   TABLET (bis 1019 px)
   ============================================================ */
@media screen and (max-width: 1019px) {

    #page_margins {
        width: auto;
        margin-right: 0;
    }

    /* Kopf: alle Teile skalieren proportional zur Breite (1000 x 309) */
    #header {
        position: relative;
        height: auto;
        aspect-ratio: 1000 / 309;
    }
    #header h1 {
        top: 0;
        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 */
        overflow: hidden;
    }
    #header #slideshow img {
        width: 100%;
        height: 100%;
    }

    #pre-header ul {
        width: auto;
    }

    /* Reiter-Menü kompakter, darf notfalls umbrechen */
    #menu {
        width: auto;
        height: auto;
        min-height: 37px;
    }
    #menu ul {
        margin-left: 10px;
    }
    #menu ul li {
        padding-right: 8px;
    }
    #menu ul li a {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Inhalte dürfen nicht über den Rand ragen */
    #centerframe_content img,
    #centerframe_content iframe,
    #centerframe_content video,
    #centerframe_content object,
    #centerframe_content embed {
        max-width: 100%;
    }
    #centerframe_content img {
        height: auto;
    }
    #centerframe_content iframe[src*="youtube"],
    #centerframe_content iframe[src*="vimeo"] {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
    #centerframe_content {
        overflow-wrap: break-word;
    }
    /* Facebook-Box: berechnet ihre Breite nur beim Laden */
    #centerframe_content .fb-page,
    #centerframe_content .fb-page span,
    #centerframe_content .fb-page iframe {
        max-width: 100% !important;
    }

    /* Spalten in Prozent statt Pixel (Inhaltsbreite 760 px, Abstand 20 px) */
    .links_50, .rechts_50 { width: 48.684%; }
    .links_66, .rechts_66 { width: 65.789%; }
    .links_75, .rechts_75 { width: 74.342%; }
    .links_25_1, .links_25_2, .rechts_25_1, .rechts_25_2 { width: 23.026%; }
    .links_33, .mitte_33, .rechts_33 { width: 31.579%; }
    .links_25_2, .rechts_25_1, .rechts_25_2, .mitte_33, .rechts_33 {
        margin-left: 2.632%;
    }

    .rightframe {
        display: none;
    }
}


/* ============================================================
   SMARTPHONE (bis 760 px)
   ============================================================ */
@media screen and (max-width: 760px) {

    body {
        background: #ecebea;
    }

    #page_margins {
        margin: 0;
    }

    /* Reihenfolge: Kopf, Menü-Button, Menü, Inhalt, Service-Links, Fuß */
    #page {
        display: flex;
        flex-direction: column;
    }
    #header      { order: 1; }
    #nav-schalter{ order: 2; }
    #menu        { order: 3; }
    #main        { order: 4; }
    #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;
        height: auto;
        min-height: 60px;
        padding: 10px 12px 10px 76px;
        box-sizing: border-box;
        background: #fe0000;
        color: white;
    }
    #header h1::before {            /* nur das Logo aus kopf.png */
        content: "";
        position: absolute;
        left: 8px;
        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: Arial, Helvetica, sans-serif;
        font-size: 14px;
        line-height: 1.3;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, .35);
    }
    #header #slideshow {
        position: relative;
        top: auto;
        height: auto;
        aspect-ratio: 4 / 1;
    }
    #header #slideshow img {
        object-fit: cover;
    }

    /* ---------- Menü-Button ---------- */
    #nav-schalter {
        display: block;
        width: 100%;
        margin: 0;
        padding: 12px 16px;
        border: 0;
        border-bottom: 3px solid #fe0000;
        background: #131313;
        color: white;
        font-family: Verdana, Tahoma, Arial, sans-serif;
        font-size: 16px;
        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;
        margin: 0;
        height: auto;
        min-height: 0;
        overflow: visible;
        background: #fcfbfa;
    }
    body.nav-offen #menu {
        display: block;
    }
    #menu ul {
        display: block;
        float: none;
        margin: 0;
    }
    #menu ul li {
        float: none;
        padding: 0;
    }
    #menu ul li a,
    #menu ul li.aktiv a,
    #menu ul li.pfadaktiv a {
        margin: 0;
        padding: 13px 16px;
        border: 0;
        border-bottom: 1px solid #ddd;
        border-left: 5px solid transparent;
        background: #fcfbfa;
    }
    #menu ul li.aktiv a,
    #menu ul li.pfadaktiv a {
        border-left-color: #fe0000;
        background: white;
    }

    /* Unternavigation direkt unter dem aktiven Hauptmenüpunkt */
    #menu ul li ul.unternavi {
        display: block;
        margin: 0;
        padding: 0 0 4px;
        background: #f3f2f1;
        border-bottom: 1px solid #ddd;
    }
    #menu ul li ul.unternavi ul {
        padding: 0;
        border: 0;
    }
    #menu ul li ul.unternavi li {
        float: none;
        margin: 0;
        padding: 0;
        background: none;
    }
    #menu ul li ul.unternavi li a {
        padding: 10px 16px 10px 34px;
        border: 0;
        border-left: 5px solid #fe0000;
        background: #f3f2f1;
        color: #131313;
        font-size: 15px;
        font-weight: normal;
    }
    #menu ul li ul.unternavi ul li a {
        padding-left: 52px;
        font-size: 14px;
    }
    #menu ul li ul.unternavi li.aktiv > a {
        color: #fe0000;
        font-weight: bold;
    }

    /* ---------- Hauptbereich einspaltig ---------- */
    #main {
        float: none;
        display: flex;
        flex-direction: column;
        background-image: none;
        min-height: 0;
    }
    #centerframe,
    #leftframe {
        float: none;
        width: auto;
        margin: 0;
    }
    #centerframe_content {
        margin: 16px 14px 8px;
    }
    #leftframe, #centerframe {
        font-size: 15px;
    }
    #centerframe ol li {
        font-size: inherit;
    }

    /* Unternavigation ohne aktiven Hauptmenüpunkt (z. B. Datenschutz):
       steht bei offenem Menü oberhalb des Inhalts */
    #leftframe {
        order: -1;
        display: none;
    }
    body.nav-offen #leftframe {
        display: block;
    }
    /* Unternavigation steckt schon im Hauptmenü → linke Spalte nicht doppelt zeigen */
    body.hat-unternavi #leftframe {
        display: none;
    }
    #leftframe_content {
        margin: 0;
    }
    #leftframe ul {
        margin: 0;
        padding: 6px 0;
        background: #f3f2f1;
        border-bottom: 3px solid #fe0000;
    }
    #leftframe ul::before {
        content: "In diesem Bereich";
        display: block;
        padding: 4px 16px 6px;
        color: #777;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .05em;
    }
    #leftframe ul ul {
        margin: 0;
        padding: 0;
        border: 0;
    }
    #leftframe ul ul::before {
        content: none;
    }
    #leftframe li,
    #leftframe li ul li {
        margin: 0;
        padding: 0;
        background: none;
    }
    #leftframe li a {
        padding: 10px 16px 10px 26px;
        font-size: 15px;
    }
    #leftframe li li a {
        padding-left: 42px;
        font-size: 14px;
    }

    /* ---------- Inhalte ---------- */
    .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;
    }

    #centerframe h2 { font-size: 20px; margin: 10px 0 16px; }
    #centerframe h3 { font-size: 17px; }

    /* ---------- Service-Links (Startseite, Kontakt, Impressum …) ---------- */
    #pre-header {
        position: static;
        background: #131313;
    }
    #pre-header ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        float: none;
        padding: 8px 6px;
    }
    #pre-header ul li a {
        margin: 0;
        padding: 8px 10px;
    }

    #footer {
        background-image: none;
    }
    #footer p {
        padding: 16px 14px;
    }
}
