/* ========== Allgemeine Grundeinstellungen ========== */
html {
  scroll-behavior: smooth;
}

/* ========== Skip-Link (Barrierefreiheit) ==========
   Für Tastatur-/Screenreader-Nutzer: per Tab erreichbar, im Normalzustand
   unsichtbar außerhalb des Bildschirms, bei Fokus sichtbar. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10001;
  background-color: #fff;
  color: #c1001f;
  padding: 0.8rem 1.2rem;
  border-radius: 0 0 8px 0;
  font-weight: bold;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f8f8f8;
  font-size: 18px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========== Header ========== */
header {
  background-color: #c1001f;
  color: white;
  padding: 2.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 999;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
  text-align: left;
}

header img {
  height: auto;
  max-height: 120px;
  width: auto;
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 2.5rem;
  margin: 0;
}

.header-text p {
  font-size: 1.25rem;
  margin: 0;
}

/* ========== Navigation ========== */
nav {
  background-color: #333;
  color: white;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  position: sticky;
  /* Wird per JS auf die tatsächliche Header-Höhe gesetzt, damit auf jedem
     Gerät (unterschiedliche Header-Höhen je nach Breite) kein Spalt bzw.
     keine Überlappung zwischen Header und Menüleiste entsteht. */
  top: var(--header-height, 96px);
  z-index: 998;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.8rem;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  padding: 0.4rem 0.6rem;
  transition: background 0.3s;
}

nav a:hover {
  background-color: #555;
  border-radius: 4px;
}

/* ========== Banner ========== */
.banner {
  display: block;
  width: 100%;
  height: auto;
}

/* Hamburger-Button: standardmäßig (Desktop) ausgeblendet, siehe Media Query weiter unten.
   Klickfläche ist 44x44px (WCAG 2.5.8 Target Size), das sichtbare Icon bleibt
   dabei unverändert 28x20px und wird über .nav-toggle-icon zentriert. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-toggle-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  pointer-events: none;
}

.nav-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger-Icon wird im geöffneten Zustand zu einem "X" */
.nav-toggle.open .nav-toggle-icon span:nth-child(1) {
  transform: translateY(8.5px) rotate(45deg);
}

.nav-toggle.open .nav-toggle-icon span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open .nav-toggle-icon span:nth-child(3) {
  transform: translateY(-8.5px) rotate(-45deg);
}

/* ========== Hauptbereich ========== */
main {
  flex: 1;
  padding: 2rem;
  display: flex;
  justify-content: center;
}

.content-container {
  max-width: 900px;
  width: 100%;
  background-color: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  /* Lange, nicht umbrechbare Zeichenketten (z. B. ausgeschriebene URLs in
     der Datenschutzerklärung) sollen umbrechen statt den Viewport
     horizontal zu sprengen (WCAG 1.4.10 Reflow bei 320px Breite). */
  overflow-wrap: break-word;
}

/* ========== Footer ========== */
footer {
  background-color: #333;
  color: white;
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ========== Kontakt-Grid ========== */
.kontakt-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  background-color: #eaeaea;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.kontakt-grid > div {
  flex: 1;
  min-width: 200px;
  margin: 0.5rem;
  font-size: 0.75rem;
}

.kontakt-grid h4 {
  margin-bottom: 0.5rem;
}

