/* Firefox-spezifische Performance-Optimierungen */

/* Optimiere Font-Rendering für Firefox */
html {
    /* Besseres Antialiasing */
    -moz-osx-font-smoothing: grayscale;
}

body {
    /* Kein künstliches Verstecken - Browser optimiert selbst */
    /* font-display in @font-face steuert das Verhalten */
}

/* Verhindere Layout-Shifts während Font-Loading */
body {
    /* Fallback-Font mit ähnlicher Metrik wie Custom-Font */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Custom-Font kommt später ohne sichtbaren Shift */
body.fonts-loaded {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Content-Visibility für Off-Screen-Elemente (Firefox 108+) */
.forum-post:not(:first-child),
.server-card:nth-child(n+7),
.news-article:nth-child(n+4) {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* Optimiere Transitions für Firefox - WENIGER ist MEHR */
/* will-change kann Flackern verursachen, nur wo wirklich nötig */

/* Reduziere Repaints durch containment */
.site-header {
    contain: layout style;
}

.site-footer {
    contain: layout style;
}

/* Optimiere Scrolling-Performance */
.forum-content,
.server-list,
.news-feed {
    /* Lass Firefox selbst entscheiden - translateZ(0) kann Flackern verursachen */
    /* Moderne Browser optimieren automatisch */
}

/* Verhindere Layout-Shift durch Bilder */
img {
    /* Reserviere Platz für Bilder */
    max-width: 100%;
    height: auto;
}

/* Setze aspect-ratio für Bilder ohne explizite Dimensionen */
img[width][height] {
    aspect-ratio: attr(width) / attr(height);
}

/* Hero und Header Sections: Reserviere Mindesthöhe */
.hero-section,
.forum-hero,
.news-header,
.server-header {
    min-height: 400px;
    contain: layout style;
}

/* Lazy-Loading für Bilder */
img[loading="lazy"] {
    content-visibility: auto;
}

/* Reduziere Paint-Komplexität */
.hero-section::before,
.forum-hero::before {
    /* Kein will-change - verursacht Flackern in Firefox */
}

/* Optimiere Animationen */
@media (prefers-reduced-motion: no-preference) {
    .btn-bg,
    .card,
    nav a {
        /* Nutze nur transform und opacity für Animationen */
        transition-property: transform, opacity;
        transition-duration: 0.2s;
        transition-timing-function: ease-out;
    }
}

/* Deaktiviere Animationen bei Nutzereinstellung */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Firefox-spezifische Scrollbar-Optimierung */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.5) rgba(0, 0, 0, 0.2);
}

/* Optimiere CSS Grid und Flexbox Rendering */
.forum-content,
.server-grid,
.news-grid {
    /* Verhindere Layout-Shifts */
    contain: layout;
}

/* Kritische Rendering-Optimierung */
@supports (content-visibility: auto) {
    /* Nutze content-visibility für bessere Performance */
    .forum-post,
    .server-card,
    .news-article {
        content-visibility: auto;
    }
}

/* Optimiere z-index Stacking */
.site-header {
    z-index: 1000;
    isolation: isolate;
}

.mobile-menu-overlay {
    z-index: 2000;
    isolation: isolate;
}

/* KEINE künstlichen Compositing-Layers - Firefox macht das selbst besser */
/* will-change und translateZ(0) können Flackern verursachen */
