/* style.css - iOS 12 Compatible Version */

/* ==========================================================================
   1. GRUNDEINSTELLUNGEN & GLOBALE STILE
   ========================================================================== */
:root {
  --haupt-farbe: #f25044;
  --gold-ton: #bba14f;
  --gold-hell: #eee2a7;
  --dunkel-grau: #6e6e6e;
  --hell-grau: #b4b4b4;
  --text-dunkel: #484848;
  --text-hell: #fff7f7;
  --weiss: #ffffff;
  --border-color: #c0c0c0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  background-color: var(--weiss);
  color: var(--text-dunkel);
  font-size: 1rem;
}
.container {
  width: 95%;
  max-width: 2400px;
  margin: 2rem auto;
  padding: 1rem;
  box-sizing: border-box;
  overflow-x: hidden;
}
.lueken {
  text-align: center;
  font-size: 1rem;
}
h1 {
  font-size: 3rem;
  color: var(--haupt-farbe);
  text-align: center;
  font-family: "Georgia", "Times New Roman", Times, serif;
  margin-top: 0;
}
h2 {
  font-size: 1.6rem;
  color: var(--text-dunkel);
  text-align: left;
  margin-top: 24px;
}
h3 {
  font-size: 1.4rem;
  color: var(--text-dunkel);
  text-align: left;
}
h4 {
  font-size: 1.1rem;
  color: var(--text-dunkel);
  text-align: left;
}
p {
  font-size: 1.1rem;
  color: var(--text-dunkel);
  text-align: left;
}

/* ==========================================================================
   2. NAVIGATION (ALLE SEITEN)
   ========================================================================== */
.top-nav {
  background-color: var(--dunkel-grau);
  height: 6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5% 0 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  box-sizing: border-box;
}
.top-nav .logo img {
  height: 4rem;
  vertical-align: middle;
  margin-left: 1rem;
}
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  height: 100%;
}
.nav-links a {
  display: flex;
  align-items: center;
  height: 100%;
  color: var(--text-hell);
  text-decoration: none;
  padding: 0 1.5rem;
  font-size: 1.25rem;
}
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--dunkel-grau);
  min-width: 100%;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1;
}
.dropdown-content a {
  color: var(--text-hell);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}
.dropdown-content a:hover,
.nav-links > li > a:hover {
  background-color: var(--hell-grau);
  color: var(--text-dunkel);
}
.dropdown:hover .dropdown-content {
  display: block;
}
.hamburger-menu {
  display: none;
  cursor: pointer;
  padding: 1rem;
  flex-direction: column;
  justify-content: space-around;
  height: 30px;
}
.hamburger-menu .line {
  width: 35px;
  height: 4px;
  background-color: white;
  border-radius: 2px;
  transition: all 0.3s ease-in-out;
}
.mobile-nav {
  display: none;
  position: fixed;
  top: 6rem;
  left: 0;
  width: 100%;
  background-color: var(--dunkel-grau);
  flex-direction: column;
  padding-bottom: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 999;
}
.mobile-nav a {
  color: white;
  text-decoration: none;
  font-size: 1.5rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--hell-grau);
}
.mobile-nav a:last-child {
  border-bottom: none;
}
.mobile-nav.active {
  display: flex;
}
.hamburger-menu.active .line:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}
.hamburger-menu.active .line:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.active .line:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

/* ==========================================================================
   3. LAYOUT: HOME (index.html)
   ========================================================================== */
