/* ==========================================================================
   TSV Utting – style.css
   Body-Schrift: Raleway | Überschriften: Roboto Condensed
   Textfarbe: #4d4d4d | Akzentfarbe: #b60000 | Footer: #2d2d2d
   ========================================================================== */

/* ---------- Lokal eingebundene Schriften (DSGVO-konform), Dateien in ../fonts/ ---------- */
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/raleway-400.ttf") format("truetype");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/raleway-500.ttf") format("truetype");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/raleway-600.ttf") format("truetype");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/raleway-700.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/roboto-condensed-400.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/roboto-condensed-700.ttf") format("truetype");
}

:root {
  --color-primary: #b60000;      /* Akzentfarbe TSV Utting */
  --color-primary-dark: #8f0000;
  --color-accent: #b60000;
  --color-text: #4d4d4d;         /* Textfarbe */
  --color-text-light: #757575;
  --color-bg: #ffffff;
  --color-bg-alt: #f7f7f7;
  --color-border: #ebebeb;
  --color-footer-bg: #2d2d2d;
  --color-header-overlay: rgba(0, 0, 0, 0.8);
  --radius: 6px;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
  --max-width: 1200px;
  --font-base: "Raleway", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-heading: "Roboto Condensed", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Sprungmarken nicht unter dem sticky Header (und auf Abteilungsseiten
   unter der Sprungmenü-Leiste) verschwinden lassen */
[id] { scroll-margin-top: 132px; }
.dept-subnav ~ [id] { scroll-margin-top: 190px; }

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

/* Seiteninhalt erst einblenden, wenn die Bilder geladen sind
   und die Inhalte aus Google Sheets da sind (Header ausgenommen). Die
   Klasse .is-loading setzt ein kleines Skript im <head> und entfernt sie
   danach (spätestens nach 5 Sekunden). */
body > *:not(.site-header) {
  transition: opacity .8s ease;
}
html.is-loading body > *:not(.site-header) {
  opacity: 0;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

/* Nur für Screenreader/Suchmaschinen sichtbar, visuell ausgeblendet
   (z.B. für die technische H1 auf der Startseite, die aus Design-Gründen
   nicht als große sichtbare Überschrift erscheinen soll) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  margin: 0 0 16px;
}

/* Große Abschnittsüberschriften: zentriert, mit Schraffur links und rechts */
h1, h2 {
  font-size: 50px;
  font-weight: 700;
  text-transform: uppercase;
  color: #060606;
  line-height: 1.1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
h1::before, h1::after,
h2::before, h2::after {
  content: "";
  flex: 1 1 90px;
  max-width: 140px;
  height: 40px;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.08),
    rgba(0, 0, 0, 0.08) 1px,
    transparent 1px,
    transparent 7px
  );
}
@media (max-width: 700px) {
  h1, h2 { font-size: 34px; gap: 14px; }
  h1::before, h1::after, h2::before, h2::after { max-width: 50px; height: 28px; }
}

/* Überschrift mit Unterzeile („des TSV Utting“) – wie auf der alten Website:
   Haupttitel groß, Unterzeile klein darunter, Schraffur über beide Zeilen. */
.h-stack { display: flex; flex-direction: column; align-items: center; }
.h-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-base);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
h1:has(.h-sub)::before, h1:has(.h-sub)::after,
h2:has(.h-sub)::before, h2:has(.h-sub)::after { height: auto; align-self: stretch; }
@media (max-width: 700px) {
  .h-sub { font-size: 16px; margin-top: 2px; }
}

/* Kleine Karten-/Blocküberschriften */
h3 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: #333333;
  margin-bottom: 5px;
}

/* Kleine Zwischentitel */
h5 {
  font-size: 18px;
  font-weight: 400;
  text-transform: none;
  color: #4d4d4d;
}

/* Kleine fette Labels (z.B. "Öffnungszeiten:") */
h6 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: #4d4d4d;
}

p { margin: 0 0 16px; color: var(--color-text-light); }

