/* ==========================================================================
   Zeitspiel – Handy- & Tablet-Anpassungen
   --------------------------------------------------------------------------
   Diese Datei greift NUR auf schmalen oder hochkant gehaltenen Bildschirmen:
   Seitenverhältnis unter 14:10 (Handy/Tablet hochkant) oder Breite unter 1024px
   (z. B. Handy quer). Auf breiten Desktop-Bildschirmen (16:9, z. B. 3840x2160)
   wird hier nichts angewendet – dort bleibt das Original-Layout pixelgenau.

   Statt vh (Bildschirmhöhe) nutzen die Schriftgrößen hier clamp(): fließend,
   aber mit Mindest- und Höchstwert. So wird Text auf Tablets nicht riesig und
   auf Handys quer nicht winzig.
   ========================================================================== */

@media (max-width: 1023px) {
    /* ---------- Kein seitliches Scrollen ---------- */

    /* 100vw ist inkl. Scrollbalken breiter als das Fenster -> 100% */
    html,
    section {
        width: 100%;
    }

    /* Bilder fliegen auf Handy von unten statt von der Seite ein:
       vorher standen sie vor der Animation bis zu 50% über den Rand. */
    .right-column.slide-image,
    .left-column.slide-image {
        transform: translateY(40px);
        opacity: 0;
    }

    .right-column.slide-image.active,
    .left-column.slide-image.active {
        transform: none;
        opacity: 1;
    }

    /* Checkbox-Text darf umbrechen (war auf 320px zu breit) */
    .confirmation label {
        flex-basis: auto !important;
        flex-shrink: 1 !important;
        min-width: 0;
    }

    /* ---------- Kopfzeile ---------- */

    .topbar {
        height: clamp(38px, 6vh, 50px);
    }

    .topbar-link img {
        height: clamp(18px, 2.75vh, 24px);
    }

    #english {
        font-size: clamp(12px, 1.75vh, 15px);
        padding: 6px 12px;
        border-width: 2px;
        border-radius: 6px;
    }

    .logo-container {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 8px 0;
    }

    #logo {
        position: static;
        left: auto;
        transform: none;
        margin: 0;
        height: clamp(52px, 9vh, 80px);
        width: auto;
    }

    .hamburger {
        position: absolute;
        top: 50%;
        right: 5vw;
        margin: 0;
        padding: 8px;
        transform: translateY(-50%);
    }

    .bar {
        width: 34px;
        height: 4px;
        margin: 6px auto;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(10px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-10px) rotate(-45deg);
    }

    .nav-buttons {
        height: 100vh;
        overflow-y: auto;
        padding-top: 12px;
        padding-bottom: 180px;
    }

    body .dropdown button,
    body #hidden-contact {
        font-size: clamp(20px, 4.6vw, 30px) !important;
        line-height: 1.2;
        padding: 14px 5vw !important;
    }

    body .side-navbtn-container button {
        font-size: clamp(16px, 3.4vw, 22px) !important;
        padding: 10px 5vw !important;
    }

    /* ---------- Startbereich (Bild/Video mit Titel) ---------- */

    #start:has(.overlay-text) {
        min-height: 480px;
    }

    #start:has(.overlay-text) .media-container {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding-top: 0;
        padding-bottom: 8vh; /* Titel minimal über der Bildschirmmitte */
    }

    #start:has(.overlay-text) .on-media {
        position: relative;
        margin: 0 auto !important;
        width: min(88%, 680px);
    }

    body .overlay-text {
        font-size: clamp(30px, min(8vw, 11vh), 64px);
        line-height: 1.15;
    }

    body .mobile-text {
        font-size: clamp(20px, min(4.8vw, 6vh), 36px);
        line-height: 1.25;
    }

    body .on-media button {
        font-size: clamp(16px, min(3.8vw, 4.8vh), 21px);
        line-height: 1.2;
        padding: 14px 22px 12px;
        margin-top: clamp(14px, 3vh, 26px);
        border-width: 2px;
        border-radius: 6px;
    }

    /* ---------- Text-/Bild-Sektionen ---------- */

    section:has(> .left-column) {
        display: grid;
        grid-template-columns: minmax(0, 1fr); /* Spalte nie breiter als der Bildschirm */
    }

    /* Absätze als Block: Text bricht immer innerhalb der Bildschirmbreite um (iPhone/Safari) */
    body .text-container p {
        display: block;
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .text-container {
        font-size: clamp(17.5px, 2.5vw, 21px);
    }

    body .text-container p {
        font-size: clamp(17.5px, 2.5vw, 21px);
        line-height: 1.45;
    }

    body .text-container h1 {
        font-size: clamp(28px, 5.4vw, 42px);
        line-height: 1.15;
        margin-bottom: 12px;
    }

    body .right-column.reveal-text .text-container,
    body .left-column.reveal-text .text-container {
        width: min(88%, 720px);
        padding-top: clamp(40px, 8vw, 80px);
        padding-bottom: clamp(40px, 8vw, 80px);
    }

    /* Bilder nicht höher als 75% des Bildschirms (wichtig bei Tablet/Handy quer) */
    .left-column.slide-image img,
    .right-column.slide-image img {
        max-height: 75vh;
        object-fit: cover;
    }

    /* Einleitungen der Unterseiten */
    body .introduction {
        padding-top: clamp(48px, 9vw, 96px);
        padding-bottom: clamp(48px, 9vw, 96px);
    }

    body .introduction .text-container {
        width: min(88%, 760px) !important;
        margin-top: 0;
    }

    body .introduction .text-container p,
    body .introduction p {
        font-size: clamp(17.5px, 2.6vw, 22px);
        line-height: 1.45;
        margin-bottom: 0.9em;
    }

    body .introduction .text-container h3 {
        font-size: clamp(21px, 3.6vw, 29px);
        line-height: 1.25;
        margin-bottom: 1em;
    }

    body .introduction ol li {
        font-size: clamp(16.5px, 2.4vw, 20px);
        line-height: 1.45;
        margin-bottom: 1.1em;
    }

    body .introduction li::before {
        font-size: clamp(32px, 8vw, 42px);
        line-height: 1;
        margin-right: 16px;
        min-width: 0.9em;
    }

    /* ---------- Kontaktformular ---------- */

    input[type="text"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px; /* 16px verhindert Auto-Zoom auf dem iPhone */
        padding: 12px;
        border: 1px solid #ccc;
        border-radius: 6px;
    }

    textarea {
        height: 150px !important;
    }

    input[type="submit"] {
        font-size: 16px;
        padding: 12px 26px;
        border-radius: 6px;
    }
    .file-btn {
        font-size: 14px;
        padding: 10px 14px;
        border-radius: 6px;
    }

    .file-upload {
        font-size: 13px;
    }

    body .form-end {
        font-size: 15px;
        line-height: 1.4;
        gap: 12px;
    }

    .checkbox,
    .checkbox input,
    .checkbox .checkbox-overlay {
        width: 15px;
        height: 15px;
    }

    .checkbox .checkbox-overlay,
    .checkbox input:checked ~ .checkbox-overlay {
        border-width: 2px;
        border-radius: 5px;
    }

    .checkbox .icon {
        width: 11px;
        height: 11px;
    }

    .contact .text-container p {
        margin-bottom: 24px !important;
    }

    /* ---------- Fußbereich ---------- */

    .prefooter {
        padding: clamp(36px, 7vw, 64px) 6vw;
        font-size: clamp(16px, 2.2vw, 19px);
    }

    body .prefooter-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 24px;
        width: 100%;
        float: none;
        margin-bottom: 8px;
    }

    body .prefooter-links .prefooter-column,
    body .prefooter > .prefooter-column {
        float: none;
        width: auto;
        margin: 0 !important;
        padding: 0;
    }

    body .prefooter ul {
        font-size: clamp(16px, 2.2vw, 19px);
        margin-bottom: 20px;
    }

    body .prefooter b {
        display: block;
        font-size: clamp(19px, 2.8vw, 23px);
        margin-bottom: 10px;
    }

    .prefooter li {
        margin-bottom: 6px;
    }

    footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 12px 24px;
        font-size: 16px;
        padding: 24px 6vw;
    }

    .footer-left-column,
    .footer-right-column {
        float: none;
        width: auto;
        padding: 0;
    }

    .copyr,
    .footer-links {
        float: none;
        margin: 0;
        padding: 0;
    }

    .footer-links {
        display: flex;
        gap: 24px;
    }

    .footer-links a {
        margin-right: 0 !important;
    }

    /* ---------- Über uns ---------- */

    body h2 {
        font-size: clamp(17px, 2.6vw, 22px);
    }

    body figure figcaption {
        font-size: 16px;
    }

    body .slides-container button {
        font-size: 30px;
        padding: 12px;
    }

    body .slides-container button:hover {
        font-size: 34px;
    }

    body #map {
        width: 90%;
        height: clamp(300px, 50vh, 480px);
    }

    .map-consent-pin {
        height: 40px;
        margin-bottom: 14px;
    }
    .map-consent-address {
        font-size: 18px;
        margin-bottom: 18px;
    }
    .map-consent-load {
        font-size: 16px;
        padding: 12px 22px;
        border-radius: 6px;
    }
    .map-consent-note {
        font-size: 14px;
        margin-top: 16px;
    }
    .map-consent {
        border-radius: 8px;
        background-size: 28px 28px;
    }

    /* ---------- Rechtstexte (Impressum, Datenschutz) ---------- */

    #start:not(:has(.overlay-text)) .on-media {
        margin-top: calc(clamp(38px, 6vh, 50px) + clamp(52px, 9vh, 80px) + 16px + 32px);
    }

    #start:not(:has(.overlay-text)) .media-container {
        width: min(88%, 760px);
        margin-left: auto;
        margin-right: auto;
    }

    body #start:not(:has(.overlay-text)) h2 {
        font-size: clamp(28px, 5.4vw, 42px);
    }

    body #start:not(:has(.overlay-text)) h3 {
        font-size: clamp(17px, 2.6vw, 22px);
    }

    body #start:not(:has(.overlay-text)) p,
    body #start:not(:has(.overlay-text)) li,
    body #start:not(:has(.overlay-text)) ul {
        font-size: clamp(16.5px, 2.4vw, 20px);
        line-height: 1.5;
    }
}