.home-body {
  background-color: var(--dunkel-grau);
}
.background-image,
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
}
.background-image {
  object-fit: cover;
  z-index: -2;
}
.overlay {
  background-color: rgba(0, 0, 0, 0.35);
}
.home-container h1 {
  color: var(--text-hell);
}
.termin-box {
  display: grid;
  width: 100%;
  max-width: 1400px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  grid-gap: 1rem; /* iOS 12 Fallback */
  margin: 2rem auto;
}
.grid-item {
  background-color: var(--hell-grau);
  border: 2px solid var(--hell-grau);
  border-radius: 8px;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 60px 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0 1rem;
  grid-gap: 0 1rem;
  align-items: center;
}
.grid-item .item-3 {
  grid-row: 1 / 3;
  grid-column: 1 / 2;
  font-size: 3rem;
  font-weight: bold;
  color: var(--text-dunkel);
  text-align: center;
  line-height: 1;
}
.grid-item .item-1 {
  grid-row: 1 / 2;
  grid-column: 2 / 3;
  font-size: 1rem;
  font-weight: bold;
  color: var(--haupt-farbe);
  text-align: left;
  align-self: end;
}
.grid-item .item-4 {
  grid-row: 2 / 3;
  grid-column: 2 / 3;
  font-size: 1rem;
  color: var(--text-dunkel);
  text-align: left;
  align-self: start;
}
.grid-item.highlight {
  background-color: white;
  transform: scale(1.05);
}

/* ==========================================================================
   4. LAYOUT: ÜBER UNS & REGELN
   ========================================================================== */
.c_regeln,
.vorstellung {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  grid-gap: 2rem; /* iOS 12 Fallback */
  margin: 2rem auto;
}
.regel-container,
.person {
  background: var(--weiss);
  padding: 1.5rem;
  border-radius: 8px;
  border: 2px solid var(--border-color);
}
.person .foto {
  float: left;
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
}
.person .thema {
  font-size: 1.4rem;
  color: var(--text-dunkel);
  text-align: left;
}
.person p {
  clear: left;
}
/* ==========================================================================
   STILISIERUNG FÜR 'ÜBER UNS' SEITE (Größe, Clipping & Side-by-Side Layout)
   ========================================================================== */

/* 1. DER ÄUSSERE CONTAINER (DER RAHMEN) */
.vorstellung .person .foto-rahmen {
  padding: 5px;
  background-color: var(--weiss);
  display: block;

  /* Größe-Fix */
  width: 120px;
  height: 160px;

  margin: 0; /* WICHTIG: Entfernt margin: 0 auto für Linksbündigkeit */

  border-radius: 8px;
  border: 1px solid var(--border-color);

  overflow: hidden; /* iOS 12 Clipping Fix */

  box-sizing: content-box;

  /* Stellt sicher, dass dieses Element im Flexbox-Layout links bleibt */
  flex-shrink: 0;
}

/* 2. DAS INNERE BILD */
.vorstellung .person .foto {
  border-radius: 8px;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 3. NEUER FLEX-CONTAINER FÜR FOTO + NAME */
.vorstellung .person .person-header-flex {
  display: flex; /* Layout: Side-by-Side */
  align-items: center; /* Vertikale Zentrierung von Name/Spitzname zum Foto */
  gap: 20px; /* Abstand zwischen Foto und Name */
  margin-bottom: 20px; /* Abstand zur Personenbeschreibung darunter */
}

/* 4. ANPASSUNG DER ÜBERSCHRIFT */
/* Entfernt Standard-Block-Abstände und sorgt dafür, dass die Überschrift gut im Flex-Container sitzt */
.vorstellung .person .person-header-flex h2 {
  margin: 0;
  text-align: left; /* Stellt sicher, dass die Überschrift linksbündig ist */
  line-height: 1.2;
}

/* 5. STILISIERUNG DES SPITZNAMEN-TEXTES */
.vorstellung .person .person-header-flex .nickname-text {
  font-size: 1.1rem;
  font-weight: normal;
  display: block; /* Erzwingt den Zeilenumbruch nach dem Namen */
  color: var(--text-dunkel);
}

/* ==========================================================================
   STILISIERUNG FÜR 'ÜBER UNS' CONTAINER (Layout)
   ========================================================================== */

.vorstellung {
  display: grid;
  /* Erzeugt ZWEI gleich breite Spalten */
  grid-template-columns: 1fr 1fr;
  /* Abstand zwischen den Spalten und Zeilen */
  gap: 40px 30px;
}

/* Stellt sicher, dass jede Person-Box sich im Grid korrekt verhält */
.vorstellung .person {
  /* Setzt die minimale Höhe zurück, falls vorhanden, und stellt sicher, dass es ein Grid-Item ist */
  min-height: auto;
}

/* ==========================================================================
   5. LAYOUT: GALERIE
   ========================================================================== */
.galerie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  grid-gap: 1.5rem; /* iOS 12 Fallback */
}
.galerie-item {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--weiss);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* KORREKTUR: aspect-ratio entfernt, Höhe definiert für 4:3 (bei ca 300px Breite) */
.galerie-item img {
  width: 100%;
  height: 250px; /* Erzwingt Höhe */
  object-fit: cover; /* Schneidet Bild passend zu */
}
.galerie-text {
  padding: 1rem;
  text-align: center;
  color: var(--text-dunkel);
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   6. LAYOUT: ERGEBNISSE (Saison_XXXX.html)
   ========================================================================== */
#ergebnisseite h2 {
  text-align: left;
  border-bottom: 2px solid var(--hell-grau);
  margin-top: 3rem;
  padding-bottom: 0.5rem;
}

