/* ========================================================================
   SHAHEAD VINTAGE PLAYER — QUICK CONTROLS
   Change the size or palette here; the complete radio scales as one unit.
   ======================================================================== */
.shvp-player {
    --shvp-player-size: 700px;

    /* Radio palette */
    --shvp-shell: #171717 !important;
    --shvp-face: #e7e4da !important;
    --shvp-ink: #171717 !important;
    --shvp-muted: #77736a !important;
    --shvp-accent: #C39C26 !important;
    --shvp-paper: #e7e4da !important;
    --shvp-repeat-shape: #C39C26 !important;
    /*--shvp-player-shadow: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.22));*/
    --shvp-player-shadow:
    drop-shadow(0 16px 22px rgba(0, 0, 0, 0.24))
    drop-shadow(0 4px 5px rgba(0, 0, 0, 0.12));

    /* Runtime values — controlled by the player script. */
    --shvp-progress: 0%;
    --shvp-volume-position: 4%;
    --shvp-volume-stick-y: 0px;
    --shvp-radio-signal-headroom: clamp(120px, 40%, 210px);

    padding-top: var(--shvp-radio-signal-headroom);
    position: relative;
    width: min(100%, var(--shvp-player-size)) !important;
    margin-inline: 0 !important;
    color: var(--shvp-face) !important;
    font-family: inherit !important;
    container-type: inline-size !important;
    isolation: isolate !important;
    filter: var(--shvp-player-shadow) !important;
}

.shvp-player *,
.shvp-player *::before,
.shvp-player *::after {
    box-sizing: border-box;
}

/* Native audio remains a safe fallback until JavaScript initializes. */
.shvp-audio {
    display: block;
    width: 100%;
    min-height: 54px;
}

.shvp-player.is-ready .shvp-audio {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.shvp-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 612 / 590;
}

.shvp-radio-art {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Map the one player palette to the variables used by the master SVG. */
.shvp-player .shvp-radio-artwork {
    --shvp-radio-dark: var(--shvp-shell) !important;
    --shvp-radio-light: var(--shvp-face) !important;
    --shvp-radio-accent: var(--shvp-accent) !important;
    --shvp-radio-signal-opacity: 0.62 !important;
    --shvp-radio-repeat: var(--shvp-shell) !important;
    --shvp-radio-volume-stick: var(--shvp-shell);
}

/* Accent the volume stick only while it is being adjusted */
.shvp-player.is-adjusting-volume .shvp-radio-artwork {
    --shvp-radio-volume-stick: var(--shvp-accent) !important;
}

/* Active Repeat: ALL or ONE */
.shvp-player:not([data-repeat-mode="off"]) .shvp-radio-artwork {
    --shvp-radio-repeat: var(--shvp-repeat-shape) !important;
}

/* The SVG stick is the real visual volume indicator; it only travels vertically. */
.shvp-player [id^="shvp-radio-volume-stick-"] {
    transform: translateY(var(--shvp-volume-stick-y)) !important;
    transform-box: fill-box !important;
    transform-origin: center !important;
    transition: transform 0.18s ease, opacity 0.18s ease !important;
}

.shvp-player.is-muted [id^="shvp-radio-volume-stick-"] {
    opacity: 0.58;
}

.shvp-player.is-loading [id^="shvp-radio-antenna-sparks-"] {
    opacity: 0.88;
}

/* Dynamic metadata is accessible HTML positioned in the SVG safe area. */
.shvp-display {
    position: absolute;
    top: 57.9%;
    left: 40.15%;
    z-index: 4;
    width: 19.9%;
    min-width: 0;
    color: var(--shvp-ink);
    text-align: center;
}

.shvp-playlist,
.shvp-current-track {
    overflow: hidden;
    margin: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shvp-playlist {
    color: var(--shvp-muted);
    font-size: clamp(9px, 1.1cqw, 11px);
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.shvp-current-track {
    margin-top: 0;
    font-size: clamp(10px, 1.6cqw, 13px);
    font-weight: 600;
    letter-spacing: 0.6px;
}

.shvp-time-row {
    display: flex;
    justify-content: space-between;
    margin-top: 0.1cqw;
    color: var(--shvp-muted);
    font-size: clamp(10px, 0.92cqw, 13px);
    font-variant-numeric: tabular-nums;
}

.shvp-progress {
    display: block;
    width: 100%;
    height: 2.2cqw;
    margin: 0;
    padding: 0;
    cursor: pointer;
    appearance: none;
    background: transparent;
    touch-action: none;
    margin-top: -10px;
}

.shvp-progress::-webkit-slider-runnable-track {
    height: max(1.5px, 0.32cqw);
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--shvp-accent) var(--shvp-progress),
        rgba(23, 23, 23, 0.22) var(--shvp-progress)
    );
}

.shvp-progress::-moz-range-track {
    height: max(1.5px, 0.32cqw);
    border-radius: 999px;
    background: rgba(23, 23, 23, 0.22);
}

.shvp-progress::-moz-range-progress {
    height: max(1.5px, 0.32cqw);
    border-radius: 999px;
    background: var(--shvp-accent);
}

.shvp-progress::-webkit-slider-thumb {
    width: max(6px, 1.12cqw);
    height: max(6px, 1.12cqw);
    margin-top: calc((max(1.5px, 0.32cqw) - max(6px, 1.12cqw)) / 2);
    border: 0;
    border-radius: 50%;
    background: var(--shvp-accent);
    appearance: none;
}

.shvp-progress::-moz-range-thumb {
    width: max(6px, 1.12cqw);
    height: max(6px, 1.12cqw);
    border: 0;
    border-radius: 50%;
    background: var(--shvp-accent);
}

/* HTML controls aligned with the exact control guide inside the master SVG. */
.shvp-transport {
    position: absolute;
    top: 76.6% !important;
    left: 32.2% !important;
    z-index: 5 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 43.6% !important;
    height: 7.3% !important;
    gap: 0.55cqw !important;
}

.shvp-control {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(23, 23, 23, 0.2) !important;
    border-radius: 0.7cqw !important;
    background: var(--shvp-face) !important;
    color: var(--shvp-ink) !important;
    cursor: pointer;
    place-items: center !important;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

.shvp-control:hover,
button.shvp-control:focus,
.shvp-control:focus-visible {
    background: #f6f3e9 !important;
    background-color: #f6f3e9 !important;
    color: var(--shvp-accent) !important;
}

button.shvp-control:focus-within {
    color: var(--shvp-ink) !important;
}

.shvp-control:active {
    transform: translateY(1px) !important;
}

/* Keep the Play/Pause button pressed while audio is playing */
.shvp-player .shvp-play {
    transform: translateY(0);
}

.shvp-player.is-playing .shvp-play {
    transform: translateY(2px) !important;
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.18);
}

.shvp-control svg {
    display: block;
    width: 60%;
    margin: 0 auto;
}

/* Slightly soften the sharp corners of transport icons */
.shvp-transport .shvp-control svg path,
.shvp-transport .shvp-control svg rect {
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    paint-order: stroke fill !important;
}

.shvp-icon-pause {
    display: none;
}

.shvp-player.is-playing .shvp-icon-play {
    display: none;
}

.shvp-player.is-playing .shvp-icon-pause {
    display: inline;
}

/* The illustrated left dial acts as the repeat control. */
.shvp-repeat {
    position: absolute;
    top: 76.8% !important;
    left: 25.5% !important;
    z-index: 6 !important;
    display: grid !important;
    width: 5.8% !important;
    aspect-ratio: 1 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--shvp-face) !important;
    cursor: pointer !important;
    place-items: center !important;
}

