/* ==========================================================================
   Darcy's Stacks

   Two colours carry the room: midnight navy for air and forest green for
   matter. Brass is the only accent and it is rationed. There is one typeface,
   Archivo, served locally, and the width axis does the expressive work.

   The canvas is owned rather than decorated: one colossal solid word behind
   the collection, one light source that answers the pointer, and one animated
   object per view. No patterns, no textures, no borrowed backgrounds.
   ========================================================================== */

/* -------------------------------------------------------------- typefaces */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/assets/fonts/archivo-latin-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/assets/fonts/archivo-latin-ext-var.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ----------------------------------------------------------------- tokens */

:root {
  /* Ground */
  --navy:      #071525;
  --navy-deep: #04101c;
  --navy-lift: #0b1e33;
  --navy-hi:   #102a44;

  /* Matter */
  --forest:      #103e32;
  --forest-hi:   #17563f;
  --forest-deep: #0a2a21;
  --leaf:        #72a58a;

  /* Accent, rationed */
  --gold:      #d9bb79;
  --gold-warm: #e8ce97;
  --gold-deep: #9c7c34;

  /* Ink */
  --ink:      #f2efdc;
  --ink-soft: #b9c8d1;
  --ink-dim:  #8ea2b0;
  --ember:    #e08a7e;
  --ember-lo: #8c3327;

  /* Structure */
  --line:    rgba(242, 239, 220, 0.13);
  --line-hi: rgba(242, 239, 220, 0.26);
  --field:   #061323;

  /* Light, written by brand.js */
  --lx: 38%;
  --ly: 14%;
  --lume: 0.5;

  /* Type */
  --face: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wide: 118;
  --wider: 125;
  --norm: 100;

  --t-2xs:  0.72rem;
  --t-xs:   0.795rem;
  --t-sm:   0.885rem;
  --t-base: 1rem;
  --t-md:   1.2rem;
  --t-lg:   1.5rem;
  --t-xl:   1.95rem;
  --t-2xl:  2.45rem;
  --t-3xl:  3.05rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: var(--ink);
  font-family: var(--face);
  font-variation-settings: 'wdth' var(--norm);
  font-size: var(--t-base);
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The room itself: navy above, forest settling into the floor. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--navy-deep) 0%, var(--navy) 42%, #06131f 100%),
    linear-gradient(0deg, rgba(16, 62, 50, 0.5) 0%, rgba(16, 62, 50, 0) 46%);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection { background: var(--gold); color: var(--navy-deep); }

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------- spectral light -- */

.lume {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58vmax 46vmax at var(--lx) var(--ly),
      rgba(217, 187, 121, 0.13), rgba(217, 187, 121, 0) 62%),
    radial-gradient(120vmax 96vmax at var(--lx) var(--ly),
      rgba(114, 165, 138, 0.15), rgba(11, 30, 51, 0) 68%);
  opacity: calc(0.5 + var(--lume) * 0.5);
}

/* --------------------------------------------------------- the colossus -- */

