/* ========================================
   LAYOUT
   Seitenrahmen, Navigation und Kopfzeile
   ======================================== */


/* 1. Seitenaufteilung */

.shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
  gap: 16px;

  max-width: 1400px;
  margin: 16px auto 60px;
  padding-inline: 16px;
}

.sidebar {
  position: sticky;
  inset-block-start: 16px;
}

.content-column {
  min-width: 0;
}

.page-panel {
  margin-block-end: 16px;
  padding: 26px;
  background: var(--panel);
  border-radius: 12px;
  scroll-margin-block-start: 16px;
}

#main {
  overflow-anchor: none;
}


/* 2. Symbole */

.icon {
  display: block;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;

  background: linear-gradient(135deg, #ffe780, var(--accent));
  color: #111111;
}

.badge .icon {
  width: 22px;
  height: 22px;
}


/* 3. Desktop-Navigation */

.sidebar-card {
  padding: 10px;
  background: var(--panel);
  border-radius: 12px;
}

.brand {
  display: block;
  margin-block: 0 26px;
  margin-inline: 6px;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
  border-block-start: 3px solid var(--accent);
  border-radius: 11px;
}

#section-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;

  min-height: 52px;
  padding: 14px 12px;
  border-radius: 10px;

  color: var(--text);
  font-size: 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.nav-link:hover {
  background: var(--card);
}

.nav-link[aria-current="page"] {
  background: #ffffff;
  color: #111111;
  box-shadow: inset 0 0 8px #cccccc;
}

.mobile-toggle,
.menu-backdrop {
  display: none;
}


/* 4. Sprachauswahl */

.language {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;

  margin-block-start: 8px;
  padding: 10px 12px;
  border-block-start: 1px solid var(--border);
  background: var(--panel);
}

.language img {
  display: block;
  justify-self: center;
  object-fit: contain;
}

.language > a,
.language > span {
  justify-self: start;
}

.language a {
  color: inherit;
  text-decoration: none;
}

.language a:hover {
  text-decoration: underline;
}

.language a,
.language [aria-current="true"] {
  position: relative;
  text-decoration: none;
}

.language a::after,
.language [aria-current="true"]::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: -6px;

  height: 2px;
  border-radius: 2px;
  background: var(--accent);

  transform: scaleX(0);
  transform-origin: center;
  transition: transform 180ms ease;
}

.language a:hover,
.language a:focus-visible {
  text-decoration: none;
}

.language a:hover::after,
.language a:focus-visible::after {
  transform: scaleX(1);
}

.language [aria-current="true"]::after {
  transform: scaleX(1);
  animation: language-line-in 180ms ease-out;
}

@keyframes language-line-in {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .language a::after,
  .language [aria-current="true"]::after {
    transition: none;
    animation: none;
  }
}
/* 5. Kopfzeile */

.topbar {
  position: sticky;
  inset-block-start: 16px;
  z-index: 20;

  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;

  margin-block-end: 16px;
  padding: 10px 12px;
  border-block-start: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
}

.header-brand,
.title-mobile {
  display: none;
}

.topbar h1 {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.header-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  min-width: 0;
}

.header-contact a {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  min-width: 0;
  min-height: 44px;

  color: var(--text);
  text-decoration: none;
}

.header-contact a:hover {
  text-decoration: underline;
}

.header-contact a span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.header-contact .icon {
  width: 20px;
  height: 20px;
  filter: invert(1);
}

body.light .header-contact .icon {
  filter: none;
}

.theme-button {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  width: 40px;
  height: 40px;
}


/* 6. Sanfte Farbwechsel */

body,
.sidebar-card,
.language,
.topbar,
.page-panel,
.nav-link,
.hero-copy,
.service-card,
.contact-list,
.header-contact a,
em {
  transition:
    background-color 240ms ease,
    color 240ms ease,
    border-color 240ms ease,
    box-shadow 240ms ease;
}


/* 7. Kleinere Desktopfenster */

