/*
 * Smart Background Sound v0.9.15 - smartbackgroundsound.css
 * (C) 2026 A YOOzeCase Company. All rights reserved.
 *
 * Zelf-stylende toggle-knop via modifier-classes (yc-music-toggle--*).
 * v0.9.9: centrale design tokens (YC 7A), responsive breakpoints
 * 1024/640/420, tap-target >= 44px op touch (YC 7F), donker thema naar
 * 4.5:1 contrast op lichte achtergronden. Label-weergaven
 * (inline/onder/tooltip/hover-pill/uitklap-omlaag), aangepaste
 * X/Y-positie (inline door JS), accent-kleur (CSS-var door JS) en
 * entree-animaties. Overschrijfbaar via YOOtheme Customizer custom CSS.
 */

/* ---- Centrale design tokens (YC 7A) --------------------------------------
 * Gedefinieerd op de wrapper zodat alle componenten ze erven. Het
 * component-niveau (--yc-music-btn-*) consumeert deze tokens en blijft
 * het hook-punt voor de JS-accentkleur en Customizer-overrides. De
 * knop draagt de tokens ook zelf: bij smaak 3/4 mount de JS hem in de
 * sectie-container, buiten het .yc-music element. */
.yc-music,
.yc-music-toggle {
    /* Maten */
    --yc-music-size-small:  24px;
    --yc-music-size-medium: 32px;
    --yc-music-size-large:  44px;
    --yc-music-tap-min:     44px;

    /* Spacing */
    --yc-music-space-xs: 3px;
    --yc-music-space-sm: 6px;
    --yc-music-space-md: 10px;
    --yc-music-space-lg: 14px;

    /* Radius */
    --yc-music-radius-pill: 999px;
    --yc-music-radius-card: 16px;
    --yc-music-radius-tip:  8px;

    /* Licht thema */
    --yc-music-light-bg:           rgba(255, 255, 255, 0.94);
    --yc-music-light-bg-hover:     rgb(255, 255, 255);
    --yc-music-light-color:        #222222;
    --yc-music-light-color-active: #000000;
    --yc-music-light-border:       rgba(0, 0, 0, 0.18);
    --yc-music-light-wave:         rgba(0, 0, 0, 0.35);
    --yc-music-light-pulse:        rgba(0, 0, 0, 0.22);
    --yc-music-shadow:             0 2px 6px rgba(0, 0, 0, 0.12);

    /* Donker thema (bg 0.65 i.p.v. 0.55: labeltekst haalt zo >= 4.5:1
     * op een volledig witte onderliggende achtergrond, YC 7F) */
    --yc-music-dark-bg:            rgba(0, 0, 0, 0.65);
    --yc-music-dark-bg-hover:      rgba(0, 0, 0, 0.82);
    --yc-music-dark-color:         #f5f5f5;
    --yc-music-dark-color-active:  #ffffff;
    --yc-music-dark-border:        rgba(255, 255, 255, 0.22);
    --yc-music-dark-wave:          rgba(255, 255, 255, 0.45);
    --yc-music-dark-pulse:         rgba(255, 255, 255, 0.3);
    --yc-music-shadow-dark:        0 2px 6px rgba(0, 0, 0, 0.4);
}

.yc-music { position: relative; }
.yc-music-host { position: relative; }