/* ========== Responsive Design ========== */
/* Ab hier (<=1024px, d. h. Tablet und Smartphone): Hamburgermenü statt Menüleiste */
@media (max-width: 1024px) {
  .content-container {
    padding: 1.5rem;
  }

  /* Logo und Textblock bleiben ab 320px in einer Zeile: Größen skalieren
     fluid mit der Fensterbreite (clamp = Minimalwert, bevorzugter vw-Wert, Maximalwert) */
  header {
    padding: 1.5rem 1rem;
  }

  .header-text {
    min-width: 0;
  }

  header img {
    height: clamp(32px, 9vw, 100px);
    max-height: none;
  }

  .header-text h1 {
    font-size: clamp(0.8rem, 4vw, 1.75rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-text p {
    font-size: clamp(0.65rem, 2.4vw, 1.1rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Banner höchstens 1/4 der sichtbaren Fensterhöhe */
  .banner {
    height: 25vh;
    max-height: 25vh;
    object-fit: cover;
    object-position: center;
  }

  nav {
    justify-content: space-between;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0;
  }

  .nav-links.open {
    display: flex;
    margin-top: 0.8rem;
  }

  .nav-links a {
    width: 100%;
    padding: 0.6rem;
  }
}

@media (max-width: 768px) {
  main {
    padding: 1rem;
  }

  .kontakt-grid {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .content-container {
    padding: 1rem;
  }
}

/* Zusätzliche Reserve für sehr schmale Displays (z. B. iPhone SE, 320px) */
@media (max-width: 380px) {
  header {
    padding: 1.1rem 0.6rem;
  }

  .header-content {
    gap: 0.5rem;
  }
}

/* ========== Cookie Overlay ========== */
#cookie-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cookie-box {
  background: white;
  padding: 2rem;
  max-width: 90%;
  width: 400px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.cookie-box p {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: #333;
}

.cookie-box a {
  color: #c1001f;
  text-decoration: underline;
}

.cookie-box button {
  padding: 0.5rem 1rem;
  background-color: #c1001f;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

/* ========== Modal-Fenster (Kontaktformular / Danke-Hinweis) ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: white;
  padding: 2rem;
  max-width: 90%;
  width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  position: relative;
}

.modal-box-small {
  width: 400px;
  text-align: center;
}

/* Kontaktformular-Fenster: bewusst breiteres Querformat (3:2), damit es
   nicht gedrückt wirkt. Passt der Formularinhalt nicht vollständig hinein,
   wird innerhalb des Fensters gescrollt (siehe overflow-y auf .modal-box). */
#contact-overlay .modal-box {
  width: 720px;
  aspect-ratio: 3 / 2;
}

/* Auf schmalen Bildschirmen würde ein erzwungenes 3:2-Format das Formular
   auf eine unbenutzbar geringe Höhe zusammendrücken - dort daher normale,
   inhaltsbestimmte Höhe wie bei den anderen Modal-Fenstern. */
@media (max-width: 760px) {
  #contact-overlay .modal-box {
    aspect-ratio: auto;
  }
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #333;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.form-row label {
  font-weight: bold;
  margin-bottom: 0.3rem;
}

.form-row input,
.form-row textarea {
  font: inherit;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.char-counter {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: #666;
  text-align: right;
}

/* Honeypot-Feld: für echte Nutzer und Screenreader unsichtbar, Bots füllen es trotzdem aus */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.form-error {
  color: #c1001f;
  font-weight: bold;
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-primary,
.btn-secondary {
  font: inherit;
  font-weight: bold;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.btn-primary {
  background-color: #c1001f;
  color: white;
}

.btn-primary:disabled {
  background-color: #e59aa4;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #eee;
  color: #333;
}

.link-button {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  color: #c1001f;
  text-decoration: underline;
  cursor: pointer;
}

/* ========== Social Icons ========== */
.social-icons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
  background-color: #f8f8f8;
}

.social-icons a img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  transition: transform 0.3s ease-in-out;
}

.social-icons a:hover img {
  transform: scale(1.1);
}

/* ========== Kontakt ========== */
.kontaktliste-grid {
  display: grid;
  /* min(280px, 100%) statt fix 280px: verhindert horizontales Scrollen
     (WCAG 1.4.10 Reflow) auf sehr schmalen Displays ab 320px CSS-Breite,
     auf denen 280px durch das Padding von main/.content-container/.kontaktliste-grid
     nicht mehr zur Verfügung stehen. */
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 1rem;
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.kontaktliste-grid div {
  background-color: #f4f4f4;
  padding: 1rem;
  border-radius: 8px;
  line-height: 1.5;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.kontaktliste-grid a {
  color: #c1001f;
  text-decoration: none;
}

.kontaktliste-grid a:hover {
  text-decoration: underline;
}

/* ========== Box-Modell ========== */
* {
  box-sizing: border-box;
}

/* ========== Sichtbarer Fokus (Barrierefreiheit, WCAG 1.4.11 / 2.4.7) ==========
   Der Browser-Standard-Fokusring reicht als Sichtbarkeit aus, hat aber auf
   hellen Hintergründen (weiß, #f8f8f8, #f4f4f4) je nach Browser/Betriebssystem
   teils nur ~2,4:1 Kontrast - unter dem geforderten Minimum von 3:1. Der
   doppelte Ring (weiß + schwarz) hebt sich dagegen von JEDEM auf dieser Seite
   vorkommenden Hintergrund (hell wie dunkel) mit mindestens 3:1 ab. */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
  box-shadow: 0 0 0 4px #000000;
}
