:root {
  --bg: #fafaf9;
  --text: #1e1e1e;
  --tertiary: #b3b3b3;
  --stroke: #d4d4d8;
  --spring: cubic-bezier(0.3, 1.1, 0.5, 1);
  --spring-time: 0.55s;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--bg); }
body { font: 400 14px/18.2px "IBM Plex Mono", ui-monospace, monospace; color: var(--text); }
a { color: inherit; text-decoration: none; }
img { display: block; }

.shelf-page { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; height: 100vh; overflow: clip; background: var(--bg); }

/* horizontal scrolling row of sections */
.shelf-row {
  position: relative; z-index: 3; flex: none; display: flex; align-items: center; justify-content: flex-start; gap: 40px;
  width: 100%; height: 85vh; padding: 0 80px; overflow: auto;
  scrollbar-width: none; opacity: 0.001; animation: row-in 0.2s ease 0.05s forwards;
}
.shelf-row::-webkit-scrollbar { width: 0; height: 0; }
@keyframes row-in { to { opacity: 1; } }
@media (max-width: 1199.98px) { .shelf-row { padding: 0 34px 0 32px; } }

.section { flex: none; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; position: relative; }
.section.films { z-index: 0; }
.section.vinyls { z-index: 0; }
.section.gbs, .section.gcs { z-index: 2; }
.heading { display: flex; align-items: center; justify-content: center; padding: 8px 0; }
.heading h2 { font: 400 14px/18.2px "IBM Plex Mono", ui-monospace, monospace; color: var(--tertiary); text-transform: uppercase; white-space: pre; }

/* the frame is a fixed 224px window; the taller strip is centred inside it */
.frame { display: flex; align-items: center; justify-content: center; height: 224px; position: relative; }
.strip { flex: none; display: flex; align-items: flex-start; padding: 40px 80px 10px 0; position: relative; }
.films .strip, .gcs .strip { width: 440px; }
.vinyls .strip { width: 515px; padding-left: 2.5px; padding-right: 98.5px; }
.gbs .strip { width: 488px; }

/* one item = a slot that widens when the box inside turns to face the viewer */
.item { position: relative; flex: none; display: flex; align-items: center; justify-content: flex-start; transition: width var(--spring-time) var(--spring); }
.film, .gc { width: 60px; height: 267px; }
.film:hover, .gc:hover { width: 112px; }
.vinyl { width: 69px; height: 268px; }
.vinyl:hover { width: 148px; }
.gb { width: 68px; height: 190px; }
.gb:hover { width: 124px; }

.scale { position: relative; flex: none; display: flex; align-items: center; justify-content: center; transform: scale(0.7); }
.box {
  position: relative; display: flex; align-items: center; justify-content: center; transform-style: preserve-3d; transform-origin: 0 100%;
  transform: perspective(2000px) rotateX(-38deg) rotateY(-40deg);
  transition: transform var(--spring-time) var(--spring);
}
.item:hover .box { transform: perspective(2000px) rotateX(-33deg) rotateY(-70deg); }
.vinyl:hover .box { transform: perspective(2000px) rotateX(-33deg) rotateY(-60deg); }

.spine, .cover, .top, .bg, .art, .hl, .light, .line { transition: left var(--spring-time) var(--spring), top var(--spring-time) var(--spring), transform var(--spring-time) var(--spring); }
.art img, .bg img, .top img { width: 100%; height: 100%; object-fit: fill; user-select: none; }

/* shared dvd-style box: films and gamecube */
.film .box, .gc .box { width: 21px; height: 267px; }
.film .spine, .gc .spine { position: relative; width: 21px; height: 267px; padding-top: 10px; overflow: hidden; }
.film .bg, .gc .bg { position: absolute; left: 0; top: 0; width: 21px; height: 267px; overflow: hidden; filter: brightness(0.75); }
.film .cover, .gc .cover {
  position: absolute; left: -78px; top: 4px; width: 190px; height: 268px; overflow: hidden; z-index: 1;
  transform-origin: 95px 134px; transform: translate3d(0, 0, -100px) rotateY(90deg);
}
.film .top, .gc .top {
  position: absolute; left: -4px; top: -91px; width: 21px; height: 190px; overflow: hidden; z-index: 1; background: #333;
  transform-origin: 10.5px 95px; transform: translate3d(0, 0, -100px) rotateX(90deg);
}
.film .line, .gc .line { position: absolute; left: -85px; top: 95px; width: 190px; height: 1px; background: rgba(255, 255, 255, 0.31); transform-origin: 95px 0.5px; transform: translateY(-50%) rotate(-90deg); }

