:root {
  --rf-accent: #006729E6;
  --rf-accent-2: #006729;
  --rf-text: #142015;
  --rf-muted: #5f6b64;
  --rf-surface-2: #ffffff;
  --rf-line: rgba(0, 103, 41, .15);
  --rf-shadow: 0 24px 70px rgba(9, 28, 17, .14);
}

/* Desktop Navigation */
.rf-demo-mega {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  position: relative;
  width: 100%;
  font-family: 'Open Sans', sans-serif;
}

.rf-demo-link {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: .75rem 1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--rf-text);
  font-weight: var(--rf-menu-font-weight, 800);
  font-size: var(--rf-menu-font-size, .84rem);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}

.rf-demo-link:hover,
.rf-demo-item:hover > .rf-demo-link,
.rf-demo-item:focus-within > .rf-demo-link {
  background: color-mix(in srgb, var(--rf-accent) 18%, transparent);
}

.rf-demo-item {
  position: static;
}

.rf-demo-panel {
  position: absolute;
  top: calc(100% + .6rem);
  left: 50%;
  right: auto;
  width: min(980px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1.25rem;
  padding: 1.4rem;
  border: 1px solid var(--rf-line);
  border-radius: 28px;
  box-sizing: border-box;
  background: #f6fffb;
  box-shadow: var(--rf-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: var(--rf-menu-speed, 220ms) ease;
  z-index: 500;
  overflow: hidden;
}



.rf-demo-panel--wide {
  /*
   * Breite und Spalten kommen jetzt dynamisch
   * aus rf_mega_panel_style().
   */
}

/*.rf-demo-panel--wide {
  width: min(1260px, calc(100vw - 32px));
  grid-template-columns: 1.1fr 1.5fr .8fr .8fr;
}*/

.rf-demo-item:hover .rf-demo-panel,
.rf-demo-item:focus-within .rf-demo-panel {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.rf-demo-intro {
  padding: 1.2rem;
  border-radius: 22px;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--rf-accent) 20%, transparent),
    rgba(255, 255, 255, .04)
  );
}

.rf-demo-kicker {
  color: var(--rf-accent-2);
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .16em;
  font-size: .72rem;
}

.rf-demo-intro h3 {
  margin: .3rem 0 .75rem;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.rf-demo-intro p,
.rf-demo-col a,
.rf-product-tile small {
  color: var(--rf-muted);
}

.rf-demo-cta {
  display: inline-flex;
  margin-top: 1rem;
  padding: .8rem 1rem;
  border-radius: 999px;
  background: var(--rf-accent);
  color: #fff !important;
  font-weight: 800;
  text-decoration: none;
}

.rf-demo-col {
  display: grid;
  align-content: start;
  gap: .55rem;
}

.rf-demo-col h4 {
  margin: 0 0 .5rem;
  color: var(--rf-text);
}

.rf-demo-col a {
  padding: .45rem 0;
  border-bottom: 1px solid var(--rf-line);
  text-decoration: none;
}

.rf-demo-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.rf-product-tile {
  position: relative;
  display: grid;
  gap: .55rem;
  min-height: 150px;
  padding: 1rem;
  border: 1px solid var(--rf-line);
  border-radius: 20px;
  overflow: visible;
  background: rgba(255, 255, 255, .8);
  color: var(--rf-text);
  text-decoration: none;
  transition: .18s ease;
}

.rf-product-tile:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--rf-accent) 45%, transparent);
}

/* =========================================================
   MOBILE NAVIGATION
   ========================================================= */

