:root {
    --ink: #101113;
    --paper: #f5f2eb;
    --orange: #f6a800;
    --aqua: #40e0d0;
    --muted: rgba(245, 242, 235, 0.56);
}

* { 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;
}

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

.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

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

.status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--muted);
    font-size: 0.67rem;
}

.status span {
    width: 6px;
    height: 6px;
    background: var(--orange);
    animation: blink 2.8s steps(1, end) infinite;
}

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

h1 {
    position: relative;
    margin: 0;
    color: var(--paper);
    font-size: clamp(9rem, 27vw, 21rem);
    font-weight: 900;
    line-height: 0.72;
    letter-spacing: -0.09em;
    text-align: center;
}

h1::before,
h1::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}

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

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

.album-note {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 30px 0 0;
    color: var(--muted);
    font-size: clamp(0.58rem, 1vw, 0.72rem);
}

.album-note i { width: 22px; height: 1px; background: var(--orange); }

.track-grid {
    width: min(100%, 780px);
    margin-inline: auto;
}

.track-grid {
    margin-top: clamp(54px, 8vh, 86px);
    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: rgba(245, 242, 235, 0.44);
    font-size: 0.65rem;
    transition: color 150ms ease, background 150ms ease;
}

.track-grid li:last-child { border-bottom: 0; }
.track-grid li:nth-child(3n + 1) { color: var(--paper); }
.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;
    color: rgba(245, 242, 235, 0.56);
    text-decoration: none;
    pointer-events: auto;
    touch-action: manipulation;
}

.album-services a:hover {
    color: var(--ink);
    background: var(--orange);
}

.service-icon {
    display: block;
    width: 24px;
    height: 24px;
    background: currentColor;
    pointer-events: none;
    mask: var(--service-icon) center / contain no-repeat;
    -webkit-mask: var(--service-icon) center / contain no-repeat;
}

.service-icon--spotify { --service-icon: url("spotify.svg"); }
.service-icon--deezer { --service-icon: url("deezer.svg"); }
.service-icon--apple-music { --service-icon: url("apple-music.svg"); }
.service-icon--youtube-music { --service-icon: url("youtube-music.svg"); }

.album-services a:focus-visible {
    color: var(--ink);
    background: var(--orange);
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.track-title {
    min-width: 0;
    color: var(--paper);
    font-size: 0.69rem;
    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.56rem;
}

footer p { margin: 0; }

@keyframes blink {
    0%, 78% { opacity: 1; }
    79%, 100% { opacity: 0.18; }
}

@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; }
    .masthead { align-items: flex-start; flex-direction: column; gap: 14px; }
    .album { padding-top: 96px; }
    h1 { font-size: clamp(8rem, 45vw, 12rem); }
    .album-note { gap: 9px; }
    .track-grid li { grid-template-columns: 3.25rem minmax(0, 1fr); }
    .track-grid li { min-height: 50px; padding-inline: 12px; }
    .album-services { gap: 4px; margin-top: 24px; }
    .track-title { font-size: 0.6rem; line-height: 1.35; }
    footer { align-items: flex-end; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .status span { animation: none; }
    h1::before,
    h1::after,
    .track-grid li::after { animation: none; }
}
