/*
 * FFW Memmenhausen – eigene Styles (überschreibt Quark2, wird zuletzt geladen)
 * Farben übernommen aus der alten Joomla-Seite (Helix Ultimate Preset)
 */

/* :root[data-theme] nötig – Quark2 setzt seine Variablen unter :root[data-theme="light"] (spezifischer als :root) */
:root,
:root[data-theme] {
  --ffw-red: #9c160f;        /* Links, Akzente */
  --ffw-red-dark: #420e0e;   /* Text, Footer, Linien */
  --ffw-red-light: #e09692;  /* Link-Hover */
  --ffw-active: #8f1b1b;     /* aktiver Menüpunkt */

  --q2-bg: #ffffff;
  --q2-text: #420e0e;
  --q2-text-strong: #420e0e;
  --q2-link: var(--ffw-red);
  /* Header-Höhe NICHT ändern: Quark2 schrumpft den sticky Header beim Scrollen auf 60px und hat dafür
     nur 16px "Totzone" (site.js). Bei 72 -> 60 (12px) stabil; größere Höhen (z. B. 96) lassen den
     Header beim Hochscrollen pulsieren, weil die Seite um die Differenz springt. */
}

/* ---------- Grundlayout ---------- */

/* Breite wie Original (Bootstrap-Container 1140px, 15px Innenabstand -> 1110px Inhalt).
   Gilt für Header, Inhalt und Footer. */
.container {
  max-width: 1140px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px));
}

/* Quark2 setzt den Inhalt in eine schmale "Karte" (max. 960px + Innenabstand) –
   im Original steht der Text direkt in voller Containerbreite auf Weiß */
#body-wrapper > .container > .content-item {
  max-width: none;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

a:hover,
a:focus {
  color: var(--ffw-red-light);
}

/* ---------- Überschriften wie alte Seite (Bootstrap 4 + Helix: Helvetica, 500, 1.2) ---------- */

:root,
:root[data-theme] {
  --ffw-font-heading: "Helvetica Neue", Helvetica, Arial, sans-serif;
  /* Quark2-Display-Schrift (Cal Sans) auch in Karten-Titeln usw. ersetzen */
  --pico-font-family-display: var(--ffw-font-heading);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--ffw-font-heading);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: normal;
  color: var(--ffw-red-dark);
  margin-top: 0;
  margin-bottom: 0.5rem;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; letter-spacing: normal; text-transform: none; }

@media (max-width: 560px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.65rem; }
  h3 { font-size: 1.45rem; }
}

/* Quark2-Akzentbalken über h2 – gab es auf der alten Seite nicht */
h2::before {
  content: none;
}
/* Quark2 färbt "h2 direkt nach h1" in Akzentfarbe und zieht es hoch – alte Seite nicht */
h1 + h2 {
  margin-top: 0;
  color: var(--ffw-red-dark);
}
/* Quark2-Abstände vor Überschriften nach Text etwas zurücknehmen */
:is(p, ul, ol, dl, blockquote, pre, table, figure, hr, iframe, .card) + :is(h1, h2, h3, h4, h5, h6) {
  margin-top: 1.5rem;
}

/* Inline-SVG-Icons (partials/icon.html.twig, Ersatz für Font Awesome) */
.ffw-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Header ---------- */

#header {
  background: rgba(255, 255, 255, 0.96);
}

.navbar-brand img.ffw-logo {
  height: 64px;
  width: auto;
  transition: height 0.2s ease;
}
.header-animated.scrolled .navbar-brand img.ffw-logo {
  height: 48px;
}

.dropmenu a {
  color: var(--ffw-red-dark);
  font-size: 1rem;
  font-weight: 400;
}
.dropmenu a:hover {
  color: var(--ffw-red);
  background: transparent;
}
.dropmenu a.active,
.dropmenu a.active:hover {
  color: var(--ffw-active);
  background: transparent;
  font-weight: 600;
}
.dropmenu li > ul a {
  display: flex;
}

/* ---------- Slider (Diashow) ---------- */

