/* ==========================================================================
   Mobile Ansicht von KIEZ to go
   Gilt fuer Smartphones (Hoch- und Querformat) und Tablets im Hochformat.
   Das Desktop-Layout steht unveraendert in kiez.css und hintergrund.css und
   greift erst ab 900 px Breite UND 601 px Hoehe.
   ========================================================================== */

/* Elemente, die nur in der mobilen Ansicht existieren */
.menue-knopf,
.unterzeile,
.menue-imp,
.nur-mobil,
#startbilder { display: none; }

@media (max-width: 899.98px), (max-height: 600.98px) {

  /* --- Grundgeruest ---------------------------------------------------- */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    margin: 0;
    background: #fff;
    color: #000;
    font-family: DrescherGroteskBT-Book, Verdana, sans-serif;
  }

  /* Die Kinder von #content werden direkt zu Flex-Elementen des body */
  #content { display: contents; }

  #flinks,
  #textboxindextop,
  .rand,
  .nur-desktop,
  #supersized,
  #supersized-loader { display: none; }

  /* --- Kopfbereich ----------------------------------------------------- */
  #logo {
    order: 1;
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid #000;
  }

  #logo > a { grid-column: 1; display: block; line-height: 0; }

  #logo img {
    display: block;
    width: 200px;
    max-width: 100%;
    height: auto;
  }

  .unterzeile {
    display: block;
    grid-column: 1;
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1.2;
  }

  /* --- Menue ------------------------------------------------------------ */
  .js .menue-knopf {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 2;
    position: relative;
    width: 48px;
    height: 48px;
    margin: 0 -8px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: #000;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .menue-knopf span,
  .menue-knopf::before,
  .menue-knopf::after {
    content: "";
    position: absolute;
    left: 11px;
    width: 26px;
    height: 2px;
    background: currentColor;
    transition: transform .2s, opacity .2s;
  }

  .menue-knopf span { top: 23px; }
  .menue-knopf::before { top: 15px; }
  .menue-knopf::after { top: 31px; }

  .menue-knopf[aria-expanded="true"] span { opacity: 0; }
  .menue-knopf[aria-expanded="true"]::before { transform: translateY(8px) rotate(45deg); }
  .menue-knopf[aria-expanded="true"]::after { transform: translateY(-8px) rotate(-45deg); }

  /* Ohne JavaScript steht das Menue einfach unter dem Kopfbereich */
  .menue {
    order: 2;
    padding: 12px 16px 20px;
    background: #fff;
    border-bottom: 1px solid #000;
  }

  /* Mit JavaScript wird es als Vollbild-Ebene geoeffnet */
  .js .menue { display: none; }

  .js .menue.offen {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    padding: 96px 16px 32px;
    border: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.menue-auf { overflow: hidden; }

  .menue br,
  .menue .dbn10 { display: none; }

  .menue a.menuegr {
    display: block;
    padding: 9px 0;
    font-size: 26px;
    line-height: 1.2;
  }

  .menue a.menuekl,
  .menue .menueklohnelink {
    display: block;
    padding: 10px 0 10px 14px;
    font-size: 17px;
    line-height: 1.25;
  }

  .menue-imp {
    display: block;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #000;
  }

  .menue-imp a {
    display: block;
    padding: 10px 0;
    color: #000;
    font-size: 16px;
  }

  /* --- Titelbild ------------------------------------------------------- */
  picture { display: block; order: 3; }

  #background-img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    max-height: 65vh;
    object-fit: cover;
    background: #222;
  }

  #startbilder {
    display: block;
    order: 3;
    position: relative;
    aspect-ratio: 3 / 2;
    max-height: 65vh;
    overflow: hidden;
    background: #222 url(mobil-bilder/fotos/s1-640.jpg) center / cover no-repeat;
  }

  .startbild {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: center / cover no-repeat;
    opacity: 0;
    transition: opacity 1s;
  }

  /* --- Bildsteuerung --------------------------------------------------- */
  #diashowrechts,
  #diashowlinks {
    display: flex;
    align-items: center;
    background: #000;
    color: #fff;
  }

  #diashowrechts {
    order: 4;
    justify-content: space-between;
    padding: 2px 4px;
  }

  #diashowrechts a,
  #diashowlinks a,
  #diashowrechts font {
    color: #fff;
    font-family: DrescherGroteskBT-SemiBold, Verdana, sans-serif;
    font-size: 17px;
    line-height: 1.2;
    text-decoration: none;
  }

  #diashowrechts font { order: 2; }
  #diashowrechts a:first-of-type { order: 1; }
  #diashowrechts a:last-of-type { order: 3; }

  #diashowrechts a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 48px;
    -webkit-tap-highlight-color: transparent;
  }

  #diashowrechts img,
  #diashowlinks img {
    display: block;
    width: auto;
    height: 24px;
  }

  /* Schwarze Pfeile liegen hier immer auf schwarzem Grund */
  #diashowrechts img[src*="schwarz"],
  #diashowlinks img[src*="schwarz"] { filter: brightness(0) invert(1); }

  /* --- Text ------------------------------------------------------------ */
  .inhalt {
    order: 5;
    box-sizing: border-box;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 16px 28px;
    font-size: 17px;
    line-height: 1.5;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
  }

  .inhalt.nur-mobil { display: block; }

  .inhalt .fliestext,
  .inhalt .fliestextbold,
  .inhalt .konstbold,
  .inhalt .konstnormal {
    font-size: 17px;
    line-height: 1.5;
  }

  /* Besser lesbar als das urspruengliche Hellgrau, bleibt aber abgesetzt */
  .inhalt .konstnormal { color: #6e6e6e; }

  .inhalt p { margin: 0 0 1em; }
  .inhalt p:empty { display: none; }

  .inhalt img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
  }

  .inhalt a { text-underline-offset: 2px; }

  .trennlinie {
    overflow: hidden;
    white-space: nowrap;
    -webkit-hyphens: none;
    hyphens: none;
  }

  /* --- Fusszeile ------------------------------------------------------- */
  #imp {
    order: 99;
    margin-top: auto;
    padding: 6px 16px 10px;
    border-top: 1px solid #000;
    text-align: center;
  }

  #imp a {
    display: block;
    padding: 10px 0;
    color: #000;
    font-size: 15px;
  }

  /* --- Einzelbild-Seiten ----------------------------------------------- */
  body.seite-bild {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #000;
  }

  .seite-bild #diashowlinks { order: 1; flex: none; padding: 0 12px; }

  .seite-bild #diashowlinks a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }

  .seite-bild #diashowlinks img { height: 20px; }

  .seite-bild picture {
    order: 2;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
  }

  .seite-bild #background-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    max-height: none;
    object-fit: contain;
    background: #000;
  }

  .seite-bild #diashowrechts { order: 3; flex: none; }
}

/* Groessere oder hochaufloesende Bildschirme bekommen das schaerfere Startbild */
@media (max-width: 899.98px) and (min-width: 500px),
       (max-width: 899.98px) and (min-resolution: 2dppx),
       (max-height: 600.98px) and (min-width: 500px),
       (max-height: 600.98px) and (min-resolution: 2dppx) {
  #startbilder { background-image: url(mobil-bilder/fotos/s1-1200.jpg); }
}

/* Smartphones im Querformat: Hoehe sparen */
@media (max-height: 480px) {
  .unterzeile { display: none; }
  #logo { padding-top: 4px; padding-bottom: 4px; }
  #diashowrechts a { height: 40px; }
  .seite-bild #diashowlinks a { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .menue-knopf span,
  .menue-knopf::before,
  .menue-knopf::after,
  .startbild { transition: none; }
}