@media (min-width: 1025px) and (max-width: 1100px) {
  .shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .nav-link {
    padding: 12px 9px;
    font-size: 16px;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .page-panel {
    padding: 20px;
  }
}


/* 8. Tablet und Smartphone */

@media (max-width: 1024px) {
  .shell {
    display: block;
    margin-block: 12px 35px;
    padding-inline: 12px;
  }

  .sidebar {
    position: static;
    margin-block-end: 12px;
  }

  /* Das Logo erscheint jetzt im Header. */
  .sidebar .brand {
    display: none;
  }

  /*
   * Ohne JavaScript bleibt die Navigation normal sichtbar.
   * Mit JavaScript liegt sie über der Seite.
   */
  .js .sidebar {
    margin: 0;
  }

  .js .sidebar-card {
    padding: 0;
    background: transparent;
    border-radius: 0;
  }

  .nav-link {
    align-items: center;
    min-height: 48px;
    font-size: 16px;
  }

  .js .mobile-toggle {
    position: fixed;
    top: 50%;
    left: 10px;
    z-index: 41;
    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;

    background: var(--accent);
    color: #111111;
    box-shadow: 0 3px 12px rgb(0 0 0 / 30%);
    font-size: 0;
  }

  .js .mobile-toggle span {
    font-family: Arial, sans-serif;
    font-size: 26px;
    line-height: 1;
  }

  .js #section-nav {
    position: fixed;
    top: 50%;
    left: 68px;
    z-index: 40;
    transform: translateY(-50%);

    width: min(290px, calc(100vw - 80px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;

    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--panel);
    box-shadow: 0 8px 30px rgb(0 0 0 / 35%);
  }

  .js #section-nav:not([data-collapsed="false"]) {
    display: none;
  }

  .menu-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 30;

    display: block;
    background: rgb(0 0 0 / 40%);
  }

  body.menu-open {
    overflow: hidden;
  }

  .language {
    font-size: 14px;
  }

  /* Gemeinsamer kompakter Header */
  .topbar {
    position: static;
    grid-template-columns: 88px minmax(0, 1fr) 44px;
    gap: 10px 14px;
    padding: 14px;
  }

  .header-brand {
    display: block;
    grid-column: 1;
    grid-row: 1;

    width: 88px;
    height: 62px;
    overflow: hidden;
    border-radius: 7px;
  }

  /*
   * Beschneidet nur die Darstellung der blauen Ränder.
   * Die Bilddatei selbst bleibt unverändert.
   */
  .header-brand img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 65%;
  }

  .topbar h1 {
    grid-column: 2;
    grid-row: 1;
    font-size: 26px;
  }

  .title-desktop {
    display: none;
  }

  .title-mobile {
    display: inline;
  }

  .header-contact {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 0 24px;
  }

  .theme-button {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    width: 44px;
    height: 44px;
  }

  .page-panel {
    padding: 20px;
  }
}


/* 9. Smartphone */

@media (max-width: 600px) {
  .topbar {
    grid-template-columns: 68px minmax(0, 1fr) 44px;
    gap: 8px 10px;
    padding: 12px;
  }

  .header-brand {
    width: 68px;
    height: 52px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .header-contact {
    flex-direction: column;
    align-items: stretch;
    font-size: 15px;
  }

  .header-contact a {
    gap: 9px;
  }

  .header-contact .icon {
    width: 19px;
    height: 19px;
  }

  .page-panel {
    padding: 18px;
  }
}


/* 10. Besonders schmale Bildschirme */

@media (max-width: 380px) {
  .shell {
    padding-inline: 8px;
  }

  .topbar {
    grid-template-columns: 56px minmax(0, 1fr) 44px;
    gap: 8px;
  }

  .header-brand {
    width: 56px;
    height: 46px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .page-panel {
    padding: 12px;
  }
}


/* 11. Reduzierte Bewegung */

@media (prefers-reduced-motion: reduce) {
  body,
  .sidebar-card,
  .language,
  .topbar,
  .page-panel,
  .nav-link,
  .hero-copy,
  .service-card,
  .contact-list,
  .header-contact a,
  em {
    transition: none;
  }
}


/* 12. HTML übergang bei Sprachwechsel  */

@view-transition {
  navigation: auto;
}

::view-transition-group(root) {
  animation-duration: 240ms;
  animation-timing-function: ease-in-out;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
