:root {
    --ink: #101113;
    --paper: #f5f2eb;
    --orange: #f6a800;
    --aqua: #40e0d0;
}

* { box-sizing: border-box; }
html { background: var(--ink); }

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--paper);
    background:
        radial-gradient(circle at 74% 18%, rgba(246, 168, 0, 0.12), transparent 32rem),
        radial-gradient(circle at 18% 82%, rgba(64, 224, 208, 0.07), transparent 28rem),
        var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(245, 242, 235, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 242, 235, 0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 90%);
}

#signal-field,
.grain {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#signal-field { z-index: 1; }

.grain {
    z-index: 2;
    opacity: 0.32;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
}

main {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-rows: auto 1fr auto;
    width: min(1180px, calc(100% - 48px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 32px 0 26px;
}

footer,
.track-grid {
    font-family: "Courier New", Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.brand { display: block; width: clamp(155px, 20vw, 245px); height: auto; }

.album { align-self: start; padding: clamp(82px, 12vh, 138px) 0 88px; }
.year-wrap {
    position: relative;
    display: grid;
    justify-items: center;
    pointer-events: none;
}

.cover {
    position: relative;
    width: min(36vw, 210px);
    aspect-ratio: 1;
    margin: 0 auto;
}

.cover-art {
    display: block;
    width: 100%;
    height: 100%;
}

.cover-glitch {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: screen;
    -webkit-mask: url("026-cover.svg") center / contain no-repeat;
    mask: url("026-cover.svg") center / contain no-repeat;
}

.cover-glitch--a {
    background: var(--aqua);
    clip-path: polygon(0 18%, 100% 18%, 100% 36%, 0 36%);
    animation: title-glitch-a 5.8s steps(1, end) infinite;
}

.cover-glitch--b {
    background: var(--orange);
    clip-path: polygon(0 63%, 100% 63%, 100% 78%, 0 78%);
    animation: title-glitch-b 5.8s 90ms steps(1, end) infinite;
}

.track-grid {
    width: min(100%, 780px);
    margin: clamp(54px, 8vh, 86px) auto 0;
    padding: 0;
    border-top: 1px solid rgba(245, 242, 235, 0.17);
    border-bottom: 1px solid rgba(245, 242, 235, 0.17);
    list-style: none;
}

.track-grid li {
    position: relative;
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    align-items: center;
    min-height: 47px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(245, 242, 235, 0.09);
    color: var(--paper);
    font-size: 0.73rem;
    transition: color 150ms ease, background 150ms ease;
}

.track-grid li:last-child { border-bottom: 0; }
.track-grid li:hover,
.track-grid li:focus-within {
    color: var(--ink);
    background: var(--orange);
}

.album-services {
    position: relative;
    z-index: 10;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
    pointer-events: auto;
}

.album-services a {
    position: relative;
    z-index: 1;
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    pointer-events: auto;
    touch-action: manipulation;
    opacity: 0.7;
    transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.album-services a:hover {
    opacity: 1;
    background: rgba(245, 242, 235, 0.08);
    transform: translateY(-2px);
}

.album-services a:hover .service-icon {
    transform: scale(1.08);
}

.service-icon {
    display: block;
    width: 24px;
    height: 24px;
    pointer-events: none;
    background: var(--service-icon) center / contain no-repeat;
    transition: transform 0.2s ease;
}

/* Linked services keep their brand colour */
.service-icon--spotify { --service-icon: url("spotify.svg"); }
.service-icon--deezer { --service-icon: url("deezer.svg"); }
.service-icon--youtube-music { --service-icon: url("youtube-music.svg"); }
.service-icon--apple-music { --service-icon: url("apple-music.svg"); }
.service-icon--audiomack { --service-icon: url("audiomack.svg"); }

.album-services a:focus-visible {
    opacity: 1;
    background: rgba(245, 242, 235, 0.08);
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.track-title {
    min-width: 0;
    color: var(--paper);
    font-size: 0.77rem;
    letter-spacing: 0.1em;
    white-space: normal;
}

.track-grid li:hover .track-title,
.track-grid li:focus-within .track-title { color: var(--ink); }

.track-grid li::after {
    content: "";
    position: absolute;
    top: -1px;
    left: 8%;
    width: 14%;
    height: 1px;
    background: var(--aqua);
    opacity: 0;
}

.track-grid li:nth-child(4n + 2)::after {
    animation: row-glitch 4.6s steps(1, end) infinite;
}

.track-grid li:nth-child(4n)::after {
    animation: row-glitch 6.2s 1.4s steps(1, end) infinite;
}

footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    color: rgba(245, 242, 235, 0.36);
    font-size: 0.63rem;
}

footer p { margin: 0; }

footer a,
footer a:link,
footer a:visited { color: rgba(245, 242, 235, 0.36); text-decoration: none; }

footer a:hover { color: var(--paper); }

footer a:focus-visible { color: var(--paper); outline: 2px solid currentColor; outline-offset: 4px; }

@keyframes title-glitch-a {
    0%, 84%, 88%, 100% { opacity: 0; transform: translate(0); }
    85% { opacity: 0.68; transform: translate(9px, -2px); }
    86% { opacity: 0.5; transform: translate(-6px, 1px); }
    87% { opacity: 0.72; transform: translate(3px, 0); }
}

@keyframes title-glitch-b {
    0%, 85%, 89%, 100% { opacity: 0; transform: translate(0); }
    86% { opacity: 0.72; transform: translate(-10px, 2px); }
    87% { opacity: 0.48; transform: translate(7px, -1px); }
    88% { opacity: 0.68; transform: translate(-3px, 0); }
}

@keyframes row-glitch {
    0%, 91%, 94%, 100% { opacity: 0; transform: translateX(0); }
    92% { opacity: 0.7; transform: translateX(38px); }
    93% { opacity: 0.35; transform: translateX(-11px); }
}

@media (max-width: 760px) {
    main { width: min(100% - 28px, 620px); padding-top: 22px; }
    .album { padding-top: 96px; }
    .cover { width: min(42vw, 170px); }
    .track-grid li { grid-template-columns: 3.25rem minmax(0, 1fr); min-height: 50px; padding-inline: 12px; }
    .album-services { gap: 4px; margin-top: 24px; }
    .track-title { font-size: 0.67rem; line-height: 1.35; }
    footer { align-items: flex-end; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .cover-glitch,
    .track-grid li::after { animation: none; }
    .album-services a,
    .service-icon { transition: none; }
    .album-services a:hover { transform: none; }
    .album-services a:hover .service-icon { transform: none; }
}
