/* =====================================================================
   MINGUS-X: the crate
   Direction: black canvas, one tight neo-grotesk (Geist), huge tight
   headline, sharp 2px corners, one accent that follows the cover.
   Deliberately loosened from brand/BRAND.md.
   ===================================================================== */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/geist-variable.woff2') format('woff2');
}

@property --shade { syntax: '<number>'; inherits: true; initial-value: 0; }

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ink: #050506;
  --text: #f4f4f1;
  --dim: rgba(255, 255, 255, 0.58);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #eeeee8;
  --r: 2px;
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(18px, 3.2vw, 40px);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: #08080a; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

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

/* ---- stage ---- */
.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow: clip;
  background: var(--ink);
}
.backdrop { position: absolute; inset: -14%; z-index: 0; pointer-events: none; }
.backdrop i {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(90px) saturate(1.5) brightness(0.42);
  transform: scale(1.2);
  opacity: 0;
  transition: opacity 1s ease;
}
.backdrop i.on { opacity: 1; }
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(80% 62% at 50% 48%, transparent 25%, var(--ink) 100%);
}
.bar, .crate, .deck { position: relative; z-index: 1; }

/* ---- header ---- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  min-height: 68px;
}
.home {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.05em;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
/* wordmark: the hyphen is spaced by hand. Measured on the glyphs at the
   hyphen's height, S to hyphen was 0.08em but hyphen to X was 0.19em (the X
   is open at that height). These margins make both gaps about 0.12em. */
.home { letter-spacing: -0.025em; }
.home i { font-style: normal; margin: 0 -0.07em 0 0.04em; }
.bar-nav { display: flex; gap: clamp(14px, 3vw, 32px); }
.navbtn {
  appearance: none;
  background: none;
  border: 0;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 450;
  letter-spacing: -0.01em;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.2s;
}
.navbtn:hover { color: #fff; }

/* ---- buttons ---- */
.primary, .ghost {
  appearance: none;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--r);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s, border-color 0.2s;
}
.primary { background: var(--accent); color: #08080a; border: 0; }
.primary:hover { transform: translateY(-2px); }
.primary:active { transform: scale(0.98); }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.ghost:hover { border-color: rgba(255, 255, 255, 0.55); }
.round {
  appearance: none;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.round:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); }
.round:active { transform: scale(0.94); }

/* =====================================================================
   THE CRATE
   ===================================================================== */
.crate {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: 0 var(--gutter) max(14px, env(safe-area-inset-bottom));
  touch-action: pan-y;
  transition: opacity 0.25s ease;
}
/* leaving the crate: everything fades except the chosen sleeve, which flies to the deck */
.crate .crate-head, .crate .crate-foot, .crate .legal { transition: opacity 0.3s ease; }
.crate.out .slot:not([aria-selected="true"]) .face, .crate.out .crate-head, .crate.out .crate-foot, .crate.out .legal { opacity: 0; transition: opacity 0.3s ease; }
.crate.out .rack { cursor: default; pointer-events: none; }
/* coming back: the chosen sleeve is hidden while its copy flies in from the deck */
.crate.landing .slot[aria-selected="true"] .face { opacity: 0; }
/* the record waits inside the landing sleeve, then slides back up out of it */
.crate.landing .slot[aria-selected="true"] .disc { transform: translateY(0) rotate(0deg); transition: none; }

/* leaving the deck */
.deck.leaving .panel { animation: none; opacity: 0; transition: opacity 0.35s ease; }
.deck.leaving .player { animation: none; }
/* fully inside the sleeve by now, so hiding it cannot be seen */
.deck.leaving.fly .player { visibility: hidden; }
/* opening: the record stays hidden until the arriving sleeve covers its spot */
.deck.hold .player { opacity: 0; transition: none; }
.deck .player { transition: opacity 0.2s ease; }

.now-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.055em;
  line-height: 0.9;
  font-size: clamp(2.2rem, 6.4vw, 5.8rem);
  overflow-wrap: anywhere;
  transition: opacity 0.35s ease, transform 0.6s var(--ease-out);
}
.now-title.swap { opacity: 0; transform: translateY(14px); }