.ffw-slider {
  --ffw-slider-line: 3px; /* Stärke der dunkelroten Linien oben/unten (wie alte Seite) */
  position: relative;
  overflow: hidden;
  background: var(--ffw-red-dark);
  border-block: var(--ffw-slider-line) solid var(--ffw-red-dark);
}
/* Format wie SmartSlider der alten Seite: 1920 x 650, auf allen Seiten gleich */
.ffw-slider__track {
  position: relative;
  aspect-ratio: 1920 / 650;
  min-height: 200px;
  max-height: 650px;
  width: 100%;
}
.ffw-slider__slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 1s ease;
}
.ffw-slider__slide.is-active {
  opacity: 1;
}
.ffw-slider__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ffw-slider__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2.5rem;
  text-align: center;
  color: #fff;
  font-size: 1.25rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.ffw-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 10px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.ffw-slider__arrow--prev { left: 15px; }
.ffw-slider__arrow--next { right: 15px; }
.ffw-slider:hover .ffw-slider__arrow,
.ffw-slider__arrow:focus-visible {
  opacity: 1;
}
.ffw-slider__arrow:hover {
  background: rgba(0, 0, 0, 0.6);
}
.ffw-slider__arrow svg,
.ffw-carousel__arrow svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ffw-slider__arrow { color: #fff; }

.ffw-slider__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
  /* wie die Pfeile: nur bei Mauszeiger über dem Banner (oder Tastatur-Fokus) sichtbar */
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ffw-slider:hover .ffw-slider__dots,
.ffw-slider__dots:focus-within {
  opacity: 1;
}
.ffw-slider__dot {
  width: 10px;
  height: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}
.ffw-slider__dot.is-active {
  background: #fff;
}

/* Zoom-Effekt (banner_zoom: true): Nachbau SmartSlider „Ken Burns“ der alten Seite
   (Hintergrund scale 1.5 → 1.2 in 5 s × „slow“ ≈ 7.5 s, Mitte) → relativ 1.25 → 1.
   Läuft bei jedem Bild der Diashow neu an, sobald es aktiv wird. */
/* Dauer/Stärke pro Seite: banner_zoom_dauer / banner_zoom_staerke → data-Attribute → ffw.js setzt
   --ffw-zoom-dauer / --ffw-zoom-scale auf .ffw-slider. Ohne Angabe (oder ohne JS) gelten 7.5s / 1.25. */
.ffw-slider--zoom .ffw-slider__slide.is-active img {
  animation: ffw-banner-zoom var(--ffw-zoom-dauer, 7.5s) cubic-bezier(0.25, 0.1, 0.25, 1) both;
  transform-origin: 50% 50%;
}
@keyframes ffw-banner-zoom {
  from { transform: scale(var(--ffw-zoom-scale, 1.25)); }
  to   { transform: scale(1); }
}
/* Gegenstück (banner_zoom: rein): 1 → 1.25, Bild bleibt danach vergrößert stehen */
.ffw-slider--zoom-rein .ffw-slider__slide.is-active img {
  animation: ffw-banner-zoom-rein var(--ffw-zoom-dauer, 7.5s) cubic-bezier(0.25, 0.1, 0.25, 1) both;
  transform-origin: 50% 50%;
}
@keyframes ffw-banner-zoom-rein {
  from { transform: scale(1); }
  to   { transform: scale(var(--ffw-zoom-scale, 1.25)); }
}
@media (prefers-reduced-motion: reduce) {
  .ffw-slider--zoom .ffw-slider__slide.is-active img,
  .ffw-slider--zoom-rein .ffw-slider__slide.is-active img { animation: none; }
}

/* Auf Touch-Geräten Pfeile immer zeigen */
@media (hover: none) {
  .ffw-slider__arrow { opacity: 0.8; }
  .ffw-slider__dots { opacity: 1; }
}

/* ---------- Banner-Texte (partials/banner-text.html.twig) ----------
   Nachbau der SmartSlider-Ebenen der alten Jugendfeuerwehr-Seite: halbtransparente Kästen
   mit weißer Schrift fliegen nacheinander abwechselnd von links/rechts ein, danach springt
   das Logo herein. Liegt außerhalb der Bildspur -> bewegt sich beim Parallax nicht mit. */
.ffw-banner-text {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1.5rem;
  pointer-events: none; /* Pfeile/Punkte der Diashow bleiben klickbar */
  overflow: hidden;
}
.ffw-banner-text__item {
  max-width: 940px;
  margin: 0;
  padding: 0.3em 0.9em;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: var(--ffw-font-heading);
  font-size: clamp(1.15rem, 1.8vw, 1.9rem);
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  animation-duration: 0.9s;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  animation-fill-mode: forwards;
}
.ffw-banner-text__item:nth-child(odd)  { animation-name: ffw-banner-von-links; }
.ffw-banner-text__item:nth-child(even) { animation-name: ffw-banner-von-rechts; }
.ffw-banner-text__item:nth-child(1) { animation-delay: 0.3s; }
.ffw-banner-text__item:nth-child(2) { animation-delay: 1.1s; }
.ffw-banner-text__item:nth-child(3) { animation-delay: 1.9s; }
.ffw-banner-text__item:nth-child(4) { animation-delay: 2.7s; }
.ffw-banner-text__item:nth-child(5) { animation-delay: 3.5s; }
.ffw-banner-text__item:nth-child(n+6) { animation-delay: 4.3s; }

/* Logo: weißer Kasten, springt von rechts herein und federt nach */
.ffw-banner-text__item.ffw-banner-text__logo {
  padding: 0.4rem 0.9rem;
  background: #fff;
  border-radius: 4px;
  line-height: 0;
  animation-name: ffw-banner-hereinspringen;
  animation-duration: 1.1s;
  animation-timing-function: ease-out;
}
.ffw-banner-text__logo img {
  display: block;
  width: auto;
  height: clamp(40px, 4.5vw, 64px);
}

@keyframes ffw-banner-von-links {
  from { opacity: 0; transform: translateX(-180px); }
  to   { opacity: 1; transform: none; }
}
@keyframes ffw-banner-von-rechts {
  from { opacity: 0; transform: translateX(180px); }
  to   { opacity: 1; transform: none; }
}
@keyframes ffw-banner-hereinspringen {
  0%   { opacity: 0; transform: translateX(100vw); }
  55%  { opacity: 1; transform: translateX(-25px); }
  70%  { transform: translateX(10px); }
  85%  { transform: translateX(-5px); }
  100% { opacity: 1; transform: none; }
}

/* Tablet hochkant / Handy: Banner ist zu flach -> Texte unter dem Bild auf Dunkelrot */
@media (max-width: 900px) {
  .ffw-banner-text {
    position: static;
    gap: 0.4rem;
    padding: 0.9rem 15px 1rem;
  }
  .ffw-banner-text__item {
    padding: 0;
    background: none;
    font-size: 1.05rem;
  }
  .ffw-banner-text__item.ffw-banner-text__logo {
    margin-top: 0.4rem;
    padding: 0.3rem 0.7rem;
  }
  .ffw-banner-text__logo img { height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .ffw-banner-text__item {
    opacity: 1;
    animation: none;
  }
}

/* ---------- Willkommenstext ---------- */

/* mit ID, sonst gewinnt Quark2s "#body-wrapper { padding-block: bis 4rem }" */
#body-wrapper.ffw-intro {
  text-align: center;
  padding-block: 30px 0.5rem; /* Original: 30px Abstand unter dem Banner */
  margin-bottom: 0;           /* Blades-Abstand unter <section> */
}
.ffw-intro h2 {
  margin-bottom: 0.25em;
}
.ffw-intro p {
  max-width: 860px;
  margin: 0.75rem auto 0;
  font-size: 1.125rem;
}

/* ---------- Teaser-Karussells (Aktuelles / Einsätze) ---------- */

.ffw-teasers {
  padding-block: 1rem;
  margin-bottom: 0; /* Blades-Abstand unter <section> */
}
.ffw-teasers__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.ffw-teasers__head h2 {
  margin: 0;
}
.ffw-teasers__all {
  font-size: 0.95rem;
}
.ffw-rule,
.content-item hr {
  border: 0;
  border-top: 1px solid var(--ffw-red-dark);
  margin: 0.75rem 0 1.25rem;
}

.ffw-carousel {
  position: relative;
}
.ffw-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 1.25rem) / 3);
  gap: 1.25rem;
  /* Innenabstand, damit Schatten und Hover-Anheben nicht abgeschnitten werden;
     negativer Rand gleicht ihn seitlich wieder aus */
  margin: -0.5rem -0.75rem 0;
  padding: 0.5rem 0.75rem 1.75rem;
  scroll-padding-inline: 0.75rem;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.ffw-carousel__track::-webkit-scrollbar {
  display: none;
}
@media (max-width: 900px) {
  .ffw-carousel__track { grid-auto-columns: calc((100% - 1.25rem) / 2); }
}
@media (max-width: 560px) {
  .ffw-carousel__track { grid-auto-columns: 85%; }
}

