/* Audio Player — ACORN Oral History Project */

.aohp-player {
    margin-top: var(--two-spacer);
}

/* Bar — always visible */

.aohp-player__bar {
    display: flex;
    align-items: center;
    gap: var(--one-spacer);
}

/* Details toggle */

.aohp-player__details-toggle {
    border: 4px solid currentColor;
    background: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    flex-shrink: 0;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
}

.aohp-player__details-toggle:hover {
    color: var(--wp--preset--color--red);
    border-color: var(--wp--preset--color--red);
}

/* Details panel — hidden by default */

.aohp-player__details {
    display: none;
    border: 4px solid currentColor;
    border-top: none;
    padding: var(--two-spacer);
}

.aohp-player--expanded .aohp-player__details {
    display: block;
}

/* Session groups */

.aohp-player__sessions {
    margin: 0 0 var(--two-spacer) 0;
}

.aohp-player__session {
    margin-bottom: var(--one-spacer);
}

h2.aohp-player__session-heading,
h2.aohp-player__session-heading span {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0;
    margin: 0 0 0.25rem 0;
}

.aohp-player__session-tracks {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Track buttons */

.aohp-player__track {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 500;
    text-align: left;
    width: 100%;
    padding-bottom: var(--one-spacer);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: baseline;
    gap: var(--one-spacer);
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.aohp-player__track:hover {
    opacity: 1;
    color: var(--wp--preset--color--red);
}

.aohp-player__track[aria-selected="true"] {
    opacity: 1;
    border-left-color: var(--wp--preset--color--red);
    font-weight: 800;
}

.aohp-player__track-number {
    flex-shrink: 0;
    font-weight: 800;
}

/* Controls */

.aohp-player__controls {
    display: flex;
    align-items: center;
    gap: var(--one-spacer);
    flex-wrap: wrap;
}

.aohp-player__play,
.aohp-player__mute {
    border: 4px solid currentColor;
    background: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    flex-shrink: 0;
}

.aohp-player__play:hover,
.aohp-player__mute:hover {
    color: var(--wp--preset--color--red);
    border-color: var(--wp--preset--color--red);
}

.aohp-player__play svg,
.aohp-player__mute svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.aohp-player__time {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 0.875rem;
    min-width: 3.5em;
    flex-shrink: 0;
}

.aohp-player__time--duration {
    text-align: right;
}

.aohp-player__seek-wrapper {
    flex: 1 1 auto;
    min-width: 80px;
    display: flex;
    align-items: center;
}

.aohp-player__volume-wrapper {
    display: flex;
    align-items: center;
    gap: var(--one-spacer);
    flex-shrink: 0;
}

/* Range inputs — shared base */

.aohp-player__seek,
.aohp-player__volume {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0;
    color: var(--wp--preset--color--off-white)
}

/* Seek track */

.aohp-player__seek::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(
        to right,
        var(--wp--preset--color--red) 0%,
        var(--wp--preset--color--red) var(--progress, 0%),
        currentColor var(--progress, 0%),
        currentColor 100%
    );
}

.aohp-player__seek::-moz-range-track {
    height: 4px;
    background: currentColor;
}

.aohp-player__seek::-moz-range-progress {
    height: 4px;
    background: var(--wp--preset--color--red);
}

/* Volume track */

.aohp-player__volume::-webkit-slider-runnable-track {
    height: 4px;
    background: currentColor;
}

.aohp-player__volume::-moz-range-track {
    height: 4px;
    background: currentColor;
}

/* Shared thumb — small square */

.aohp-player__seek::-webkit-slider-thumb,
.aohp-player__volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: currentColor;
    border: none;
    margin-top: -6px;
}

.aohp-player__seek::-moz-range-thumb,
.aohp-player__volume::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: currentColor;
    border: none;
    border-radius: 0;
}

/* Focus styles */

.aohp-player__play:focus-visible,
.aohp-player__mute:focus-visible,
.aohp-player__track:focus-visible,
.aohp-player__details-toggle:focus-visible {
    outline: 3px solid var(--wp--preset--color--red);
    outline-offset: 2px;
}

.aohp-player__seek:focus-visible,
.aohp-player__volume:focus-visible {
    outline: none;
}

.aohp-player__seek:focus-visible::-webkit-slider-thumb,
.aohp-player__volume:focus-visible::-webkit-slider-thumb {
    outline: 3px solid var(--wp--preset--color--red);
    outline-offset: 2px;
}

.aohp-player__seek:focus-visible::-moz-range-thumb,
.aohp-player__volume:focus-visible::-moz-range-thumb {
    outline: 3px solid var(--wp--preset--color--red);
    outline-offset: 2px;
}

/* Error state */

.aohp-player__error {
    padding: var(--one-spacer);
    border: 4px solid var(--wp--preset--color--red);
    color: var(--wp--preset--color--red);
    font-weight: 800;
    display: none;
}

.aohp-player__error[aria-live] {
    display: none;
}

.aohp-player--error .aohp-player__error {
    display: block;
}

.aohp-player--error .aohp-player__controls {
    opacity: 0.4;
    pointer-events: none;
}

/* Loading state */

.aohp-player--loading .aohp-player__play {
    opacity: 0.4;
    pointer-events: none;
}

/* Responsive */

@media screen and (max-width: 991px) {
    .aohp-player__controls {
        gap: 0.5rem;
    }

    .aohp-player__seek-wrapper {
        order: 10;
        flex-basis: 100%;
        min-width: 100%;
    }

    .aohp-player__volume-wrapper {
        display: none;
    }
}