.rack {
  --w: clamp(120px, min(58vw, calc((100dvh - 410px) / 1.3)), 400px);
  --t: max(16px, calc(var(--w) * 0.05));
  position: relative;
  align-self: center;
  flex: none;
  width: calc(100% + var(--gutter) * 2);
  margin: 0 calc(var(--gutter) * -1);
  height: calc(var(--w) * 1.3);
  list-style: none;
  perspective: 1500px;
  perspective-origin: 50% 38%;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.rack.dragging { cursor: grabbing; }

.slot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--w);
  height: var(--w);
  margin: calc(var(--w) / -2) 0 0 calc(var(--w) / -2);
  transform-style: preserve-3d;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  will-change: transform;
}
.rack.ready .slot { transition: transform 0.85s var(--ease-out), --shade 0.85s ease; }
.rack.dragging .slot { transition: none; }
.box { position: absolute; inset: 0; transform-style: preserve-3d; }
.slot:focus-visible .box { outline: 2px solid #fff; outline-offset: 8px; }

.face { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: opacity 0.3s ease; }
.front {
  inset: 0;
  transform: translateZ(calc(var(--t) / 2));
  background: #111;
  border-radius: 1px;
  overflow: hidden;
  box-shadow: 0 40px 70px rgba(0, 0, 0, 0.6);
}
.front img { display: block; width: 100%; height: 100%; object-fit: cover; }
.front::before { content: ""; position: absolute; inset: 0; z-index: 1; background: #000; opacity: var(--shade); pointer-events: none; }
.front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(255,255,255,0.14), transparent 22%, transparent 70%, rgba(0,0,0,0.14)), linear-gradient(90deg, rgba(0,0,0,0.28), transparent 6%);
  pointer-events: none;
}
.back { inset: 0; transform: rotateY(180deg) translateZ(calc(var(--t) / 2)); background: #0d0d0f; }
.edge {
  top: 0; bottom: 0;
  left: calc(50% - var(--t) / 2);
  width: var(--t);
  background: #141416;
}
.edge.right {
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2));
  background-image: var(--art, none);
  background-size: 2400% 100%;
  background-position: 100% 50%;
  overflow: hidden;
}
.edge.right::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(5,5,6,0.5), rgba(5,5,6,0.65)); }
.edge.right .spine-text { transform: rotate(180deg); }
.spine::after, .edge.right::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--shade); pointer-events: none; }

.spine {
  top: 0; bottom: 0;
  left: calc(50% - var(--t) / 2);
  width: var(--t);
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
  background-color: #141416;
  background-image: var(--art, none);
  background-size: 2400% 100%;
  background-position: 0 50%;
  overflow: hidden;
}
.spine::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(5,5,6,0.5), rgba(5,5,6,0.65)); }
.spine-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 0.8em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: calc(var(--w) * 0.05) 0;
  white-space: nowrap;
  overflow: hidden;
  font-size: calc(var(--t) * 0.62);
  line-height: 1;
}
.spine-text b { font-weight: 650; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; }
.spine-text i { font-style: normal; font-weight: 450; font-size: 0.82em; color: var(--dim); }

/* the record: tucked inside its sleeve, it slides out of the top of the
   one that is selected. Each record has its own splatter and label. */
.disc {
  top: 3%;
  left: 3%;
  width: 94%;
  height: 94%;
  border-radius: 50%;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  transform: translateY(0) rotate(0deg);
  transition: transform 0.9s var(--ease-out), opacity 0.3s ease;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 22px rgba(0, 0, 0, 0.6);   /* centred, so it looks the same at any rotation */
}
.disc svg { display: block; width: 100%; height: 100%; }
.slot[aria-selected="true"] .disc { transform: translateY(-24%) rotate(35deg); }