section { padding: 56px 0; }
section.alt { background: var(--color-bg-alt); }
/* Sponsoren-Seite: weniger Abstand zwischen Text/Button und Logos */
section.sponsor-intro { padding-bottom: 12px; }
section.sponsor-list { padding-top: 12px; }

/* Schmaler weißer Trenner zwischen zwei direkt aufeinanderfolgenden
   .alt-Abschnitten (z.B. Verantwortliche -> Trainingszeiten auf den
   Abteilungsseiten), damit die beiden grauen Blöcke nicht ineinander
   übergehen. */
.section-divider {
  height: 32px;
  background: var(--color-bg);
}

/* Alle Buttons einheitlich: roter Rahmen, beim Drüberfahren rot gefüllt */
.btn,
.btn.secondary {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 999px;
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.btn:hover,
.btn.secondary:hover { background: var(--color-primary); color: #fff; }

.actions {
  text-align: center;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* Zentriert einzelne CTA-Buttons (PDF-Links, News-Zurück-Links, Formular-Absenden ...) */
.center { text-align: center; }
.text-narrow { max-width: 820px; margin-left: auto; margin-right: auto; }

/* Eingebetteter PDF-Viewer (pdf.js Canvas) */
.pdf-embed {
  width: 100%;
  max-width: 1700px;
  margin: 24px auto;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius, 6px);
  box-shadow: var(--shadow);
  overflow: auto;
  background: #fff;
  text-align: center;
}
.pdf-embed canvas {
  display: block;
  margin: 0 auto;
}
.pdf-embed .pdf-fallback {
  display: block;
  width: 100%;
  aspect-ratio: 1191 / 843; /* Querformat der PDF-Seite */
  border: 0;
}
@media (max-width: 700px) {
  .pdf-embed canvas { width: auto; }
}

/* ---------- Hinweisfenster (Startseite) ----------
   Erscheint nur, wenn im Tab "Hinweise" etwas steht (siehe sheets.js). */
.site-hinweis-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.site-hinweis-box {
  position: relative;
  background: #fff;
  color: #222;
  max-width: 480px;
  width: 100%;
  padding: 32px 36px;
  border-radius: var(--radius, 10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.site-hinweis-title {
  margin: 0 0 14px;
  padding-right: 20px; /* Platz für das Schließen-X */
  font-size: 1.35rem;
  line-height: 1.3;
}
.site-hinweis-box p { margin: 0 0 12px; }
.site-hinweis-box p:last-child { margin-bottom: 0; }
.site-hinweis-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #888;
}
.site-hinweis-close:hover { color: #000; }

/* Danke-Fenster nach dem Absenden des Kontaktformulars (main.js) */
.form-thanks-box h3 { margin: 0 0 10px; }
.form-thanks-icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 50%;
  background: #e7f6ec; color: var(--color-primary-dark, #1b5e20);
  font-size: 28px; line-height: 56px; font-weight: 700;
}
.form-thanks-box .btn { margin-top: 8px; }

/* ---------- Header / Navigation ---------- */
/* Dunkler, halbtransparenter Header auf jeder Seite */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-header-overlay);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo img { height: 100px; width: auto; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 26px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
}

.main-nav > ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.main-nav > ul > li {
  position: relative;
}

.main-nav > ul > li > a {
  font-family: var(--font-base);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  padding: 10px 2px;
  display: inline-block;
}

.main-nav > ul > li > a:hover,
.main-nav > ul > li.active > a {
  color: var(--color-primary);
}

/* Dropdown: schmales, einspaltiges Menü mit roter Akzentlinie oben */
.sub-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  background: #fff;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
  border-top: 4px solid var(--color-primary);
  border-radius: 0;
  width: 230px;
  padding: 10px 24px;
  list-style: none;
  margin: 0;
}

/* letzter Menüpunkt: Panel rechtsbündig aufklappen, damit es nicht
   über den Bildschirmrand hinausragt */
.main-nav > ul > li:last-child .sub-nav,
.main-nav > ul > li:last-child .mega-panel {
  left: auto;
  right: 0;
}

/* Auf-/Zuklappen per JS (Klasse .menu-open), damit beim schnellen
   Drüberfahren nie mehrere Menüs gleichzeitig offen bleiben. */
.main-nav > ul > li.menu-open > .sub-nav {
  display: block;
}

.sub-nav li a {
  display: block;
  padding: 10px 0 10px 6px;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  color: #000;
  white-space: normal;
  border-bottom: 1px solid var(--color-border);
}
.sub-nav li:last-child a { border-bottom: none; }
.sub-nav li a::before {
  content: "\203A";
  display: inline-block;
  margin-right: 8px;
  color: var(--color-primary);
  font-weight: 700;
}
.sub-nav li a:hover { color: var(--color-primary); }

.sub-nav .sub-heading {
  padding: 10px 0 6px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: normal;
  color: #222;
  text-transform: uppercase;
  display: inline-block;
  border-bottom: 2px solid var(--color-primary);
  margin-top: 6px;
}

/* "Sportbetrieb"-Menü: eine Spalte (Abteilungen), Breite wie .sub-nav */
.mega-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  background: #fff;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
  border-top: 4px solid var(--color-primary);
  border-radius: 0;
  width: 230px;
  padding: 10px 24px;
  margin: 0;
}
.main-nav > ul > li.menu-open > .mega-panel {
  display: flex;
}
.mega-col { width: 100%; }
.mega-col ul { list-style: none; display: block; margin: 0; padding: 0; }
.mega-col li a {
  display: block;
  padding: 6px 0 6px 6px;
  font-size: 14px;
  color: #000;
}
.mega-col li a::before { content: "\203A"; margin-right: 8px; color: var(--color-primary); font-weight: 700; }
.mega-col li a:hover { color: var(--color-primary); }
.mega-col .sub-heading {
  display: inline-block;
  padding: 0 0 6px;
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-heading);
  color: #222;
  text-transform: uppercase;
  border-bottom: 2px solid var(--color-primary);
}
.mega-col .sub-heading.spaced { margin-top: 22px; }