.shvp-repeat__indicator {
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.shvp-repeat__mode {
    position: absolute;
    top: calc(100% + 0.5cqw);
    left: 50%;
    color: var(--shvp-muted);
    font-size: clamp(9px, 0.9cqw, 12px);
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    transform: translateX(-50%);
}

.shvp-repeat:hover .shvp-repeat__indicator,
.shvp-repeat:focus-visible .shvp-repeat__indicator,
.shvp-player:not([data-repeat-mode="off"]) .shvp-repeat__indicator {
    box-shadow: 0 0 0 0.7cqw rgba(170, 145, 74, 0.08) !important;
}

.shvp-player:not([data-repeat-mode="off"]) .shvp-repeat__mode {
    color: var(--shvp-accent);
}

/* Transparent accessible hit area over the illustrated vertical volume stick. */
.shvp-volume {
    position: absolute;
    top: 58.3%;
    left: 82.4%;
    z-index: 7;
    width: 10.4%;
    height: 15.6%;
}

.shvp-volume__knob {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    cursor: grab;
    touch-action: none;
}

.shvp-volume__knob:hover {
    cursor: grab;
}

.shvp-volume__knob.is-dragging {
    cursor: grabbing;
}

.shvp-volume__knob:focus-visible {
    outline: 2px solid var(--shvp-accent);
    outline-offset: 2px;
}

.shvp-volume__value {
    position: absolute;
    top: var(--shvp-volume-position);
    right: calc(100% + 0.8cqw);
    padding: 0.55cqw 0.8cqw;
    border: 1px solid rgba(231, 228, 218, 0.16);
    border-radius: 3px;
    background: var(--shvp-shell);
    color: var(--shvp-face);
    font-size: clamp(6px, 1.05cqw, 8px);
    font-variant-numeric: tabular-nums;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity 0.18s ease, top 0.18s ease;
}

.shvp-volume__knob:hover .shvp-volume__value,
.shvp-volume__knob:focus-visible .shvp-volume__value,
.shvp-volume__knob.is-dragging .shvp-volume__value {
    opacity: 1;
}

/* Paper drawer emerges from beneath the radio and scrolls internally. */
.shvp-drawer-toggle {
    position: relative;
    bottom: 60px;
    left: 0;
    right: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    width: max(50%, 300px);;
    min-height: 25px;
    margin: -3.8cqw auto 0;
    padding: 1.1cqw 0cqw;
    border: none;
    background: var(--shvp-shell);
    color: var(--shvp-muted);
    cursor: pointer;
    font-size: clamp(8px, 1.8cqw, 11px);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: left;
    text-transform: uppercase;
}

button.shvp-drawer-toggle:hover,
button.shvp-drawer-toggle:focus {
    background-color: transparent !important;
    color: var(--shvp-accent);
}

.shvp-drawer-toggle__count {
    margin-inline: 1.4cqw;
    color: var(--shvp-muted);
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
}

.shvp-drawer-toggle__icon svg {
    display: block;
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.shvp-drawer-toggle[aria-expanded="true"] .shvp-drawer-toggle__icon svg {
    transform: rotate(180deg);
}

.shvp-drawer {
    position: relative;
    bottom: 50px;
    width: max(50%, 200px);
    max-height: 0;
    margin-inline: auto;
    overflow: hidden;
    border: 4px solid var(--shvp-shell) !important;
    background: var(--shvp-shell);
    color: var(--shvp-muted);
    opacity: 0;
    transform: translateY(-1.3cqw);
    transition:
        max-height 0.42s ease,
        opacity 0.26s ease,
        transform 0.42s ease,
        border-color 0.2s ease;
    border-radius: 0 0 8px 8px;
}

.shvp-player.is-drawer-open .shvp-drawer {
    max-height: min(252px, 52cqw);
    opacity: 1;
    transform: translateY(0);
}

.shvp-tracks {
    max-height: min(224px, 46cqw);
    margin: 0;
    padding: 1.2cqw 2.5cqw 2.2cqw;
    overflow-y: auto;
    list-style: none;
    scrollbar-color: var(--shvp-accent) rgba(23, 23, 23, 0.1);
    scrollbar-width: thin;
}

.shvp-track__button {
    display: grid;
    grid-template-columns: 4.5cqw minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    min-height: 46px;
    padding: 1.4cqw 1cqw;
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(71, 71, 71, 0.71);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.shvp-track__button:hover,
.shvp-track__button:focus {
    background-color: #2d2c2c5e !important;
}

.shvp-track:last-child .shvp-track__button {
    border-bottom: 0;
}

.shvp-track__number,
.shvp-track__duration {
    color: var(--shvp-muted);
    font-size: clamp(7px, 1.5cqw, 9px);
    font-variant-numeric: tabular-nums;
}

.shvp-track__title {
    overflow: hidden;
    padding-inline: 1.2cqw;
    font-size: clamp(9px, 1.9cqw, 12px);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shvp-track__button:hover,
.shvp-track__button:focus-visible,
.shvp-track__button.is-active,
.shvp-track__button.is-active .shvp-track__number,
.shvp-track__button.is-active .shvp-track__duration {
    color: var(--shvp-accent) !important;
}

.shvp-editor-message {
    padding: 12px 14px !important;
    border-left: 3px solid var(--shvp-accent, #C39C26) !important;
    background: #f6f5f0 !important;
    color: #222 !important;
}

.shvp-player .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.shvp-player button:focus-visible,
.shvp-player input:focus-visible {
    outline: 2px solid var(--shvp-accent);
    outline-offset: 2px;
}

/*@media (max-width: 480px) {*/
@container (max-width: 370px) {
    .shvp-drawer-toggle {
        bottom: 43px !important;
        width: max(40%, 190px) !important;
        min-height: 18px !important;
        margin: 0 auto 0 !important;
        padding: 0cqw 0cqw !important;
        font-size: clamp(6px, 1.8cqw, 11px) !important;
        letter-spacing: 0.3px !important;
    }
    .shvp-drawer-toggle__icon svg {
        width: 12px !important;
        height: 12px !important;
    }
    .shvp-drawer {
        bottom: 41px !important;
    }
    .shvp-track__button {
        min-height: 35px !important;
    }
    .shvp-repeat__mode {
        font-size: clamp(6px, 0.9cqw, 9px) !important;
    }
    .shvp-playlist,
    .shvp-current-track,
    .shvp-time-row {
        font-size: 7.2px !important;
    }
    .shvp-display {
        line-height: 14px !important;
    }
    .shvp-time-row {
        position: relative;
        bottom: 8px;
        margin-top: 12px;
    }
    .shvp-current-track {
        position: absolute;
        bottom: -17px;
    }
    .shvp-control {
        border-radius: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shvp-player *,
    .shvp-player *::before,
    .shvp-player *::after {
        scroll-behavior: auto !important;
        animation: none !important;
        transition-duration: 0.01ms !important;
    }

    .shvp-player [id^="shvp-radio-volume-stick-"] {
        transition: none !important;
    }
}
