/* Stylesheet, Teil 3 von 3 (nach stil-bausteine.css): schmale Bildschirme, Bewegung, Drucken, Farben berechnen. */

/* ================================================================ Schmaler */
@media (max-width: 1000px) {
  .leistung { grid-template-columns: 13rem 1fr; }
  .leistung-punkte { grid-column: 2; }
  .fuss-raster { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  :root { --rand: min(1120px, 100% - 2rem); }

  .held-raster,
  .gebiet-raster,
  .kontakt-raster,
  .handlungsband { grid-template-columns: 1fr; }

  .held-bild { order: -1; }
  .held-bild img { aspect-ratio: 16 / 10; }
  .held-marke { left: auto; right: 1rem; bottom: 1rem; max-width: 13rem; }

  .schritt,
  .schritt + .schritt {
    border-left: 0;
    padding-left: 0;
    padding-bottom: 1.8rem;
  }
  .schritt + .schritt { border-top: 1px solid var(--linie-dunkel); padding-top: 1.8rem; }

  /* Telefonnummer wandert aus der Kopfzeile in die feste Leiste unten */
  .kopf-tel { display: none; }

  .menue-knopf {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    padding: 12px 10px;
    background: none;
    border: 1px solid var(--linie);
    border-radius: 3px;
    cursor: pointer;
  }
  .menue-knopf span {
    display: block;
    height: 2px;
    background: var(--primaer);
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
  }
  .menue-knopf[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menue-knopf[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menue-knopf[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Das Menü der großen Ansicht wird durch das Seitenmenü ersetzt.
     Ohne JavaScript zeigt der noscript-Block in base.njk es wieder an. */
  .kopf .navi { display: none; }

  /* ------------------------------------------------- Seitenmenü (fährt von rechts ein) */
  .seitenmenue-schleier {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 290;
    background: color-mix(in srgb, var(--dunkel) 62%, transparent);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility 0s linear .3s;
  }
  .seitenmenue-schleier.ist-offen { opacity: 1; visibility: visible; transition: opacity .3s ease, visibility 0s; }

  .seitenmenue {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    width: min(24rem, 88vw);
    background: var(--flaeche);
    color: var(--text);
    border-left: 1px solid var(--linie);
    box-shadow: -20px 0 50px color-mix(in srgb, var(--dunkel) 22%, transparent);
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Zu = nach rechts aus dem Bild geschoben UND unsichtbar: dann ist es auch
       für Tastatur und Vorlese-Programme nicht erreichbar. */
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .32s cubic-bezier(.22, .8, .3, 1), visibility 0s linear .32s;
  }
  .seitenmenue.ist-offen {
    transform: none;
    visibility: visible;
    transition: transform .32s cubic-bezier(.22, .8, .3, 1), visibility 0s;
  }
  /* Offen: die Seite dahinter lässt sich nicht scrollen */
  html.seitenmenue-offen { overflow: hidden; }

  .seitenmenue :focus-visible { outline-offset: -4px; }

  .seitenmenue-kopf {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 74px;
    padding: 0 .8rem 0 1.5rem;
    border-bottom: 1px solid var(--linie);
  }
  .seitenmenue-marke {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
    text-decoration: none;
    color: var(--primaer);
  }
  .seitenmenue-marke img { flex: none; width: 38px; height: 38px; }
  .seitenmenue-marke .logo-breit { width: auto; height: 44px; }
  .seitenmenue-name {
    display: block;
    font-family: var(--schrift-display);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.02em;
    line-height: 1.1;
  }
  .seitenmenue-zusatz {
    display: block;
    margin-top: .2rem;
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--akzent-text);
  }
  .seitenmenue-zu {
    flex: none;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    transition: background-color .15s ease;
  }
  .seitenmenue-zu:hover { background: var(--flaeche-tief); }
  .seitenmenue-zu .ico { width: 24px; height: 24px; }

  .seitenmenue-liste { list-style: none; margin: 0; padding: 0; }
  .seitenmenue-link {
    display: block;
    padding: 1.1rem 1.5rem;
    font-family: var(--schrift-display);
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.2;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--linie);
    transition: background-color .15s ease;
  }
  .seitenmenue-link:hover { background: var(--flaeche-tief); }
  .seitenmenue-link[aria-current="page"] { color: var(--akzent-text); box-shadow: inset 4px 0 0 var(--akzent); }

  .seitenmenue-fuss {
    margin-top: auto;
    display: grid;
    gap: .95rem;
    padding: 1.4rem 1.5rem max(1.5rem, env(safe-area-inset-bottom));
    background: var(--flaeche-tief);
    border-top: 1px solid var(--linie);
  }
  .seitenmenue-kontakt {
    display: flex;
    align-items: center;
    gap: .85rem;
    color: var(--text);
    text-decoration: none;
    font-size: 1.02rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }
  .seitenmenue-kontakt .ico { flex: none; width: 22px; height: 22px; color: var(--akzent-text); }
  .seitenmenue-kontakt:hover span { text-decoration: underline; text-underline-offset: .2em; }
  .seitenmenue-cta { width: 100%; justify-content: center; gap: .6rem; margin-top: .2rem; }
  .seitenmenue-cta .ico { width: 18px; height: 18px; }

  @media (prefers-reduced-motion: reduce) {
    .seitenmenue, .seitenmenue-schleier { transition: none; }
  }

  .anrufleiste {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 140;
    background: var(--dunkel);
    border-top: 1px solid var(--linie-dunkel);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .anrufleiste a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1.05rem .6rem;
    font-weight: 600;
    font-size: .97rem;
    text-decoration: none;
    color: #fff;
  }
  .anrufleiste a + a { background: var(--akzent); color: var(--auf-akzent); }

  /* Platz schaffen, damit die feste Leiste nichts verdeckt */
  body { padding-bottom: 4.2rem; }
  .cookie-hinweis { bottom: 4.9rem; }
}

@media (max-width: 620px) {
  /* Knöpfe über die volle Breite: nebeneinander passen sie nicht mehr,
     und zwei unterschiedlich breite Knöpfe untereinander sehen unruhig aus */
  .held-knoepfe .knopf,
  .handlungsband-knoepfe .knopf { flex: 1 0 100%; }

  .leistung { grid-template-columns: 1fr; gap: .8rem; }
  .leistung-punkte { grid-column: 1; }
  .leistung-kurz { padding-top: 0; }
  .fuss-raster { grid-template-columns: 1fr; gap: 1.8rem; }
  .kennzahlen { gap: 1.3rem; }
  .kennzahl + .kennzahl { border-left: 0; padding-left: 0; }
  .held-marke { position: static; max-width: none; margin-top: 1rem; }
}

/* ========================================================= Bewegung sparsam */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ================================================================= Drucken */
@media print {
  .kopf, .anrufleiste, .cookie-hinweis, .held-knoepfe, .formular { display: none; }
  body { padding-bottom: 0; }
  .abschnitt { padding-block: 1.5rem; }
}

/* ============================================ Farben berechnen (Barrierefreiheit)
   Relative Farbsyntax (Chrome 119+, Safari 16.4+, Firefox 128+): Aus dem Akzent
   des Kunden wird die Helligkeit passend gesetzt. Die Werte sind mit einem
   Farbkreis-Durchlauf nachgerechnet (siehe docs/TECHNIK.md):
     Schrift auf hell:   Helligkeit hoechstens 0,44  -> mind. 4,8 : 1
     Schrift auf dunkel: Helligkeit mindestens 0,72  -> mind. 5,2 : 1
     auf dem Akzent:     Weiss oder Schwarz, was besser lesbar ist -> mind. 4,7 : 1
   Aeltere Browser bleiben bei den Rueckfallwerten oben. */
@supports (color: oklch(from red l c h)) {
  :root {
    --akzent-text:       oklch(from var(--akzent) min(l, 0.44) c h);
    --akzent-auf-dunkel: oklch(from var(--akzent) max(l, 0.72) c h);
    --auf-akzent:        oklch(from var(--akzent) clamp(0, (0.60 - l) * 1000, 1) 0 0);
    --auf-akzent-tief:   oklch(from var(--akzent-tief) clamp(0, (0.60 - l) * 1000, 1) 0 0);
  }
}
