/* Studio UI (#107) — dark dense grid, Higgsfield-style.
   House rules: separation via bg-tint steps + shadow + spacing — no
   visible 1px borders on cards/buttons; no neon. */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--acc); color: var(--bg); }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; padding: 0; }

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100dvh;
}

/* ── Sidebar: workspace picker above project list ───────────────── */
.side {
  background: var(--bg-1);
  display: flex; flex-direction: column;
  min-height: 0;
}
.side .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 12px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  font-size: 15px;
}
.side .brand .dot { width: 8px; height: 8px; background: var(--acc); border-radius: 2px; }
.side .brand .live {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px; text-transform: none;
  color: var(--mute-2); letter-spacing: 0;
}
.side .brand .live.on { color: var(--acc); }

.ws-pick { padding: 6px 14px 10px; }
.ws-pick select {
  width: 100%;
  appearance: none;
  background: var(--bg-3);
  color: var(--ink-2);
  border: none; border-radius: 9px;
  padding: 9px 12px;
  font-family: var(--font-mono); font-size: 12.5px;
}
.ws-pick label {
  display: block;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mute-2);
  margin: 0 2px 6px;
}

.proj-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 16px;
  scrollbar-color: var(--bg-3) transparent;
}
.proj-list .proj {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-3);
  font-family: var(--font-mono); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 140ms ease, color 140ms ease;
}
.proj-list .proj:hover { background: var(--bg-2); color: var(--ink); }
.proj-list .proj.active { background: var(--bg-3); color: var(--ink); }
.proj-list .empty { color: var(--mute-2); padding: 10px; font-size: 12.5px; }

/* ── Main column ────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px 10px;
  flex-wrap: wrap;
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  letter-spacing: -0.01em; text-transform: uppercase;
}
.topbar .count { font-family: var(--font-mono); font-size: 11.5px; color: var(--mute); }

.kind-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.kind-chips .chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink-3);
  font-family: var(--font-mono); font-size: 11.5px;
  transition: background 140ms ease, color 140ms ease;
}
.kind-chips .chip:hover { background: var(--bg-3); }
.kind-chips .chip.active { background: var(--ink); color: var(--bg); }
.kind-chips .chip .n { color: inherit; opacity: 0.55; margin-left: 5px; }

/* ── Grid ───────────────────────────────────────────────────────── */
.grid-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 22px 40px; scrollbar-color: var(--bg-3) transparent; }

.kind-section { margin-top: 18px; }
.kind-head {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--mute);
  margin: 0 2px 10px;
}
.kind-head .n { color: var(--mute-2); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  border-radius: 11px;
  overflow: hidden;
  background: var(--bg-2);
  aspect-ratio: 1 / 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
  isolation: isolate;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -12px rgb(0 0 0 / 0.7); }
.tile.gone { opacity: 0.25; pointer-events: none; }
.tile img, .tile video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.tile .glyph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 30px;
  color: var(--mute);
}
.tile .cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 18px 9px 7px;
  background: linear-gradient(to top, rgb(0 0 0 / 0.78), transparent);
  font-family: var(--font-mono); font-size: 10.5px;
  color: rgb(255 255 255 / 0.92);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .badge {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  font-family: var(--font-mono); font-size: 9.5px;
  background: rgb(0 0 0 / 0.6);
  color: rgb(255 255 255 / 0.85);
  padding: 2px 6px; border-radius: 5px;
  backdrop-filter: blur(4px);
}
.tile .badge.v { background: var(--acc); color: var(--bg); font-weight: 700; }
.tile.fresh::after {
  content: "";
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--acc);
  border-radius: 11px;
  animation: freshFade 2.4s ease forwards;
}
@keyframes freshFade { from { opacity: 1; } to { opacity: 0; } }

.placeholder { color: var(--mute-2); padding: 60px 0; text-align: center; font-family: var(--font-mono); font-size: 12.5px; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgb(0 0 0 / 0.92);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 32px;
}
.modal[hidden] { display: none; }
.modal .stage {
  max-width: min(94vw, 1200px);
  max-height: 86vh;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-1);
  box-shadow: 0 40px 90px -30px rgb(0 0 0 / 0.9);
  display: grid;
}
.modal .stage img, .modal .stage video {
  max-width: min(94vw, 1200px);
  max-height: 78vh;
  width: auto; height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.modal .stage audio { width: min(80vw, 560px); margin: 48px 32px; }
.modal .stage pre {
  margin: 0; padding: 24px;
  max-width: min(94vw, 1200px); max-height: 78vh;
  overflow: auto;
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}
.modal .meta {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: var(--bg-2);
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--mute);
  min-width: 0;
}
.modal .meta .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal .meta .open { margin-left: auto; color: var(--acc); white-space: nowrap; }
.modal .close {
  position: fixed; top: 22px; right: 22px;
  width: 42px; height: 42px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink);
  display: grid; place-items: center;
  font-size: 17px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.5);
}
.modal .close:hover { background: var(--bg-3); }
