/* =============================================
   STRONA GŁÓWNA — układ premium (Spotify-class)
   Mobile: mniejsze elementy, brak poziomego „skakania” strony
   ============================================= */

/* Lista utworów ze stroną główną nie może rozpychać layoutu w poziomie */
#listaUtworow:has(.home-page-root) {
    overflow-x: hidden;
    min-width: 0;
    max-width: 100%;
    background-color: #0a0a0a;
}

/* Jednolite ciemne tło całej kolumny głównej na stronie głównej (nagłówek „Strona główna” + lista) */
.glowna-zawartosc:has(#listaUtworow .home-page-root) {
    background-color: #0a0a0a;
}

.glowna-zawartosc:has(#listaUtworow .home-page-root)::before,
.glowna-zawartosc:has(#listaUtworow .home-page-root)::after {
    opacity: 0.14;
}

.playlista:has(#listaUtworow .home-page-root) {
    background-color: #0a0a0a;
}

.home-page-root {
    min-height: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    padding-bottom: 120px;
    box-sizing: border-box;
}

/* --- Treść --- */
.home-scroll {
    padding: 16px clamp(16px, 3vw, 32px) 32px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
    max-width: min(1400px, 100%);
    box-sizing: border-box;
}

.home-section-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    padding: 0 4px;
    min-width: 0;
}

.home-section-head--grid {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.home-section-head h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    min-width: 0;
    word-break: break-word;
}

.home-section-hint {
    font-size: 0.8rem;
    color: #8c8c8c;
    font-weight: 500;
    min-width: 0;
    word-break: break-word;
}

/* --- Horizontal strips --- */
.home-strip-section {
    margin-bottom: 36px;
    min-width: 0;
    max-width: 100%;
}

.home-strip {
    display: flex;
    gap: 16px;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0 16px;
    margin: 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
}

.home-strip::-webkit-scrollbar {
    height: 6px;
}

.home-strip::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

.home-strip--compact .home-pl-card--strip {
    min-width: 140px;
    max-width: 160px;
}

/* --- Cards --- */
.home-pl-card {
    scroll-snap-align: start;
    flex-shrink: 0;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease, opacity 0.2s ease;
    min-width: 0;
}

.home-pl-card:focus {
    outline: 2px solid #1db954;
    outline-offset: 3px;
}

.home-pl-card:focus:not(:focus-visible) {
    outline: none;
}

.home-pl-card:focus-visible {
    outline: 2px solid #1db954;
    outline-offset: 3px;
}

.home-pl-card:hover,
.home-pl-card:focus-visible {
    transform: translateY(-3px);
}

.home-pl-card--strip {
    min-width: 160px;
    max-width: 180px;
    width: 28vw;
}

.home-pl-card__cover {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.home-pl-card:hover .home-pl-card__cover,
.home-pl-card:focus-visible .home-pl-card__cover {
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.home-pl-card__shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.18) 0%, transparent 48%);
    pointer-events: none;
}

.home-pl-play {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1db954;
    color: #000;
    cursor: pointer;
    touch-action: manipulation;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(6px) scale(0.92);
    transition: opacity 0.2s ease, transform 0.22s ease, background 0.15s ease;
    z-index: 2;
}

.home-pl-play:hover {
    background: #1ed760;
    transform: translateY(0) scale(1.02);
}

.home-pl-card:hover .home-pl-play,
.home-pl-card:focus-within .home-pl-play {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.home-pl-card__body {
    margin-top: 12px;
    padding: 0 2px;
    min-width: 0;
}

.home-pl-card__title {
    margin: 0 0 4px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.home-pl-card__meta {
    margin: 0;
    font-size: 0.78rem;
    color: #a7a7a7;
    font-weight: 500;
}

/* --- Grid --- */
.home-grid-section {
    margin-top: 8px;
    min-width: 0;
    max-width: 100%;
}

.home-playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px 16px;
    padding: 4px 0 24px;
    min-width: 0;
}

.home-pl-card--grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.home-pl-card--grid .home-pl-card__cover {
    border-radius: 8px;
}

.home-pl-card--grid .home-pl-play {
    width: 42px;
    height: 42px;
    right: 8px;
    bottom: 8px;
}

.home-pl-card--grid .home-pl-card__title {
    font-size: 0.88rem;
}

/* Touch: zawsze widoczny przycisk odtwarzania */
@media (hover: none) {
    .home-pl-play {
        opacity: 0.92;
        transform: translateY(0) scale(1);
    }

    .home-pl-card:hover,
    .home-pl-card:focus-visible {
        transform: none;
    }
}

.home-empty {
    padding: 48px 24px;
    text-align: center;
    color: #8c8c8c;
    font-size: 0.95rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    max-width: 100%;
}

/* Legacy (np. stare cache) — bez zmian nazw klas */
.home-page-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    height: 100%;
    overflow-y: auto;
    padding-bottom: 120px;
}