@media (max-width: 991.98px) {

  /*
   * Hauptcontainer
   */
  .rf-demo-mega {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;

    width: 100%;
    gap: .45rem;
    padding: .75rem 0 1rem;

    position: static;
  }

  /*
   * Jeder Hauptmenüpunkt
   */
  .rf-demo-item {
    position: relative;
    width: 100%;
  }

  /*
   * Hauptmenü-Button / Link
   */
  .rf-demo-link {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    min-height: 48px;

    padding: .8rem 1rem;

    border: 0;
    border-radius: 14px;

    background: rgba(0, 103, 41, .08);

    color: var(--rf-text);

    font-size: .82rem;
    font-weight: 700;
    line-height: 1.3;

    letter-spacing: .03em;

    text-decoration: none;
    text-align: left;

    cursor: pointer;
  }

  .rf-demo-link:hover,
  .rf-demo-item:hover > .rf-demo-link,
  .rf-demo-item:focus-within > .rf-demo-link {
    background: rgba(0, 103, 41, .12);
  }

  /*
   * Pfeil automatisch erzeugen, wenn Untermenü vorhanden
   */
  .rf-demo-item:has(> .rf-demo-panel) > .rf-demo-link::after {
    content: "";
    display: block;

    width: 9px;
    height: 9px;

    flex: 0 0 9px;
    margin-left: .8rem;

    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;

    transform: rotate(45deg);
    transition: transform .2s ease;
  }

  .rf-demo-item.open > .rf-demo-link::after {
    transform: rotate(225deg);
  }

  /*
   * GANZ WICHTIG:
   * Mobile Untermenüs sind standardmäßig wirklich geschlossen.
   */
  .rf-demo-panel,
  .rf-demo-panel--wide,
  .menu-effect-fade .rf-demo-panel,
  .menu-effect-scale .rf-demo-panel,
  .rf-demo-item.hover-open .rf-demo-panel {

    position: static !important;

    top: auto !important;
    left: auto !important;
    right: auto !important;

    display: none !important;

    width: 100% !important;
    max-width: 100% !important;

    grid-template-columns: 1fr !important;

    gap: .8rem;

    margin: .4rem 0 .2rem;
    padding: .8rem;

    border: 1px solid rgba(0, 103, 41, .12);
    border-radius: 16px;

    background: #f8fcfa;

    box-shadow: none;

    opacity: 1 !important;
    visibility: visible !important;

    transform: none !important;

    pointer-events: auto !important;

    overflow: visible;
  }

  /*
   * Ausschließlich .open öffnet das Menü.
   */
  .rf-demo-item.open > .rf-demo-panel,
  .rf-demo-item.open > .rf-demo-panel--wide {
    display: grid !important;
  }

  /*
   * Hover/Focus darf auf Mobile NICHT das Panel öffnen.
   */
  .rf-demo-item:hover > .rf-demo-panel,
  .rf-demo-item:focus-within > .rf-demo-panel {
    display: none !important;
    transform: none !important;
  }

  /*
   * Aber ein per JS geöffnetes Menü muss offen bleiben,
   * auch wenn focus-within vorhanden ist.
   */
  .rf-demo-item.open:hover > .rf-demo-panel,
  .rf-demo-item.open:focus-within > .rf-demo-panel {
    display: grid !important;
  }

  /*
   * Intro-Bereich
   */
  .rf-demo-intro {
    padding: .9rem;

    border-radius: 14px;

    background: rgba(0, 103, 41, .06);
  }

  .rf-demo-kicker {
    font-size: .62rem;
    letter-spacing: .10em;
  }

  .rf-demo-intro h3 {
    margin: .25rem 0 .5rem;
    font-size: 1.15rem;
    line-height: 1.25;
  }

  .rf-demo-intro p {
    margin-bottom: .5rem;
    font-size: .86rem;
    line-height: 1.5;
  }

  .rf-demo-cta {
    margin-top: .5rem;
    padding: .65rem .85rem;

    border-radius: 12px;

    font-size: .82rem;
  }

  /*
   * Textlink-Spalten
   */
  .rf-demo-col {
    display: grid;
    gap: 0;

    padding: .2rem 0;
  }

  .rf-demo-col h4 {
    margin: .3rem 0 .45rem;

    font-size: .9rem;
    font-weight: 800;
  }

  .rf-demo-col a {
    display: block;

    padding: .65rem .25rem;

    border-bottom: 1px solid rgba(0, 103, 41, .10);

    font-size: .86rem;
    line-height: 1.35;

    color: var(--rf-text);

    text-decoration: none;
  }

  /*
   * Produktkacheln
   */
  .rf-demo-product-grid {
    display: grid;

    grid-template-columns: 1fr !important;

    gap: .55rem;
  }

  .rf-product-tile {
    display: grid;

    grid-template-columns: auto 1fr;
    align-items: center;

    min-height: 0;

    gap: .65rem;

    padding: .75rem;

    border-radius: 14px;

    background: #fff;
  }

  .rf-product-tile:hover {
    transform: none;
  }

  .rf-product-tile strong {
    font-size: .86rem;
    line-height: 1.3;
  }

  .rf-product-tile small {
    font-size: .76rem;
    line-height: 1.35;
  }

  /*
   * Bilder im mobilen Mega-Menü kleiner halten
   */
  .rf-menu-image-wrap {
    width: 44px;
    min-height: 44px;

    margin: 0;
  }

  .rf-menu-image-wrap img {
    display: block;

    width: auto !important;
    height: auto !important;

    max-width: 100% !important;

    object-fit: contain;
  }

  .rf-menu-badge {
    padding: .18rem .42rem;

    font-size: .58rem;
  }

  /*
   * Animationen im mobilen Menü deaktivieren.
   * Dadurch gibt es weniger Konflikte beim Öffnen.
   */
  .rf-menu-tile-effect-float .rf-menu-image-wrap,
  .rf-menu-tile-effect-pulse .rf-menu-image-wrap {
    animation: none;
  }

  .rf-menu-tile-effect-slide:hover .rf-menu-image-wrap {
    transform: none;
  }

}


