/*
  Compact vinyl deck adapted from Vinyl Web Player by Stu Cochrane
  https://github.com/stuartc1/vinyl-web-player (MIT)
*/

:root {
    color-scheme: dark;
    --mint: #c8ffe8;
    --line: rgba(200, 255, 232, .28);
    --dim: rgba(200, 255, 232, .52);
    --bg: #0c0c0e;
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --pixel: "Silkscreen", "Press Start 2P", var(--mono);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
}

body {
    overflow: hidden;
    font-family: var(--mono);
    color: var(--mint);
}

audio {
    display: none;
}

.deck {
    position: relative;
    height: 100%;
    padding: 16px;
    display: grid;
    grid-template-columns: clamp(108px, 35%, 136px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
        "cover info"
        "controls controls";
    align-content: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background:
        radial-gradient(120% 100% at 12% 0%, rgba(200, 255, 232, .08), transparent 55%),
        var(--bg);
    box-shadow: inset 0 0 30px rgba(200, 255, 232, .025);
}

.deck::before,
.deck::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    opacity: .8;
}

.deck::before {
    top: 0;
    left: 0;
    border-top: 1px solid var(--mint);
    border-left: 1px solid var(--mint);
    border-top-left-radius: 6px;
}

.deck::after {
    right: 0;
    bottom: 0;
    border-right: 1px solid var(--mint);
    border-bottom: 1px solid var(--mint);
    border-bottom-right-radius: 6px;
}

.deck-cover {
    grid-area: cover;
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid rgba(200, 255, 232, .45);
    border-radius: 4px;
    background: #08080a;
    cursor: pointer;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.deck-cover:hover {
    border-color: rgba(200, 255, 232, .8);
    box-shadow: 0 0 16px rgba(200, 255, 232, .16);
}

.deck-cover:focus-visible {
    outline: 2px solid rgba(200, 255, 232, .8);
    outline-offset: 2px;
}

.disc {
    position: absolute;
    inset: 5%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, rgba(200, 255, 232, .16) 0 1.5%, transparent 2%),
        repeating-radial-gradient(circle at 50% 50%, #17171a 0 1px, #0a0a0c 1px 3px);
    box-shadow: inset 0 0 14px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .7);
    opacity: 0;
    transform: scale(.86);
    transition: opacity .28s ease, transform .35s cubic-bezier(.2, .7, .2, 1);
}

.deck-cover img {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    margin: auto;
    display: block;
    object-fit: cover;
    border-radius: 3px;
    image-rendering: pixelated;
    transition:
        width .5s cubic-bezier(.2, .7, .2, 1),
        height .5s cubic-bezier(.2, .7, .2, 1),
        border-radius .4s ease,
        box-shadow .3s ease,
        transform .35s ease;
}

.deck.is-playing .disc {
    opacity: 1;
    transform: scale(1);
    animation: spin 2.4s linear infinite;
}

.deck.is-playing .deck-cover img {
    width: 38%;
    height: 38%;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(200, 255, 232, .55), 0 0 10px rgba(200, 255, 232, .16);
    animation: spin 2.4s linear infinite;
}

.spindle {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
    border-radius: 50%;
    background: #050506;
    box-shadow: 0 0 0 1px rgba(200, 255, 232, .4);
    opacity: 0;
    transition: opacity .3s ease;
}

.deck.is-playing .spindle {
    opacity: 1;
}

.deck-info {
    grid-area: info;
    align-self: center;
    min-width: 0;
}

.eyebrow {
    margin: 0 0 7px;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.2;
    letter-spacing: .10em;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: rgba(200, 255, 232, .4);
}

.eyebrow span {
    color: var(--mint);
}

.deck-info h1 {
    margin: 0 0 6px;
    overflow: hidden;
    font-family: var(--pixel);
    font-size: clamp(17px, 5vw, 20px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: .01em;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--mint);
    text-shadow: 0 0 12px rgba(200, 255, 232, .25);
}

.artist {
    margin: 0;
    overflow: hidden;
    font-size: 9.5px;
    line-height: 1.4;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--dim);
}

.deck-controls {
    grid-area: controls;
    display: grid;
    grid-template-columns: 30px auto minmax(0, 1fr) auto 26px;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(200, 255, 232, .38);
    border-radius: 50%;
    background: rgba(200, 255, 232, .06);
    color: var(--mint);
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease;
}

.icon-btn svg {
    display: block;
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.icon-btn .line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.icon-btn:hover {
    border-color: rgba(200, 255, 232, .75);
    background: rgba(200, 255, 232, .14);
    box-shadow: 0 0 10px rgba(200, 255, 232, .2);
}

.icon-btn:focus-visible {
    outline: 2px solid rgba(200, 255, 232, .75);
    outline-offset: 2px;
}

.deck:not(.is-playing) .i-pause,
.deck.is-playing .i-play,
.deck:not(.is-muted) .i-muted,
.deck.is-muted .i-vol {
    display: none;
}

.icon-btn.mute {
    width: 26px;
    height: 30px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.icon-btn.mute svg {
    width: 14px;
    height: 14px;
}

.icon-btn.mute:hover {
    background: transparent;
    box-shadow: none;
    color: #fff;
}

.time {
    font-size: 10px;
    line-height: 1;
    letter-spacing: .02em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--dim);
}

.seek {
    display: flex;
    align-items: center;
    height: 18px;
    min-width: 0;
    cursor: pointer;
    touch-action: none;
}

.seek:focus-visible {
    outline: none;
}

.seek:focus-visible .seek-track {
    box-shadow: 0 0 0 2px rgba(200, 255, 232, .35);
}

.seek-track {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(200, 255, 232, .18);
}

.seek-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    border-radius: 2px;
    background: var(--mint);
    box-shadow: 0 0 8px rgba(200, 255, 232, .45);
}

.seek-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 8px rgba(200, 255, 232, .6);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .deck.is-playing .disc,
    .deck.is-playing .deck-cover img {
        animation: none;
    }

    .deck-cover img,
    .disc {
        transition: none;
    }
}