.art { position: absolute; inset: 0; }
.hl { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; overflow: hidden; background: linear-gradient(90deg, rgba(255, 255, 255, 0.84) 0%, rgba(201, 201, 201, 0.4) 100%); }
.light {
  position: absolute; left: -220px; top: -52px; width: 318px; height: 146px; transform-origin: 159px 73px; transform: rotate(122deg);
  background: linear-gradient(180deg, rgba(219, 217, 217, 0.4) 1.2458%, rgb(138, 138, 138) 100%); filter: blur(2px);
}

/* game boy box */
.gb .box { width: 35px; height: 190px; }
.gb .spine { position: relative; width: 35px; height: 190px; padding-top: 10px; overflow: hidden; }
.gb .bg { position: absolute; left: 0; top: 0; width: 35px; height: 190px; overflow: hidden; filter: brightness(0.75); }
.gb .cover {
  position: absolute; left: -64px; top: 4px; width: 190px; height: 190px; overflow: hidden; z-index: 1;
  transform-origin: 95px 95px; transform: translate3d(0, 0, -100px) rotateY(90deg);
}
.gb .top {
  position: absolute; left: -4px; top: -91px; width: 35px; height: 190px; overflow: hidden; z-index: 1;
  transform-origin: 17.5px 95px; transform: translate3d(0, 0, -100px) rotateX(90deg);
}

/* vinyl sleeve */
.vinyl .box { width: 4px; height: 268px; }
.vinyl .spine { position: absolute; left: 0; top: 0; width: 4px; height: 268px; overflow: hidden; }
.vinyl .bg { position: absolute; left: 0; top: 0; width: 4px; height: 275px; overflow: hidden; filter: brightness(0.75); }
.vinyl .wrap { position: absolute; left: 0; top: 0; width: 4px; height: 268px; transform-origin: 4px 0; transform: rotateY(90deg); }
.vinyl .cover { position: absolute; left: 4px; top: 0; width: 268px; height: 268px; overflow: hidden; z-index: 1; }
.vinyl .topc { position: absolute; left: 0; top: 0; width: 4px; height: 268px; z-index: 1; background: rgb(43, 42, 46); transform-origin: 0 0; transform: rotateX(-90deg); }
.vinyl .topi { position: absolute; left: 0; top: 0; width: 4px; height: 268px; overflow: hidden; z-index: 1; transform-origin: 0 0; transform: rotateX(-90deg); }
.vinyl .pattern {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%22126%22 height=%22126%22><path id=%22a%22 d=%22M126 0v21.584L21.584 126H0v-17.585L108.415 0H126Zm0 108.414V126h-17.586L126 108.414Zm0-84v39.171L63.585 126H24.414L126 24.414Zm0 42v39.17L105.584 126h-39.17L126 66.414ZM105.586 0 0 105.586V66.415L66.415 0h39.171Zm-42 0L0 63.586V24.415L24.415 0h39.171Zm-42 0L0 21.586V0h21.586Z%22 fill=%22rgb(136, 136, 136, 0.2)%22 fill-rule=%22evenodd%22/></svg>");
}

/* hovered (active) geometry */
.film:hover .bg, .gc:hover .bg { left: 10.0781px; top: 1px; transform: translateX(-50%); }
.film:hover .cover, .gc:hover .cover { left: -90px; top: 10px; }
.film:hover .light, .gc:hover .light { left: -183px; top: -8px; }
.film:hover .top, .gc:hover .top { left: -16px; top: -85px; }
.gb:hover .bg { left: -0.828125px; top: 1px; }
.gb:hover .cover { left: -76px; top: 10px; }
.gb:hover .light { left: -183px; top: -8px; }
.gb:hover .top { left: -14px; top: -85px; }
.film:hover .hl, .gc:hover .hl, .gb:hover .hl { background: linear-gradient(90deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.82) 100%); }