.ffw-card {
  scroll-snap-align: start;
  margin: 0;
  list-style: none;
}
.ffw-card::before {
  content: none !important;
}
.ffw-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--q2-radius-md);
  overflow: hidden;
  color: var(--ffw-red-dark);
  text-decoration: none;
  background: var(--q2-bg-elev);
  /* gleicher Schatten wie die Quark2-Karten auf den Blog-Seiten */
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.06) 0 8px 24px -8px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.ffw-card__link:hover {
  color: var(--ffw-red);
  text-decoration: none;
  box-shadow:
    rgba(19, 19, 22, 0.06) 0 1px 2px,
    rgba(19, 19, 22, 0.1) 0 14px 32px -8px;
  transform: translateY(-2px);
}
.ffw-card__media {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--ffw-red-dark);
}
.ffw-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.ffw-card__link:hover .ffw-card__media img {
  transform: scale(1.04);
}
.ffw-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.875rem 1rem 1rem;
}
.ffw-card__date {
  font-size: 0.85rem;
  color: var(--ffw-red);
}
.ffw-card__title {
  font-weight: 600;
  line-height: 1.3;
}

.ffw-carousel__arrow {
  position: absolute;
  top: calc(50% - 1.5rem);
  z-index: 2;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 9px;
  border: 0;
  border-radius: 50%;
  background: var(--ffw-red);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.ffw-carousel__arrow--prev { left: -12px; }
.ffw-carousel__arrow--next { right: -12px; }
.ffw-carousel__arrow:disabled {
  opacity: 0;
  pointer-events: none;
}
.ffw-carousel.is-static .ffw-carousel__arrow {
  display: none;
}

/* ---------- Galerien im Inhalt (Lightbox, siehe ffw.php + ffw.js) ---------- */

/* Festes Raster: alle Vorschaubilder gleich groß, egal wie viele Bilder ein Abschnitt hat */
.ffw-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-block: 1rem 1.5rem;
}
@media (max-width: 860px) {
  .ffw-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .ffw-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ffw-zoom {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: var(--q2-radius);
  overflow: hidden;
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.06) 0 8px 24px -8px;
}
.ffw-gallery .ffw-zoom {
  display: block;
}
.ffw-zoom img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.ffw-zoom:hover img {
  transform: scale(1.04);
}
/* Hochformat (Frontmatter "gallery_format: hoch") – z. B. Personen, wie Original 200x360 */
.ffw-zoom--hoch img {
  aspect-ratio: 400 / 720;
}
.ffw-gallery:has(.ffw-zoom--hoch) {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 860px) {
  .ffw-gallery:has(.ffw-zoom--hoch) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .ffw-gallery:has(.ffw-zoom--hoch) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Lightbox: Schließen-X größer und besser treffbar (GLightbox-Standard nur 35px) */
.glightbox-clean .gclose {
  width: 48px;
  height: 48px;
  top: 16px;
  right: 16px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 1;
}
.glightbox-clean .gclose svg {
  width: 20px;
}
.glightbox-clean .gclose:hover,
.glightbox-clean .gclose:focus-visible {
  background-color: var(--ffw-red);
}
@media (max-width: 768px) {
  /* Handy: noch größer, Abstand zum Rand für den Daumen */
  .glightbox-clean .gclose {
    width: 56px;
    height: 56px;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
  }
  .glightbox-clean .gclose svg {
    width: 24px;
  }
}

/* Lightbox mit nur einem Bild: keine Pfeile (ffw.js setzt .ffw-lb-single) */
.glightbox-container.ffw-lb-single .gprev,
.glightbox-container.ffw-lb-single .gnext {
  display: none !important;
}

/* Bildunterschrift: ![Beschreibung](bild.jpg "Unterschrift") */
.ffw-zoom__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2rem 0.75rem 0.6rem;
  line-height: 1.25;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  pointer-events: none;
  /* lange Wörter mit Trennstrich umbrechen ("Atemschutz-geräteträger"), Sprache kommt aus <html lang="de"> */
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
@media (max-width: 560px) {
  .ffw-zoom__caption {
    font-size: 0.85rem;
    padding: 1.5rem 0.5rem 0.5rem;
  }
}

/* Titel auf Detailseiten: Quark2 verlinkt die Überschrift auf sich selbst -> wie normale h1 darstellen */
.content-title .p-name a {
  color: inherit;
  text-decoration: none;
  pointer-events: none;
}

/* Handy-Menü (Overlay) im FFW-Stil statt Quark2 (Cal Sans, schwarz) */
.overlay .overlay-menu a {
  font-family: var(--ffw-font-heading);
  font-weight: 500;
  letter-spacing: normal;
  color: var(--ffw-red-dark);
}
.overlay .overlay-menu a:hover,
.overlay .overlay-menu a.active {
  color: var(--ffw-red);
}
.overlay .overlay-menu ul ul a {
  font-family: var(--pico-font-family-sans-serif);
  color: var(--ffw-red-dark);
  opacity: 0.8;
}
/* Impressum/Datenschutz unten im Handy-Menü (partials/navigation.html.twig): klein, mit Linie abgesetzt */
.overlay .overlay-menu .ffw-mobile-legal {
  display: flex;
  justify-content: flex-start;
  gap: 1.5rem;
  margin: 1.5rem 0 0;
  padding: 1rem 0 0;
  max-width: 16rem;
  border-top: 1px solid rgba(66, 14, 14, 0.25);
  list-style: none;
}
.overlay .overlay-menu .ffw-mobile-legal li {
  margin: 0;
  padding: 0;
}
.overlay .overlay-menu .ffw-mobile-legal a {
  font-family: var(--pico-font-family-sans-serif);
  font-size: 0.95rem;
  opacity: 0.8;
}

/* ---------- Chronik / Zeitstrahl (templates/chronik.html.twig) ---------- */

.ffw-chronik__intro {
  font-size: 1.05rem;
}
/* Sprungleiste mit Jahreszahlen */
.ffw-chronik__jump {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start; /* Blades verteilt <nav>-Inhalte sonst mit space-between */
  gap: 0.4rem;
  margin: 1.5rem 0 2.5rem;
}
.ffw-chronik__jump a {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--ffw-red-dark);
  border-radius: var(--q2-radius-pill);
  font-size: 0.9rem;
  color: var(--ffw-red-dark);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.ffw-chronik__jump a:hover,
.ffw-chronik__jump a:focus-visible {
  background: var(--ffw-red);
  border-color: var(--ffw-red);
  color: #fff;
}

/* Jahresleiste in Blog-Listen (blog.html.twig, "year_filter: true") – mitlaufend wie die Chronik-Leiste
   (Klassen .ffw-chronik__nav / __nav-scroll / __pin, Styles weiter unten) */
.ffw-yearfilter {
  margin: 0 0 1.5rem;
}
.ffw-yearfilter a.is-active {
  background: var(--ffw-red);
  border-color: var(--ffw-red);
  color: #fff;
}
.ffw-yearfilter__info {
  margin: -0.75rem 0 1.25rem;
  color: var(--q2-text-muted);
}

/* Seitennavigation (Pagination) */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}
.pagination li {
  margin: 0;
  list-style: none;
}
.pagination li::before {
  content: none !important;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  padding: 0 0.6rem;
  border: 1px solid var(--ffw-red-dark);
  border-radius: var(--q2-radius-sm);
  color: var(--ffw-red-dark);
  text-decoration: none;
}
.pagination a:hover,
.pagination a:focus-visible {
  background: var(--ffw-red);
  border-color: var(--ffw-red);
  color: #fff;
}
.pagination .active span {
  background: var(--ffw-red-dark);
  border-color: var(--ffw-red-dark);
  color: #fff;
}
.pagination .disabled span {
  opacity: 0.35;
}