/* ========== Tablet / mobile ========== */
@media (max-width: 768px) {
    .home-page-root {
        padding-bottom: 92px;
    }

    .home-scroll {
        padding: 8px 8px 18px;
    }

    .home-section-head {
        margin-bottom: 8px;
        padding: 0 1px;
    }

    .home-section-head h2 {
        font-size: 0.98rem;
    }

    .home-section-hint {
        font-size: 0.62rem;
        line-height: 1.3;
    }

    .home-strip-section {
        margin-bottom: 18px;
    }

    .home-strip {
        gap: 6px;
        padding: 2px 0 8px;
    }

    .home-strip--compact .home-pl-card--strip {
        min-width: 78px;
        max-width: 92px;
        width: 24vw;
    }

    .home-pl-card--strip {
        min-width: 86px;
        max-width: 100px;
        width: 27vw;
    }

    .home-pl-card__cover {
        border-radius: 7px;
    }

    .home-pl-play {
        width: 28px;
        height: 28px;
        right: 4px;
        bottom: 4px;
    }

    .home-pl-play svg {
        width: 12px;
        height: 12px;
    }

    .home-pl-card__body {
        margin-top: 5px;
    }

    .home-pl-card__title {
        font-size: 0.66rem;
        -webkit-line-clamp: 2;
    }

    .home-pl-card__meta {
        font-size: 0.56rem;
    }

    .home-playlist-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 6px;
        padding: 0 0 14px;
    }

    .home-pl-card--grid .home-pl-play {
        width: 26px;
        height: 26px;
        right: 4px;
        bottom: 4px;
    }

    .home-pl-card--grid .home-pl-card__title {
        font-size: 0.64rem;
    }

    .home-pl-card:focus,
    .home-pl-card:focus-visible {
        outline-offset: 1px;
    }

    .home-empty {
        padding: 22px 12px;
        font-size: 0.76rem;
    }
}

@media (max-width: 480px) {
    .home-scroll {
        padding: 6px 6px 16px;
    }

    .home-section-head h2 {
        font-size: 0.9rem;
    }

    .home-section-hint {
        font-size: 0.58rem;
    }

    .home-strip {
        gap: 5px;
        padding: 2px 0 6px;
    }

    .home-strip--compact .home-pl-card--strip {
        min-width: 70px;
        max-width: 84px;
        width: 25vw;
    }

    .home-pl-card--strip {
        min-width: 76px;
        max-width: 92px;
        width: 28vw;
    }

    .home-pl-play {
        width: 24px;
        height: 24px;
        right: 3px;
        bottom: 3px;
    }

    .home-pl-play svg {
        width: 10px;
        height: 10px;
    }

    .home-pl-card__title {
        font-size: 0.62rem;
    }

    .home-pl-card__meta {
        font-size: 0.52rem;
    }

    .home-playlist-grid {
        gap: 6px 5px;
    }

    .home-pl-card--grid .home-pl-play {
        width: 22px;
        height: 22px;
        right: 3px;
        bottom: 3px;
    }

    .home-pl-card--grid .home-pl-card__title {
        font-size: 0.6rem;
    }

    .home-strip-section {
        margin-bottom: 14px;
    }
}

@media (max-width: 360px) {
    .home-pl-card--strip {
        min-width: 70px;
        max-width: 82px;
    }

    .home-strip--compact .home-pl-card--strip {
        min-width: 64px;
        max-width: 76px;
    }

    .home-section-head h2 {
        font-size: 0.86rem;
    }
}
