/* ============================================================
   MMM4 — site styles
   ============================================================ */

@font-face {
  font-family: "Russian Gothic";
  src: url("../assets/russian-gothic.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --ink: #000;
  --paper: #f7f7f5;
  --rule: rgba(0, 0, 0, .28);
  --nav-size: clamp(26px, 2.65vw, 52px);
  --edge: clamp(18px, 3.2vw, 56px);
  --rail-col: clamp(300px, 27vw, 520px);
  --gap: clamp(20px, 3vw, 60px);
  --tilt: -4.2deg;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Russian Gothic", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.scrolls { overflow-y: auto; overflow-x: hidden; }

/* ---------- background texture loop ---------- */

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--paper);
}

#bg video,
#bg img {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  /* anchored to the TOP of the (already top-cropped) source */
  object-fit: cover;
  object-position: center top;
}

#bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.55));
}

/* ---------- layout ---------- */

.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail-col) 1fr;
  gap: var(--gap);
  padding: var(--edge) var(--edge) 0;
}

/* ---------- rail: logo + nav ---------- */

.rail {
  z-index: 20;
  position: sticky;
  top: var(--edge);
  align-self: start;
  height: fit-content;
}

.logo {
  display: block;
  width: clamp(180px, 19vw, 330px);
  color: var(--ink);
  margin-bottom: clamp(14px, 2vw, 30px);
}

.logo svg { display: block; width: 100%; height: auto; }

.nav { display: flex; flex-direction: column; align-items: flex-start; }

.nav a {
  font-size: var(--nav-size);
  line-height: 1.04;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.005em;
  transform-origin: 6% 80%;
  transition: transform .34s var(--ease);
  will-change: transform;
  padding-right: .1em;
}

.nav a:hover,
.nav a:focus-visible {
  transform: rotate(var(--item-tilt, var(--tilt)));
  outline: none;
}

.nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: .055em;
  text-underline-offset: .04em;
}

/* ---------- stage (right-hand content) ---------- */

.stage {
  position: relative;
  min-width: 0;
  padding-bottom: 70px;
}

/* ---------- ASCII ---------- */

#ascii {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: min(0.78vh, 1.12vw);
  line-height: .68;
  letter-spacing: 0;
  white-space: pre;
  color: var(--ink);
  margin: 0;
  user-select: none;
  padding-top: clamp(4px, 1vh, 16px);
}

/* ---------- footer ---------- */

.foot {
  position: fixed;
  left: var(--edge);
  bottom: clamp(10px, 1.6vh, 20px);
  z-index: 40;
}

.foot button {
  font-family: inherit;
  font-size: 13px;
  letter-spacing: .02em;
  background: none;
  border: 0;
  padding: 2px 4px;
  margin: 0;
  color: var(--ink);
  cursor: pointer;
  opacity: .6;
  transition: opacity .2s;
}

.foot button:hover { opacity: 1; }
.foot .c { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }

/* ============================================================
   Creative Direction — drifting scatter field
   ============================================================ */

.scatter {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;   /* only the tiles themselves take clicks */
}

/* On the scatter page the stage is empty, so the page shell must not sit
   over the tiles and swallow their clicks — only the menu takes input. */
body.scatter-page .page { pointer-events: none; }
body.scatter-page .rail { pointer-events: auto; }
body.scatter-page .stage { display: none; }