/* One word, set once, filled solid and lit by the same source as the room. */
.colossus {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.colossus__word {
  display: block;
  font-size: clamp(7rem, 31vw, 33rem);
  font-weight: 800;
  font-variation-settings: 'wdth' var(--wider);
  letter-spacing: -0.048em;
  line-height: 0.72;
  white-space: nowrap;
  text-indent: -0.048em;

  background-image: radial-gradient(70vmax 58vmax at var(--lx) var(--ly),
    #1a4a63 0%, #14405c 18%, #0f2c44 44%, #0a1d30 74%, #081727 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;

  transform: translate3d(0, calc(var(--colossus-y, -2vh)), 0);
  transition: transform 0.9s var(--ease-out), opacity 0.6s var(--ease);
}

/* The wall is edge to edge artwork; the word would only fight it. */
[data-view='wall'] .colossus { opacity: 0; }
[data-view='crate'] .colossus__word { --colossus-y: -13vh; }
[data-view='sphere'] .colossus__word { --colossus-y: 0vh; }
[data-view='coverflow'] .colossus__word { --colossus-y: -6vh; }

/* ------------------------------------------------------------------- boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.9rem;
  background: var(--navy);
}
.boot[hidden] { display: none; }

.boot__mark {
  display: block;
  width: clamp(88px, 16vw, 132px);
  color: var(--gold);
}
.boot__mark svg { display: block; width: 100%; height: auto; }

.boot__bar {
  display: block;
  position: relative;
  width: clamp(88px, 16vw, 132px);
  height: 2px;
  background: rgba(242, 239, 220, 0.12);
  overflow: hidden;
}
.boot__bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  background: var(--gold);
  animation: sweep 1.5s var(--ease) infinite;
}
@keyframes sweep {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(280%); }
}

/* ------------------------------------------------------------------- rail */

.rail {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(4, 16, 28, 0.94), rgba(7, 21, 37, 0.7));
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
}
.rail[hidden] { display: none; }

.rail__identity {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.rail__mark {
  display: block;
  flex: 0 0 auto;
  width: 2.05rem;
  color: var(--gold);
}
.rail__mark svg { display: block; width: 100%; height: auto; }

.rail__words { min-width: 0; }

.rail__name {
  margin: 0;
  font-size: clamp(1.02rem, 1.5vw, 1.3rem);
  font-weight: 700;
  font-variation-settings: 'wdth' var(--wide);
  letter-spacing: -0.015em;
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail__count {
  margin: 0.1rem 0 0;
  font-size: var(--t-2xs);
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.views {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(4, 16, 28, 0.55);
}
.views__btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 550;
  white-space: nowrap;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}
.views__btn:hover { color: var(--ink); background: rgba(242, 239, 220, 0.06); }
.views__btn[aria-pressed='true'] {
  background: var(--forest);
  border-color: rgba(217, 187, 121, 0.34);
  color: var(--ink);
  font-weight: 650;
}

.rail__tools {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search { position: relative; }
.search__label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%);
}
.search__input {
  width: 16rem;
  max-width: 100%;
  background: var(--field);
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: var(--t-sm);
  color: var(--ink);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.search__input::placeholder { color: var(--ink-dim); }
.search__input:hover { border-color: rgba(242, 239, 220, 0.4); }
.search__input:focus { border-color: var(--leaf); outline: none; }
.search__input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ------------------------------------------------------------- primitives */

.btn {
  border: 1px solid var(--gold-deep);
  background: var(--gold);
  color: var(--navy-deep);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 650;
  white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.btn:hover { background: var(--gold-warm); }

.btn--ghost {
  background: rgba(242, 239, 220, 0.03);
  border-color: var(--line-hi);
  color: var(--ink-soft);
  font-weight: 550;
}
.btn--ghost:hover {
  background: rgba(242, 239, 220, 0.09);
  color: var(--ink);
  border-color: rgba(242, 239, 220, 0.42);
}

.btn--danger { background: transparent; border-color: rgba(140, 51, 39, 0.7); color: var(--ember); }
.btn--danger:hover { background: var(--ember-lo); color: var(--ink); border-color: var(--ember-lo); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* A hairline pair, used as a rule between blocks. */
.groove {
  height: 3px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid rgba(242, 239, 220, 0.06);
  margin: 1.25rem 0;
}

/* ------------------------------------------------------------------ stage */

.stage {
  position: relative;
  z-index: 10;
  flex: 1 1 auto;
  min-height: 0;
}
.stage[hidden] { display: none; }

.pane { position: absolute; inset: 0; }
.pane[hidden] { display: none; }

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: 2rem;
}
.empty[hidden] { display: none; }
.empty__head {
  margin: 0;
  font-size: var(--t-xl);
  font-variation-settings: 'wdth' var(--wide);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.empty__body { margin: 0; color: var(--ink-soft); max-width: 34ch; }

/* -------------------------------------------------------------- cover art */

.sleeve {
  position: relative;
  aspect-ratio: 1;
  background: var(--navy-lift);
  overflow: hidden;
}
.sleeve > img,
.sleeve > svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* The lip of light along the sleeve opening. */
.sleeve::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.14) 0%, transparent 20%);
  pointer-events: none;
}

/* ------------------------------------------------------------- Cover Flow */

.cf {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  perspective: 1500px;
  perspective-origin: 50% 42%;
  touch-action: pan-y;
  user-select: none;
}

.cf__deck {
  position: relative;
  transform-style: preserve-3d;
  cursor: grab;
}
.cf__deck:active { cursor: grabbing; }

.cf__item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(148px, 27vh, 310px);
  margin: calc(clamp(148px, 27vh, 310px) / -2 * 1.34) 0 0 calc(clamp(148px, 27vh, 310px) / -2);
  transform-style: preserve-3d;
  will-change: transform;
}

.cf__face {
  position: relative;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.5),
    0 24px 54px rgba(0, 0, 0, 0.62);
}