/* title tooltip: one per section, slides between items */
.tip {
  position: absolute; left: 0; top: 0; z-index: 6; display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, 4px); opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tip.show { opacity: 1; transform: translate(-50%, 0); transition: opacity 0.18s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.tip-arrow { position: relative; display: block; width: 16px; height: 16px; margin-bottom: -7px; }
.tip-arrow img { position: absolute; display: block; }
.tip-stroke { z-index: 0; left: 9%; top: 5%; width: 13.12px; height: 12px; }
.tip-fill { z-index: 2; left: 14%; top: 10%; width: 11.52px; height: 10.4px; }
.tip-body { position: relative; z-index: 1; display: block; padding: 6px 8px; white-space: nowrap; background: #fff; box-shadow: inset 0 0 0 1px var(--stroke); border-radius: 4px; }

/* footer */
/* big AKAT mark bleeding off the bottom-left, as in the Shelf design (1512 x 982: 480 x 263 at left 32, 120.8px below the edge) */
.shelf-logo { position: fixed; left: 32px; bottom: -120.78px; z-index: 5; display: block; width: 480px; height: 263.06px; image-rendering: pixelated; }
.shelf-logo { opacity: .2; transition: opacity .15s ease; animation: shelf-logo-in .4s cubic-bezier(.4, 0, 0, 1) .25s backwards; }
@keyframes shelf-logo-in { from { translate: 0 calc(100% + 16px); } }
.shelf-logo img { width: 100%; height: 100%; image-rendering: pixelated; transform-origin: 0 100%; transition: transform .32s cubic-bezier(.3, 1.6, .5, 1); will-change: transform; }
.shelf-logo:hover, .shelf-logo:focus-visible { opacity: 1; outline: none; }
.shelf-logo:hover img, .shelf-logo:focus-visible img { transform: scale(1.05); }
.shelf-logo:active img { transform: scale(1.02); transition-duration: .12s; }
@media (prefers-reduced-motion: reduce) { .shelf-logo { animation: none; } .shelf-logo img { transition: none; } .shelf-logo:hover img { transform: none; } }
.shelf-links { position: fixed; right: 32px; bottom: 32px; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.shelf-links a { display: flex; align-items: center; justify-content: center; gap: 4px; }
.shelf-links p { font: 400 14px/18.2px "IBM Plex Mono", ui-monospace, monospace; color: var(--text); }
@media (max-width: 1199.98px) {
  .shelf-logo { left: 2.67vw; bottom: -10.07vw; width: 40vw; height: auto; aspect-ratio: 480 / 263.06; }
  .shelf-links { right: 16px; bottom: 16px; gap: 4px; }
}
/* phones (Figma 390 x 844): the mark is a fixed 220 wide, 12px in from the left and cropped 31.6px below the edge; the links keep their 8px gap */
@media (max-width: 599.98px) {
  .shelf-logo { left: 12px; bottom: -31.57px; width: 220px; height: 120.57px; aspect-ratio: auto; }
  .shelf-links { right: 16px; bottom: 16px; gap: 8px; }
  .shelf-row { padding-top: 73px; }
}

/* entrance: the boxes fall in from the top one after another */
.shelf-row > .section:nth-child(1) { --s: 0; } .shelf-row > .section:nth-child(2) { --s: 1; }
.shelf-row > .section:nth-child(3) { --s: 2; } .shelf-row > .section:nth-child(4) { --s: 3; }
.item:nth-child(1) { --i: 0; } .item:nth-child(2) { --i: 1; } .item:nth-child(3) { --i: 2; }
.item:nth-child(4) { --i: 3; } .item:nth-child(5) { --i: 4; } .item:nth-child(6) { --i: 5; }
.item { animation: item-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) calc(0.25s + (var(--s, 0) * 6 + var(--i, 0)) * 0.045s) backwards; }
@keyframes item-in { from { translate: 0 -100vh; } }
/* each label fades in once the last box of its own section has landed: 0.25s + (section * 6 + 5) * 0.045s, plus the 0.55s fall */
.heading { animation: label-in 0.5s ease calc(0.8s + (var(--s, 0) * 6 + 5) * 0.045s) backwards; }
@keyframes label-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .item, .heading { animation: none; } }

/* the logos are buttons, not pictures to drag out of the page */
.shelf-logo, .shelf-logo img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

/* no blue flash when tapping links and buttons on phones */
html, a, button, img { -webkit-tap-highlight-color: transparent; }