/* Chronik-Jahresleiste: läuft beim Scrollen unter dem Header mit, eine wischbare Zeile,
   aktives Jahr hervorgehoben (ffw.js setzt .is-active und scrollt die Leiste mit) */
/* Aufbau: [erstes Jahr fest] [wischbare Zeile] [letztes Jahr fest] */
.ffw-chronik__nav {
  position: sticky;
  top: 61px;               /* Höhe des geschrumpften Headers (60px + Rand) */
  z-index: 20;
  flex-wrap: nowrap;
  align-items: center;
  padding: 0.6rem 0;
  background: var(--q2-bg);
  border-bottom: 1px solid var(--q2-divider);
}
.ffw-chronik__nav-scroll {
  --ffw-fade-l: 1.25rem;   /* weiche Kante links/rechts = "hier geht es weiter" */
  --ffw-fade-r: 1.25rem;
  position: relative;      /* Bezug für offsetLeft der Jahre (ffw.js) */
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 0.4rem;             /* gleicher Abstand wie zu den festen Jahren (Leiste: gap 0.4rem) */
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--ffw-fade-l), #000 calc(100% - var(--ffw-fade-r)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--ffw-fade-l), #000 calc(100% - var(--ffw-fade-r)), transparent);
}
/* am Anfang/Ende der Zeile keine Ausblendung auf dieser Seite (ffw.js setzt die Klassen) */
.ffw-chronik__nav-scroll.is-at-start { --ffw-fade-l: 0px; }
.ffw-chronik__nav-scroll.is-at-end { --ffw-fade-r: 0px; }
.ffw-chronik__nav-scroll::-webkit-scrollbar {
  display: none;
}
.ffw-chronik__nav a {
  flex: 0 0 auto;
  white-space: nowrap;
}
/* erstes/letztes Jahr fest, etwas kräftiger */
.ffw-chronik__pin {
  font-weight: 600;
  border-width: 2px !important;
}
.ffw-chronik__nav a.is-active {
  background: var(--ffw-red);
  border-color: var(--ffw-red);
  color: #fff;
}