.cf__deck:focus-visible { outline: none; }
.cf__deck:focus-visible .cf__item[aria-selected='true'] .cf__face {
  outline: 2px solid var(--gold);
  outline-offset: 6px;
}

.cf__mirror {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  transform: scaleY(-1);
  transform-origin: center;
  opacity: 0.26;
  -webkit-mask-image: linear-gradient(to bottom, transparent 44%, rgba(0, 0, 0, 0.9));
          mask-image: linear-gradient(to bottom, transparent 44%, rgba(0, 0, 0, 0.9));
  pointer-events: none;
}
.cf__mirror .sleeve::after { display: none; }

.cf__caption {
  text-align: center;
  padding: 0 1.5rem 2rem;
  display: grid;
  gap: 0.15rem;
  min-height: 7.5rem;
  align-content: start;
}
.cf__title {
  margin: 0;
  font-size: clamp(1.3rem, 2.7vw, var(--t-2xl));
  font-variation-settings: 'wdth' var(--wide);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.08;
}
.cf__artist {
  margin: 0.1rem 0 0;
  font-size: var(--t-md);
  color: var(--ink-soft);
  font-weight: 400;
}
.cf__meta {
  margin: 0.4rem 0 0;
  font-size: var(--t-xs);
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}
.cf__meta span { display: inline-flex; align-items: center; gap: 0.45rem; }
.cf__meta span + span::before {
  content: '';
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--gold-deep);
}
.cf__hint {
  margin: 0.55rem 0 0;
  font-size: var(--t-2xs);
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------- the wall */

.wall {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(108px, 13vw, 190px), 1fr));
  gap: 3px;
  align-content: start;
}
.wall__item {
  position: relative;
  border: 0;
  padding: 0;
  background: none;
  display: block;
  transition: transform 0.2s var(--ease);
}
.wall__item:hover, .wall__item:focus-visible {
  transform: scale(1.07);
  z-index: 3;
}
.wall__item:hover .wall__plate, .wall__item:focus-visible .wall__plate { opacity: 1; }