.page-hero {
  background: var(--color-bg-alt);
  padding: 48px 0;
  border-bottom: 1px solid var(--color-border);
}
.page-hero h1 { margin: 0; }
.breadcrumb { font-size: 0.85rem; color: var(--color-text-light); margin-bottom: 8px; }
.breadcrumb a:hover { color: var(--color-primary); }

/* ---------- Abteilungs-Sprungmenü (Allgemeines/Verantwortliche/Trainer/...) ---------- */
/* Rote Button-Leiste unter dem Header, bleibt beim Scrollen oben stehen */
.dept-subnav {
  position: sticky;
  top: 132px; /* Höhe des sticky Headers (Logo 100px + 16px Padding oben/unten) */
  z-index: 90;
}
.dept-subnav .container {
  display: flex;
  flex-wrap: wrap;
}
.dept-subnav a {
  flex: 1 1 auto;
  text-align: center;
  padding: 16px 12px;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-base);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  white-space: nowrap;
}
.dept-subnav a:last-child { border-right: none; }
.dept-subnav a:hover { background: var(--color-primary-dark); }
@media (max-width: 700px) {
  /* Auch mobil sticky (2-spaltig, daher etwas höher) */
  .dept-subnav a { flex: 1 1 50%; border-bottom: 1px solid rgba(255, 255, 255, 0.25); }
  .dept-subnav ~ [id] { scroll-margin-top: 244px; }
}

/* ---------- Abteilungen-Kacheln (Übersichtsseite abteilungen/index.html) ----------
   Quadratische Kachel je Abteilung: Abteilungsfoto als Hintergrund, dunkler
   halbtransparenter Layer darüber mit zentriertem Symbol + Abteilungsname.
   Bei Hover verschwindet der Layer (inkl. Symbol/Name) nach unten und gibt
   das Foto frei; Klick auf die ganze Kachel führt zur Abteilungsseite. */
