/* Thalassothérapie – style.css (v3.0 — re-skin delattre.ch, monochrome + accent vert) */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
    --ink: #111111; /* texte / traits principaux            */
    --ink-2: #9a9a9a; /* texte secondaire                     */
    --ink-3: #c4c4c4; /* texte tertiaire / index de liste     */
    --line: #dcdcdc; /* traits inactifs                      */
    --sep: #f2f2f2; /* séparateurs de liste                 */
    --sep-strong: #ececec; /* séparateur de section                */
    --accent: #60e08f; /* vert unique (lecture, actif, hover)  */
    --hover-bg: #fafafa; /* hover de rangée                      */
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family:
        "Lexend",
        ui-sans-serif,
        system-ui,
        -apple-system,
        sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    background: #ffffff;
    color: var(--ink);
}

button {
    font-family: inherit;
}

a {
    color: var(--ink);
    text-decoration: none;
}
a:hover {
    color: var(--accent);
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}
@keyframes eq1 {
    0%,
    100% {
        transform: scaleY(0.3);
    }
    50% {
        transform: scaleY(1);
    }
}
@keyframes eq2 {
    0%,
    100% {
        transform: scaleY(0.9);
    }
    40% {
        transform: scaleY(0.35);
    }
}
@keyframes eq3 {
    0%,
    100% {
        transform: scaleY(0.5);
    }
    60% {
        transform: scaleY(1);
    }
}
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}
@keyframes btnspin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 30px;
}
.home-link {
    display: flex;
    align-items: center;
    color: var(--ink);
    padding: 11px;
    margin: -11px;
}
.home-link:hover {
    color: var(--accent);
}
.menu-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 17px 13px;
    margin: -17px -13px;
    color: var(--ink);
    cursor: pointer;
}
.menu-btn:hover {
    color: var(--accent);
}
.menu-btn span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: currentColor;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout {
    flex: 1;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 40px 32px 80px;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 80px;
    align-items: start;
    align-content: start;
}

/* ── Colonne player ──────────────────────────────────────────────────────── */
.player {
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    gap: 36px;
    min-width: 0;
}

.brand {
    margin: 0;
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cursor {
    display: inline-block;
    width: 3px;
    height: 26px;
    background: var(--accent);
    animation: blink 1s ease-in-out infinite;
}

/* Toggle de mode (segmented control) */
.mode-toggle {
    display: inline-flex;
    align-self: flex-start;
    border: 1px solid var(--ink);
    height: 42px;
}
.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 20px;
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 0.01em;
    color: var(--ink-2);
}
.mode-btn:hover {
    color: var(--ink);
}
.mode-btn[aria-selected="true"] {
    color: var(--ink);
    font-weight: 500;
}
.mode-cursor {
    display: inline-block;
    width: 3px;
    height: 14px;
    background: transparent;
}
.mode-btn[aria-selected="true"] .mode-cursor {
    background: var(--accent);
    animation: blink 1s ease-in-out infinite;
}
.mode-sep {
    width: 1px;
    background: var(--ink);
}

/* Bloc en lecture */
.now {
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.22s ease;
}
.now.fade {
    opacity: 0;
}
.np-status {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 8px;
}
.np-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line);
}
body.playing .np-dot {
    background: var(--accent);
    animation: blink 1.6s ease-in-out infinite;
}
.np-title {
    font-size: 21px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.np-sub {
    font-size: 13px;
    font-weight: 300;
    color: var(--ink-2);
}

/* Waveform scrubbable */
.wave-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wave-scrub {
    position: relative;
    height: 52px;
}
.wave {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2px;
    height: 52px;
}
.wave i {
    width: 2px;
    flex-shrink: 0;
    border-radius: 1px;
    background: var(--line);
    transition: background 0.2s;
}
.wave i.played {
    background: var(--accent);
}
/* Input range accessible superposé (invisible, clavier + tactile) */
#seek {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.wave-scrub:has(#seek:focus-visible) {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
}
.times {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 300;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}
.times #cur {
    color: var(--ink);
}

/* Contrôles */
.ctrl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.ctl {
    background: none;
    border: none;
    padding: 10px;
    margin: -6px;
    cursor: pointer;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ctl:hover {
    color: var(--accent);
}
.ctl.toggle.on {
    color: var(--accent);
}
.play-btn {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border: 1px solid var(--ink);
    border-radius: 50%;
    background: none;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.play-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
body.playing .play-btn {
    border-color: var(--accent);
    color: var(--accent);
}
.play-btn .icon-play {
    margin-left: 2px;
}

/* Buffering : anneau discret sur le bouton play */
.play-btn.buffering svg {
    opacity: 0;
}
.play-btn.buffering {
    position: relative;
    pointer-events: none;
}
.play-btn.buffering::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    border-top-color: var(--accent);
    animation: btnspin 0.7s linear infinite;
}

/* Volume */
.vol {
    display: flex;
    align-items: center;
    gap: 14px;
}
.vol-hint {
    font-size: 12px;
    font-weight: 300;
    color: var(--ink-2);
}
#vol {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 24px;
    margin: 0;
    background: transparent;
    cursor: pointer;
}
#vol::-webkit-slider-runnable-track {
    height: 1px;
    background: linear-gradient(
        to right,
        var(--ink) var(--fill, 100%),
        var(--line) var(--fill, 100%)
    );
}
#vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    margin-top: -4.5px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    background: #ffffff;
}
#vol::-moz-range-track {
    height: 1px;
    background: linear-gradient(
        to right,
        var(--ink) var(--fill, 100%),
        var(--line) var(--fill, 100%)
    );
}
#vol::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    background: #ffffff;
}

