/**
 * Homepage Layout - Nowy, prosty layout na Flex/Grid
 * Tylko dla strony głównej - ignoruje legacy CSS
 */

/* ============================================
   RESET DLA STRONY GŁÓWNEJ
   ============================================ */

#teaser {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ============================================
   SEKCJE - Flexbox Layout
   ============================================ */

.home-section {
    margin-bottom: 48px;
}

.home-section h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.home-section h2 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.home-section h2 a:hover {
    color: #4CAF50;
}

/* ============================================
   NEWSY - Nowoczesne karty (Petapixel style)
   ============================================ */

.home-news {
    margin-bottom: 32px;
    /* Wycentrowany kontener */
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
}

.home-news h2 {
    margin-bottom: 20px;
}

/* Nowoczesne karty newsów */
.ff-news {
    max-width: 1200px;
    margin: 0 auto 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ff-news__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #33363b;
    text-decoration: none;
    color: #f5f5f5;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease-out,
                box-shadow 0.15s ease-out,
                background 0.15s ease-out;
}

.ff-news__item:hover {
    background: #3c4046;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
    text-decoration: none;
    color: #f5f5f5;
}

.ff-news__icon {
    flex: 0 0 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.ff-news__content {
    flex: 1 1 auto;
}

.ff-news__meta {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #b0b6c0;
    margin-bottom: 3px;
}

.ff-news__dot {
    margin: 0 4px;
}

.ff-news__title {
    font-size: 14px;
    margin: 0 0 4px;
    color: #ffffff;
    font-weight: 600;
    line-height: 1.4;
}

.ff-news__lead {
    font-size: 12px;
    margin: 0;
    color: #d4d7dd;
    line-height: 1.45;
    max-height: 3.0em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Responsive dla newsów */
@media (max-width: 768px) {
    .ff-news {
        gap: 8px;
    }
    
    .ff-news__item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .ff-news__icon {
        flex: 0 0 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .ff-news__title {
        font-size: 13px;
    }
    
    .ff-news__lead {
        font-size: 11px;
    }
}

/* Upewnij się, że li też jest widoczny */
.home-news #news-wrapper .newsticker li,
.home-news #newsticker_1 li,
.home-news .newsticker li {
    opacity: 1 !important;
    visibility: visible !important;
    display: list-item !important;
}

/* ============================================
   SPOTLIGHT SLIDER - Pełna szerokość
   ============================================ */

.spotlight-swiper-wrapper {
    margin-bottom: 48px;
    border-radius: 12px;
    overflow: hidden;
}

/* ============================================
   GALERIE - Nowoczesne kafelki (Pinterest/500px style)
   ============================================ */

/* Grid container */
.home-gallery,
.ff-gallery-grid {
    display: grid;
    gap: 16px;
    margin-top: 20px;
    width: 100%;
}

/* Responsive columns */
@media (min-width: 1200px) {
    .home-gallery,
    .ff-gallery-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 kolumny na dużych ekranach */
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .home-gallery,
    .ff-gallery-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 kolumny na tabletach */
    }
}

@media (max-width: 767px) {
    .home-gallery,
    .ff-gallery-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 kolumny na mobile */
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .home-gallery,
    .ff-gallery-grid {
        grid-template-columns: 1fr; /* 1 kolumna na małych mobile */
        gap: 10px;
    }
}

/* Kafelek (card) */
.home-gallery .ff-card,
.ff-card {
    display: block;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 3 / 2; /* Proporcje 3:2 */
    text-decoration: none;
    cursor: pointer;
}

.home-gallery .ff-card:hover,
.ff-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Obrazek w kafelku */
.home-gallery .ff-card__img,
.ff-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.home-gallery .ff-card:hover .ff-card__img,
.ff-card:hover .ff-card__img {
    transform: scale(1.05);
}

/* Badge (gwiazdka) w prawym górnym rogu */
.home-gallery .ff-card__badge,
.ff-card__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #FFD700;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Legacy support - ukryj stare elementy */
.home-gallery .photo {
    display: none;
}

.home-gallery .photo.ff-card {
    display: block;
}

/* Ukryj wszystkie dodatkowe elementy - tylko miniaturki */
.home-gallery .photo .title,
.home-gallery .photo .date,
.home-gallery .photo .stats,
.ff-card .title,
.ff-card .date,
.ff-card .stats {
    display: none !important;
}

.home-gallery .photo .stats {
    padding: 0 12px 12px;
    margin: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.4;
}

/* Małe ikony w stats */
.home-gallery .photo .stats img {
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain !important;
}

.home-gallery .photo .stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.home-gallery .photo .stats a {
    color: inherit;
    text-decoration: none;
    margin-right: 4px;
}

/* Wyklucz badge z stats (badge jest w photo-link) */
.home-gallery .photo .stats img.badge {
    display: none !important;
}

/* Ukryj ikonę i liczbę analiz (critiques) */
.home-gallery .photo .stats img[src*="critiques.gif"],
.home-gallery .photo .stats img[alt*="analiz"],
.home-gallery .photo .stats img[title*="analiz"] {
    display: none !important;
}

/* Ukryj span z liczbą critiques (poprzedza img critiques.gif) - dla nowoczesnych przeglądarek */
.home-gallery .photo .stats span:has(+ img[src*="critiques.gif"]) {
    display: none !important;
}

/* Ukryj ikonę i liczbę komentarzy (comments) */
.home-gallery .photo .stats img[src*="comments.gif"],
.home-gallery .photo .stats img[alt*="kom"],
.home-gallery .photo .stats img[title*="kom"] {
    display: none !important;
}

/* Ukryj span z liczbą komentarzy (poprzedza img comments.gif) */
.home-gallery .photo .stats span:has(+ img[src*="comments.gif"]) {
    display: none !important;
}

/* Fallback: ukryj wszystkie span w stats, potem pokaż tylko views */
@supports not selector(:has(*)) {
    .home-gallery .photo .stats span {
        display: none !important;
    }
    .home-gallery .photo .stats span:first-of-type {
        display: inline-flex !important;
    }
}

.home-gallery .photo .date {
    padding: 0 12px;
    margin: 0 0 8px 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   HIGH RANKED / HIGH STATS - Flexbox Grid
   ============================================ */

.home-users {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 16px;
    margin-top: 20px;
    width: 100%;
}

.home-users a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.home-users a:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.home-users .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin-bottom: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.home-users .label {
    font-size: 13px;
    color: #fff;
    text-align: center;
    margin-bottom: 4px;
}

.home-users span:last-child {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

/* Responsive dla home-users - 7 kolumn na desktop */
@media (max-width: 1400px) {
    .home-users {
        grid-template-columns: repeat(7, 1fr) !important;
    }
}

@media (max-width: 1200px) {
    .home-users {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .home-users {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .home-users {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   RECOMMENDED PORTFOLIOS - Grid avatary
   ============================================ */

#ports {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

#ports a {
    display: block;
    border-radius: 50%;
    overflow: hidden;
    transition: transform 0.2s ease;
}

#ports a:hover {
    transform: scale(1.1);
}

#ports img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 50%;
}

/* ============================================
   REKLAMY - Wyśrodkowane
   ============================================ */

.advert-wrapper {
    margin: 32px 0;
    text-align: center;
}

/* ============================================
   RESPONSIVE - Mobile First
   ============================================ */

@media (max-width: 768px) {
    #teaser {
        padding: 16px 12px;
    }

    .home-section {
        margin-bottom: 32px;
    }

    .home-section h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .home-users {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 12px;
    }

    #ports {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .home-users {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   OVERRIDE LEGACY STYLES - Tylko dla #teaser
   ============================================ */

#teaser .section {
    display: contents; /* Usuwa legacy flex/float */
}

#teaser .section.high_ranked {
    display: contents;
}

#teaser .section.high_ranked a {
    display: contents; /* Reset dla home-users */
}

#teaser .clear,
#teaser .clearfix {
    display: none !important;
}

/* ============================================
   DECOR CLASS - Nowy styl
   ============================================ */

#teaser h2.decor {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

/* ============================================
   GALLERY WRAPPER - Nowy wrapper
   ============================================ */

.home-gallery-wrapper {
    display: contents;
}