.wall__plate {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2.4rem 0.65rem 0.6rem;
  background: linear-gradient(transparent, rgba(4, 16, 28, 0.95));
  text-align: left;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  pointer-events: none;
}
.wall__plateTitle {
  display: block;
  font-size: var(--t-sm);
  font-weight: 650;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wall__plateMeta {
  display: block;
  font-size: var(--t-2xs);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------- the sphere */

.sphere {
  position: absolute;
  inset: 0;
  perspective: 1600px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.sphere:active { cursor: grabbing; }

.sphere__world {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
  will-change: transform;
}
.sphere__node {
  position: absolute;
  width: var(--node, 108px);
  height: var(--node, 108px);
  margin: calc(var(--node, 108px) / -2) 0 0 calc(var(--node, 108px) / -2);
  transform-style: preserve-3d;
  border: 0;
  padding: 0;
  background: none;
}
.sphere__node .sleeve { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6); }
.sphere__node:hover { z-index: 5; }

.sphere__readout {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 2000;
  max-width: min(30rem, calc(100% - 2rem));
  padding: 0.42rem 1rem;
  border-radius: 999px;
  background: rgba(4, 16, 28, 0.9);
  border: 1px solid var(--line);
  text-align: center;
  pointer-events: none;
  font-size: var(--t-sm);
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   The crate

   A real box. Every wall has an outer skin, an inner skin, a rim you can see
   the thickness of, and a moulded corner post at each join, so the camera can
   orbit right around it and always find solid geometry. The lattice is punched
   through both skins with a mask, which means the holes genuinely misalign as
   you move: that parallax is what makes it read as moulded plastic rather
   than a picture of a crate.
   ========================================================================== */

.crate {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

.crate__viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  perspective: 1700px;
  perspective-origin: 50% 44%;
  touch-action: none;
  cursor: grab;
  outline: none;
}
.crate__viewport:active { cursor: grabbing; }
.crate__viewport[data-mode='orbit'] { cursor: move; }

.crate__scene {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.crate__box,
.crate__stack {
  position: absolute;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
}

/* Every quad in the crate. Geometry is written from JS. */
.crate__face {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.crate__face > svg { display: block; }

/* The floor the crate stands on. Not a surface, just the light it blocks. */
.crate__contact {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  pointer-events: none;
  background:
    radial-gradient(closest-side ellipse at 50% 50%, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.34) 46%, rgba(0, 0, 0, 0) 78%);
}

/* Solid quads: rim caps, corner posts and the underside of the base. These
   carry no lattice, so their shading does all the work. Orientation decides
   how much of the room light each one catches. */
.crate__solid {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* Rim and post tops look straight up into the light. */
.crate__solid--cap {
  background: linear-gradient(135deg, #1e6349 0%, #175139 55%, #103e32 100%);
  box-shadow: inset 0 0 0 1px rgba(4, 16, 28, 0.5);
}
/* Corner posts stand proud of the walls like moulded ribs. */
.crate__solid--post {
  background: linear-gradient(180deg, #1a5a45 0%, #103e32 58%, #0a2a21 100%);
  box-shadow: inset 0 0 0 1px rgba(4, 16, 28, 0.45);
}
/* Post faces turned into the crate sit in its shade. */
.crate__solid--postin {
  background: linear-gradient(180deg, #0e352a 0%, #0a2a21 100%);
}
/* The underside of the base never sees the room. */
.crate__solid--base {
  background: #071f19;
}

/* One sleeve, pivoting about its bottom edge, where it meets the crate floor. */
.rec {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--rec, 300px);
  height: var(--rec, 300px);
  margin: calc(var(--rec, 300px) * -1) 0 0 calc(var(--rec, 300px) / -2);
  padding: 0;
  border: 0;
  background: none;
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.rec__face,
.rec__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.rec__face { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); }
.rec__face .sleeve { height: 100%; }

/* How far into the crate's shadow this sleeve sits. */
.rec__face::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 16, 28, 0.5), rgba(4, 16, 28, 0.86));
  opacity: var(--shade, 0);
}

/* The back of the sleeve: greyboard, with the opening along the top. */
.rec__back {
  transform: rotateY(180deg);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0 5px, rgba(0, 0, 0, 0) 5px),
    linear-gradient(168deg, #3b4a52, #2a363d 46%, #1b2429);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
}

/* The cardboard thickness you look down onto when the crate is full. */
.rec__edge {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 10px;
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
  background: linear-gradient(90deg, #2c3840, #4a5a63 26%, #333f47 62%, #202a30);
  box-shadow: inset 0 1px 0 rgba(242, 239, 220, 0.14), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.rec[aria-selected='true'] .rec__face {
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(217, 187, 121, 0.22);
}
.crate__viewport:focus-visible .rec[aria-selected='true'] .rec__face {
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.72), 0 0 0 2px var(--gold);
}

/* ------------------------------------------------------------- crate HUD  */

.crate__hud {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  display: grid;
  gap: 0.7rem;
  padding: 0 1.25rem 1.1rem;
  justify-items: center;
}

.plate {
  text-align: center;
  max-width: 44rem;
}
.plate__title {
  margin: 0;
  font-size: clamp(1.15rem, 2.3vw, var(--t-xl));
  font-variation-settings: 'wdth' var(--wide);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.plate__artist { margin: 0.1rem 0 0; color: var(--ink-soft); }
.plate__meta {
  margin: 0.35rem 0 0;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: var(--t-2xs);
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.plate__meta span { display: inline-flex; align-items: center; gap: 0.75rem; }
.plate__meta span + span::before {
  content: '';
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--gold-deep);
}

.crate__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem 1.1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ctl {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ctl__label {
  font-size: var(--t-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

.crate__sorts, .crate__views { display: flex; gap: 2px; }
.crate__sortBtn,
.crate__viewBtn {
  background: rgba(242, 239, 220, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  color: var(--ink-soft);
  font-size: var(--t-xs);
  font-weight: 550;
  white-space: nowrap;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.crate__sortBtn:hover,
.crate__viewBtn:hover {
  color: var(--ink);
  background: rgba(242, 239, 220, 0.1);
  border-color: var(--line-hi);
}
.crate__sortBtn[data-active='true'],
.crate__viewBtn[aria-pressed='true'] {
  color: var(--navy-deep);
  background: var(--gold);
  border-color: var(--gold-deep);
  font-weight: 650;
}

.crate__viewBtn--icon {
  min-width: 2.1rem;
  display: inline-grid;
  place-items: center;
  padding: 0.3rem 0.5rem;
}
.crate__viewBtn svg { display: block; width: 0.95rem; height: 0.95rem; fill: currentColor; }

.crate__pos {
  font-size: var(--t-2xs);
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------- detail (a label) */

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(31rem, 100vw);
  height: 100%;
  background: var(--navy-lift);
  border-left: 1px solid var(--line-hi);
  box-shadow: -30px 0 70px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  animation: slideIn 0.3s var(--ease-out);
}
.sheet[hidden] { display: none; }
@supports (height: 100dvh) { .sheet { height: 100dvh; } }

@keyframes slideIn { from { transform: translateX(100%); } }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(3, 10, 18, 0.68);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.scrim[hidden] { display: none; }

.sheet__close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 2.1rem; height: 2.1rem;
  border-radius: 50%;
  border: 1px solid var(--line-hi);
  background: rgba(4, 16, 28, 0.8);
  color: var(--ink-soft);
  font-size: 1.15rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.sheet__close:hover { color: var(--ink); border-color: var(--ink-dim); }

.sheet__art { max-width: 12.5rem; margin-bottom: 1.25rem; }
.sheet__art .sleeve { box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6); }

.sheet__title {
  margin: 0;
  font-size: var(--t-xl);
  font-variation-settings: 'wdth' var(--wide);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.sheet__artist { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: var(--t-md); }

.facts {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
  font-size: var(--t-sm);
}
.facts dt { color: var(--ink-dim); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.sides { display: grid; gap: 1.1rem; }
.side__name {
  font-size: var(--t-2xs);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}
.side__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.15rem; }
.side__track {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.5rem;
  font-size: var(--t-sm);
  padding: 0.22rem 0;
  border-bottom: 1px solid rgba(242, 239, 220, 0.07);
}
.side__num { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.side__dur { color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.sheet__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.note {
  font-size: var(--t-sm);
  color: var(--ink-soft);
  background: rgba(16, 62, 50, 0.34);
  border-left: 2px solid var(--gold-deep);
  padding: 0.7rem 0.9rem;
  margin: 0;
}

.tag {
  display: inline-block;
  font-size: var(--t-2xs);
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  color: var(--ink-soft);
}
.tag--placeholder { border-color: rgba(217, 187, 121, 0.5); color: var(--gold); }

/* ------------------------------------------------------------------ modal */

.modal {
  border: 1px solid var(--line-hi);
  background: var(--navy-lift);
  color: var(--ink);
  border-radius: 6px;
  padding: 0;
  width: min(46rem, calc(100vw - 2rem));
  max-height: min(46rem, calc(100vh - 3rem));
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
}
@supports (height: 100dvh) {
  .modal { max-height: min(46rem, calc(100dvh - 3rem)); }
}
.modal::backdrop { background: rgba(3, 10, 18, 0.76); }

.modal__inner {
  padding: 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: inherit;
}
.modal__title {
  margin: 0 0 1rem;
  font-size: var(--t-lg);
  font-variation-settings: 'wdth' var(--wide);
  font-weight: 750;
  letter-spacing: -0.02em;
}
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ forms */

.form { display: grid; gap: 0.9rem; }
.form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem;
}
.field { display: grid; gap: 0.3rem; }
.field--wide { grid-column: 1 / -1; }
.field__label {
  font-size: var(--t-2xs);
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field__input,
.field__select,
.field__area {
  background: var(--field);
  border: 1px solid var(--line-hi);
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  font-size: var(--t-sm);
  width: 100%;
}
.field__area { resize: vertical; min-height: 4.5rem; font-family: inherit; }
.field__input:focus, .field__select:focus, .field__area:focus {
  border-color: var(--leaf);
  outline: none;
}
.field__hint { font-size: var(--t-2xs); color: var(--ink-dim); }
.field__error { font-size: var(--t-xs); color: var(--ember); }

.check { display: flex; align-items: center; gap: 0.55rem; font-size: var(--t-sm); }
.check input { accent-color: var(--gold); width: 1.05rem; height: 1.05rem; }

.tracks { display: grid; gap: 0.35rem; }
.tracks__row {
  display: grid;
  grid-template-columns: 3.5rem 1fr 5rem 2rem;
  gap: 0.4rem;
}
.tracks__del {
  background: none;
  border: 1px solid var(--line-hi);
  border-radius: 4px;
  color: var(--ink-soft);
}
.tracks__del:hover { color: var(--ink); border-color: var(--ember-lo); }

.drop {
  border: 1px dashed var(--line-hi);
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
  font-size: var(--t-sm);
  color: var(--ink-soft);
  cursor: pointer;
}
.drop:hover, .drop[data-over='true'] { border-color: var(--gold); color: var(--ink); }

/* ------------------------------------------------------------------ stats */

.stats { display: grid; gap: 1.25rem; }
.stats__figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 1rem;
}
.figure__n {
  display: block;
  font-size: var(--t-2xl);
  font-variation-settings: 'wdth' var(--wide);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.figure__k {
  font-size: var(--t-2xs);
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bars { display: grid; gap: 0.4rem; }
.bar { display: grid; grid-template-columns: 5rem 1fr 2.5rem; gap: 0.6rem; align-items: center; font-size: var(--t-sm); }
.bar__k { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bar__track { height: 0.5rem; background: var(--field); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--gold); }
.bar__n { text-align: right; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100vw - 2rem);
  background: var(--ink);
  color: var(--navy-deep);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 650;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.toast[hidden] { display: none; }
.toast[data-tone='bad'] { background: var(--ember-lo); color: var(--ink); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .rail {
    grid-template-columns: 1fr auto;
    padding: 0.7rem 1rem;
    gap: 0.6rem 0.9rem;
  }
  .rail__identity { grid-column: 1; }
  .views { grid-column: 2; }
  .rail__tools { grid-column: 1 / -1; justify-self: stretch; justify-content: flex-start; }
  .search { flex: 1 1 12rem; }
  .search__input { width: 100%; }
}

@media (max-width: 760px) {
  .rail {
    grid-template-columns: 1fr;
    padding: 0.6rem 0.85rem;
    gap: 0.55rem;
  }
  .rail__identity { grid-column: 1; }
  .views { grid-column: 1; justify-self: stretch; }
  .views__btn { flex: 1 1 0; padding: 0.42rem 0.3rem; font-size: var(--t-xs); text-align: center; }
  .rail__tools { gap: 0.4rem; }
  .rail__tools .btn { flex: 1 1 auto; padding: 0.5rem 0.7rem; }
  .search { flex: 1 1 100%; }

  .sheet { width: 100%; border-left: 0; }
  .sheet__art { max-width: 9.5rem; }
  .facts { grid-template-columns: 7rem 1fr; }
  .cf__caption { min-height: 6.2rem; padding-bottom: 1rem; }
  .stats__figures { grid-template-columns: repeat(2, 1fr); }
  .modal { width: calc(100vw - 1rem); }
  .modal__inner { padding: 1.1rem; }
  .tracks__row { grid-template-columns: 2.8rem 1fr 4rem 2rem; }
  .wall { padding: 0.6rem; gap: 2px; }
  .crate__hud { padding: 0 0.75rem 0.8rem; gap: 0.5rem; }
}

@media (max-width: 400px) {
  .rail { padding: 0.5rem 0.7rem; }
  .rail__mark { width: 1.7rem; }
  .views__btn { padding: 0.4rem 0.2rem; font-size: var(--t-2xs); }
  .rail__tools .btn { font-size: var(--t-xs); padding: 0.45rem 0.6rem; }
  .facts { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .facts dt { margin-top: 0.4rem; }
  .plate__meta { gap: 0.55rem; }
  .crate__controls { gap: 0.35rem 0.5rem; }
  .crate__sortBtn, .crate__viewBtn { padding: 0.25rem 0.45rem; font-size: 0.72rem; }
  .crate__viewBtn--icon { min-width: 1.85rem; padding: 0.25rem 0.35rem; }
}

/* Short and wide: give the stage every pixel it can have. */
@media (max-height: 620px) {
  .cf__caption { min-height: 5rem; padding-bottom: 0.6rem; }
  .crate__hud { padding-bottom: 0.6rem; gap: 0.45rem; }
  .plate__artist, .plate__meta { display: none; }
}

/* ------------------------------------------------------------ preferences */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .boot__bar i { animation: none; width: 100%; opacity: 0.5; }
  .colossus__word { transition: none; }
}