/* ── Colonne liste ───────────────────────────────────────────────────────── */
.listing {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}
.list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--ink);
    padding-bottom: 14px;
}
.list-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
}
.track-count {
    font-size: 12px;
    font-weight: 300;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

/* Filtres sources (chips) */
.sources {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.sources-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-2);
    margin-right: 4px;
}
.chips {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 12px;
    background: none;
    border: 1px solid var(--line);
    cursor: pointer;
    font-size: 12px;
    font-weight: 300;
    color: #b0b0b0;
}
/* Zone tactile élargie (invisible) */
.chip::after {
    content: "";
    position: absolute;
    inset: -8px -2px;
}
.chip:hover {
    border-color: var(--accent);
}
.chip[aria-pressed="true"] {
    border-color: var(--ink);
    color: var(--ink);
}
.chip-box {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 1px solid var(--ink-3);
    background: transparent;
}
.chip[aria-pressed="true"] .chip-box {
    border-color: var(--accent);
    background: var(--accent);
}
.chip-count {
    font-size: 10px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] .chip-count {
    color: var(--ink-2);
}

/* Liste des pistes */
.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: 45vh;
    overflow: scroll;
}
.track {
    border-bottom: 1px solid var(--sep);
}
.row {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 13px 10px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.row:hover {
    background: var(--hover-bg);
}
.track.active .row {
    box-shadow: inset 2px 0 0 var(--accent);
}

.row-lead {
    width: 26px;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-start;
    font-size: 12px;
    font-weight: 300;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}
.row-eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}
.row-eq i {
    display: inline-block;
    width: 2px;
    height: 12px;
    background: var(--accent);
    transform-origin: bottom;
    transform: scaleY(0.4);
}
.track.active .row-num {
    display: none;
}
.track.active .row-eq {
    display: flex;
}
body.playing .track.active .row-eq i:nth-child(1) {
    animation: eq1 0.9s ease-in-out infinite;
}
body.playing .track.active .row-eq i:nth-child(2) {
    animation: eq2 1.1s ease-in-out infinite;
}
body.playing .track.active .row-eq i:nth-child(3) {
    animation: eq3 0.7s ease-in-out infinite;
}

.row-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.row-t {
    font-size: 14px;
    font-weight: 400;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track.active .row-t {
    color: var(--accent);
    font-weight: 500;
}
.row-s {
    font-size: 12px;
    font-weight: 300;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.row-dur {
    font-size: 12px;
    font-weight: 300;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Skeleton loader */
.track.skeleton {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 13px 10px;
    pointer-events: none;
}
.skel {
    background: linear-gradient(
        90deg,
        var(--sep) 25%,
        var(--hover-bg) 50%,
        var(--sep) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}
.skel-num {
    width: 26px;
    height: 12px;
    flex-shrink: 0;
}
.skel-title {
    width: 68%;
    height: 13px;
    margin-bottom: 8px;
}
.skel-sub {
    width: 38%;
    height: 11px;
}

/* Message statut / erreur */
.status-msg {
    padding: 12px 0;
    font-size: 13px;
    font-weight: 300;
    color: var(--ink-2);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
    padding: 24px 30px;
    font-size: 11px;
    font-weight: 300;
    color: var(--ink-3);
    text-align: center;
}

/* ── Focus visible (clavier) ─────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .site-header {
        padding: 18px 20px;
    }
    .layout {
        grid-template-columns: 1fr; /* 1 colonne : player d'abord, liste dessous */
        gap: 48px;
        padding: 24px 20px 64px;
    }
    .player {
        position: static; /* plus de sticky sous le breakpoint */
        gap: 28px;
    }
    .footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 16px 16px;
    }
    .layout {
        gap: 40px;
        padding: 20px 16px 56px;
    }
    .player {
        gap: 24px;
    }
    .brand {
        font-size: 24px;
    }
    .cursor {
        height: 24px;
    }
    .mode-btn {
        padding: 0 14px;
    }
}

/* Cibles tactiles ≥ 44px (recommandation Apple / WCAG) */
@media (pointer: coarse) {
    .ctl {
        padding: 13px;
        margin: -9px;
    }
    .mode-toggle {
        height: 44px;
    }
    #vol {
        height: 44px;
    }
    #vol::-webkit-slider-thumb {
        margin-top: -4.5px;
    }
}

/* ── Préférence « réduire les animations » ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .cursor,
    .mode-btn[aria-selected="true"] .mode-cursor,
    body.playing .np-dot {
        animation: none !important;
        opacity: 1;
    }
    body.playing .track.active .row-eq i {
        animation: none !important;
        transform: scaleY(0.4);
    }
    .skel {
        animation: none !important;
    }
    .play-btn.buffering::after {
        animation-duration: 1.4s;
    }
    .wave i {
        transition: none;
    }
    * {
        scroll-behavior: auto !important;
    }
}
