* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow-y: scroll;
  height: 100%;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #333;
}

/* Normaler Hintergrund für alle anderen Seiten */

body {
  background: url('/background.jpg') no-repeat center center fixed;
  background-size: cover;
}

/* Sprachumschaltung */

.lang-switch {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
}

.lang-switch a {
  display: inline-block;
  padding: 4px 10px;
  margin-right: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  text-decoration: none;
  border-radius: 3px;
  font-size: 13px;
  font-weight: bold;
}

.lang-switch a.active {
  background: #c0392b;
}

/* Seitenlayout */

.layout {
  display: flex;
  min-height: 100vh;
  height: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 13.34%;
  height: 100vh;
  overflow-y: scroll;
  padding: 200px 10px 10px 10px;
}

.sidebar ul {
  list-style: none;
}

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

.sidebar a {
  display: block;
  padding: 10px 14px;
  text-align: center;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  /* Eine durchgehende Skalierung für Desktop und Tablet.
     Ab 1101 px bleibt die Schrift bei 21 px, darunter schrumpft sie fließend. */
  font-size: clamp(14px, calc(2.06vw - 1.66px), 21px);
  transition: background 0.2s, color 0.2s;
  /* Zu lange Wörter werden getrennt, statt unter den Scrollbalken zu rutschen.
     Gilt auf allen Bildschirmbreiten (Desktop und Tablet). */
  hyphens: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sidebar a:hover {
  background: rgba(255,255,255,0.15);
  color: #ff3333;
}

.sidebar a.active {
  background: rgba(255,255,255,0.15);
  color: #888;
}

/* Inhaltsbereich */

.content {
  flex: 1;
  margin-left: 13.34%;
  max-width: none;
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(to right, transparent 7.7%, rgba(77, 67, 67, 0.7) 7.7% 82.3%, transparent 82.3%);
  color: #ffffff;
  padding: 2.7rem calc(5.4rem + 15vw) 5.4rem calc(5.4rem + 6.66vw);
  font-size: 18px;
  line-height: 1.5;
  font-weight: 500;
}

.content h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.content p {
  margin-bottom: 0.5em;
}

.content p:last-of-type {
  margin-top: 1rem;
}

.content a {
  color: #ffffff;
}

/* Bildkarussell */

.carousel {
  width: 100%;
  margin-top: 2rem;
}

.carousel-main {
  width: 100%;
}

.carousel-slide {
  display: none;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.carousel-slide.active {
  display: block;
}

.carousel-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.carousel-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: opacity 0.3s, border-color 0.3s;
}

.carousel-thumb:hover {
  opacity: 1;
}

.carousel-thumb.active {
  border-color: #ffffff;
  opacity: 1;
}

/* Logo */

.sidebar-logo {
  position: fixed;
  top: 50px;
  left: 10px;
  width: 213px;
  z-index: 101;
}

/* Fußbereich der Navigation */

.sidebar-footer {
  margin-top: 30px;
  font-size: 19px;
  line-height: 1.5;
  color: #ccc;
  text-align: center;
}

.sidebar-footer a {
  display: inline;
  padding: 0;
  margin: 0;
  color: #ccc;
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: #d4a800;
  text-decoration: none;
}

/* ==========================================
   GREYHOUND – wechselnder Vollbild-Hintergrund
   Nur auf der Greyhound-Seite
   ========================================== */

body.greyhound-page {
  position: relative;
  isolation: isolate;
  background: none;
}

/* Hintergrund ganz nach hinten */

.greyhound-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Beide Hintergrundbilder */

.greyhound-background .background-image {
  position: absolute;
  inset: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  animation: greyhoundFade 16s linear infinite;
}

/* Erstes Bild */

.greyhound-background .background-one {
  background-image: url('/images/greyhound/background/01BackGreyhound.jpg');
  animation-delay: 0s;
}

/* Zweites Bild */

.greyhound-background .background-two {
  background-image: url('/images/greyhound/background/02BackGreyhound.jpg');
  animation-delay: -8s;
}

/* Sanfter Wechsel zwischen den Bildern */

@keyframes greyhoundFade {
  0%, 5% {
    opacity: 1;
  }

  45% {
    opacity: 1;
  }

  55% {
    opacity: 0;
  }

  95% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

/* Seiteninhalt liegt über den Hintergrundbildern */

body.greyhound-page .layout {
  position: relative;
  z-index: 1;
}

body.greyhound-page .lang-switch {
  z-index: 100;
}

body.greyhound-page .sidebar-logo {
  z-index: 101;
}

/* SUPER KLIMA – wechselnder Vollbild-Hintergrund */

body.super-klima-page {
  position: relative;
  background: transparent;
}

body.super-klima-page .super-klima-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

body.super-klima-page .super-klima-background .background-image {
  position: absolute;
  inset: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}

body.super-klima-page .super-klima-background .background-image.active {
  opacity: 1;
}

body.super-klima-page .layout {
  position: relative;
  z-index: 1;
}

body.super-klima-page .lang-switch {
  z-index: 100;
}

body.super-klima-page .sidebar-logo {
  z-index: 101;
}

/* NIGHTLINER – wechselnder Vollbild-Hintergrund */

body.nightliner-page {
  position: relative;
  background: transparent;
}

body.nightliner-page .nightliner-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

body.nightliner-page .nightliner-background .background-image {
  position: absolute;
  inset: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}

body.nightliner-page .nightliner-background .background-image.active {
  opacity: 1;
}

body.nightliner-page .layout {
  position: relative;
  z-index: 1;
}

body.nightliner-page .lang-switch {
  z-index: 100;
}

body.nightliner-page .sidebar-logo {
  z-index: 101;
}

/* Nightliner: Seitenhöhe und rechter Dokument-Scrollbalken */
body.nightliner-page {
  height: auto;
  min-height: 100vh;
  overflow-y: visible;
}

/* Gemeinsames Hintergrundsystem für alle Seiten */
.page-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.page-background .background-image {
  position: absolute;
  inset: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}

.page-background .background-image.active {
  opacity: 1;
}

/* Seiteninhalt vor dem Hintergrund halten */
.layout {
  position: relative;
  z-index: 1;
}

/* Bilder direkt im Seitentext */
.intext-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
}

/* Untermenü Kundenprojekte */
.sidebar .submenu {
  margin-top: 2px;
  margin-bottom: 8px;
  padding-left: 12px;
}

.sidebar .submenu li {
  margin-bottom: 2px;
}

.sidebar .submenu a {
  color: #ffcc00;
  font-size: 17px;
  padding: 6px 8px;
  text-align: left;
}

.sidebar .submenu a:hover {
  color: #ffe066;
  background: rgba(255,255,255,0.15);
}

.sidebar .submenu a.active {
  color: #ffcc00;
  background: rgba(255,255,255,0.15);
}

/* Zentrierte Überschrift für das Ducato-Kundenprojekt */
.centered-title {
  text-align: center;
}

/* Dokument-Scrollen auf allen Seiten sicherstellen */
html,
body {
  height: auto;
  min-height: 100%;
}

html {
  overflow-y: scroll;
}

body {
  overflow-y: visible;
}

/* Getrennte Scrollbereiche für Navigation und Inhalt */
.sidebar,
.content {
  overscroll-behavior-y: contain;
}

/* Das Gesamtdokument selbst scrollt nicht */
html,
body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Auch die Nightliner-Seite verwendet die getrennten Scrollbereiche */
body.nightliner-page {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}


/* ==========================================================
   Responsive Ergänzungen
   Das bisherige Desktop-Layout bleibt unverändert.
   Tablet und Smartphone erhalten eigene Layoutregeln.
   ========================================================== */

/* Medien sollen nie breiter als ihr Inhaltsbereich werden. */
.content img,
.content video,
.content iframe,
.content-area img,
.page-text img {
  max-width: 100%;
}

.content img,
.content-area img,
.page-text img {
  height: auto;
}

.content-area,
.page-text {
  min-width: 0;
  overflow-wrap: anywhere;
}


/* Einheitliche, fließende Logo-Skalierung für Desktop und Tablet.
   Die Breite orientiert sich an der Sidebar und berücksichtigt den Scrollbalken. */
@media (min-width: 761px) {
  .sidebar-logo {
    top: clamp(32px, 3.125vw, 50px);
    left: clamp(5px, 0.7vw, 10px);
    width: calc(13.34vw - 42px);
    max-width: calc(13.34vw - 30px);
    height: auto;
  }
}

/* Tablet: Menü-Schrift und Abstände skalieren stufenlos.
   Es gibt hier bewusst keine Schwellenwerte und keine JavaScript-Klasse mehr,
   damit weder in der Schriftgröße noch im Layout ein Sprung auftritt. */
@media (min-width: 761px) and (max-width: 1100px) {
  .sidebar {
    /* Sidebar bleibt fließend proportional zur Fensterbreite.
       Dadurch gibt es am Übergang von Desktop zu Tablet keinen Breiten-Sprung. */
    width: 13.34%;
    /* oben: 200 px bei 1100 px, 175 px bei 761 px
       seitlich: 10 px bei 1100 px, 8 px bei 761 px */
    padding: calc(7.37vw + 118.9px) calc(0.59vw + 3.5px) 16px;
    /* Sicherheitsnetz: nichts rutscht unter den Scrollbalken. */
    overflow-x: hidden;
  }

  /* Hauptmenüpunkte: dieselbe fließende Schriftgröße wie auf dem Desktop
     (21 px bei 1100 px, 14 px bei 761 px, dazwischen stufenlos).
     Bei Platzmangel wird wie im Fußbereich umgebrochen, statt die Schrift
     weiter zu verkleinern. Untermenüs bleiben von dieser Regel unberührt. */
  .sidebar > ul > li > a {
    font-size: clamp(14px, calc(2.06vw - 1.66px), 21px);

    /* Vertikal: 10 px bei 1100 px, 8 px bei 761 px.
       Horizontal: 14 px bei 1100 px, 1 px ab ca. 761 px. */
    padding: calc(0.59vw + 3.5px) clamp(1px, calc(3.83vw - 28.2px), 14px);

    white-space: normal;
    hyphens: auto;
    overflow-wrap: anywhere;
  }

  .sidebar-footer {
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  .content {
    /* Gleiche fließende Abstände wie auf dem Desktop:
       Textfläche und Abdunklung verändern sich ohne Sprung. */
    margin-left: 13.34%;
    padding: 2.7rem calc(5.4rem + 15vw) 5.4rem calc(5.4rem + 6.66vw);
    font-size: clamp(16px, 1.7vw, 18px);
  }
}

/* Smartphone und schmale Tablets: Navigation als aufklappbares Menü. */
.nav-toggle {
  display: none;
}

@media (max-width: 760px) {
  html,
  body,
  body.nightliner-page {
    width: 100%;
    height: auto;
    min-height: 100%;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    background-attachment: scroll;
  }

  .layout {
    display: block;
    width: 100%;
    min-height: 100svh;
    height: auto;
  }

  .sidebar-logo {
    position: fixed;
    top: 10px;
    left: 12px;
    width: min(38vw, 150px);
    height: auto;
    z-index: 102;
  }

  .lang-switch {
    position: fixed;
    top: 12px;
    right: 12px;
    left: auto;
    z-index: 104;
  }

  .lang-switch a {
    padding: 7px 10px;
    margin-left: 3px;
    margin-right: 0;
    font-size: 13px;
  }

  .nav-toggle {
    display: flex;
    position: fixed;
    top: 58px;
    right: 12px;
    z-index: 105;
    width: 48px;
    height: 44px;
    padding: 10px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 5px;
    background: rgba(20,20,20,.88);
    cursor: pointer;
  }

  .nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform .2s ease, opacity .2s ease;
  }

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

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

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

  .sidebar {
    display: none;
    position: fixed;
    top: 112px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 103;
    width: auto;
    height: auto;
    max-height: calc(100svh - 122px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 12px 20px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px;
    background: rgba(18,18,18,.97);
    box-shadow: 0 8px 28px rgba(0,0,0,.45);
  }

  .sidebar.is-open {
    display: block;
  }

  .sidebar li {
    margin-bottom: 3px;
  }

  .sidebar a {
    padding: 11px 12px;
    text-align: left;
    font-size: 18px;
    line-height: 1.3;
  }

  .sidebar .submenu {
    margin: 2px 0 8px;
    padding-left: 12px;
  }

  .sidebar .submenu a {
    padding: 8px 10px;
    font-size: 15px;
  }

  .sidebar-footer {
    margin-top: 20px;
    padding: 14px 8px 4px;
    border-top: 1px solid rgba(255,255,255,.2);
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
  }

  .content {
    width: 100%;
    min-height: 100svh;
    height: auto;
    margin: 0;
    overflow: visible;
    padding: 8.2rem 1rem 2.5rem;
    background: linear-gradient(
      to right,
      rgba(77,67,67,.78),
      rgba(77,67,67,.78)
    );
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
  }

  .content h1 {
    font-size: clamp(1.55rem, 7vw, 2rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .content h2 {
    margin-bottom: 1.25rem;
    font-size: clamp(1.25rem, 5.5vw, 1.65rem);
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .content h3 {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  .content p {
    margin-bottom: .85em;
  }

  .content p:last-of-type {
    margin-top: .8rem;
  }

  .content a {
    overflow-wrap: anywhere;
  }

  .content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .carousel {
    width: 100%;
    margin-top: 1.5rem;
  }

  .carousel-main,
  .carousel-slide {
    width: 100%;
  }

  .carousel-slide {
    max-height: 55svh;
    object-fit: contain;
  }

  .carousel-thumbs {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .carousel-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 48px;
  }

  .intext-image {
    width: auto;
    max-width: 100%;
    margin: 1.25rem auto;
  }

  /* Sonderhintergründe bleiben sichtbar, scrollen aber mit dem Gerät. */
  .page-background,
  .greyhound-background,
  body.super-klima-page .super-klima-background,
  body.nightliner-page .nightliner-background {
    position: fixed;
    inset: 0;
  }
}

@media (max-width: 380px) {
  .content {
    padding-right: .85rem;
    padding-left: .85rem;
    font-size: 15px;
  }

  .sidebar-logo {
    width: 125px;
  }

  .lang-switch a {
    padding: 6px 8px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle span {
    transition: none;
  }
}