/* Zeitstrahl: Jahr links, Linie mit Punkten, Inhalt rechts.
   Linie = helle Grundlinie (::before) + rote Füllung (.ffw-chronik__fill, Höhe aus ffw.js) */
.ffw-chronik__timeline {
  --ffw-tl-year: 7.5rem;                       /* Breite der Jahresspalte */
  --ffw-tl-gap: 2.25rem;                       /* Abstand Linie -> Inhalt */
  --ffw-tl-x: calc(var(--ffw-tl-year) + 1rem); /* Position der Linie */
  position: relative;
}
.ffw-chronik__timeline::before,
.ffw-chronik__fill {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: var(--ffw-tl-x);
  width: 3px;
  border-radius: 2px;
}
.ffw-chronik__timeline::before {
  bottom: 0;
  background: #ead9d8;
}
.ffw-chronik__fill {
  z-index: 1;
  height: var(--ffw-tl-fill, 0px);
  max-height: calc(100% - 0.5rem);
  background: var(--ffw-red);
}
.ffw-chronik__list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ffw-chronik__item {
  position: relative;
  display: grid;
  grid-template-columns: var(--ffw-tl-year) 1fr;
  column-gap: calc(2rem + var(--ffw-tl-gap) - 1rem);
  margin: 0;
  padding: 0 0 2.5rem;
  list-style: none;
  scroll-margin-top: 130px; /* Header + mitlaufende Jahresleiste */
}
.ffw-chronik__item::before {
  content: none !important; /* Pico-Listenpunkt */
}
/* Punkt auf der Linie: leer = noch nicht gelesen, gefüllt = gelesen, groß = aktuelles Jahr */
.ffw-chronik__item::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0.45rem;
  left: calc(var(--ffw-tl-x) - 6px);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ffw-red);
  box-sizing: border-box;
  transition: background 0.2s ease, transform 0.2s ease;
}
.ffw-chronik__item.is-passed::after {
  background: var(--ffw-red);
}
.ffw-chronik__item.is-current::after {
  transform: scale(1.35);
  box-shadow: 0 0 0 4px rgba(156, 22, 15, 0.18);
}
.ffw-chronik__year {
  font-family: var(--ffw-font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ffw-red);
  text-align: right;
  transition: color 0.2s ease;
}
.ffw-chronik__item.is-current .ffw-chronik__year {
  color: var(--ffw-red-dark);
}
.ffw-chronik__body > :first-child {
  margin-top: 0;
}
.ffw-chronik__body > :last-child {
  margin-bottom: 0;
}
.ffw-chronik__body .ffw-gallery {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Handy: Jahr über dem Inhalt, Linie ganz links */
@media (max-width: 700px) {
  .ffw-chronik__timeline { --ffw-tl-x: 6px; }
  .ffw-chronik__item {
    grid-template-columns: 1fr;
    padding-left: 2rem;
  }
  .ffw-chronik__year {
    text-align: left;
    margin-bottom: 0.5rem;
  }
  .ffw-chronik__body .ffw-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Einblenden beim Scrollen (ffw.js setzt .is-visible) */
.js-reveal .ffw-chronik__item {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js-reveal .ffw-chronik__item.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal .ffw-chronik__item { opacity: 1; transform: none; transition: none; }
}

/* Leiste unten: Vorheriger | Zurück | Nächster (Quark2 sieht nur 2 Knöpfe à 48 % vor) */
.prev-next {
  align-items: center;
}
.prev-next .btn {
  max-width: none;
}
.prev-next .ffw-back--nav {
  flex: 0 0 auto;
}
@media (max-width: 560px) {
  .prev-next {
    flex-wrap: wrap;
  }
  .prev-next .ffw-back--nav {
    order: -1;
    flex-basis: 100%;
  }
}

/* Schwebender "Nach oben"-Knopf */
.ffw-totop {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ffw-red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease;
}
.ffw-totop.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.ffw-totop:hover,
.ffw-totop:focus-visible {
  background: var(--ffw-red-dark);
  color: #fff;
}
.ffw-totop .ffw-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2.5;
}

/* Anhang (Tabellen unter dem Zeitstrahl) */
.ffw-chronik__anhang {
  margin-top: 4rem;  /* deutlicher Abstand zwischen Zeitstrahl und Tabellen, ohne Trennlinie */
  padding-top: 0;
}

/* Tabellen im Inhalt als Karte (Vorstandschaft, Geschichte: Anschaffungen, Feuerwehrhäuser, Kommandanten …):
   roter Streifen oben, Kopfzeile hell abgesetzt in Großbuchstaben, erste Spalte rot/fett, nicht umbrechend. */
.content-item table {
  width: 100%;
  margin: 0.5rem 0 2rem;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--q2-radius);
  overflow: hidden;
  background: #fff;
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.08) 0 12px 32px -12px;
  border-top: 4px solid var(--ffw-red);
}
.content-item th,
.content-item td {
  text-align: left;
  border-bottom: 1px solid var(--q2-divider);
}
.content-item th {
  padding: 0.9rem 1.25rem;
  color: var(--ffw-red-dark);
  background: #f7f1f0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.content-item td {
  padding: 0.85rem 1.25rem;
  vertical-align: middle;
}
.content-item td:first-child {
  white-space: nowrap;
  width: 1%;
  color: var(--ffw-red);
  font-weight: 600;
  padding-right: 2.5rem;
}
.content-item td + td {
  font-size: 1.1rem;
  color: var(--ffw-red-dark);
}
.content-item tbody tr:last-child td {
  border-bottom: 0;
}
.content-item tbody tr:hover td {
  background: #fbf7f6;
}
@media (max-width: 560px) {
  .content-item th,
  .content-item td {
    padding-inline: 0.85rem;
  }
  .content-item td:first-child {
    padding-right: 1rem;
  }
  .content-item td + td {
    font-size: 1rem;
  }
}