.dept-tile-grid {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
/* Kompakter 6-spaltiger Streifen (Startseite, direkt unter dem Menü):
   11 Abteilungen + 1 Anmeldung-Kachel = 12 Felder, exakt 2 Reihen */
.dept-tile-grid.dept-tile-grid--6col {
  grid-template-columns: repeat(6, 1fr);
}
/* Übersichtsseite Abteilungen: 11 Abteilungen + Anmeldung = 3 Reihen à 4 */
.dept-tile-grid.dept-tile-grid--4col {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
  .dept-tile-grid.dept-tile-grid--4col { grid-template-columns: repeat(3, 1fr); }
}
/* "Zur Anmeldung"-Kachel: kein Foto, stattdessen Vereinsfarbe als Hintergrund */
.dept-tile-cta {
  background: var(--color-primary);
}
.dept-tile-cta .dept-tile-icon {
  object-fit: contain;
}
.dept-tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0;
  background: var(--color-bg-alt);
}
.dept-tile-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dept-tile-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.55);
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.dept-tile-icon {
  width: 75px;
  height: 75px;
  display: block;
}
.dept-tile-label {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  text-align: center;
  padding: 0 12px;
}
.dept-tile:hover .dept-tile-overlay,
.dept-tile:focus-visible .dept-tile-overlay {
  transform: translateY(100%);
  opacity: 0;
}
/* "Zur Anmeldung"-Kachel: kein Hover-Effekt, immer nur ein normaler Link */
.dept-tile-cta:hover .dept-tile-overlay,
.dept-tile-cta:focus-visible .dept-tile-overlay {
  transform: none;
  opacity: 1;
}
@media (max-width: 700px) {
  .dept-tile-grid,
  .dept-tile-grid.dept-tile-grid--6col,
  .dept-tile-grid.dept-tile-grid--4col { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .dept-tile-icon { width: 53px; height: 53px; }
  .dept-tile-label { font-size: 16px; }
}

/* ---------- Qualitätssiegel (kleine Vorschaubilder, Klick vergrößert) ---------- */
.card img.siegel-img {
  width: min(420px, 85%);
  aspect-ratio: auto;
  object-fit: contain;
  margin: 0 auto 14px;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}
.siegel-card-body { text-align: center; }
.card img.siegel-img:hover { transform: scale(1.05); }

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
}

/* ---------- Grids / Cards ---------- */
.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-3px); }
.card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.card a.glightbox { display: block; cursor: zoom-in; }
/* Einzelne Karten-Bilder (z.B. Rückblicke-Titelbilder), die nicht
   beschnitten werden sollen: ganzes Bild sichtbar, mittig zentriert,
   Rest der Fläche mit dezentem Hintergrund aufgefüllt. */
.card img.no-crop { object-fit: contain; object-position: center; background: #f0f0f0; }
.card .card-body { padding: 18px 20px; }
.card .card-body h3 { margin-bottom: 6px; }
.card .meta { font-size: 0.8rem; color: var(--color-text-light); margin-bottom: 10px; }

/* ---------- Foto-Galerie (z.B. Historische Bilder) ---------- */
.photo-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: 20px;
}
.photo-grid-item {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 4/3;
  background: var(--color-bg-alt);
}
.photo-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.photo-grid-item:hover img { transform: scale(1.06); }
.photo-grid-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 12px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.3;
}

.stats-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  text-align: center;
}
.stat-number {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--color-primary);
}
.stat-label { color: var(--color-text-light); font-size: 0.9rem; }

/* ---------- Timeline (Historie) ---------- */
.timeline {
  border-left: 3px solid var(--color-primary);
  padding-left: 24px;
  /* Zeitleiste als Block mittig auf der Seite */
  width: fit-content;
  max-width: calc(100% - 12px);
  margin-left: auto;
  margin-right: auto;
}
.timeline-item { margin-bottom: 24px; position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--color-primary);
}
.timeline-item .year { font-weight: 700; color: var(--color-primary-dark); }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}
th { background: var(--color-bg-alt); font-weight: 700; }

/* Verantwortliche & Trainingszeiten (Abteilungsseiten): erste Spalte fett,
   egal ob Platzhaltertext oder live aus Google Sheets geladen. */
tbody[data-sheet="verantwortliche-abteilung"] td:first-child,
tbody[data-sheet="trainingszeiten-abteilung"] td:first-child {
  font-weight: 700;
}