/* ==========================================================================
   Feinschliff Handy/Tablet
   ========================================================================== */

@media (max-width: 1023px) {
    /* Kontaktleiste: Symbole gleichmäßig, größere Tippflächen */
    .topbar-links-container {
        width: auto;
        gap: clamp(6px, 3vw, 20px);
        padding-left: calc(5vw - 10px);
    }

    .topbar-link {
        margin: 0;
    }

    body .topbar-link button {
        width: 44px;
        height: 100%;
        padding: 0;
    }

    .topbar-link img {
        margin: 0 auto;
        float: none;
    }

    /* Menü: feine Trennlinien, ruhiger Rhythmus */
    .nav-buttons .dropdown {
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        width: 90%;
    }

    #nav a button:hover,
    #nav a button:active {
        color: #e65a85;
    }

    /* Startbild der Unterseiten leicht abdunkeln: weißer Titel bleibt lesbar */
    #start:has(.overlay-text) {
        box-shadow: inset 0 0 0 100vmax rgba(0, 0, 0, 0.28);
    }

    body .overlay-text {
        text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
    }

    body .on-media button {
        background-color: rgba(0, 0, 0, 0.15);
    }

    /* Formular: lesbare Buttons, Pfeil am Auswahlfeld, Fokus sichtbar */
    input[type="submit"],
    .file-btn {
        color: #fff;
    }

    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='2' fill='none'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 34px;
    }

    input[type="text"]:focus,
    input[type="email"]:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid #e65a85;
        outline-offset: 1px;
    }

    /* Fußbereich: Überschriften der Kontaktdaten dezenter */
    body .prefooter .small-heading {
        font-size: 13px;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: #8f8d8d;
        margin-top: 12px;
        margin-bottom: 2px;
    }

    body .prefooter > .prefooter-column {
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        padding-top: 24px;
    }

    /* Formular-Ende: Checkbox dicht am Text, Button behält seine Höhe */
    body .form-end {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px 20px;
    }

    body .form-end > div {
        flex: 1 1 auto;
        min-width: 0;
    }

    body .confirmation {
        align-items: flex-start;
        column-gap: 10px;
        margin: 0 0 6px 0;
    }

    body .confirmation .checkbox {
        flex: 0 0 auto;
        margin: 3px 0 0 0;
    }

    body .form-end label {
        hyphens: manual;
    }

    body .form-end input[type="submit"] {
        flex: 0 0 auto;
        align-self: center;
        float: none;
        height: auto;
        margin: 0 !important;
    }

    /* Über uns: auf kleinen Schirmen immer zuerst das Foto, dann der Text */
    body #unser-team section > .slide-image,
    body #our-team section > .slide-image {
        order: -1;
    }

    /* Diashow-Pfeile: runde Flächen statt Text auf Bild */
    body .slides-container button.btn-left,
    body .slides-container button.btn-right {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.45);
        font-size: 20px;
        line-height: 44px;
        text-shadow: none;
    }

    body .slides-container button.btn-left {
        left: 10px;
    }
    body .slides-container button.btn-right {
        right: 10px;
    }

    body .slides-container button:hover {
        font-size: 20px;
        background-color: rgba(0, 0, 0, 0.7);
    }
}

