@font-face {
    font-family: 'Montserrat';
    src: url('../../../fonts/Montserrat-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
}

:root {
    --paper: #e9e5dd; /* the off-white page, same as the 3D studio paper */
    --ink: #1c1b19;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Montserrat', sans-serif;
}

/* The 3D scene fills the window; touch-action none so a finger drag turns the unit instead of the page */
.scene, .scene canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.noscript {
    position: fixed;
    inset: auto 0 45vh;
    text-align: center;
}

/* Arrives bottom left once the display has played its first full cycle */
.name {
    position: fixed;
    left: 5vw;
    bottom: 7vh;
    font-size: clamp(36px, 5.2vw, 92px);
    font-weight: 250;
    line-height: 0.95;
    letter-spacing: -0.02em;
    pointer-events: none;
    opacity: 0;
    translate: 0 0.3em;
    transition: opacity 1.2s ease, translate 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.name span { display: block; }
.name span + span { padding-left: 0.5em; }
.name.in { opacity: 1; translate: 0 0; }

/* The crate of records slides in from the right along the floor. Seen from above (perspective-origin),
   so the records further back peek out over the ones in front. */
.crate {
    --w: min(28vw, 400px);
    --d: 150px;
    position: fixed;
    right: 5vw;
    bottom: 6vh;
    width: var(--w);
    height: calc(var(--w) * 0.95);
    perspective: 1100px;
    perspective-origin: 30% -70%;
    translate: 130vw 0;
    visibility: hidden;
    transition: translate 1.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 1.8s;
}
.crate.in { translate: 0 0; visibility: visible; transition: translate 1.8s cubic-bezier(0.16, 1, 0.3, 1); }
.crate::before { /* its shadow on the floor */
    content: "";
    position: absolute;
    left: -6%;
    right: -6%;
    bottom: -6%;
    height: 22%;
    background: radial-gradient(closest-side, rgb(40 30 20 / 0.32), transparent);
    filter: blur(6px);
}

.crate-box {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: translateZ(calc(var(--d) * -1));
}

/* Wood panels: the generated wood (main.js) with dark gaps between three planks */
.crate-front, .crate-back, .crate-side {
    position: absolute;
    bottom: 0;
    height: 46%;
    background:
        linear-gradient(transparent 31%, rgb(30 20 12 / 0.85) 31% 35%, transparent 35% 65%, rgb(30 20 12 / 0.85) 65% 69%, transparent 69%),
        var(--wood, none) center / cover,
        #8a6e50;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.3), inset 0 -10px 18px -8px rgb(0 0 0 / 0.35);
}
.crate-front { left: 0; right: 0; transform: translateZ(var(--d)); }
.crate-front::after { /* hand hole */
    content: "";
    position: absolute;
    left: 38%;
    right: 38%;
    top: 10%;
    height: 14%;
    border-radius: 99px;
    background: #1d150e;
}
.crate-back { left: 0; right: 0; filter: brightness(0.6); }
.crate-side {
    left: 0;
    width: var(--d);
    transform-origin: left bottom;
    transform: rotateY(-90deg);
    filter: brightness(0.78);
}
.crate-side.right { left: 100%; }

/* Records stand leaning back; the front one is Option 1. Hover, focus or a first tap lifts one out. */
.record {
    position: absolute;
    left: 7%;
    width: 86%;
    bottom: 10%;
    aspect-ratio: 1;
    color: #fff;
    transform-origin: 50% 100%;
    transform: translateZ(calc(var(--d) - 16px - var(--i) * 13px)) translateY(calc(var(--i) * -4.6%)) rotateX(14deg);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.record[href] { cursor: pointer; }
.record:hover, .record:focus-visible, .record.active {
    transform: translateZ(calc(var(--d) - 16px - var(--i) * 13px)) translateY(calc(var(--i) * -4.6%)) rotateX(14deg) translateY(-36%); /* slides out along its own lean, so it stays behind the records in front */
}

.sleeve {
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: linear-gradient(160deg, rgb(255 255 255 / 0.2), transparent 45%), var(--tone);
    background-size: cover;
    background-position: center;
    box-shadow: 0 -3px 10px rgb(0 0 0 / 0.25), inset 0 0 0 1px rgb(255 255 255 / 0.12);
}
.record:focus-visible .sleeve { outline: 2px solid var(--ink); outline-offset: 3px; }
.record[aria-disabled] .sleeve { filter: saturate(0.55); }

/* Printed along the top of each sleeve, so the menu reads even before a record is lifted */
.label {
    position: absolute;
    left: 8%;
    top: 0.3em;
    font-size: clamp(9px, 0.8vw, 12px);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
}
.label small {
    font-size: 0.8em;
    font-weight: 400;
    opacity: 0.7;
    letter-spacing: 0.1em;
}

@media (orientation: portrait) {
    .crate { --w: min(48vw, 360px); right: 4vw; bottom: 4vh; }
}

@media (prefers-reduced-motion: reduce) {
    .name, .crate, .crate.in, .record { transition: none; }
}
