/*
===============================================
    Theme picker (paintbrush) + scroll progress
===============================================
*/

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: var(--z-progress, 120);
    pointer-events: none;
    background: var(--scroll-track, rgba(255, 255, 255, 0.12));
}

.scroll-progress__bar {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    transform-origin: left center;
    transition: width 80ms linear;
}

.theme-toggle-sep {
    flex: 0 0 auto;
}

.theme-picker {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
}

.theme-toggle {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--header-bg) 70%, transparent);
    color: var(--text);
    box-shadow: none;
    cursor: pointer;
    transition:
        transform var(--transition-fast) var(--ease-smooth),
        border-color var(--transition-fast) var(--ease-smooth),
        background var(--transition-fast) var(--ease-smooth),
        color var(--transition-fast) var(--ease-smooth);
}

header nav .theme-toggle,
.cv-nav .theme-toggle,
.site-nav .theme-toggle {
    width: 38px;
    height: 38px;
}

.theme-toggle::before {
    display: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible,
.theme-picker.is-open .theme-toggle {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--blue) 45%, var(--glass-border));
    background: color-mix(in srgb, var(--blue) 12%, transparent);
    color: var(--text);
    box-shadow: none;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 3px;
}

.theme-toggle__icon {
    width: 22px;
    height: 22px;
    background-color: currentColor;
    -webkit-mask: var(--theme-icon) center / contain no-repeat;
    mask: var(--theme-icon) center / contain no-repeat;
}

.theme-toggle__icon--brush {
    --theme-icon: url("../images/icons/paint-roller-svgrepo-com.svg");
    width: 20px;
    height: 20px;
}

/* Panel */
.theme-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: calc(var(--z-progress, 120) + 20);
    min-width: 220px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid transparent;
    background:
        linear-gradient(
            color-mix(in srgb, var(--bn-surface, var(--header-bg)) 94%, transparent),
            color-mix(in srgb, var(--bn-surface, var(--header-bg)) 94%, transparent)
        ) padding-box,
        linear-gradient(135deg, rgba(0, 148, 255, 0.55), rgba(255, 15, 122, 0.4), rgba(214, 254, 0, 0.28)) border-box;
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.42),
        0 0 0 1px color-mix(in srgb, var(--text) 5%, transparent),
        0 0 28px rgba(0, 148, 255, 0.12);
    opacity: 0;
    transform: translateY(-12px) scale(0.88);
    transform-origin: top right;
    filter: blur(4px);
    pointer-events: none;
    transition:
        opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 280ms cubic-bezier(0.34, 1.4, 0.64, 1),
        filter 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.theme-panel.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
    pointer-events: auto;
}

.theme-panel__heading,
.theme-panel__option {
    opacity: 0;
    transform: translateY(6px);
    transition:
        opacity 200ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
        background var(--transition-fast) var(--ease-smooth),
        border-color var(--transition-fast) var(--ease-smooth);
}

.theme-panel.is-visible .theme-panel__heading {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 40ms;
}

.theme-panel.is-visible .theme-panel__option:nth-child(2) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 70ms;
}

.theme-panel.is-visible .theme-panel__option:nth-child(3) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 110ms;
}

.theme-panel.is-visible .theme-panel__option:nth-child(4) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 150ms;
}

.theme-panel.is-visible .theme-panel__option:nth-child(n+5) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 180ms;
}

.theme-panel[hidden] {
    display: none !important;
}

.theme-panel__heading {
    margin: 0 0 10px;
    padding: 4px 8px 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-soft, var(--text-muted));
    border-bottom: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.theme-panel__option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 9px 10px;
    border: 1px solid transparent !important;
    border-radius: 14px;
    background: transparent !important;
    color: var(--text) !important;
    cursor: pointer;
    text-align: left;
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: none !important;
    overflow: visible;
    isolation: auto;
}

.theme-panel__option::before {
    display: none !important;
    content: none !important;
}

.theme-panel__option + .theme-panel__option {
    margin-top: 6px;
}

.theme-panel__option:hover,
.theme-panel__option:focus-visible,
.theme-panel__option:active {
    background: color-mix(in srgb, var(--text) 6%, transparent) !important;
    border-color: color-mix(in srgb, var(--text) 12%, transparent) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

/* Blokkeer globale button-lift; stagger-transform blijft via .is-visible */
.theme-panel .theme-panel__option:hover,
.theme-panel .theme-panel__option:focus-visible,
.theme-panel .theme-panel__option:active {
    transform: translateY(6px);
}

.theme-panel.is-visible .theme-panel__option:hover,
.theme-panel.is-visible .theme-panel__option:focus-visible,
.theme-panel.is-visible .theme-panel__option:active {
    transform: translateY(0);
}

.theme-panel__option:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 2px;
}

.theme-panel__option.is-active {
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--blue) 14%, transparent),
            color-mix(in srgb, var(--pink) 10%, transparent)
        ) !important;
    border-color: color-mix(in srgb, var(--blue) 35%, var(--pink) 25%) !important;
}

.theme-panel__option:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.theme-panel__preview {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 30px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        0 4px 10px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.theme-panel__accents {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 5px;
    display: flex;
    gap: 3px;
}

.theme-panel__accent {
    flex: 1 1 auto;
    height: 4px;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.theme-panel__label {
    flex: 1 1 auto;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.theme-panel__check {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid color-mix(in srgb, var(--text) 22%, transparent);
    background: transparent;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.theme-panel__option.is-active .theme-panel__check {
    border: 0;
    background: transparent;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 30%, transparent);
}

.theme-panel__option.is-active .theme-panel__check::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #0094ff 0%, #ff0f7a 100%);
}

.theme-panel__option.is-active .theme-panel__check::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3.5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

/* Witte logo's leesbaar maken op lichte thema's */
html[data-theme="light"] .logo-afbeelding[src*="logo-n-white"],
html[data-theme="light"] .footer-logo-afbeelding[src*="logo-n-white"],
html[data-theme="light"] .cv-logo[src*="logo-n-white"],
html[data-theme="amore"] .logo-afbeelding[src*="logo-n-white"],
html[data-theme="amore"] .footer-logo-afbeelding[src*="logo-n-white"],
html[data-theme="amore"] .cv-logo[src*="logo-n-white"],
html[data-theme="noel"] .logo-afbeelding[src*="logo-n-white"],
html[data-theme="noel"] .footer-logo-afbeelding[src*="logo-n-white"],
html[data-theme="noel"] .cv-logo[src*="logo-n-white"] {
    filter: brightness(0) saturate(100%);
}

@media (max-width: 900px) {
    .theme-panel {
        right: -4px;
        min-width: 200px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-progress__bar {
        transition: none;
    }

    .theme-toggle,
    .theme-toggle:hover,
    .theme-toggle:focus-visible,
    .theme-picker.is-open .theme-toggle,
    .theme-panel,
    .theme-panel__heading,
    .theme-panel__option {
        transition: none;
        transform: none;
        filter: none;
    }

    .theme-panel.is-visible,
    .theme-panel.is-visible .theme-panel__heading,
    .theme-panel.is-visible .theme-panel__option {
        transform: none;
        filter: none;
        opacity: 1;
        transition-delay: 0ms;
    }
}
