/* ===== PAGE D'ACCUEIL ===== */

.home-main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
}

/* Hero compact */
.home-hero {
    padding: 3rem 4rem 2.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.home-hero-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--primary-color);
    border: 1px solid rgba(255,140,0,0.4);
    padding: 0.28rem 1rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    background: rgba(255,140,0,0.08);
}

.home-hero-title {
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: -2px;
    color: #f0e8d8;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.home-hero-year {
    color: var(--primary-color);
}

.home-hero-subtitle {
    font-size: 0.95rem;
    color: rgba(220,200,165,0.65);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Grille 2×2 */
.home-repertoriu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin: 0 20%;
}

.home-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    position: relative;
}

/* Colonnes de droite (2e et 4e) : pas de border-right */
.home-col:nth-child(2n) {
    border-right: none;
}

/* Colonnes du bas (3e et 4e) : pas de border-bottom */
.home-col:nth-child(3),
.home-col:nth-child(4) {
    border-bottom: none;
}

/* Trait coloré en haut de chaque colonne */
.home-col::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    flex-shrink: 0;
}

.home-col.category-paghjella::before { background: linear-gradient(90deg, #C0392B, transparent 70%); }
.home-col.category-terzettu::before  { background: linear-gradient(90deg, #3498db, transparent 70%); }
.home-col.category-madricalu::before { background: linear-gradient(90deg, #27ae60, transparent 70%); }
.home-col.category-messa::before     { background: linear-gradient(90deg, #8e44ad, transparent 70%); }

/* Header de colonne */
.home-col-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 2rem 1.75rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.home-col-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.category-paghjella .home-col-icon { color: #C0392B; }
.category-terzettu  .home-col-icon { color: #3498db; }
.category-madricalu .home-col-icon { color: #27ae60; }
.category-messa     .home-col-icon { color: #8e44ad; }

.home-col-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.category-paghjella .home-col-title { color: #C0392B; }
.category-terzettu  .home-col-title { color: #3498db; }
.category-madricalu .home-col-title { color: #27ae60; }
.category-messa     .home-col-title { color: #8e44ad; }

.home-col-desc {
    font-size: 0.8rem;
    color: rgba(220,200,165,0.55);
    line-height: 1.6;
    margin: 0;
}

/* Liste des morceaux — grille 2 colonnes */
.home-songs-list {
    overflow-y: auto;
    padding: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
    align-content: start;
    height: 15rem;
    scrollbar-width: none;
    /* Fondu en bas pour signaler le scroll */
    mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
}

.home-songs-list::-webkit-scrollbar {
    display: none;
}

/* Cards morceaux */
.home-song-card {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s, border-color 0.15s;
}

.home-song-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.1);
}

.home-song-play {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.42rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
    transition: transform 0.15s;
}

.home-song-card:hover .home-song-play { transform: scale(1.1); }

.category-paghjella .home-song-play { background: rgba(192,57,43,0.28); color: #e05548; border: 1px solid rgba(192,57,43,0.4); }
.category-terzettu  .home-song-play { background: rgba(52,152,219,0.28); color: #5dade2; border: 1px solid rgba(52,152,219,0.4); }
.category-madricalu .home-song-play { background: rgba(39,174,96,0.28);  color: #52c882; border: 1px solid rgba(39,174,96,0.4); }
.category-messa     .home-song-play { background: rgba(142,68,173,0.28); color: #bb8fce; border: 1px solid rgba(142,68,173,0.4); }

.home-song-info {
    flex: 1;
    min-width: 0;
}

.home-song-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(232,220,200,0.9);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.home-song-meta {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
    margin-top: 0.15rem;
}

.home-song-locu {
    display: inline-flex;
    align-items: center;
    font-size: 0.58rem;
    font-weight: 600;
    color: rgba(220,200,165,0.6);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 0.05rem 0.35rem;
    margin-top: 0.25rem;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.home-song-locu:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(220,200,165,0.9);
}

.home-song-voices {
    display: none;
}

.home-loading,
.home-no-songs {
    color: rgba(255,255,255,0.25);
    font-style: italic;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

/* ===== TOGGLE VUE ===== */

.home-view-toggle {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.home-toggle-btn {
    padding: 0.32rem 1.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(220,200,165,0.4);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.home-toggle-btn:first-child {
    border-radius: 20px 0 0 20px;
    border-right: none;
}

.home-toggle-btn:last-child {
    border-radius: 0 20px 20px 0;
}

.home-toggle-btn.active {
    background: rgba(255,140,0,0.1);
    border-color: rgba(255,140,0,0.4);
    color: var(--primary-color);
}

.home-toggle-btn:not(.active):hover {
    color: rgba(220,200,165,0.75);
    border-color: rgba(255,255,255,0.2);
}

/* ===== VUE PAR LOCHI — CARTE DE LA CORSE ===== */

#lochi-view {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 4rem;
    flex: 1;
}

/* Wrapper image + marqueurs */
.corsica-map-wrapper {
    position: relative;
    display: inline-block;
    height: 68vh;
    max-height: 580px;
}

.corsica-map-img {
    height: 100%;
    width: auto;
    display: block;
    filter: invert(1) drop-shadow(0 0 6px rgba(255,255,255,0.35));
    mix-blend-mode: screen;
}

/* Grille de calibration */
.corsica-map-grid {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.grid-line {
    stroke: rgba(255, 140, 0, 0.25);
    stroke-width: 0.5px;
}

.grid-label {
    fill: rgba(255, 200, 80, 0.7);
    font-size: 9px;
    font-family: monospace;
}

/* Marqueur : anneau + point — positionné en absolu sur l'image */
.locu-marker-group {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.locu-marker-ring {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 140, 0, 0.08);
    border: 1px solid rgba(255, 140, 0, 0.25);
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
}

.locu-marker-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 140, 0, 0.85);
    transition: transform 0.18s, background 0.18s;
}

.locu-marker-group:hover .locu-marker-ring {
    background: rgba(255, 140, 0, 0.18);
    border-color: rgba(255, 140, 0, 0.5);
    transform: scale(1.3);
}

.locu-marker-group:hover .locu-marker-dot {
    background: #ffaa33;
    transform: scale(1.3);
}

/* Tooltip */
.locu-tooltip {
    background: rgba(10, 6, 2, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 140, 0, 0.25);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    min-width: 190px;
    max-width: 260px;
    box-shadow: 0 8px 36px rgba(0, 0, 0, 0.65);
    pointer-events: auto;
}

.locu-tooltip-header {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: rgba(255, 140, 0, 0.9);
    margin-bottom: 0.55rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 140, 0, 0.15);
}

.locu-tooltip-song {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    cursor: pointer;
    transition: background 0.12s;
    border-radius: 6px;
}

.locu-tooltip-song:hover {
    background: rgba(255, 255, 255, 0.05);
}

.locu-tooltip-play {
    font-size: 0.45rem;
    color: rgba(255, 140, 0, 0.55);
    flex-shrink: 0;
    padding: 0 0.25rem;
}

.locu-tooltip-song-info {
    flex: 1;
    min-width: 0;
}

.locu-tooltip-title {
    font-size: 0.82rem;
    color: rgba(232, 220, 200, 0.9);
    font-weight: 600;
    line-height: 1.3;
}

/* Couleurs catégorie dans le tooltip */
.locu-tooltip-song.category-paghjella .locu-tooltip-play { color: rgba(192, 57, 43, 0.8); }
.locu-tooltip-song.category-terzettu  .locu-tooltip-play { color: rgba(52, 152, 219, 0.8); }
.locu-tooltip-song.category-madricalu .locu-tooltip-play { color: rgba(39, 174, 96, 0.8); }
.locu-tooltip-song.category-messa     .locu-tooltip-play { color: rgba(142, 68, 173, 0.8); }

.locu-tooltip-song.category-paghjella:hover { background: rgba(192, 57, 43, 0.08); }
.locu-tooltip-song.category-terzettu:hover  { background: rgba(52, 152, 219, 0.08); }
.locu-tooltip-song.category-madricalu:hover { background: rgba(39, 174, 96, 0.08); }
.locu-tooltip-song.category-messa:hover     { background: rgba(142, 68, 173, 0.08); }

.locu-tooltip-meta {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 0.1rem;
}

/* ===== MOBILE (≤ 768px) — ÉCRAN D'ACCUEIL DÉDIÉ ===== */

@media (max-width: 768px) {

    /* ── Hero identique au desktop, prend sa place ── */
    .home-hero {
        padding: 2.5rem 2rem 2rem;
    }

    /* ── Toggle masqué ── */
    .home-view-toggle {
        display: none;
    }

    /* ── Grille 2×2, hauteur naturelle — pas de 1fr (évite l'espace vide) ── */
    .home-repertoriu {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        margin: 0;
    }

    /* ── Cellules ── */
    .home-col {
        display: flex;
        flex-direction: column;
        border-right: 1px solid rgba(255,255,255,0.12);
        border-bottom: 1px solid rgba(255,255,255,0.12);
        overflow: hidden;
    }
    .home-col:nth-child(2n) { border-right: none; }
    .home-col:nth-child(3),
    .home-col:nth-child(4) { border-bottom: none; }

    /* ── Header catégorie : centré, tappable ── */
    .home-col-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.85rem 0.5rem 0.65rem;
        gap: 0.25rem;
        border-bottom: 1px solid rgba(255,255,255,0.07);
        flex-shrink: 0;
        min-height: 44px;
    }

    .home-col-icon {
        font-size: 1.5rem;
        margin-top: 0;
    }

    .home-col-title {
        font-size: 0.9rem;
        margin-bottom: 0;
    }

    .home-col-desc {
        display: none;
    }

    /* ── 2 morceaux nets + 1 masqué ── */
    .home-songs-list {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 10.5rem;
        overflow: hidden;
        padding: 0.35rem;
        gap: 0.18rem;
        mask-image: linear-gradient(to bottom, black 63%, transparent 95%);
        -webkit-mask-image: linear-gradient(to bottom, black 63%, transparent 95%);
    }

    /* ── Cards touch-friendly ── */
    .home-song-card {
        padding: 0.5rem 0.45rem;
        min-height: 44px;
        align-items: center;
        gap: 0.35rem;
    }

    .home-song-play {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .home-song-title {
        font-size: 0.72rem;
    }

    .home-song-meta {
        font-size: 0.6rem;
    }

    .home-song-locu {
        display: none;
    }
}

/* ===== PWA STANDALONE — safe areas iPhone ===== */

@media (display-mode: standalone) {
    /* Espace pour le notch/Dynamic Island */
    header {
        padding-top: env(safe-area-inset-top, 0px);
    }
    /* Espace pour la barre d'accueil iPhone */
    body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    /* Pas de footer dans l'app */
    footer {
        display: none;
    }
}