/* ---------- Seitenlayout "nebeneinander" (Frontmatter seitenlayout, z. B. Vorstandschaft) ----------
   Überschrift oben über die ganze Breite, Text/Tabelle links, Bilder (Galerie-Absatz) rechts. */
.ffw-layout--nebeneinander {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  column-gap: 3rem;
  row-gap: 0;
  align-items: start;
}
.ffw-layout--nebeneinander > * {
  grid-column: 1;
}
.ffw-layout--nebeneinander > h1 {
  grid-column: 1 / -1;
}
.ffw-layout--nebeneinander > :is(.ffw-gallery, p:has(> .ffw-zoom)) {
  grid-column: 2;
  grid-row: 2 / span 20;  /* rechts neben allem, was nach der Überschrift kommt */
  grid-template-columns: minmax(0, 1fr);
  display: grid;
  gap: 1rem;
  margin: 0.5rem 0 2rem;
}
.ffw-zoom--frei img {
  aspect-ratio: auto;
}
/* Tabelle: Kartendesign gilt für alle Inhaltstabellen (siehe „Tabellen im Inhalt“ oben) */
@media (max-width: 860px) {
  .ffw-layout--nebeneinander {
    display: block;
  }
  .ffw-layout--nebeneinander > :is(.ffw-gallery, p:has(> .ffw-zoom)) {
    max-width: 26rem;
    margin-inline: auto;
  }
}

