/* Студия: полка, грид средних карточек и карточка сведений.
   Зависимость: studio.html, studio.js, переменные :root в app.css. */

.studio-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.studio-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  padding: 0 18px;
  border-bottom: 1px solid var(--sep);
  background: var(--card);
}

.studio-bar > a:last-child {
  margin-left: auto;
  color: var(--secondary);
  text-decoration: none;
}

.studio-brand {
  color: inherit;
  font-weight: 680;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.studio-projects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.studio-bar button,
.studio-projects button,
.studio-kind header button,
.studio-add,
.studio-menu button,
.gen-pop .go,
.save-pop button,
.save-pop a {
  font: inherit;
  color: inherit;
  background: var(--fill);
  border: 0;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 12px;
  cursor: pointer;
  text-decoration: none;
}

.studio-projects button.on,
.studio-folder.on > button,
.studio-loose.on > button {
  background: var(--selected);
  color: var(--label);
}

.studio-app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 300px;
  height: calc(100vh - 60px);
}

.studio-shelf,
.studio-inspect {
  overflow: auto;
  background: var(--card);
}

.studio-shelf {
  border-right: 1px solid var(--sep);
  padding: 18px 14px 24px;
}

.studio-kind + .studio-kind {
  margin-top: 28px;
}

.studio-kind header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.studio-kind h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}

.studio-kind header button,
.studio-add {
  min-height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.studio-add {
  display: flex;
  margin: 0 0 10px;
}

.studio-folder,
.studio-loose {
  margin-top: 8px;
}

.studio-folder > button,
.studio-loose > button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  min-height: 32px;
  padding: 4px 2px;
  cursor: pointer;
}

.studio-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.studio-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: var(--stage);
  cursor: grab;
}

.studio-item img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.studio-board {
  position: relative;
  min-height: 0;
  overflow: auto;
  cursor: grab;
  background: var(--bg);
}

.studio-board.panning {
  cursor: grabbing;
}

.studio-scale {
  position: relative;
  width: 6400px;
  height: 4800px;
}

.studio-surface {
  position: relative;
  width: 6400px;
  height: 4800px;
  transform-origin: 0 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--tertiary) 1px, transparent 1px);
  background-size: 24px 24px;
}

.studio-create {
  position: sticky;
  top: 16px;
  left: 16px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 16px 0 -68px 16px;
  padding: 8px 16px 8px 8px;
  border: 1px solid var(--sep);
  border-radius: 16px;
  background: var(--card);
  color: var(--label);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.studio-create .mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--stage);
  color: var(--label);
}

.studio-hint {
  position: sticky;
  top: 28px;
  margin: 28px 20px 16px 210px;
  color: var(--secondary);
  pointer-events: none;
}

.studio-wires {
  position: absolute;
  left: 0;
  top: 0;
  width: 6400px;
  height: 4800px;
  overflow: visible;
  pointer-events: none;
}

.studio-wires line {
  stroke: var(--blue);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.85;
}

.studio-cards {
  position: absolute;
  left: 0;
  top: 0;
  width: 6400px;
  height: 4800px;
  cursor: grab;
  user-select: none;
}

.studio-card {
  position: absolute;
  width: 232px;
  background: var(--card);
  border: 1px solid var(--sep);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  cursor: move;
  touch-action: none;
  user-select: none;
}

.studio-face img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.studio-card.on {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue), 0 16px 40px rgba(0, 0, 0, 0.16);
}

.studio-card.step {
  z-index: 1;
  cursor: default;
}

.studio-card.drag {
  z-index: 5;
}

.studio-trail,
.studio-card .trail {
  position: absolute;
  top: 10px;
  left: -42px;
  z-index: 4;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--sep);
  border-radius: 16px;
  background: var(--card);
  color: var(--label);
  font: inherit;
  font-size: 20px;
  line-height: 30px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.studio-face {
  position: relative;
  min-height: 268px;
  overflow: hidden;
  border-radius: 17px 17px 0 0;
  background: var(--stage);
}

.studio-face img,
.studio-spin {
  width: 232px;
  height: 268px;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

.studio-spin {
  display: grid;
  place-items: center;
}

.studio-spin::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid var(--sep);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: studio-spin 0.8s linear infinite;
}

@keyframes studio-spin {
  to { transform: rotate(360deg); }
}

.studio-card .plus {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--label);
  font: inherit;
  font-size: 20px;
  line-height: 32px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.studio-menu {
  position: absolute;
  top: 8px;
  left: calc(100% + 8px);
  display: grid;
  gap: 2px;
  min-width: 196px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--sep);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  z-index: 4;
}

.studio-menu button {
  border-radius: 10px;
  text-align: left;
  min-height: 36px;
}

.studio-meta {
  display: grid;
  gap: 6px;
  padding: 10px 12px 12px;
  border-radius: 0 0 17px 17px;
  background: var(--card);
}

.studio-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--secondary);
}

.studio-facts .style {
  color: var(--label);
}

.studio-facts b {
  color: var(--label);
  font-weight: 650;
}

.studio-prompt {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.studio-prompt.muted,
.studio-card .note {
  color: var(--secondary);
}

.studio-card .note {
  margin: 0;
  font-size: 12px;
}

.studio-inspect {
  border-left: 1px solid var(--sep);
  padding: 22px 18px 28px;
}

.studio-inspect[hidden] {
  display: none;
}

.studio-app.inspect-off {
  grid-template-columns: 268px minmax(0, 1fr);
}

.studio-inspect h2 {
  margin: 0 0 18px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}

.studio-inspect .shot {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  object-position: center;
  border-radius: 16px;
  background: var(--stage);
  display: block;
}

.studio-inspect dl {
  margin: 16px 0 0;
}

.studio-inspect dt {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
}

.studio-inspect dd {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.studio-error {
  position: fixed;
  left: 16px;
  bottom: 16px;
  margin: 0;
  padding: 10px 12px;
  background: var(--card);
  color: var(--red);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.gen-pop,
.save-pop {
  position: relative;
  border: 0;
  border-radius: 18px;
  background: var(--card);
  color: var(--label);
  padding: 18px;
  width: min(560px, calc(100vw - 32px));
}

.gen-pop::backdrop,
.save-pop::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.gen-pop .gen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.gen-pop .gen-head p {
  margin: 0;
  color: var(--label);
  font-weight: 650;
}

.gen-pop .close {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--fill);
  color: var(--label);
  font: inherit;
  font-size: 20px;
  line-height: 32px;
  cursor: pointer;
}

.gen-pop .field {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary);
}

.gen-pop .ratios {
  margin-top: 8px;
}

.gen-pop p,
.save-pop p {
  margin: 0 0 8px;
  color: var(--secondary);
  font-size: 13px;
}

.gen-pop input,
.gen-pop textarea,
.gen-pop select {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--sep);
  border-radius: 12px;
}

.gen-pop textarea {
  min-height: 120px;
  padding: 10px 12px;
  resize: vertical;
}

.gen-pop select,
.gen-pop .go,
.save-pop .save-row {
  margin-top: 10px;
}

.save-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.save-row button[aria-checked="true"] {
  background: var(--selected);
}

.save-get {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
}

@media (max-width: 980px) {
  .studio-app,
  .studio-app.inspect-off {
    grid-template-columns: 1fr;
    height: auto;
  }

  .studio-shelf {
    max-height: 38vh;
    border-right: 0;
    border-bottom: 1px solid var(--sep);
  }

  .studio-inspect {
    border-left: 0;
    border-top: 1px solid var(--sep);
  }

  .studio-board {
    min-height: 70vh;
    height: 70vh;
  }
}
