/*
    RESPONSIVE DARSTELLUNG
    1024px = Umschaltung von der festen Sidebar zum Menüknopf.
    640px  = zusätzliche Anpassungen für schmale Handydisplays.

    Bei clamp(MINIMUM, FLEXIBEL, MAXIMUM) bleibt ein Wert immer zwischen
    der angegebenen kleinsten und größten Größe.
*/

/* Menüknopf und dunkler Hintergrund werden auf großen Bildschirmen nicht benötigt. */
.nav-toggle,
.nav-backdrop {
    display: none;
}

/* Kennzeichnet in der Sidebar die Seite, auf der man sich gerade befindet. */
.sidebar-content a.is-current {
    color: var(--farbe-mobil-aktiver-link);
}

/* Auf schmaleren Desktop-Bildschirmen stehen die Prozesskarten in zwei Reihen. */
@media (min-width: 1025px) and (max-width: 1500px) {
    .ueber-uns-prozessschritte {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ueber-uns-prozessschritte::before {
        display: none;
    }

}

/* Tablet und kleinere Bildschirme: Die feste Sidebar wird zu einem ausklappbaren Menü. */
@media (max-width: 1024px) {
    body.industrial-design-page::before {
        left: 0;
    }

    /* Grauer Menüknopf links oben. */
    .nav-toggle {
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1002;
        width: 48px;
        height: 48px;
        padding: 11px 10px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        background: var(--farbe-mobil-menueknopf);
        border: 0;
        border-radius: 12px;
        box-shadow: 0 8px 24px var(--schatten-schwarz-28);
        cursor: pointer;
    }

    /* Die drei weißen Linien des Menüknopfs. */
    .nav-toggle span {
        display: block;
        width: 100%;
        height: 3px;
        background: var(--farbe-mobil-menuezeichen);
        border-radius: 3px;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    /* Bei geöffnetem Menü verwandeln sich die drei Linien in ein X. */
    .nav-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(11.5px) rotate(45deg);
    }

    .nav-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-11.5px) rotate(-45deg);
    }

    .nav-toggle:focus-visible,
    .sidebar a:focus-visible,
    .sidebar summary:focus-visible {
        outline: 3px solid var(--farbe-mobil-fokus);
        outline-offset: 3px;
    }

    /* Dunkelt die Seite hinter der geöffneten Sidebar ab. */
    .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: block;
        background: var(--farbe-mobil-hintergrund-abdunklung);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    /* Geschlossene Sidebar: Sie befindet sich außerhalb des sichtbaren Bereichs. */
    .sidebar {
        width: min(84vw, 320px);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        box-shadow: 12px 0 30px var(--schatten-schwarz-25);
    }

    /* Geöffnete Sidebar: Sie wird wieder in den sichtbaren Bereich geschoben. */
    .sidebar.is-open {
        transform: translateX(0);
    }

    body.nav-open {
        overflow: hidden;
    }

    body.nav-open .nav-backdrop {
        opacity: 1;
        visibility: visible;
    }

    /* Ohne feste Sidebar dürfen die Seitenbereiche die ganze Breite verwenden. */
    .slideshow,
    .container,
    .row,
    .team-Bereich,
    .ueber-uns-Bereich,
    .media-Bereich,
    .kunden-Bereich,
    .produkte-Bereich,
    .services,
    .impressum-container,
    .datenschutz-container,
    .jobs-Bereich,
    .kontakt-Bereich {
        width: 100%;
        margin-left: 0;
    }

    .slideshow {
        height: clamp(240px, 40vh, 360px);
    }

    /* Ohne feste Sidebar füllt der Über-uns-Hintergrund das ganze Fenster. */
    .ueber-uns-Bereich::before {
        left: 0;
    }

    .ueber-uns-einleitung {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }

    .startseite-Box .services {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ueber-uns-hero-bild {
        width: min(100%, 620px);
        margin-right: auto;
        margin-left: auto;
    }

    .container {
        padding: 32px 24px;
    }

    .container[id] {
        scroll-margin-top: 80px;
    }

    .container h1,
    .container h2 {
        width: min(100%, 620px);
        margin-top: 32px;
    }

    .space {
        margin-top: 80px;
    }

    /* Text und Bild stehen auf Tablet und Handy untereinander. */
    .row {
        flex-direction: column;
        gap: 24px;
        padding: 0 24px;
        margin-right: 0;
    }

    .box-1,
    .box-2,
    .box-3 {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .box-2,
    .box-2_ro {
        flex: 0 0 auto;
        height: clamp(280px, 62vw, 450px);
    }

    .box-2_ro {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .box-3 p:last-child {
        flex-wrap: wrap;
    }

    .team-Bereich,
    .ueber-uns-Bereich,
    .media-Bereich,
    .kunden-Bereich,
    .produkte-Bereich,
    .impressum-container,
    .datenschutz-container,
    .jobs-Bereich,
    .kontakt-Bereich {
        padding-right: 24px;
        padding-left: 24px;
    }

    body > .sidebar + .team-Bereich,
    body > .sidebar + .ueber-uns-Bereich,
    body > .sidebar + .media-Bereich,
    body > .sidebar + .kunden-Bereich,
    body > .sidebar + .produkte-Bereich,
    body > .sidebar + .impressum-container,
    body > .sidebar + .datenschutz-container,
    body > .sidebar + .jobs-Bereich,
    body > .sidebar + .kontakt-Bereich {
        padding-top: 88px;
    }

    .services {
        margin-top: 0;
        padding-right: 24px;
        padding-left: 24px;
    }

    .services .service_text p {
        margin-bottom: 64px;
    }

    .team-Grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .ueber-uns-leistungsraster {
        min-width: 0;
        grid-template-columns: minmax(0, 1fr);
    }

    /* Lange Bereichsnamen dürfen die Karten auf Handys nicht verbreitern. */
    .ueber-uns-leistungsraster a,
    .ueber-uns-leistungsraster h3 {
        min-width: 0;
        max-width: 100%;
    }

    .ueber-uns-leistungsraster a {
        width: 100%;
    }

    .ueber-uns-leistungsraster h3 {
        overflow-wrap: anywhere;
    }

    .ueber-uns-prozessschritte {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .produkte-raster {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .software-karte {
        grid-template-columns: 1fr;
    }

    .software-karte--lagerverwaltung .software-inhalt {
        max-width: 860px;
        text-align: center;
    }

    .software-vorschau {
        min-height: 260px;
        border-right: 0;
        border-bottom: 1px solid var(--farbe-produkte-karte-rahmen);
    }

    .ueber-uns-prozessschritte::before {
        display: none;
    }

    .kunden-row {
        flex-wrap: wrap;
        gap: 30px;
    }

    .jobs-pdf-wrapper {
        height: min(70vh, 700px);
        min-height: 500px;
    }
}

/* Zusätzliche Anpassungen für schmale Handydisplays. */
@media (max-width: 640px) {
    .nav-toggle {
        top: 12px;
        left: 12px;
    }

    .sidebar {
        width: min(88vw, 320px);
    }

    .firmenlogo {
        padding: 48px 0;
    }

    /* Die große Slideshow wird flacher, damit die Bilder weniger abgeschnitten werden. */
    .slideshow {
        height: clamp(180px, 52vw, 230px);
    }

    .container,
    .team-Bereich,
    .ueber-uns-Bereich,
    .media-Bereich,
    .kunden-Bereich,
    .produkte-Bereich,
    .impressum-container,
    .datenschutz-container,
    .jobs-Bereich,
    .kontakt-Bereich,
    .services {
        padding-right: 16px;
        padding-left: 16px;
    }

    body > .sidebar + .team-Bereich,
    body > .sidebar + .ueber-uns-Bereich,
    body > .sidebar + .media-Bereich,
    body > .sidebar + .kunden-Bereich,
    body > .sidebar + .produkte-Bereich,
    body > .sidebar + .impressum-container,
    body > .sidebar + .datenschutz-container,
    body > .sidebar + .jobs-Bereich,
    body > .sidebar + .kontakt-Bereich {
        padding-top: 76px;
    }

    .container h1,
    .container h2 {
        font-size: 1.75rem;
        padding: 10px 14px;
        margin-top: 20px;
    }

    /* Lange Haupttitel mit Piktogramm passen vollständig in schmale Handydisplays. */
    body.technical-page .technical-landing-Box .container h1 {
        min-width: 0;
        max-width: 100%;
        padding-right: 10px;
        padding-left: 10px;
        gap: 0.4em;
        font-size: clamp(1rem, 4.8vw, 1.25rem);
        letter-spacing: 0;
        overflow-wrap: anywhere;
    }

    /* Lange Kapsel-Überschriften bleiben auch auf schmalen Handys in der Box. */
    .container .lange-ueberschrift {
        font-size: clamp(1.15rem, 5.5vw, 1.5rem);
        padding-right: 8px;
        padding-left: 8px;
        letter-spacing: 0;
        overflow-wrap: anywhere;
    }

    .space {
        margin-top: 48px;
    }

    .row {
        padding: 0 16px;
    }

    .box-1,
    .box-3 {
        padding: 22px 20px;
    }

    .box-2,
    .box-2_ro {
        height: clamp(240px, 74vw, 360px);
    }

    .box-2_ro {
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .services .headline h1,
    .ueber-uns-einleitung h1,
    .produkte-einleitung h1,
    .team-Bereich h1,
    .kunden-Box h1,
    .jobs-Box h1,
    .kontakt-Box h1 {
        font-size: 2rem;
        letter-spacing: 1px;
    }

    .services .service_text p,
    .kunden-text,
    .jobs-subtitle,
    .kontakt-text {
        font-size: 1rem;
    }

    .media-Box,
    .ueber-uns-Box,
    .kunden-Box,
    .produkte-Box,
    .jobs-Box,
    .kontakt-Box {
        padding: 24px 18px;
        border-radius: 14px;
    }

    .ueber-uns-Box {
        padding: 28px 20px;
    }

    .startseite-einleitung {
        min-height: clamp(430px, 118vw, 540px);
        margin: -28px -20px 0;
        border-radius: 13px 13px 0 0;
    }

    .startseite-hero-text {
        padding: 82px 54px 72px;
    }

    .startseite-hero-text .headline h1 {
        font-size: clamp(2.1rem, 10vw, 2.8rem);
    }

    .startseite-hero-text .service_text p {
        font-size: 1rem;
        line-height: 1.6;
    }

    .startseite-Box .services {
        grid-template-columns: 1fr;
        gap: 18px;
        padding-top: 30px;
    }

    body.technical-page .technical-landing-Box > .slideshow {
        width: calc(100% + 40px);
        height: clamp(220px, 62vw, 300px);
        margin: -28px -20px 0;
        border-radius: 13px 13px 0 0;
    }

    body.technical-page .technical-landing-Box .container {
        padding: 24px 16px 12px;
    }

    body.technical-page .technical-landing-Box .container.space {
        margin-top: 28px;
    }

    body.technical-page .technical-landing-Box > .slideshow + .container {
        margin-top: 18px;
    }

    body.technical-page .technical-landing-Box .row {
        padding: 14px 16px 20px;
    }

    .ueber-uns-einleitung {
        margin: -28px -20px 36px;
        padding: 64px 20px 28px;
        gap: 24px;
        border-radius: 13px 13px 0 0;
    }

    .ueber-uns-einleitung h1 {
        font-size: clamp(2.1rem, 10vw, 2.6rem);
        letter-spacing: -0.02em;
    }

    .ueber-uns-sprunglink {
        width: 100%;
    }

    .ueber-uns-bau {
        scroll-margin-top: 80px;
    }

    .ueber-uns-hero-bild img {
        max-height: 420px;
    }

    .ueber-uns-fakten,
    .ueber-uns-baugalerie,
    .ueber-uns-flaechen dl {
        grid-template-columns: 1fr;
    }

    .ueber-uns-ueberblick,
    .ueber-uns-prozess,
    .ueber-uns-flaechen {
        padding: 26px 18px;
    }

    .ueber-uns-fakten {
        gap: 26px;
    }

    .ueber-uns-fakten::before {
        display: none;
    }

    .ueber-uns-raster {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .ueber-uns-prozessschritte {
        grid-template-columns: 1fr;
    }

    .produkte-raster {
        grid-template-columns: 1fr;
    }

    .produkte-einleitung {
        margin-bottom: 30px;
    }

    .produkte-sprungnavigation {
        margin-bottom: 34px;
        flex-direction: column;
    }

    .produkte-sprungnavigation a {
        width: 100%;
        min-width: 0;
    }

    .produkte-abschnittstitel {
        font-size: 1.7rem;
    }

    .produkt-inhalt {
        padding: 24px 20px 22px;
    }

    .software-bereich {
        margin-top: 44px;
        padding-top: 36px;
    }

    .software-einleitung {
        margin-bottom: 24px;
    }

    .software-vorschau {
        min-height: 220px;
    }

    .software-inhalt {
        padding: 28px 22px;
    }

    .software-karte--lagerverwaltung .software-inhalt {
        padding-bottom: 26px;
        text-align: left;
    }

    .software-funktionsbild .produkt-eigenschaften {
        row-gap: 12px;
    }

    .software-funktionsbilder {
        grid-template-columns: 1fr;
        padding: 0 14px 18px;
        gap: 16px;
    }

    .software-funktionsbild {
        padding: 16px 12px 12px;
    }

    .software-funktionsbild .produkt-eigenschaften {
        padding-inline: 8px;
    }

    .software-screenshot figcaption {
        padding: 11px 12px;
        font-size: 0.82rem;
    }

    .software-bilddialog {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .software-bilddialog-inhalt {
        padding: 50px 8px 10px;
    }

    .software-bilddialog-bild {
        max-height: calc(100vh - 125px);
    }

    .software-bilddialog-navigation {
        width: 58px;
        height: 58px;
    }

    .software-bilddialog-navigation::before {
        width: 18px;
        height: 18px;
        border-width: 4px;
    }

    .software-bilddialog-zurueck {
        left: 14px;
    }

    .software-bilddialog-weiter {
        right: 14px;
    }

    .software-bilddialog figcaption {
        padding: 10px 8px 2px;
        font-size: 0.78rem;
    }

    .produkte-kontakt {
        padding: 24px 20px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .produkt-anfrage {
        width: 100%;
        min-width: 0;
    }

    .ueber-uns-karte {
        padding: 22px 20px;
    }

    .ueber-uns-leistungsraster a {
        padding: 22px 18px;
    }

    .ueber-uns-standort {
        flex-direction: column;
        align-items: stretch;
    }

    .ueber-uns-standort-aktionen {
        width: 100%;
    }

    .ueber-uns-kontakt {
        width: 100%;
    }

    body.industrial-design-page .media-Box,
    body.industrial-design-page .kunden-Box,
    body.industrial-design-page .jobs-Box,
    body.industrial-design-page .kontakt-Box,
    body.industrial-design-page .team-Bereich,
    body.industrial-design-page .impressum-container,
    body.industrial-design-page .datenschutz-container {
        border-radius: 10px;
    }

    body.media-design-page .media-Bereich {
        padding-top: 18px;
        padding-bottom: 18px;
    }

    body.media-design-page .media-Box::after {
        top: 14px;
        right: 16px;
    }

    body.kunden-design-page .kunden-item {
        width: 100%;
        min-width: 0;
    }

    body.kontakt-design-page .kontakt-Box {
        grid-template-columns: 1fr;
    }

    body.kontakt-design-page .kontakt-inhalt,
    body.kontakt-design-page .kontakt-aktion {
        padding: 32px 24px;
    }

    body.kontakt-design-page .kontakt-aktion {
        min-height: 250px;
    }

    body.kontakt-design-page .kontakt-Box h1 {
        justify-content: center;
        text-align: center;
    }

    body.kontakt-design-page .kontakt-text {
        text-align: center;
    }

    .media-title {
        font-size: 1.8rem;
    }

    body.technical-page .container {
        border-radius: 14px 14px 0 0;
    }

    body.technical-page .container + .row {
        border-radius: 0 0 14px 14px;
    }

    .kunden-row {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }

    .teammitglied {
        width: 170px;
        height: 170px;
    }

    .jobs-pdf-wrapper {
        height: 60vh;
        min-height: 420px;
    }

}

/* Barrierefreiheit: Animationen ausschalten, wenn das Gerät weniger Bewegung verlangt. */
@media (prefers-reduced-motion: reduce) {
    .nav-toggle span,
    .nav-backdrop,
    .sidebar,
    .slideshow .slide,
    .box-2 img {
        transition: none;
    }
}