/* Abschnitte im Inhalt wie auf der alten Seite: Überschrift + Linie */
.content-item h2 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}
.content-item h2 + hr {
  margin-top: 0;
}
.content-item h2:first-child {
  margin-top: 0;
}

/* Quark2-Kartenbild: Platzhalter im gleichen Format wie cropZoom(800, 420) */
.card-image img {
  aspect-ratio: 800 / 420;
  object-fit: cover;
  width: 100%;
}

/* ---------- Einsatzdaten-Box (Seitentyp "einsatz") ---------- */

.ffw-einsatz {
  margin: 0 0 2rem;
  padding: 1rem 1.25rem;
  background: var(--q2-bg-elev);
  border-left: 4px solid var(--ffw-red);
  border-radius: var(--q2-radius);
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.06) 0 8px 24px -8px;
}
.ffw-einsatz__row {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.25rem 1rem;
  padding-block: 0.35rem;
}
.ffw-einsatz__row + .ffw-einsatz__row {
  border-top: 1px solid var(--q2-divider);
}
.ffw-einsatz dt {
  margin: 0;
  font-weight: 600;
  color: var(--ffw-red-dark);
}
.ffw-einsatz dd {
  margin: 0;
}
@media (max-width: 560px) {
  .ffw-einsatz__row { grid-template-columns: 1fr; }
}

/* ---------- Großes Bild am Seitenende ---------- */

.ffw-bottom-image {
  margin-top: 2rem;
  margin-bottom: 0; /* Blades gibt jeder <section> margin-bottom -> sonst weiße Lücke zum Footer */
  line-height: 0;
}
.ffw-bottom-image img {
  width: 100%;
  height: clamp(220px, 34vw, 650px);
  object-fit: cover;
}

/* ---------- Footer ---------- */

#footer.ffw-footer {
  background: var(--ffw-red-dark);
  color: #a2a2a2;
  margin-top: 0;
}
.ffw-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.ffw-footer__links {
  display: flex;
  gap: 1.5rem;
}
/* mit #footer, sonst gewinnt Quark2s "#footer a" (ID-Spezifität) */
#footer.ffw-footer a {
  color: #a2a2a2;
  font-weight: inherit;
}
#footer.ffw-footer a:hover,
#footer.ffw-footer a:focus {
  color: #fff;
  text-decoration: none;
}