/* Schmale Handys: Button unter dem Text, volle Breite (sonst bricht die Datenschutz-Zeile um) */
@media (max-width: 560px) {
    body .form-end {
        flex-direction: column;
        align-items: stretch;
    }

    body .form-end input[type="submit"] {
        width: 100%;
        padding: 14px;
    }
}

/* Fußlinks ab 600px dreispaltig */
@media (min-width: 600px) and (max-width: 1023px) {
    body .prefooter-links {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Seitliches Wischen auf dem Handy sicher sperren (moderne Browser).
   html: hidden sperrt die Seite seitlich; body: clip schneidet ab, ohne
   eigenen Scrollbereich zu bilden (sonst würde das Menü-Script nicht mehr reagieren). */
@supports (overflow: clip) {
    @media (max-width: 1023px) {
        html {
            overflow-x: hidden;
        }

        body {
            overflow-x: clip;
        }
    }
}

/* Sehr niedrige Bildschirme (Handy quer): Pfeil ausblenden */
@media (max-width: 1023px) and (max-height: 500px) {
    .scroll-down {
        display: none;
    }
}


/* Hamburger-Menü auch auf großen Bildschirmen, wenn das Menü (z. B. bei starkem Zoom)
   nicht mehr in eine Zeile passt (Klasse .nav-burger, gesetzt per Skript) */
@media (min-width: 1024px) {
    html.nav-burger .logo-container {
        margin-left: 0;
        padding-top: calc(var(--u) * 1);
        width: 100%;
    }

    html.nav-burger #logo {
        float: none;
        display: block;
        margin: 0 auto;
    }

    html.nav-burger #nav button {
        margin-top: 0 !important;
    }

    html.nav-burger header.active {
        background-color: black !important;
        top: 0 !important;
        width: 100%;
        z-index: 10;
    }

    html.nav-burger #nav {
        width: 100%;
        margin-right: 0 !important;
    }

    html.nav-burger #logo {
        margin-top: -1.5vh;
        margin-bottom: 1vh;
    }

    html.nav-burger .nav-buttons {
        width: 100%;
        height: 82vh;
        left: -100%;
        padding-left: 5%;
        opacity: 0;
        position: fixed;
        flex-direction: column;
        padding-top: calc(var(--u) * 5);
        background-color: black;
        transition: all 0.4s ease-in;
        z-index: 2;
    }

    html.nav-burger .nav-buttons.active {
        opacity: 100;
        left: 0;
    }

    html.nav-burger #hidden-contact {
        display: block;
        text-decoration: underline;
    }

    html.nav-burger .dropdown:hover .dropdown-content {
        display: none;
    }

    html.nav-burger .dropdown button,
    html.nav-burger #hidden-contact {
        font-size: calc(var(--u) * 4 * var(--fs)) !important;
        padding: calc(var(--u) * 3) 5vw calc(var(--u) * 3) !important;
    }

    html.nav-burger .dropdown,
    html.nav-burger .side-navbtn-container {
        width: 100%;
    }

    html.nav-burger .side-navbtn-container button {
        font-size: calc(var(--u) * 3 * var(--fs)) !important;
        padding: calc(var(--u) * 1.75) 5vw calc(var(--u) * 1.75) !important;
    }

    html.nav-burger .hidden-navbtn {
        display: block;
        font-size: calc(var(--u) * 2 * var(--fs)) !important;
    }

    html.nav-burger body #nav #contact-button {
        display: none;
    }

    html.nav-burger #nav a button:hover {
        color: #cd325f;
    }

    html.nav-burger .hamburger {
        display: block;
        cursor: pointer;
        position: relative;
        margin-left: 80vw;
        top: 6vh;
        margin-top: -3vh;
    }

    html.nav-burger .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    html.nav-burger .hamburger.active .bar:nth-child(1) {
        transform: translateY(1.754vh) rotate(45deg);
    }

    html.nav-burger .hamburger.active .bar:nth-child(3) {
        transform: translateY(-0.877vh) rotate(-45deg);
    }

    html.nav-burger .topbar-link {
        margin-left: 5%;
    }

    html.nav-burger .topbar-link {
        margin-left: 1vw;
        height: 100%;
    }

    html.nav-burger .topbar-link button {
        background-color: transparent;
        border: none;
        width: 8.5vh;
        height: 100%;
        font-size: calc(var(--u) * 2.25 * var(--fs));
    }

    html.nav-burger .topbar-links-container {
        display: flex;
        align-items: center;
        height: 100%;
        width: 30%;
        float: left;
    }

    html.nav-burger .topbar-link img {
        margin-left: 0;
        height: 2.75vh;
    }

    html.nav-burger .topbar-link p {
        display: none;
    }

    html.nav-burger .topbar-link img {
        height: clamp(18px, 2.75vh, 24px);
    }

    html.nav-burger #english {
        font-size: clamp(12px, 1.75vh, 15px);
        padding: 6px 12px;
        border-width: 2px;
        border-radius: 6px;
    }

    html.nav-burger .logo-container {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 8px 0;
    }

    html.nav-burger #logo {
        position: static;
        left: auto;
        transform: none;
        margin: 0;
        height: clamp(52px, 9vh, 80px);
        width: auto;
    }

    html.nav-burger .hamburger {
        position: absolute;
        top: 50%;
        right: 5vw;
        margin: 0;
        padding: 8px;
        transform: translateY(-50%);
    }

    html.nav-burger .bar {
        width: 34px;
        height: 4px;
        margin: 6px auto;
    }

    html.nav-burger .hamburger.active .bar:nth-child(1) {
        transform: translateY(10px) rotate(45deg);
    }

    html.nav-burger .hamburger.active .bar:nth-child(3) {
        transform: translateY(-10px) rotate(-45deg);
    }

    html.nav-burger .nav-buttons {
        height: 100vh;
        overflow-y: auto;
        padding-top: 12px;
        padding-bottom: 180px;
    }

    html.nav-burger body .dropdown button,
    html.nav-burger body #hidden-contact {
        font-size: clamp(20px, 4.6vw, 30px) !important;
        line-height: 1.2;
        padding: 14px 5vw !important;
    }

    html.nav-burger body .side-navbtn-container button {
        font-size: clamp(16px, 3.4vw, 22px) !important;
        padding: 10px 5vw !important;
    }

    html.nav-burger .topbar-link {
        margin: 0;
    }

    html.nav-burger body .topbar-link button {
        width: 44px;
        height: 100%;
        padding: 0;
    }

    html.nav-burger .topbar-link img {
        margin: 0 auto;
        float: none;
    }

    html.nav-burger #nav a button:hover,
    html.nav-burger #nav a button:active {
        color: #e65a85;
    }
}

/* Kontaktformular auf Handy/Tablet: mehr Abstand nach unten */
@media (max-width: 1023px) {
    .contact {
        padding-bottom: clamp(40px, 8vw, 64px);
    }
}