.scatter {
  /* tiles are never placed this far left, but if one drifts close while the
     field pans it dissolves instead of meeting a hard edge */
  --fade-a: calc(var(--edge) + var(--rail-col) * .66);
  --fade-b: calc(var(--edge) + var(--rail-col) + var(--gap) * .55);
  -webkit-mask-image: linear-gradient(to right, transparent 0,
    transparent var(--fade-a), #000 var(--fade-b), #000 100%);
  mask-image: linear-gradient(to right, transparent 0,
    transparent var(--fade-a), #000 var(--fade-b), #000 100%);
}

.scatter-field {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 128%;
  height: 130%;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
}

.tile {
  position: absolute;
  pointer-events: auto;
  transform: translate3d(-50%, -50%, 0) scale(1);
  transform-origin: center center;
  transition: transform .5s var(--ease), z-index 0s;
  cursor: pointer;
  z-index: 1;
  will-change: transform;
}

.tile img, .tile video {
  display: block;
  width: 100%;
  height: auto;
  background: #ddd;
}

.tile:hover {
  transform: translate3d(-50%, -50%, 0) scale(var(--pop, 2.7));
  z-index: 60;
}

.tile.ph {
  background: repeating-linear-gradient(45deg, #e6e6e3 0 6px, #dcdcd8 6px 12px);
  aspect-ratio: 3 / 2;
}

/* ============================================================
   Projects — mixed-size static grid
   ============================================================ */

.projects {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(10px, 1.4vw, 26px);
  padding-top: clamp(6px, 1.4vh, 22px);
}

.proj {
  position: relative;
  flex: 0 0 auto;
  background: repeating-linear-gradient(45deg, #e6e6e3 0 6px, #dcdcd8 6px 12px);
  overflow: hidden;
  transition: transform .4s var(--ease);
}

.proj img { display: block; width: 100%; height: 100%; object-fit: cover; }
.proj:hover { transform: translateY(-4px); }

/* ============================================================
   Hosting — releases
   ============================================================ */

.releases {
  display: flex;
  flex-direction: column;
  gap: clamp(26px, 4.4vh, 58px);
  padding-top: clamp(6px, 1.4vh, 22px);
  max-width: 1050px;
}

.release {
  display: grid;
  grid-template-columns: clamp(150px, 20vw, 290px) 1fr;
  gap: clamp(14px, 2vw, 34px);
  align-items: start;
}

.release .cover {
  aspect-ratio: 1;
  background: #000;
  overflow: hidden;
}

.release .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.release h2 {
  margin: 0;
  font-size: clamp(20px, 2.1vw, 40px);
  line-height: .98;
  font-weight: 400;
}

.release .artist {
  font-size: clamp(18px, 1.95vw, 37px);
  line-height: .98;
}

.release .date {
  font-size: clamp(11px, .95vw, 17px);
  margin: clamp(8px, 1.4vh, 20px) 0 0;
  opacity: .85;
}

.release .excl {
  font-size: clamp(16px, 1.65vw, 32px);
  margin-top: clamp(8px, 1.6vh, 22px);
}

.links {
  display: flex;
  gap: clamp(8px, .9vw, 15px);
  margin-top: clamp(10px, 1.8vh, 24px);
  flex-wrap: wrap;
}

.links a {
  width: clamp(28px, 2.5vw, 42px);
  height: clamp(28px, 2.5vw, 42px);
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: transform .25s var(--ease), opacity .25s;
}

.links a svg { width: 58%; height: 58%; fill: currentColor; }
.links a:hover { transform: scale(1.12) rotate(-6deg); }
.links a[data-empty="1"] { opacity: .22; pointer-events: none; }

/* ============================================================
   Curation — playlist index + embed
   ============================================================ */

.curation {
  display: grid;
  grid-template-columns: 1fr clamp(190px, 21vw, 330px);
  gap: clamp(18px, 3vw, 54px);
  padding-top: clamp(6px, 1.4vh, 22px);
  align-items: start;
}

.embed-pane {
  min-height: 420px;
  display: grid;
  align-items: start;
}

.embed-pane iframe {
  width: 100%;
  max-width: 660px;
  height: min(70vh, 640px);
  border: 0;
  border-radius: 12px;
}

.playlist-index {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: .04em;
}

.playlist-index button {
  font-family: inherit;
  font-size: clamp(15px, 1.5vw, 29px);
  line-height: 1.05;
  background: none;
  border: 0;
  padding: .05em .1em;
  color: var(--ink);
  cursor: pointer;
  transform-origin: 94% 80%;
  transition: transform .34s var(--ease);
}

.playlist-index button:hover { transform: rotate(3.4deg); }

.playlist-index button[aria-selected="true"] {
  text-decoration: underline;
  text-decoration-thickness: .055em;
  text-underline-offset: .04em;
}

/* ---------- empty states ---------- */

.empty {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .4;
  padding: 40px 0;
}

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

@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; padding-top: 20px; }
  .rail { position: static; }
  .scatter { position: relative; inset: auto; height: 74vh; margin-top: 18px;
             -webkit-mask-image: none; mask-image: none; }
  .release { grid-template-columns: 1fr; }
  .curation { grid-template-columns: 1fr; }
  .playlist-index { align-items: flex-start; text-align: left; }
  #ascii { font-size: min(0.6vh, 0.98vw); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}

/* ============================================================
   Detail panel — opens over the page, page stays behind
   ============================================================ */

.detail {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vh, 54px) clamp(16px, 4vw, 64px);
  background: rgba(247, 247, 245, .80);
  -webkit-backdrop-filter: blur(9px) saturate(.9);
  backdrop-filter: blur(9px) saturate(.9);
  opacity: 0;
  transition: opacity .3s var(--ease);
}

.detail.on { opacity: 1; }

.detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 31%);
  gap: clamp(16px, 3vw, 52px);
  width: min(1180px, 100%);
  max-height: 100%;
  align-items: start;
  transform: translateY(14px) scale(.985);
  transition: transform .34s var(--ease);
}