/* KORREKTUR: gap entfernt (iOS 12 Flexbox Bug), stattdessen Margin */
.top-section-wrapper {
  display: flex;
  flex-wrap: wrap;
  /* gap: 2rem; ENTFERNT */
  margin: -1rem; /* Kompensiert das Padding der Kinder */
}
.top-section-wrapper > .sektion {
  flex: 1;
  min-width: 400px;
  background-color: var(--gold-ton);
  border: none;
  border-radius: 8px;
  padding: 0 3rem;
  color: white;
  display: flex;
  flex-direction: column;
  margin: 1rem; /* Ersatz für gap */
}

.top-section-wrapper > .sektion h2 {
  color: white;
  text-align: left;
  border-bottom: 2px solid white;
  flex-shrink: 0;
}
#matador-sektion {
  align-items: center;
}
#matador-sektion h2 {
  white-space: nowrap;
}

/* KORREKTUR: Matador Content Layout repariert */
#matador-content {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  /* gap: 2rem; ENTFERNT */
}
.matador-details {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 300px;
  margin: 1rem; /* Ersatz für gap */
}
.matador-details .matador-photo {
  margin-right: 1rem;
} /* Abstand Bild zu Tabelle */

.matador-photo img {
  height: 150px;
  width: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 3px solid var(--weiss);
  border-radius: 8px;
}
.matador-stats {
  flex-grow: 1;
  align-self: center;
  display: flex;
  align-items: center;
}
.matador-stats table {
  width: 100%;
  color: white;
  border: none;
}
.matador-stats td {
  border: none;
  background: none;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  text-align: left;
}

/* Styles for two matadors */
#matador-content.zwei-matadore .matador-details {
  flex-basis: 45%;
}
#matador-content.zwei-matadore .matador-photo img {
  height: 120px;
}
#matador-content.zwei-matadore .matador-stats td {
  font-size: 0.8rem;
  padding: 0 1rem;
}

.chart-container {
  flex-grow: 1;
  min-height: 200px;
  padding-bottom: 20px;
  box-sizing: border-box;
}
.sektion-chart-only {
  background-color: var(--dunkel-grau);
  border-radius: 8px;
  padding: 1.5rem;
  margin: -1rem 0 2rem 0;
  color: white;
  display: flex;
  flex-direction: column;
}
.sektion-chart-only h2 {
  color: white;
  text-align: left;
  border-bottom: 2px solid white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}
h2.headline-monatsrunden,
h2.headline-finalrunden {
  color: var(--text-hell);
  background-color: var(--dunkel-grau);
  padding: 1rem;
  margin: 2rem 0;
  border-radius: 8px;
  border-bottom: none;
  text-align: center;
}
h2.headline-finalrunden {
  background-color: var(--gold-ton);
}