/* ---- Knop: basis + zelf-stylende defaults (licht) ------------------------ */
.yc-music-toggle {
    --yc-music-btn-size: var(--yc-music-size-medium, 32px);
    --yc-music-btn-bg: var(--yc-music-light-bg, rgba(255, 255, 255, 0.94));
    --yc-music-btn-bg-hover: var(--yc-music-light-bg-hover, rgb(255, 255, 255));
    --yc-music-btn-color: var(--yc-music-light-color, #222);
    --yc-music-btn-color-active: var(--yc-music-light-color-active, #000);
    --yc-music-btn-border: 1px solid var(--yc-music-light-border, rgba(0, 0, 0, 0.18));
    --yc-music-btn-shadow: var(--yc-music-shadow, 0 2px 6px rgba(0, 0, 0, 0.12));
    --yc-music-wave-color: var(--yc-music-light-wave, rgba(0, 0, 0, 0.35));
    --yc-music-pulse-color: var(--yc-music-light-pulse, rgba(0, 0, 0, 0.22));
    --yc-music-offset: var(--yc-music-space-lg, 14px);
    --yc-music-radius: 50%;

    position: absolute;
    z-index: 50;
    width: var(--yc-music-btn-size);
    height: var(--yc-music-btn-size);
    border-radius: var(--yc-music-radius);
    border: var(--yc-music-btn-border);
    background: var(--yc-music-btn-bg);
    box-shadow: var(--yc-music-btn-shadow);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    color: var(--yc-music-btn-color);
    transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
    gap: var(--yc-music-space-sm, 6px);
}

/* ---- Scope ---------------------------------------------------------------- */
.yc-music-toggle--section { position: absolute; }
.yc-music-toggle--page    { position: fixed; }

/* ---- Vaste posities (preset) --------------------------------------------- */
.yc-music-toggle--pos-top-right    { top: var(--yc-music-offset);    right: var(--yc-music-offset); }
.yc-music-toggle--pos-top-left     { top: var(--yc-music-offset);    left:  var(--yc-music-offset); }
.yc-music-toggle--pos-bottom-right { bottom: var(--yc-music-offset); right: var(--yc-music-offset); }
.yc-music-toggle--pos-bottom-left  { bottom: var(--yc-music-offset); left:  var(--yc-music-offset); }
.yc-music-toggle--pos-hidden.is-visible { display: none; }
/* pos-custom: top/left/right/bottom worden inline door de JS gezet. */

/* ---- Grootte ------------------------------------------------------------- */
.yc-music-toggle--size-small  { --yc-music-btn-size: var(--yc-music-size-small, 24px);  font-size: 11px; }
.yc-music-toggle--size-medium { --yc-music-btn-size: var(--yc-music-size-medium, 32px); font-size: 14px; }
.yc-music-toggle--size-large  { --yc-music-btn-size: var(--yc-music-size-large, 44px);  font-size: 18px; }

/* ---- Tap-target op touch (YC 7F: minimaal 44x44) -------------------------
 * Op coarse pointers groeit de knop naar minstens 44px, ongeacht de
 * gekozen grootte. Visueel ontwerp op desktop blijft ongewijzigd. */
@media (pointer: coarse) {
    .yc-music-toggle {
        min-width: var(--yc-music-tap-min, 44px);
        min-height: var(--yc-music-tap-min, 44px);
    }
}

/* ---- Kleurensets --------------------------------------------------------- */
.yc-music-toggle--theme-light {
    --yc-music-btn-bg: var(--yc-music-light-bg, rgba(255, 255, 255, 0.94));
    --yc-music-btn-bg-hover: var(--yc-music-light-bg-hover, rgb(255, 255, 255));
    --yc-music-btn-color: var(--yc-music-light-color, #222);
    --yc-music-btn-color-active: var(--yc-music-light-color-active, #000);
    --yc-music-btn-border: 1px solid var(--yc-music-light-border, rgba(0, 0, 0, 0.18));
    --yc-music-wave-color: var(--yc-music-light-wave, rgba(0, 0, 0, 0.35));
    --yc-music-pulse-color: var(--yc-music-light-pulse, rgba(0, 0, 0, 0.22));
}
.yc-music-toggle--theme-dark {
    --yc-music-btn-bg: var(--yc-music-dark-bg, rgba(0, 0, 0, 0.65));
    --yc-music-btn-bg-hover: var(--yc-music-dark-bg-hover, rgba(0, 0, 0, 0.82));
    --yc-music-btn-color: var(--yc-music-dark-color, #f5f5f5);
    --yc-music-btn-color-active: var(--yc-music-dark-color-active, #ffffff);
    --yc-music-btn-border: 1px solid var(--yc-music-dark-border, rgba(255, 255, 255, 0.22));
    --yc-music-btn-shadow: var(--yc-music-shadow-dark, 0 2px 6px rgba(0, 0, 0, 0.4));
    --yc-music-wave-color: var(--yc-music-dark-wave, rgba(255, 255, 255, 0.45));
    --yc-music-pulse-color: var(--yc-music-dark-pulse, rgba(255, 255, 255, 0.3));
}
@media (prefers-color-scheme: dark) {
    .yc-music-toggle--theme-auto {
        --yc-music-btn-bg: var(--yc-music-dark-bg, rgba(0, 0, 0, 0.65));
        --yc-music-btn-bg-hover: var(--yc-music-dark-bg-hover, rgba(0, 0, 0, 0.82));
        --yc-music-btn-color: var(--yc-music-dark-color, #f5f5f5);
        --yc-music-btn-color-active: var(--yc-music-dark-color-active, #ffffff);
        --yc-music-btn-border: 1px solid var(--yc-music-dark-border, rgba(255, 255, 255, 0.22));
        --yc-music-btn-shadow: var(--yc-music-shadow-dark, 0 2px 6px rgba(0, 0, 0, 0.4));
        --yc-music-wave-color: var(--yc-music-dark-wave, rgba(255, 255, 255, 0.45));
        --yc-music-pulse-color: var(--yc-music-dark-pulse, rgba(255, 255, 255, 0.3));
    }
}

/* ---- Zichtbaarheid / interactie ------------------------------------------ */
.yc-music-toggle.is-visible { display: inline-flex; }
.yc-music-toggle:hover { transform: scale(1.12); background: var(--yc-music-btn-bg-hover); }
.yc-music-toggle:focus-visible { outline: 2px solid var(--yc-music-btn-color-active); outline-offset: 2px; }

.yc-music-toggle-icon { display: inline-block; line-height: 1; }
.yc-music-toggle-text { font-size: 13px; font-weight: 500; line-height: 1; }
.yc-music-toggle--size-small .yc-music-toggle-text { font-size: 11px; }
.yc-music-toggle--size-large .yc-music-toggle-text { font-size: 14px; }

/* ---- Label-weergave: naast icoon (pill) ---------------------------------- */
.yc-music-toggle--label-inline.has-label {
    width: auto;
    height: auto;
    min-height: var(--yc-music-btn-size);
    border-radius: var(--yc-music-radius-pill, 999px);
    padding: 0 var(--yc-music-space-lg, 14px) 0 var(--yc-music-space-md, 10px);
}

/* ---- Label-weergave: onder icoon (gestapeld) ----------------------------- */
.yc-music-toggle--label-below.has-label {
    width: auto;
    height: auto;
    min-height: var(--yc-music-btn-size);
    flex-direction: column;
    gap: var(--yc-music-space-xs, 3px);
    border-radius: var(--yc-music-radius-card, 16px);
    padding: 8px 12px;
}

/* ---- Label-weergave: tooltip op hover ------------------------------------ */
.yc-music-toggle--label-tooltip .yc-music-toggle-text {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    white-space: nowrap;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--yc-music-btn-bg-hover);
    color: var(--yc-music-btn-color);
    border: var(--yc-music-btn-border);
    box-shadow: var(--yc-music-btn-shadow);
    border-radius: 6px;
    padding: 4px 9px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.yc-music-toggle--label-tooltip:hover .yc-music-toggle-text,
.yc-music-toggle--label-tooltip:focus-within .yc-music-toggle-text {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Label-weergave: pill klapt zijwaarts uit op hover ------------------- */
.yc-music-toggle--label-hover.has-label {
    width: auto;
    border-radius: var(--yc-music-radius-pill, 999px);
    padding: 0 4px;
    transition: padding 0.25s ease, transform 0.15s ease, background 0.2s ease;
}
.yc-music-toggle--label-hover .yc-music-toggle-text {
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    transition: max-width 0.3s ease, opacity 0.25s ease;
}
.yc-music-toggle--label-hover:hover,
.yc-music-toggle--label-hover:focus-within {
    padding: 0 var(--yc-music-space-lg, 14px) 0 8px;
    transform: none;
}
.yc-music-toggle--label-hover:hover .yc-music-toggle-text,
.yc-music-toggle--label-hover:focus-within .yc-music-toggle-text {
    max-width: 180px;
    opacity: 1;
}

/* ---- Label-weergave: klapt naar beneden uit (met bounce, en terug) ------- */
.yc-music-toggle--label-expand-down .yc-music-toggle-text {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    white-space: nowrap;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--yc-music-btn-bg-hover);
    color: var(--yc-music-btn-color);
    border: var(--yc-music-btn-border);
    box-shadow: var(--yc-music-btn-shadow);
    border-radius: var(--yc-music-radius-tip, 8px);
    padding: 5px 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.yc-music-toggle--label-expand-down:hover .yc-music-toggle-text,
.yc-music-toggle--label-expand-down:focus-within .yc-music-toggle-text {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Entree-animaties (bij is-visible) ----------------------------------- */
.yc-music-toggle--enter-fade.is-visible       { animation: yc-music-enter-fade 0.4s ease both; }
.yc-music-toggle--enter-slide-up.is-visible   { animation: yc-music-enter-up 0.45s ease both; }
.yc-music-toggle--enter-slide-down.is-visible { animation: yc-music-enter-down 0.45s ease both; }

@keyframes yc-music-enter-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes yc-music-enter-up   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes yc-music-enter-down { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Animaties: pulse + soundwave ---------------------------------------- */
.yc-music-toggle.is-pulsing { animation: yc-music-pulse 2s ease-out 3; }
@keyframes yc-music-pulse {
    0%   { box-shadow: 0 0 0 0 var(--yc-music-pulse-color); }
    100% { box-shadow: 0 0 0 12px rgba(0, 0, 0, 0); }
}

.yc-music-toggle.is-playing.has-soundwave::before,
.yc-music-toggle.is-playing.has-soundwave::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    border: 1px solid var(--yc-music-wave-color);
    pointer-events: none;
    animation: yc-music-wave 1.8s linear infinite;
}
.yc-music-toggle.is-playing.has-soundwave::after { animation-delay: 0.9s; }
@keyframes yc-music-wave {
    0%   { transform: scale(1);   opacity: 0.55; }
    100% { transform: scale(2.4); opacity: 0; }
}

.yc-music-toggle.is-playing { color: var(--yc-music-btn-color-active); }
.yc-music-toggle.is-playing.has-soundwave .yc-music-toggle-icon { animation: yc-music-sway 1.2s ease-in-out infinite; }
@keyframes yc-music-sway { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* ---- Responsive breakpoints (YC 7A: 1024 / 640 / 420) --------------------
 * De knop is een zwevende widget; de breakpoints bewaken vooral dat
 * labels niet buiten het scherm vallen en de knop niet over content
 * heen schuift op kleine schermen. Geen horizontale scroll op 320px. */
@media (max-width: 1024px) {
    .yc-music-toggle--label-hover:hover .yc-music-toggle-text,
    .yc-music-toggle--label-hover:focus-within .yc-music-toggle-text {
        max-width: 140px;
    }
}
@media (max-width: 640px) {
    .yc-music-toggle { --yc-music-offset: var(--yc-music-space-md, 10px); }
    .yc-music-toggle-text { font-size: 12px; }
    .yc-music-toggle--label-hover:hover .yc-music-toggle-text,
    .yc-music-toggle--label-hover:focus-within .yc-music-toggle-text {
        max-width: 110px;
    }
    /* Tooltip boven de knop kan boven de viewport uitvallen als de knop
     * top-positioned is; toon hem dan onder de knop. */
    .yc-music-toggle--pos-top-right.yc-music-toggle--label-tooltip .yc-music-toggle-text,
    .yc-music-toggle--pos-top-left.yc-music-toggle--label-tooltip .yc-music-toggle-text {
        bottom: auto;
        top: calc(100% + 8px);
    }
}
@media (max-width: 420px) {
    .yc-music-toggle { --yc-music-offset: 8px; }
    .yc-music-toggle-text { font-size: 11px; }
    .yc-music-toggle--label-hover:hover .yc-music-toggle-text,
    .yc-music-toggle--label-hover:focus-within .yc-music-toggle-text {
        max-width: 90px;
    }
    .yc-music-toggle--label-below.has-label { padding: 6px 10px; }
}

/* ---- prefers-reduced-motion: alle beweging uit, reveal direct ------------ */
@media (prefers-reduced-motion: reduce) {
    .yc-music-toggle.is-pulsing,
    .yc-music-toggle--enter-fade.is-visible,
    .yc-music-toggle--enter-slide-up.is-visible,
    .yc-music-toggle--enter-slide-down.is-visible,
    .yc-music-toggle.is-playing.has-soundwave::before,
    .yc-music-toggle.is-playing.has-soundwave::after,
    .yc-music-toggle.is-playing.has-soundwave .yc-music-toggle-icon {
        animation: none;
    }
    .yc-music-toggle,
    .yc-music-toggle .yc-music-toggle-text {
        transition: none;
    }
    .yc-music-toggle:hover { transform: none; }
    .yc-music-toggle--label-tooltip:hover .yc-music-toggle-text,
    .yc-music-toggle--label-expand-down:hover .yc-music-toggle-text {
        transform: translateX(-50%);
    }
}

/* ---- Degraded mode (geen audio) ------------------------------------------ */
.yc-music-toggle.is-degraded { opacity: 0.55; cursor: not-allowed; }
.yc-music-toggle.is-degraded:hover { transform: none; background: var(--yc-music-btn-bg); }


/* ---- Play/pause-affordance: icoon morpht naar pauze tijdens spelen (v0.9.13) */
.yc-music-toggle.is-playing .yc-music-toggle-icon {
    position: relative;
    color: transparent;
    width: 0.7em;
    height: 0.8em;
}
.yc-music-toggle.is-playing .yc-music-toggle-icon::before,
.yc-music-toggle.is-playing .yc-music-toggle-icon::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0.2em;
    border-radius: 1px;
    background: var(--yc-music-btn-color-active, currentColor);
}
.yc-music-toggle.is-playing .yc-music-toggle-icon::before { left: 0.1em; }
.yc-music-toggle.is-playing .yc-music-toggle-icon::after  { right: 0.1em; }

/* ---- Coachmark: eenmalige hint naast de knop (v0.9.13) ------------------- */
.yc-music-coachmark {
    position: absolute;
    z-index: 51;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    max-width: 180px;
    background: var(--yc-music-btn-bg-hover, #fff);
    color: var(--yc-music-btn-color, #222);
    border: var(--yc-music-btn-border, 1px solid rgba(0, 0, 0, 0.18));
    box-shadow: var(--yc-music-btn-shadow, 0 2px 6px rgba(0, 0, 0, 0.12));
    border-radius: var(--yc-music-radius-tip, 8px);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.yc-music-coachmark.is-shown {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.yc-music-toggle--pos-bottom-right .yc-music-coachmark,
.yc-music-toggle--pos-bottom-left .yc-music-coachmark {
    top: auto;
    bottom: calc(100% + 8px);
}
@media (prefers-reduced-motion: reduce) {
    .yc-music-coachmark,
    .yc-music-coachmark.is-shown { transition: none; transform: translateX(-50%); }
}