.detail.on .detail-card { transform: none; }

.detail-media {
  display: grid;
  place-items: center;
  min-width: 0;
}

.detail-media img,
.detail-media video {
  display: block;
  max-width: 100%;
  max-height: min(80vh, 760px);
  width: auto;
  height: auto;
}

.detail-meta { min-width: 0; }

.detail-meta h2 {
  font-size: clamp(22px, 2.5vw, 46px);
  line-height: .98;
  margin: 0 0 .12em;
  font-weight: 400;
  word-wrap: break-word;
}

.detail-meta .d-date {
  font-size: clamp(12px, 1.05vw, 19px);
  opacity: .8;
  margin: 0 0 clamp(10px, 1.6vh, 22px);
}

.detail-meta .d-desc {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(12px, .92vw, 16px);
  line-height: 1.5;
  white-space: pre-wrap;
  margin: 0;
  max-width: 44ch;
}

.detail-meta .d-link {
  display: inline-block;
  margin-top: clamp(10px, 1.6vh, 22px);
  font-size: clamp(12px, 1vw, 18px);
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: .18em;
}

.detail-close {
  position: fixed;
  top: clamp(12px, 2.4vh, 28px);
  right: clamp(14px, 2.4vw, 34px);
  width: 42px;
  height: 42px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 400 30px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  cursor: pointer;
  opacity: .55;
  transition: opacity .2s, transform .3s var(--ease);
}

.detail-close:hover { opacity: 1; transform: rotate(90deg); }

/* editable in admin — typed straight into the real type, so what you
   see while writing is what the page ends up looking like */
.detail-meta [contenteditable] {
  outline: none;
  display: block;
  min-height: 1em;
  border-bottom: 1px solid rgba(0, 0, 0, .16);
  padding-bottom: .08em;
  transition: border-color .2s;
}

.detail-meta [contenteditable]:focus { border-color: var(--ink); }

.detail-meta [contenteditable]:empty::before {
  content: attr(data-ph);
  opacity: .3;
}

.detail-hint {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .42;
  margin: clamp(12px, 2vh, 24px) 0 0;
}

@media (max-width: 860px) {
  .detail-card { grid-template-columns: 1fr; overflow-y: auto; }
  .detail-media img, .detail-media video { max-height: 48vh; }
}
