:root {
  --bg: #000;
  --fg: #f2f2f2;
  --muted: #7a7a7a;
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad-x: clamp(16px, 5.3vw, 110px);
  --pad-y: clamp(16px, 3vw, 54px);
  --chrome-size: 12px;
  --list-size: clamp(20px, 2.2vw, 42px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input { font: inherit; color: inherit; }

.eyebrow { margin: 0; font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase; letter-spacing: .01em; color: var(--muted); }

/* soft fade behind the header so it stays legible over bright screens */
body::before {
  content: ''; position: fixed; left: 0; right: 0; top: 0; height: 130px; z-index: 8; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.7), rgba(0,0,0,0));
}

/* ── Canvas + chrome ────────────────────────────────────── */
.gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.gl.is-hover { cursor: pointer; }
.gl.is-dragging { cursor: grabbing; }

.chrome {
  position: fixed; z-index: 10; top: var(--pad-y); left: var(--pad-x); right: var(--pad-x);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase; letter-spacing: .01em; line-height: 1;
  pointer-events: none; transition: opacity .6s var(--ease);
}
.chrome > * { pointer-events: auto; }
.chrome__brand { display: flex; gap: 1.2em; flex-wrap: wrap; }
.chrome__muted { color: var(--muted); }
.chrome__nav { display: flex; gap: 1.6em; flex-wrap: wrap; justify-content: flex-end; }
.chrome__nav button, .chrome__nav a { text-transform: uppercase; transition: opacity .3s; }
.chrome__nav button:hover { opacity: .6; }
body.is-loading .chrome { opacity: 0; }