/* Tabellen aus Google Sheets (Desktop): Zeit und Telefonnummern nicht
   umbrechen - lange Texte brechen stattdessen in den anderen Spalten um.
   Trainingszeiten: Zeit (3.) + Kontakt (6.); Verantwortliche der
   Abteilungen: Telefon (3.); Vorstand/Hausmeister auf verein.html:
   Telefon (4.); Hausmeister auf der Kontaktseite: Telefon (3.). */
@media (min-width: 641px) {
  tbody[data-sheet="trainingszeiten-abteilung"] td:nth-child(3),
  tbody[data-sheet="trainingszeiten-abteilung"] td:nth-child(6),
  tbody[data-sheet="verantwortliche-abteilung"] td:nth-child(3),
  tbody[data-sheet="vorstand"] td:nth-child(4),
  tbody[data-sheet="hausmeister"][data-cols="4"] td:nth-child(4),
  tbody[data-sheet="hausmeister"]:not([data-cols]) td:nth-child(3) {
    white-space: nowrap;
  }
}

/* Responsive: Verantwortliche & Trainingszeiten auf dem Handy als Karten
   statt als schmale, kaum lesbare Tabelle darstellen. Jede Zeile wird zu
   einem eigenen Kasten, jede Zelle bekommt per data-label-Attribut (im
   HTML bzw. von sheets.js beim Einfügen live geladener Zeilen gesetzt)
   ihre Spaltenbezeichnung vorangestellt. */
@media (max-width: 640px) {
  #verantwortliche table,
  #trainingszeiten table {
    display: block;
    border: none;
  }
  #verantwortliche table thead,
  #trainingszeiten table thead {
    display: none;
  }
  #verantwortliche table tbody,
  #trainingszeiten table tbody {
    display: block;
  }
  #verantwortliche table tr,
  #trainingszeiten table tr {
    display: block;
    margin-bottom: 22px;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius);
    overflow: hidden;
  }
  #verantwortliche table tr:last-child,
  #trainingszeiten table tr:last-child {
    margin-bottom: 0;
  }
  #verantwortliche table td,
  #trainingszeiten table td {
    display: block;
    text-align: left;
    padding: 8px 14px;
    border-bottom: 1px solid var(--color-border);
  }
  /* Linie bleibt auch beim letzten Feld einer Karte stehen, damit der
     Inhalt nicht direkt am unteren Kartenrahmen klebt. */
  #verantwortliche table td:last-child,
  #trainingszeiten table td:last-child {
    padding-bottom: 12px;
  }
  #verantwortliche table td::before,
  #trainingszeiten table td::before {
    content: attr(data-label);
    display: block;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-primary-dark);
    margin-bottom: 2px;
  }

  /* Trainingszeiten: Tag und Zeit nebeneinander in einer Zeile statt
     jeweils eigener Zeile, genauso Trainer/in und Kontakt. Bei den
     Verantwortlichen der Abteilung genauso Telefon und Email. */
  #trainingszeiten table td[data-label="Tag"],
  #trainingszeiten table td[data-label="Zeit"],
  #trainingszeiten table td[data-label="Trainer/in"],
  #trainingszeiten table td[data-label="Kontakt"],
  #verantwortliche table td[data-label="Telefon"],
  #verantwortliche table td[data-label="Email"] {
    display: inline-block;
    width: 50%;
    box-sizing: border-box;
    vertical-align: top;
  }

  /* Leere Felder (z.B. kein Trainer/in, Kontakt, Telefon oder Email
     eingetragen) komplett ausblenden - inkl. Beschriftung, statt ein
     leeres Feld mit Label anzuzeigen. */
  #verantwortliche table td:empty,
  #trainingszeiten table td:empty {
    display: none;
  }
}

/* ---------- Öffnungszeiten-Kasten (Geschäftsstelle) ---------- */
.opening-hours {
  display: inline-block;
  margin: 4px 0 28px;
  padding: 18px 26px;
  background: var(--color-bg-alt);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
}
.opening-hours h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-base);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #333;
}
.opening-hours dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 28px;
}
.opening-hours dl > div { display: contents; }
.opening-hours dt {
  font-weight: 600;
  color: var(--color-text);
}
.opening-hours dd {
  margin: 0;
  color: var(--color-text-light);
}
@media (max-width: 500px) {
  .opening-hours { display: block; }
}