/* =========================================================
   KLEINE SMARTPHONES
   ========================================================= */

@media (max-width: 575.98px) {

  .rf-demo-link {
    min-height: 44px;

    padding: .7rem .8rem;

    font-size: .76rem;

    letter-spacing: .02em;
  }

  .rf-demo-panel,
  .rf-demo-panel--wide {
    padding: .65rem;
  }

  .rf-demo-intro h3 {
    font-size: 1.05rem;
  }

  .rf-demo-intro p,
  .rf-demo-col a {
    font-size: .8rem;
  }

  .rf-product-tile strong {
    font-size: .8rem;
  }

  .rf-product-tile small {
    font-size: .72rem;
  }

}
.rf-menu-image-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 54px;
  margin-bottom: .4rem;
}

.rf-menu-badge {
  display: inline-flex;
  width: max-content;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: rgba(0, 103, 41, .10);
  color: var(--rf-accent-2);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rf-menu-tile-effect-float .rf-menu-image-wrap {
  animation: rfMenuFloat 2.8s ease-in-out infinite;
}

.rf-menu-tile-effect-pulse .rf-menu-image-wrap {
  animation: rfMenuPulse 1.8s ease-in-out infinite;
}

.rf-menu-tile-effect-slide .rf-menu-image-wrap {
  transition: transform .25s ease;
}

.rf-menu-tile-effect-slide:hover .rf-menu-image-wrap {
  transform: translateX(8px);
}

@keyframes rfMenuFloat {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes rfMenuPulse {
  0%, 100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

/* =========================================================
   MOBILE MEGA MENU - FINAL OVERRIDE
   Keep desktop behavior unchanged; mobile opens only via .open.
   ========================================================= */
@media (max-width: 991.98px) {
  .rf-demo-mega {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: .45rem !important;
  }

  .rf-demo-item {
    position: relative !important;
    width: 100% !important;
  }

  .rf-demo-item > .rf-demo-link,
  .rf-demo-item > .rf-demo-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 46px !important;
    padding: .75rem .9rem !important;
    border-radius: 12px !important;
    background: rgba(0, 103, 41, .055) !important;
    font-size: .78rem !important;
    line-height: 1.25 !important;
    letter-spacing: .035em !important;
    white-space: normal !important;
    text-align: left !important;
  }

  .rf-demo-item > .rf-demo-panel,
  .rf-demo-item > .rf-demo-panel--wide,
  .menu-effect-fade .rf-demo-item > .rf-demo-panel,
  .menu-effect-scale .rf-demo-item > .rf-demo-panel,
  .rf-demo-item.hover-open > .rf-demo-panel,
  .rf-demo-item:hover > .rf-demo-panel,
  .rf-demo-item:focus-within > .rf-demo-panel {
    position: static !important;
    inset: auto !important;
    display: none !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: 1fr !important;
    gap: .75rem !important;
    margin: .4rem 0 0 !important;
    padding: .75rem !important;
    border: 1px solid rgba(0, 103, 41, .10) !important;
    border-radius: 14px !important;
    background: #f7faf8 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    overflow: visible !important;
  }

  .rf-demo-item.open > .rf-demo-panel,
  .rf-demo-item.open:hover > .rf-demo-panel,
  .rf-demo-item.open:focus-within > .rf-demo-panel,
  .menu-effect-fade .rf-demo-item.open > .rf-demo-panel,
  .menu-effect-scale .rf-demo-item.open > .rf-demo-panel {
    display: grid !important;
  }

  .rf-demo-item.open > .rf-demo-panel > * {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }

  .rf-demo-product-grid {
    grid-template-columns: 1fr !important;
  }

  .rf-product-tile {
    min-height: 0 !important;
  }
}

/* =========================================================
   DESKTOP MEGA MENU - HOVER DELAY BRIDGE
   Keeps the panel open while the pointer moves from the
   top-level navigation item into the absolutely positioned panel.
   Mobile behavior stays controlled by .open and is untouched.
   ========================================================= */
@media (min-width: 992px) {
  .rf-demo-item.hover-open > .rf-demo-panel,
  .rf-demo-item.hover-open > .rf-demo-panel--wide,
  .menu-effect-fade .rf-demo-item.hover-open > .rf-demo-panel,
  .menu-effect-scale .rf-demo-item.hover-open > .rf-demo-panel {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    pointer-events: auto;
  }
}


/* =========================================================
   PRODUCT GRID – FINAL DESKTOP/MOBILE FIX
   ========================================================= */

.rf-demo-product-grid {
  min-width: 0;
}

.rf-product-tile {
  min-width: 0;

  /*
   * Ganz wichtig:
   * freie Kachelhöhe NICHT auf Badge/Bild/Text verteilen.
   */
  align-content: start;

  /*
   * Jede Grid-Zeile nur so hoch wie ihr echter Inhalt.
   */
  grid-auto-rows: max-content;
}

/* Badge darf niemals zu einem Kreis / hohen Block gestreckt werden */
.rf-product-tile > .rf-menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: max-content;
  max-width: 100%;

  height: auto;
  min-height: 0;

  align-self: start;
  justify-self: start;

  margin: 0;

  padding: .25rem .55rem;

  border-radius: 999px;

  line-height: 1.15;

  white-space: nowrap;
}

/* Bildbereich nicht künstlich aufblasen */
.rf-product-tile > .rf-menu-image-wrap {
  display: flex;

  align-items: center;
  justify-content: flex-start;

  width: 100%;
  max-width: 100%;

  min-width: 0;
  min-height: 54px;

  height: auto;

  margin: 0 0 .15rem;
}

/* Deine Inline-Größe bleibt maßgeblich */
.rf-product-tile > .rf-menu-image-wrap img {
  display: block;

  max-width: 100%;

  object-fit: contain;
}

/*
 * Wichtig für lange Titel wie:
 * Schwerkraftrollen
 * Angetriebene Rollen
 */
.rf-product-tile > strong {
  display: block;

  min-width: 0;
  max-width: 100%;

  white-space: normal;

  overflow: visible;
  text-overflow: clip;

  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;

  line-height: 1.25;
}

/* Beschreibung ebenfalls innerhalb der Kachel halten */
.rf-product-tile > small {
  display: block;

  min-width: 0;
  max-width: 100%;

  white-space: normal;

  overflow-wrap: anywhere;

  line-height: 1.4;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 991.98px) {

  .rf-product-tile {
    /*
     * Auf Mobile hast du Badge + Bild + Text.
     * Deshalb NICHT pauschal alles in auto + 1fr pressen.
     */
    grid-template-columns: 1fr !important;

    align-items: start !important;
    align-content: start !important;

    grid-auto-rows: max-content !important;
  }

  .rf-product-tile > .rf-menu-badge {
    align-self: start;
    justify-self: start;

    height: auto !important;
    min-height: 0 !important;

    padding: .18rem .42rem;

    font-size: .58rem;
  }

  .rf-product-tile > .rf-menu-image-wrap {
    width: 100% !important;

    min-height: 44px !important;
    height: auto !important;

    justify-content: flex-start;
  }

  .rf-product-tile > .rf-menu-image-wrap img {
    display: block;

    width: auto !important;
    height: auto !important;

    max-width: 100% !important;
    max-height: 54px;

    object-fit: contain;
  }

}