/* KORREKTUR: gap für Teilnehmerbilder entfernt (Flexbox iOS 12) */
.teilnehmer-portraits .portraits-wrapper {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  justify-content: flex-start;
  padding: 1rem;
  border-radius: 8px;
  background-color: var(--dunkel-grau);
  /* gap: 1.5rem; ENTFERNT */
}
.teilnehmer-portraits .portraits-wrapper img {
  margin-right: 1.5rem; /* Ersatz für gap */
}
.teilnehmer-portraits .portraits-wrapper img:last-child {
  margin-right: 0;
}

#finalrunden-sektion .teilnehmer-portraits .portraits-wrapper {
  background-color: var(--gold-ton);
}
.teilnehmer-portraits img {
  height: 120px;
  width: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 3px solid var(--weiss);
  border-radius: 8px;
}
.spieltag-layout {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
} /* gap entfernt, space-between reicht oft */
.tages-tabelle,
.kumulierte-tabelle {
  width: 49%;
  margin-bottom: 2rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  table-layout: fixed;
}
th,
td {
  border: 1px solid #ddd;
  padding: 4px 5px;
  text-align: center;
  white-space: nowrap;
  font-size: 0.9rem;
}
th:first-child,
td:first-child {
  width: 25%;
  text-align: left;
  font-weight: bold;
}
th {
  background-color: var(--dunkel-grau);
  color: var(--text-hell);
}
#finalrunden-sektion th {
  background-color: var(--gold-ton);
}
.kasse-row td {
  background-color: var(--hell-grau);
  font-weight: bold;
  text-align: left;
}
#finalrunden-sektion .kasse-row td {
  background-color: var(--gold-hell);
  color: var(--text-dunkel);
}
.erinnerungen {
  margin-top: 1rem;
}

.schnappschuss-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2%;
  grid-gap: 2%; /* iOS 12 Fallback */
  margin-top: 1rem;
  margin-bottom: 3rem;
}

.querbalken {
  clear: both;
  height: 2px;
  background-color: var(--hell-grau);
  border-radius: 1px;
  margin: 3rem 0;
}

.schnappschuss-item {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--weiss);
  padding: 5px;
}

#finalrunden-sektion .schnappschuss-item {
  border-color: var(--gold-ton);
}

/* KORREKTUR: aspect-ratio entfernt, 4:3 Zuschnitt erzwungen */
.schnappschuss-item img {
  width: 100%;
  height: 200px; /* Feste Höhe erzwingt Seitenverhältnis */
  object-fit: cover; /* Wichtig: Bild wird zugeschnitten, nicht verzerrt */
  display: block;
}
/* Anpassung für verschiedene Bildschirmgrößen, damit 4:3 grob passt */
@media (max-width: 1600px) {
  .schnappschuss-item img {
    height: 180px;
  }
}
@media (max-width: 1200px) {
  .schnappschuss-item img {
    height: 150px;
  }
}

.schnappschuss-item p {
  margin: 0.5rem 0;
  font-size: 1rem;
  text-align: center;
  color: var(--text-dunkel);
  min-height: 20px;
}

/* ==========================================================================
   7. HELPER & WIDGETS (ALLE SEITEN)
   ========================================================================== */
#scrollTopBtn {
  display: none;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 999;
  border: none;
  background-color: var(--haupt-farbe);
  color: white;
  cursor: pointer;
  width: 60px;
  height: 60px;
  border-radius: 15px;
  font-size: 30px;
  font-weight: bold;
  align-items: center;
  justify-content: center;
}
#scrollTopBtn:hover {
  background-color: var(--gold-ton);
}

/* ==========================================================================
   8. RESPONSIVE ANPASSUNGEN (ALLE SEITEN)
   ========================================================================== */