/* Geschäftsstelle: zwei Spalten – links Adresse + Öffnungszeiten, rechts Foto.
   Unter 760 px untereinander. */
.office-grid {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;   /* Text + Bild gemeinsam mittig, Bild mit Abstand neben dem Text */
  gap: 32px 56px;
  align-items: start;
  padding-bottom: 40px;
}
.office-text h3 { margin-top: 0; }
.office-address {
  font-style: normal;
  line-height: 1.7;
  margin: 0 0 24px;
}
.office-contact { display: block; }
.office-contact:first-of-type { margin-top: 12px; }
@media (max-width: 760px) {
  .office-grid { grid-template-columns: 1fr; justify-content: stretch; }
}
/* Kontaktseite: links Formular, rechts Geschäftsstelle; unter 860 px untereinander */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 40px 56px;
  align-items: start;
  margin-top: 24px;
}
.contact-office {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 28px 28px 12px;
}
.contact-office h3 { margin-top: 0; }
.contact-office h4 { margin: 24px 0 6px; }
.contact-office .opening-hours { display: block; background: #fff; }
.contact-office .opening-hours h4 { margin: 0 0 12px; }
.contact-office table { margin-bottom: 8px; }
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* Foto Geschäftsstelle: fast quadratisch (1200 x 1306 px), wird ganz angezeigt */
.office-photo {
  width: 380px;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* ---------- Hinweis-Kasten Trainingszeiten (pro Abteilung) ----------
   Kasten mit rotem Strich links, nur sichtbar, wenn in Spalte "Hinweis"
   Text steht (siehe sheets.js). */
.training-hinweis {
  display: inline-block;
  margin: 4px 0 24px;
  padding: 4px 16px;
  background: var(--color-bg-alt);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
}
.training-hinweis p {
  margin: 0;
  color: var(--color-text-light);
}
.training-hinweis p + p { margin-top: 6px; }
@media (max-width: 500px) {
  .training-hinweis { display: block; }
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
input, textarea, select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
}
.form-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-note { font-size: 0.85rem; color: var(--color-text-light); }
.form-success, .form-error {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 18px;
  display: none;
  font-size: 0.92rem;
}
.form-success { background: #e7f6ec; color: var(--color-primary-dark); }
.form-error { background: #fdecea; color: #a32020; }

/* ---------- Downloads / Sponsoren ---------- */
.download-list { list-style: none; margin: 0; padding: 0; }
.download-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.download-list .file-name { font-weight: 600; }
.download-list .file-meta { font-size: 0.8rem; color: var(--color-text-light); }

.sponsor-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(5, 1fr);   /* max. 5 Quadrate nebeneinander */
  align-items: stretch;
}
@media (max-width: 900px) { .sponsor-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .sponsor-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
/* alle Sponsoren-Kästen quadratisch */
.sponsor-grid .sponsor-box { aspect-ratio: 1 / 1; min-height: 0; padding: 12px; overflow: hidden; }
.sponsor-grid .sponsor-box div { line-height: 1.25; hyphens: auto; }
/* Logo-Größe (überschreibt Inline-Stil) */
.sponsor-grid .sponsor-box img { width: 108px !important; height: 108px !important; margin-bottom: 8px !important; }
@media (max-width: 500px) {
  .sponsor-grid .sponsor-box img { width: 84px !important; height: 84px !important; margin-bottom: 6px !important; }
  .sponsor-grid .sponsor-box div { font-size: 0.78rem !important; }
}
.sponsor-grid .sponsor-box {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  background: #fff;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-footer-bg);
  color: #d9d9d9;
  padding: 48px 0 20px;
  margin-top: 64px;
}
.footer-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 32px;
}
.footer-grid h4 {
  color: #fff;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: #bdbdbd; font-size: 0.9rem; }
.footer-grid a:hover { color: #fff; }
/* Instagram-Links im Footer: Icon per ::before (eingebettetes SVG) */
.footer-social-label {
  margin: 16px 0 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.footer-social a { display: inline-flex; align-items: center; }
.footer-social a::before {
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><defs><linearGradient id='ig' x1='0' y1='1' x2='1' y2='0'><stop offset='0%25' stop-color='%23FFDC80'/><stop offset='25%25' stop-color='%23FCAF45'/><stop offset='50%25' stop-color='%23E1306C'/><stop offset='75%25' stop-color='%23C13584'/><stop offset='100%25' stop-color='%23405DE6'/></linearGradient></defs><rect x='2' y='2' width='20' height='20' rx='6' fill='none' stroke='url(%23ig)' stroke-width='2'/><circle cx='12' cy='12' r='5' fill='none' stroke='url(%23ig)' stroke-width='2'/><circle cx='17.5' cy='6.5' r='1.2' fill='url(%23ig)'/></svg>") no-repeat center / contain;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 18px;
  font-size: 0.82rem;
  color: #8f8f8f;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--color-border);
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: block; }
  .main-nav > ul {
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
  }
  .main-nav > ul > li { width: 100%; }
  .main-nav > ul > li > a {
    display: block;
    padding: 12px 24px;
    color: var(--color-text);
  }
  .sub-nav,
  .mega-panel {
    display: none;
    position: static;
    width: auto;
    box-shadow: none;
    border-top: none;
    background: var(--color-bg-alt);
    padding: 4px 12px;
  }
  .main-nav > ul > li.menu-open .sub-nav,
  .main-nav > ul > li.menu-open .mega-panel {
    display: block;
  }
  .mega-col { width: 100%; }
}

/* ---- News pro Abteilung (grauer Abschnitt, 2 Spalten Masonry) ---- */
.dept-news { margin-top: 20px; }
.dept-news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 24px;
  grid-auto-rows: 4px;
  align-items: start;
}
.dept-news-item {
  margin: 0;
  padding: 20px 24px;
  background: var(--color-bg);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius);
}
.dept-news-grid--single { grid-template-columns: 1fr; }
.dept-news-item h4 { margin: 0 0 10px; }
.dept-news-date { font-size: 0.8rem; color: var(--color-text-light); margin: 0 0 6px; }
.dept-news-item p:last-child { margin-bottom: 0; }
@media (max-width: 760px) {
  .dept-news-grid { grid-template-columns: 1fr; }
}


/* Zwischenüberschriften in Texten aus dem Sheet (Zeile mit "#") */
/* Abteilungsseiten: Einleitungstext so breit wie die Überschrift (inkl. Schraffur).
   Der Container schrumpft auf die Breite der h1; der Text füllt sie aus,
   ohne sie selbst zu verbreitern (width:0 + min-width:100%). */
#top > .container:has(> .dept-intro) { width: fit-content; }
#top > .container:has(> .dept-intro) > h1::before,
#top > .container:has(> .dept-intro) > h1::after { flex: 0 1 140px; width: 140px; min-width: 0; }
.dept-intro { width: 0; min-width: 100%; }
@media (max-width: 600px) {
  #top > .container:has(> .dept-intro) { width: auto; }
}

.dept-intro-heading {
  font-size: 18px;
  font-weight: 700;
  text-transform: none;
  color: #333333;
  margin: 28px 0 8px;
}
.dept-intro-heading:first-child { margin-top: 0; }

/* Nach-oben-Button: rund, roter Rahmen, Pfeil; beim Drüberfahren rot gefüllt */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 950;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s, background .2s ease, color .2s ease;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover,
.to-top:focus-visible { background: var(--color-primary); color: #fff; }
@media (max-width: 700px) {
  .to-top { right: 16px; bottom: 16px; width: 44px; height: 44px; }
}

/* E-Mail mit Spamschutz (info[at]...): Link ohne href, öffnet per Klick */
a.js-mail { cursor: pointer; }

/* Abschnitte mit hidden-Attribut (z.B. Zahlen, solange das Sheet leer ist) wirklich ausblenden */
section[hidden] { display: none !important; }