/* elevator rail: the first category at the bottom, climbing up */
.rail {
  position: fixed; z-index: 10; right: var(--pad-x); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column-reverse; gap: 14px; align-items: center;
  transition: opacity .6s var(--ease);
}
.rail button { position: relative; width: 6px; height: 6px; border-radius: 50%; background: #4a4a4a; transition: background .3s, transform .3s var(--ease); }
.rail button::before { content: ''; position: absolute; inset: -9px; }
.rail button:hover { background: #aaa; }
.rail button.active { background: var(--fg); transform: scale(1.7); }
.rail button::after {
  content: attr(data-label); position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase; white-space: nowrap;
  color: var(--fg); opacity: 0; pointer-events: none; transition: opacity .2s; text-shadow: 0 0 10px #000, 0 0 3px #000;
}
.rail button:hover::after { opacity: 1; }
body.is-loading .rail { opacity: 0; }
body.no-webgl .rail { display: none; }

/* one label per ribbon, riding just above it */
.rowlabels { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.rowlabel {
  position: absolute; left: var(--pad-x); top: 0; opacity: 0;
  display: flex; align-items: baseline; gap: .8em; white-space: nowrap;
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase; letter-spacing: .01em; line-height: 1;
  color: var(--muted); will-change: transform, opacity;
  transition: color .5s var(--ease), font-size .5s var(--ease);
  text-shadow: 0 0 10px #000, 0 0 3px #000;
}
.rowlabel .count { font-size: .62em; font-weight: 500; opacity: .75; }
.rowlabel.is-active {
  top: auto; bottom: calc(var(--pad-y) + 40px);
  color: var(--fg); font-size: clamp(16px, 1.7vw, 30px); letter-spacing: -.01em;
}
body.is-loading .rowlabels { opacity: 0; }

/* the centred card's name, hung under it */
.celltitle {
  position: fixed; left: 0; top: 0; z-index: 9; pointer-events: none; opacity: 0; white-space: nowrap;
  font-size: clamp(28px, 3.3vw, 62px); font-weight: 500; letter-spacing: -.025em; line-height: 1;
  text-shadow: 0 0 20px #000, 0 0 5px #000; will-change: transform, opacity;
}
body.is-loading .celltitle, body.item-open .celltitle { visibility: hidden; }
.now__name { display: none; }   /* the name now lives under the card; the counter stays */
@media (max-width: 700px) { .celltitle { font-size: clamp(24px, 7.2vw, 40px); } }

.now {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: calc(var(--pad-y) + 46px);
  display: flex; justify-content: center; align-items: baseline; gap: 1.2em;
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase; pointer-events: none;
}
.now__no { color: var(--muted); font-variant-numeric: tabular-nums; }
.now__name { pointer-events: auto; text-transform: uppercase; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now__name:hover { opacity: .6; }

.tabs {
  position: fixed; z-index: 10; left: var(--pad-x); right: var(--pad-x); bottom: var(--pad-y);
  display: flex; gap: 1.6em; justify-content: center; overflow-x: auto; scrollbar-width: none;
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase; white-space: nowrap;
  transition: opacity .6s var(--ease);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs, .now { text-shadow: 0 0 10px #000, 0 0 3px #000; }
.tabs button { text-transform: uppercase; color: var(--muted); transition: color .3s; flex: 0 0 auto; }
.tabs button:hover, .tabs button.active { color: var(--fg); }
.tabs .count { opacity: .6; margin-left: .35em; }
body.is-loading .tabs { opacity: 0; }

.hint {
  position: fixed; z-index: 9; right: var(--pad-x); bottom: calc(var(--pad-y) + 40px); margin: 0;
  text-align: right; font-size: var(--chrome-size); text-transform: uppercase; color: var(--muted);
  pointer-events: none; transition: opacity .8s var(--ease);
}
.hint.is-gone { opacity: 0; }

/* ── Index overlay ──────────────────────────────────────── */
.index {
  position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto;
  padding: calc(var(--pad-y) + 40px) var(--pad-x) 80px;
}
.index__bar {
  position: fixed; top: var(--pad-y); left: var(--pad-x); right: var(--pad-x); z-index: 2;
  display: flex; justify-content: space-between; gap: 24px; align-items: center;
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase;
}
.index__bar input {
  flex: 1; max-width: 360px; background: none; border: 0; border-bottom: 1px solid #333; padding: 4px 0;
  text-transform: uppercase; outline: none;
}
.index__bar input::placeholder { color: var(--muted); }
.index__bar button { text-transform: uppercase; }
.index__list {
  list-style: none; margin: 8vh auto 0; padding: 0; max-width: min(70vw, 1300px); text-align: center;
  font-size: var(--list-size); line-height: 1.42; letter-spacing: -.02em; color: #4a4a4a;
}
.index__list li { display: inline; }
.index__list a { white-space: nowrap; transition: color .2s; }
.index__list a:hover, .index__list a:focus-visible { color: var(--fg); outline: none; }
.index__list .sep { margin: 0 .3em; }
.index__empty { color: var(--muted); font-size: var(--chrome-size); text-transform: uppercase; }
.index__preview {
  position: fixed; left: 0; top: 0; z-index: 3; width: min(24vw, 400px); aspect-ratio: 4 / 3;
  border-radius: 14px; overflow: hidden; background: #111; pointer-events: none;
  opacity: 0; transform: translate(-9999px, -9999px) scale(.85); transition: opacity .25s var(--ease);
}
.index__preview.is-on { opacity: 1; }
.index__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Item detail ────────────────────────────────────────── */
.detail {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: grid; place-items: center;
  padding: 0 var(--pad-x) 0 min(30vw, 440px);
  opacity: 0; transition: opacity .5s var(--ease);
}
.detail.is-open { opacity: 1; }
.detail__stage {
  width: min(100%, 108vh); aspect-ratio: 4 / 3; border-radius: clamp(10px, 1.4vw, 22px); overflow: hidden;
  background: #0d0d0d; transform: scale(.95) translateY(2%); transition: transform .8s var(--ease);
  display: grid; place-items: center;
}
.detail.is-open .detail__stage { transform: none; }
.detail__stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.detail__stage .nophoto { color: var(--muted); font-size: var(--chrome-size); text-transform: uppercase; }
.detail__meta {
  position: fixed; left: var(--pad-x); top: var(--pad-y); max-width: calc(min(30vw, 440px) - var(--pad-x) - 28px);
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase;
}
.detail__cat { margin: 0 0 .9em; color: var(--muted); }
.detail__name { margin: 0; font: inherit; }
.detail__desc {
  margin: 1.6em 0 0; text-transform: none; font-weight: 400; font-size: 14px; line-height: 1.55;
  color: #bdbdbd; letter-spacing: 0;
}
.detail__actions { margin-top: 1.8em; display: flex; flex-direction: column; align-items: flex-start; gap: .9em; }
.detail__actions button { text-transform: uppercase; color: var(--muted); }
.detail__actions button:hover, .detail__actions button.selected { color: var(--fg); }
.detail__thumbs {
  position: fixed; left: min(30vw, 440px); right: 0; bottom: calc(var(--pad-y) + 30px); display: flex; gap: 8px; justify-content: center;
}
.detail__thumbs button { width: 54px; height: 40px; border-radius: 6px; overflow: hidden; opacity: .45; transition: opacity .3s; }
.detail__thumbs button.active, .detail__thumbs button:hover { opacity: 1; }
.detail__thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail__nav, .detail__close {
  position: fixed; font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase; line-height: 1;
}
.detail__nav { left: var(--pad-x); bottom: var(--pad-y); display: flex; gap: .4em; color: var(--muted); }
.detail__nav button { text-transform: uppercase; }
.detail__nav button:hover, .detail__close:hover { color: var(--fg); }
.detail__close { right: var(--pad-x); top: var(--pad-y); text-transform: uppercase; }

/* item view (3D) */
.detail__tip { display: none; margin: 1.6em 0 0; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.detail--3d { background: transparent; pointer-events: none; padding: 0; }
.detail--3d .detail__stage, .detail--3d .detail__thumbs { display: none; }
.detail--3d .detail__meta, .detail--3d .detail__nav, .detail--3d .detail__close { pointer-events: auto; }
.detail--3d .detail__meta {
  position: fixed; left: var(--pad-x); top: calc(var(--pad-y) + 64px); max-width: min(29vw, 560px);
  padding: 0; margin: 0; text-shadow: 0 0 18px #000, 0 0 4px #000;
}
.detail--3d .detail__tip { display: block; }
.detail--3d .detail__cat {
  margin: 0 0 1.1em; font-size: clamp(12px, 1vw, 16px); letter-spacing: .04em;
}
.detail--3d .detail__name {
  font-size: clamp(34px, 3.8vw, 72px); font-weight: 500; line-height: 1.02; letter-spacing: -.03em;
  text-transform: none;
}
.detail--3d .detail__desc {
  margin-top: 1.5em; font-size: clamp(15px, 1.15vw, 20px); line-height: 1.6; color: #dcdcdc;
}
.detail--3d .detail__actions { margin-top: 2.2em; gap: 1.1em; }
.detail--3d .detail__actions button {
  font-size: clamp(13px, 1vw, 16px); letter-spacing: .02em; color: #ececec;
  padding-bottom: .25em; border-bottom: 1px solid rgba(255,255,255,.28); transition: border-color .25s, color .25s;
}
.detail--3d .detail__actions button:hover, .detail--3d .detail__actions button.selected { color: #fff; border-bottom-color: #fff; }
.detail--3d .detail__tip { margin-top: 2em; font-size: clamp(11px, .85vw, 14px); }
.detail--3d .detail__nav, .detail--3d .detail__close { font-size: clamp(12px, .95vw, 15px); }
body.item-open .chrome__nav { opacity: 0; pointer-events: none; }
body.item-open .tabs, body.item-open .rail, body.item-open .now, body.item-open .rowlabels, body.item-open .hint {
  opacity: 0; pointer-events: none;
}
@media (max-width: 700px) {
  .detail--3d .detail__meta { max-width: 68vw; top: calc(var(--pad-y) + 54px); }
  .detail--3d .detail__name { font-size: clamp(26px, 7.4vw, 40px); }
  .detail--3d .detail__desc { display: none; }
}

/* favorites space */
.fvlabels { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.fvlabel {
  position: absolute; left: 0; top: 0; opacity: 0; white-space: nowrap; will-change: transform, opacity;
  display: flex; align-items: baseline; gap: .8em; transform-origin: 0 100%;
  margin-top: -1.5em;
  font-size: clamp(13px, 1.1vw, 18px); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; line-height: 1;
  color: var(--fg); text-shadow: 0 0 12px #000, 0 0 3px #000;
}
.fvlabel .count { color: var(--muted); font-size: .8em; }

/* a plain list of every item for screen readers, keyboards and search engines */
.sr-list { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip {
  position: fixed; left: 12px; top: -48px; z-index: 100; padding: 10px 14px; background: #f2f2f2; color: #000;
  border-radius: 8px; font-size: 13px; font-weight: 500; transition: top .15s;
}
.skip:focus { top: 12px; }
.chrome__staff { color: var(--muted); text-transform: uppercase; transition: opacity .3s, color .3s; }
.chrome__staff:hover { color: var(--fg); }
body.item-open .chrome__nav, body.fav-open .chrome__nav { opacity: 0; pointer-events: none; }

/* remove-stars on the favorites tiles */
.fvstars { position: fixed; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.fvstar {
  position: absolute; left: 0; top: 0; padding: 0; opacity: 0; will-change: transform, opacity;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: rgba(8, 8, 10, .62); border: 1px solid rgba(255, 199, 42, .55);
  color: #ffc72a; transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
  backdrop-filter: blur(3px);
}
.fvstar svg { width: 62%; height: 62%; fill: currentColor; display: block; }
.fvstar:hover, .fvstar:focus-visible {
  background: #ffc72a; color: #000; border-color: #ffc72a; box-shadow: 0 0 14px rgba(255, 199, 42, .7); outline: none;
}

.favview.is-empty .favview__tip { display: none; }
.favview__actions { margin-top: 2em; display: flex; flex-direction: column; align-items: flex-start; gap: 1em; }
.favview__actions[hidden] { display: none; }
.favview__actions button {
  font-size: clamp(13px, 1vw, 16px); letter-spacing: .02em; text-transform: uppercase; color: #ececec;
  padding-bottom: .25em; border-bottom: 1px solid rgba(255,255,255,.28); transition: border-color .25s, color .25s;
}
.favview__actions button:hover { color: #fff; border-bottom-color: #fff; }
.favview__actions button.armed { color: #ff8a80; border-bottom-color: #ff8a80; }
body:not(.fav-open) .fvstars { display: none; }

.favview {
  position: fixed; z-index: 11; left: var(--pad-x); top: calc(var(--pad-y) + 64px); max-width: min(23vw, 420px);
  opacity: 0; transition: opacity .5s var(--ease); text-shadow: 0 0 18px #000, 0 0 4px #000;
}
.favview.is-open { opacity: 1; }
.favview__eyebrow { margin: 0 0 1.1em; font-size: clamp(12px, 1vw, 16px); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.favview__title { margin: 0; font-weight: 500; font-size: clamp(34px, 3.8vw, 72px); line-height: 1.02; letter-spacing: -.03em; }
.favview__saved { margin: 1.1em 0 0; font-size: clamp(15px, 1.15vw, 20px); color: #dcdcdc; }
.favview__empty { margin: 1.4em 0 0; font-size: clamp(15px, 1.15vw, 20px); line-height: 1.55; color: #dcdcdc; }
.favview__tip { margin: 2em 0 0; font-size: clamp(11px, .85vw, 14px); font-weight: 500; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.favview__close {
  position: fixed; right: var(--pad-x); top: var(--pad-y); text-transform: uppercase; font-size: clamp(12px, .95vw, 15px);
  font-weight: 500; line-height: 1;
}
.favview__close:hover { color: var(--muted); }
body.fav-open .tabs, body.fav-open .rail, body.fav-open .now, body.fav-open .rowlabels, body.fav-open .hint,
body.fav-open .chrome__nav { opacity: 0; pointer-events: none; }
body.fav-open .celltitle { visibility: hidden; }
body.fav-open .tabs { opacity: 1; pointer-events: auto; }
body.no-webgl .favview { position: static; max-width: none; padding: 80px var(--pad-x) 0; opacity: 1; }
@media (max-width: 700px) {
  .favview { max-width: 66vw; top: calc(var(--pad-y) + 54px); }
  .favview__title { font-size: clamp(26px, 7.4vw, 40px); }
  .favview__tip { display: none; }
}

/* ── Quote region picker ────────────────────────────────── */
.quote {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.82); display: grid; place-items: center; padding: 20px;
  backdrop-filter: blur(6px);
}
.quote__panel {
  width: min(440px, 100%); display: grid; gap: 10px; padding: 28px; background: #0b0b0b;
  border: 1px solid #1d1d1d; border-radius: 16px;
}
.quote__panel h2 { margin: 0 0 8px; font-weight: 500; font-size: 24px; letter-spacing: -.02em; }
.quote__panel > button:not(.quote__close) {
  text-align: left; padding: 14px 16px; border: 1px solid #222; border-radius: 10px; display: grid; gap: 4px;
  transition: border-color .2s, background .2s;
}
.quote__panel > button:not(.quote__close):hover { border-color: #555; background: #111; }
.quote__panel strong { font-weight: 500; }
.quote__panel span { color: var(--muted); font-size: 13px; }
.quote__close { margin-top: 6px; color: var(--muted); text-transform: uppercase; font-size: var(--chrome-size); justify-self: start; }

/* ── Loader ─────────────────────────────────────────────── */
.loader {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: space-between;
  padding: var(--pad-y) var(--pad-x); background: var(--bg);
  font-size: var(--chrome-size); font-weight: 500; text-transform: uppercase;
  transition: opacity .8s var(--ease), visibility .8s;
}
#loaderPct { font-variant-numeric: tabular-nums; }
body:not(.is-loading) .loader { opacity: 0; visibility: hidden; }

/* ── Flat fallback (no WebGL) ───────────────────────────── */
.fallback {
  position: fixed; inset: 0; z-index: 5; overflow-y: auto;
  padding: calc(var(--pad-y) + 40px) var(--pad-x) calc(var(--pad-y) + 60px);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; align-content: start;
}
.fallback button { text-align: left; display: grid; gap: 8px; font-size: var(--chrome-size); text-transform: uppercase; }
.fallback img, .fallback .ph {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #111; display: block;
}
.fallback__head {
  grid-column: 1 / -1; margin: 18px 0 0; font-weight: 500; font-size: clamp(15px, 1.5vw, 24px);
  text-transform: uppercase; letter-spacing: -.01em;
}
.fallback__head span { color: var(--muted); font-size: .62em; margin-left: .6em; }
body.no-webgl .gl, body.no-webgl .now, body.no-webgl .hint, body.no-webgl .rowlabels { display: none; }

@media (max-width: 700px) {
  :root { --chrome-size: 11px; --list-size: clamp(18px, 5.4vw, 26px); }
  .chrome { flex-direction: column; gap: 14px; }
  .chrome__nav { justify-content: flex-start; gap: 1.2em; }
  .index__list { max-width: 94vw; }
  .index__preview { display: none; }
  .detail { padding: 0; }
  .detail__stage { width: 92vw; }
  .detail__thumbs { left: 0; }
  .detail__meta { position: static; max-width: none; padding: 0 var(--pad-x); margin-top: 18px; }
  .detail { grid-template-rows: auto auto; align-content: center; }
  .detail__thumbs { bottom: calc(var(--pad-y) + 26px); }
}

@media (prefers-reduced-motion: reduce) {
  .detail__stage, .detail, .chrome, .tabs { transition: none; }
}

/* phone: favorites actions */
.fvlabel { max-width: 46vw; }
.fvlabel > span:first-child { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) {
  .fvlabel { font-size: 12px; }
  /* the actions live along the bottom, clear of the tiles, rather than stacked under the headline */
  .favview__actions {
    position: fixed; left: var(--pad-x); right: var(--pad-x); bottom: calc(var(--pad-y) + 44px); margin: 0;
    flex-direction: row; flex-wrap: wrap; gap: 8px 22px; z-index: 11;
  }
  .favview__actions button { font-size: 12px; }
}