@media (max-width: 1050px) {
  th,
  td {
    font-size: 0.9rem;
    padding: 3px 4px;
  }
}
@media (max-width: 1000px) {
  .c_regeln,
  .vorstellung {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
  .hamburger-menu {
    display: flex;
  }
  th,
  td {
    font-size: 0.7rem;
  }
  p {
    font-size: 1rem;
  }
}
@media (max-width: 750px) {
  .tages-tabelle,
  .kumulierte-tabelle {
    width: 100%;
  }
  th,
  td {
    font-size: 1rem;
  }
  .teilnehmer-portraits .portraits-wrapper {
    justify-content: space-around;
    flex-wrap: wrap;
  }
  .teilnehmer-portraits .portraits-wrapper img {
    margin-right: 0;
  } /* Reset Margin für Wrap */

  .schnappschuss-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .schnappschuss-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
  } /* Größere Bilder auf Tablet */
}
@media (max-width: 600px) {
  .c_regeln,
  .vorstellung {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  h1 {
    font-size: 4rem;
    margin: 2rem 0;
  }
  h2 {
    font-size: 1.8rem;
  }
  h3 {
    font-size: 1.2rem;
  }
  h2.headline-monatsrunden,
  h2.headline-finalrunden {
    font-size: 2rem;
  }
  .teilnehmer-portraits img {
    height: 90px;
  }
  .top-section-wrapper > .sektion {
    flex-basis: 100%;
    min-width: 0;
  }
  .tages-tabelle,
  .kumulierte-tabelle {
    overflow-x: hidden;
  }
  table {
    table-layout: auto;
  }
  th,
  td {
    white-space: normal;
    font-size: 0.8rem;
  }
  th:first-child,
  td:first-child {
    width: auto;
  }
  .matador-photo img {
    height: 100px;
  }
  .schnappschuss-grid {
    grid-template-columns: repeat(1, 1fr);
  }
  .schnappschuss-item p {
    font-size: 1rem;
    min-height: 80px;
  }
}
@media (max-width: 395px) {
  .teilnehmer-portraits img {
    height: 80px;
  }
  .teilnehmer-portraits .portraits-wrapper {
    gap: 0.5rem;
  }
  th,
  td {
    font-size: 0.6rem;
  }
  h1 {
    font-size: 3rem;
  }

  h2 {
    font-size: 1rem;
    margin-top: 5rem;
    position: relative;
    z-index: 10;
  }

  h3 {
    font-size: 0.8rem;
  }
  h4 {
    font-size: 0.8rem;
  }
  p {
    font-size: 0.8rem;
  }
  .teilnehmer-portraits img {
    height: 55px;
    width: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border: 3px solid var(--weiss);
    border-radius: 8px;
  }
  .schnappschuss-item p {
    min-height: 60px;
  }
}

/* ==========================================================================
   9. SPEZIFISCHE FIXES
   ========================================================================== */

/* Fix für Matador-Statistik-Tabelle auf iPad im Hochformat */
@media (min-width: 751px) and (max-width: 1050px) {
  #matador-content .matador-stats table {
    table-layout: auto;
    width: auto;
  }
  #matador-content .matador-stats td:first-child {
    white-space: nowrap;
    padding-right: 1rem;
  }
}
/* Fix für den Abstand zwischen Portrait und Statistik bei den Matadoren */
#matador-content .matador-details {
  display: flex; /* Stellt sicher, dass Flexbox für die Ausrichtung verwendet wird */
  align-items: flex-start;
  gap: 30px; /* VERGRÖSSERTER ABSTAND zwischen Bild und Tabelle */
}
/* Anpassung für sehr kleine Bildschirme, falls nötig */
@media (max-width: 600px) {
  #matador-content .matador-details {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }
}
/* Optional: Feinabstimmung für den Fall mit zwei Matadoren auf iPad Hochformat */
@media (min-width: 751px) and (max-width: 1050px) {
  #matador-content.zwei-matadore .matador-stats td {
    font-size: 0.7rem;
    padding: 0 0.3rem;
  }
  #matador-content.zwei-matadore .matador-stats td:first-child {
    padding-right: 0.5rem;
  }
}