/* foot: socials / pager / call to action */
.crate-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 20px;
  padding-top: clamp(8px, 2vh, 24px);
}
.socials { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.socials a {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color 0.2s;
}
.socials a:hover { color: #fff; }

.pager { display: flex; align-items: center; gap: 18px; }
.count { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.count b { color: #fff; font-weight: 600; }
.dots { display: flex; gap: 6px; }
.dot {
  appearance: none;
  width: 14px;
  height: 14px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  position: relative;
}
.dot::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.3s, transform 0.3s;
}
.dot.on::after { background: var(--accent); transform: scale(1.35); }

.cta { justify-self: end; text-align: right; }
.legal { margin-top: 12px; font-size: 0.74rem; color: rgba(255, 255, 255, 0.4); text-align: center; }
.legal a { text-decoration: underline; text-underline-offset: 3px; }
.legal a:hover { color: #fff; }

/* =====================================================================
   THE DECK
   ===================================================================== */
.deck {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vh, 30px);
  padding: 0 var(--gutter) max(24px, env(safe-area-inset-bottom));
}
.deck .panel { animation: fade-in 0.6s ease 0.25s both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.scene {
  --scene-w: min(1040px, 92vw, max(480px, calc((100dvh - 410px) * 2.25)));
  width: var(--scene-w);
  margin-top: clamp(24px, 6vh, 56px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding-right: 6%;
}
.sleeve-art {
  position: relative;
  z-index: 3;
  width: 94%;
  aspect-ratio: 1;
  justify-self: end;
  transform: rotate(-2.5deg);
  border-radius: var(--r);
  overflow: hidden;
  background: #111;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.sleeve-art img { display: block; width: 100%; height: 100%; object-fit: cover; }

.player { position: relative; z-index: 1; width: 100%; aspect-ratio: 1; margin-left: -8%; }
.platter {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 34px 70px rgba(0, 0, 0, 0.6);
  transition: transform 0.95s cubic-bezier(0.3, 0.85, 0.25, 1);
}
/* --tuck is measured in crate.js: the record fully inside the sleeve */
.deck.docked .platter { transform: var(--tuck, translateX(-62%)); }
.deck.leaving .platter { transition: transform 0.5s cubic-bezier(0.45, 0, 0.2, 1); }
.vinyl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: spin 3.6s linear infinite;
  animation-play-state: paused;
  will-change: transform;
}
.vinyl svg { display: block; width: 100%; height: 100%; }
.deck.is-playing .vinyl { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(circle, transparent 0 34%, #000 36% 97%, transparent 100%);
  mask-image: radial-gradient(circle, transparent 0 34%, #000 36% 97%, transparent 100%);
  background:
    radial-gradient(ellipse 80% 36% at 19% 8%, rgba(255,255,255,0.12), transparent 75%),
    conic-gradient(from 25deg, transparent 0 5%, rgba(255,255,255,0.04) 7%, rgba(255,255,255,0.19) 10%, rgba(255,255,255,0.03) 13%, transparent 19% 49%, rgba(255,255,255,0.03) 54%, rgba(255,255,255,0.12) 61%, transparent 69% 100%);
}
.sheen::after { content: ""; position: absolute; inset: 2%; border-radius: 50%; box-shadow: inset 2px -3px 5px rgba(0,0,0,.6), inset -1px 2px 3px rgba(255,255,255,.2); }

/* tonearm: pivots top-right. rest -10deg, grooves 4deg to 22deg */
.tonearm {
  --arm: -10deg;
  position: absolute;
  z-index: 2;
  top: -7%;
  right: -9%;
  width: 26%;
  height: auto;
  aspect-ratio: 1 / 3;
  overflow: visible;
  pointer-events: none;
  transform-origin: 50% 12.7%;
  transform: rotate(var(--arm));
  transition: transform 1.1s cubic-bezier(0.34, 1.2, 0.4, 1);
  filter: drop-shadow(-6px 10px 12px rgba(0, 0, 0, 0.5));
}
.deck.is-tracking .tonearm { transition: transform 0.25s linear; }
.tonearm { transition: transform 1.1s cubic-bezier(0.34, 1.2, 0.4, 1), opacity 0.3s ease; }
.deck.docked .tonearm { opacity: 0; }

/* one column: every row shares the same left and right edge */
.panel { width: min(440px, 100%); display: grid; gap: 14px; text-align: center; }
.deck-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.055em;
  line-height: 0.92;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  overflow-wrap: anywhere;
}
.progress-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; margin-top: 4px; }
.panel .primary { width: 100%; }
.progress { height: 2px; background: var(--line); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left center; }
.time { font-variant-numeric: tabular-nums; font-size: 0.82rem; color: var(--dim); text-align: right; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions:has(> [hidden]) { grid-template-columns: 1fr; }   /* no full-track link: back button spans the row */
.actions .ghost { width: 100%; padding: 0 12px; }
.status { min-height: 1.4em; font-size: 0.85rem; color: var(--dim); }
.status.err { color: #f0c27a; }

/* =====================================================================
   SIDE SHEET
   ===================================================================== */
.sheet {
  margin: 0 0 0 auto;
  width: min(560px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-left: 1px solid var(--line);
  background: rgba(8, 8, 10, 0.84);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  backdrop-filter: blur(40px) saturate(140%);
  color: var(--text);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet[open] { animation: sheet-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes sheet-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-inner { position: relative; padding: clamp(20px, 5vw, 40px); padding-top: 76px; }
.sheet-close { position: absolute; top: 16px; right: 16px; }
.sheet .overline { font-size: 0.78rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); }
.sheet h2 {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  line-height: 0.92;
  font-size: clamp(2rem, 6vw, 2.9rem);
  margin: 10px 0 26px;
}
.sheet h2 .line { display: block; }   /* one sentence per line (panels.js) */
.sheet-sub { margin: 28px 0 10px; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); }
.lead { font-size: 1.3rem; line-height: 1.35; letter-spacing: -0.02em; margin-bottom: 1.1em; }
.prose p { margin-bottom: 1em; color: rgba(255, 255, 255, 0.7); font-size: 1.02rem; line-height: 1.65; }
.prose strong { color: #fff; font-weight: 600; }
.prose em { font-style: italic; color: #fff; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.shot { margin-top: 26px; }
.shot img { display: block; width: 100%; height: auto; border-radius: var(--r); }
.shot figcaption { margin-top: 8px; font-size: 0.82rem; color: var(--dim); }
.embed { display: block; width: 100%; border: 0; border-radius: var(--r); margin-bottom: 14px; }
.links-grid { display: grid; }
.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  transition: padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.link-card:last-child { border-bottom: 1px solid var(--line); }
.link-card:hover { padding-left: 8px; }
.link-main { display: flex; align-items: center; gap: 14px; font-size: 1.15rem; font-weight: 600; letter-spacing: -0.02em; }
.link-main small { display: block; font-size: 0.82rem; font-weight: 400; letter-spacing: 0; color: var(--dim); }
.link-icon { width: 22px; height: 22px; flex: none; }

/* =====================================================================
   NARROW SCREENS (phone, about 400px)
   ===================================================================== */
@media (max-width: 719px) {
  .bar { min-height: 60px; }
  .home { font-size: 1.2rem; }
  .navbtn { font-size: 0.88rem; }
  .now-title { font-size: clamp(2rem, 11vw, 3.2rem); min-height: 1.8em; }

  .crate-foot { grid-template-columns: 1fr; gap: 14px; }
  .socials { display: none; }
  .pager { justify-content: space-between; }
  .cta { justify-self: stretch; text-align: left; display: grid; grid-template-columns: 1fr; }
  .spine-text i { display: none; }
  .cta .primary { width: 100%; }

  .scene { --scene-w: min(92vw, 400px); grid-template-columns: 1fr; padding-right: 0; margin-top: 8px; }
  .sleeve-art { width: 54%; justify-self: start; margin-left: 2%; }
  .player { width: 76%; margin: -14% 11% 0 auto; }
}
@media (max-height: 600px) { .legal { display: none; } }
@media (max-height: 520px) and (orientation: landscape) { .now-title { font-size: 2rem; min-height: 0; } }

@media (prefers-reduced-motion: reduce) {
  .rack .slot, .rack .face, .now-title, .crate, .deck, .sleeve-art, .platter, .tonearm, .primary, .ghost, .round, .disc, .link-card, .backdrop i, .sheet[open] {
    animation: none !important;
    transition: none !important;
  }
  .vinyl { animation: none !important; }
  .deck .panel, .deck .player { animation: none !important; transition: none !important; }
}
