/* =========================================================
   Gemeinsame Stile für alle Seiten
   Wird auf JEDER Seite als letzte CSS-Datei geladen.
   Teil 1: Bedienung und Optik für alle Bildschirme
   Teil 2: Handy-Optimierungen (pro Seite geordnet)
   Werte in px, weil manche Seiten html { font-size: 62.5% }
   setzen und rem dort kleiner wäre.
   ========================================================= */


/* =========================================================
   TEIL 1: Für alle Bildschirme
   ========================================================= */

/* Sanftes Scrollen (z. B. Inhaltsverzeichnis, "Nach oben") –
   nicht für Leute, die im System weniger Bewegung eingestellt haben */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Menü bleibt beim Scrollen oben stehen: "overflow-x: hidden" auf
   html/body (in mehreren Seiten-CSS) blockiert das mitlaufende Menü,
   "clip" schneidet genauso ab, ohne es zu blockieren. Ältere Browser
   ignorieren die Zeile einfach und behalten "hidden". */
html,
body {
  overflow-x: clip;
}

/* Gut sichtbarer Rahmen, wenn man per Tastatur (Tab) navigiert */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #FFC107;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Hamburger-Menü zeigt, dass man es anklicken kann */
.navbar__toggle {
  cursor: pointer;
}

/* Aktuelle Seite im Menü hervorheben */
.navbar__links[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

.dropdown__link[aria-current="page"] {
  background: #3084F2;
  font-weight: 700;
}

.dropdown-toggle.is-current {
  box-shadow: inset 0 0 0 2px #ffffff;
}

/* "Nach oben"-Button (wird von app.js eingefügt) */
.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: #164DF2;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

/* manche Seiten setzen "* { transition: all }" – das Symbol soll davon unberührt bleiben */
.to-top svg,
.to-top path {
  transition: none;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.to-top:hover {
  background: #3084F2;
}

/* Footer-Links: beim Drüberfahren unterstreichen, damit klar ist, was klickbar ist */
.footer__link--items a[href]:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* =========================================================
   TEIL 2: Handy-Optimierungen
   ========================================================= */


/* ---------- Menü (alle Seiten) ---------- */
@media screen and (max-width: 960px) {
  /* Menü so hoch wie sein Inhalt, damit nichts über die Seite hinausragt */
  .navbar__menu,
  .navbar__menu.active {
    height: auto;
    padding-bottom: 20px;
  }

  /* überall gleiche Schriftgröße im Handy-Menü */
  .navbar__menu .navbar__links {
    font-size: 22px;
  }

  .navbar__menu .navbar__links.dropdown-toggle,
  .navbar__menu .dropdown__link {
    font-size: 20px;
  }
}


/* ---------- Footer (alle Seiten) ---------- */
@media screen and (max-width: 820px) {
  .footer__container {
    padding: 40px 16px;
  }

  /* Spalten paarweise nebeneinander: Vorstand | Trainer, Social Media | Kontakte */
  .footer__links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 480px;
    padding-top: 0;
    font-size: 16px;
  }

  .footer__link--wrapper {
    flex-direction: row;
    width: 100%;
  }

  .footer__link--items {
    flex: 1 1 50%;
    width: auto;
    min-width: 0;
    margin: 24px 8px 0 8px;
    padding: 0;
  }

  .footer__link--items h2 {
    font-size: 20px;
    margin-bottom: 12px;
  }

  .footer__link--items a {
    font-size: 14px;
    overflow-wrap: break-word;
  }

  /* Logo, Copyright und Icons untereinander und mittig */
  .social__media--wrap {
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin: 40px auto 0 auto;
  }

  #footer__logo {
    margin-bottom: 0;
  }

  .website__rights {
    margin: 0;
    font-size: 14px;
    text-align: center;
  }

  .social__icons {
    justify-content: center;
    width: auto;
    margin: 0;
  }

  .social__icon--link {
    margin: 0 8px;
  }
}


/* ---------- Startseite (index.html) ---------- */
@media screen and (max-width: 768px) {
  /* kein weißer Streifen zwischen Startbild und Karten */
  .services {
    margin-top: 0;
    padding: 16px 16px 48px 16px;
  }

  .services__container {
    width: 100%;
  }

  /* Karten nicht breiter als der Bildschirm */
  .services__card {
    width: 100%;
    max-width: 400px;
    margin: 12px auto;
  }

  .services__card.about-us {
    left: 0;
    height: auto;
    margin: 32px auto 0 auto;
  }

  /* die Bildkarten schieben ihre Überschrift 20rem nach unten –
     bei "Über uns" führte das zu einer großen blauen Lücke */
  .services__card.about-us h2 {
    margin-top: 0;
  }

  .about-us h2,
  .about-us p {
    text-align: left !important;
  }

  /* Sponsoren / Safeguarding: nicht die 80px-Höhe der Menü-Buttons erben */
  .services__card.about-us .button {
    height: auto;
    width: auto;
    max-width: 100%;
    align-self: flex-start;
    margin: 16px 0 0 0;
    padding: 12px 20px;
  }
}


/* ---------- Bilder (bilder.html): 2 Bilder pro Reihe ---------- */
@media screen and (max-width: 600px) {
  .gallery {
    justify-content: center;
    padding: 0 8px;
  }

  .gallery-item,
  .gallery-item.item-1x1 {
    flex: 0 0 calc(50% - 8px);
    width: calc(50% - 8px);
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 4px;
  }
}


/* ---------- Veranstaltungen (veranstaltungen.html) ---------- */
@media screen and (max-width: 768px) {
  .events-container {
    justify-content: space-between;
    padding: 0 12px;
  }

  .events-container > h2 {
    flex: 0 0 100%;
    margin-bottom: 12px;
  }

  .event {
    flex: 0 0 calc(50% - 8px);
    max-width: calc(50% - 8px);
    margin: 0 0 24px 0;
    padding: 4px;
  }

  .event > a {
    display: block;
    width: 100%;
  }

  .event img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 120px;
    min-height: 0;
    max-height: none;
    object-fit: contain;
  }

  .event h3 {
    font-size: 16px;
  }

  .event p {
    font-size: 14px;
  }
}


/* ---------- News (news.html) ---------- */
@media screen and (max-width: 480px) {
  .blog .box-container {
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  }
}


/* ---------- Safeguarding (guard.html) ---------- */
@media screen and (max-width: 480px) {
  .safeguard {
    padding: 32px 12px;
  }

  .safeguard__container {
    width: 100%;
    padding: 24px 16px;
  }
}


/* ---------- Kontakt (contact.html) ---------- */
@media screen and (max-width: 850px) {
  /* Die Kontaktliste war am Desktop nach rechts geschoben und am Handy
     der ganze Block wieder nach links – beides hier zurücksetzen */
  .contact-wrapper {
    left: 0;
  }

  .contact-list {
    left: 0;
    margin-left: 0;
    margin-top: 0;
  }

  .horizontal-line {
    margin-left: 0;
  }

  .social-media-list {
    left: 0;
  }

  .section-header {
    font-size: 44px;
    padding: 20px 0;
  }
}
