/* Студия на каноне Мама Грана: тёмный amber + раскладка photo-first */
@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

html,
body {
  font-family: var(--font);
  background: var(--mg-black);
  color: var(--mg-ivory);
}

body {
  background:
    radial-gradient(1000px 520px at 12% -8%, rgba(242, 138, 45, 0.14), transparent 55%),
    radial-gradient(800px 420px at 88% 0%, rgba(230, 95, 30, 0.08), transparent 50%),
    var(--mg-black);
}

body.is-studio {
  overflow: hidden;
  height: 100vh;
  background: var(--mg-black);
}
body.is-studio #app {
  height: 100vh;
  min-height: 100vh;
}
body.is-studio .topbar {
  padding: 0 14px;
  height: 48px;
  min-height: 48px;
  background: rgba(16, 14, 11, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--mg-hairline);
}
body.is-studio .topbar .nav,
body.is-studio .topbar-link {
  display: none !important;
}
body.is-studio .brand {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mg-hi);
}
body.is-studio .brand span {
  color: var(--mg-amber);
}
body.is-studio .main--studio {
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
}

/* —— Hub —— */
.hub-pro {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 28px 16px 72px;
}
.hub-pro__brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 8px;
  color: var(--mg-hi);
}
.hub-pro__lead {
  margin: 0 0 28px;
  color: var(--mg-copy);
  font-size: 1.05rem;
  max-width: 40ch;
}
.hub-drop {
  position: relative;
  border: 1.5px dashed rgba(242, 138, 45, 0.4);
  border-radius: 20px;
  background: rgba(16, 14, 11, 0.85);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.hub-drop.is-over,
.hub-drop:hover {
  border-color: var(--mg-amber);
  box-shadow: var(--mg-glow);
}
.hub-drop.has-photo {
  border-style: solid;
  min-height: 140px;
  justify-content: flex-start;
  padding: 16px;
  gap: 18px;
}
.hub-drop__thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--mg-border);
  background: #000;
}
.hub-drop__meta b {
  display: block;
  color: var(--mg-hi);
  margin-bottom: 4px;
}
.hub-drop__meta p {
  margin: 0 0 12px;
  color: var(--mg-muted);
  font-size: 0.9rem;
}
.hub-drop__empty {
  text-align: center;
  padding: 40px 20px;
}
.hub-drop__empty b {
  display: block;
  font-size: 1.1rem;
  color: var(--mg-hi);
  margin-bottom: 6px;
}
.hub-drop__empty p {
  margin: 0 0 18px;
  color: var(--mg-muted);
}
.hub-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 720px) {
  .hub-actions {
    grid-template-columns: 1fr 1fr;
  }
}
.hub-action {
  appearance: none;
  border: 1px solid var(--mg-border);
  background: linear-gradient(160deg, rgba(42, 36, 29, 0.55), rgba(16, 14, 11, 0.95));
  border-radius: 16px;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-height: 92px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.hub-action:hover {
  border-color: rgba(242, 138, 45, 0.55);
  box-shadow: var(--mg-glow);
  transform: translateY(-1px);
}
.hub-action__kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mg-amber);
  margin-bottom: 6px;
}
.hub-action__title {
  display: block;
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mg-hi);
  margin-bottom: 4px;
}
.hub-action__desc {
  display: block;
  font-size: 0.85rem;
  color: var(--mg-muted);
  line-height: 1.35;
}
.hub-more {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 8px 0 0;
}
.hub-more > summary {
  list-style: none;
  cursor: pointer;
  color: var(--mg-muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 2px;
}
.hub-more > summary::-webkit-details-marker {
  display: none;
}
.hub-more__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding-top: 8px;
}
.hub-more .hub-card {
  background: var(--mg-card);
  border: 1px solid var(--mg-border);
}
.hub-more .hub-card__desc {
  display: none;
}

/* —— Editor —— */
.studio-shell {
  background: var(--mg-black);
}
.toolbar--studio {
  height: 52px;
  padding: 0 12px;
  background: rgba(16, 14, 11, 0.95);
  border-bottom: 1px solid var(--mg-hairline);
  gap: 10px;
}
.toolbar__title b {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mg-hi);
}
.toolbar__title span {
  display: none;
}
.editor--studio,
.editor--pro {
  grid-template-columns: minmax(0, 1fr) 300px !important;
  background: var(--mg-black);
}
.editor--studio .editor__stage {
  background: transparent;
  border: 0;
  position: relative;
}
.editor--studio .canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px 72px;
  background: #0a0908;
  border: 0;
}
.canvas-wrap--check {
  background-color: var(--check-b);
  background-image:
    linear-gradient(45deg, var(--check-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--check-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--check-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--check-a) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.editor--studio .canvas-wrap canvas {
  max-width: 100%;
  max-height: calc(100vh - 148px);
  width: auto !important;
  height: auto !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  border-radius: 0;
  background: transparent;
}

.stage-bar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: rgba(16, 14, 11, 0.96);
  border: 1px solid var(--mg-border);
  border-radius: 14px;
  box-shadow: var(--mg-glow);
  z-index: 6;
}
.stage-bar .rail-btn,
.stage-bar .tool-btn {
  width: 40px;
  min-height: 40px;
  border-radius: 10px;
  padding: 0;
  color: var(--mg-muted);
  background: transparent;
  border: 0;
}
.stage-bar .rail-btn span,
.stage-bar .tool-btn span {
  display: none;
}
.stage-bar .rail-btn.is-on,
.stage-bar .tool-btn.is-on {
  background: rgba(242, 138, 45, 0.16);
  color: var(--mg-amber);
}
.stage-bar .rail-brush {
  writing-mode: horizontal-tb;
  width: 100px;
  height: auto;
  margin: 0 6px;
}
.stage-bar .rail-brush input[type="range"] {
  width: 100px;
  transform: none;
  accent-color: var(--mg-amber);
}

.panel--studio {
  background: var(--mg-card);
  border-left: 1px solid var(--mg-hairline);
  padding: 16px 16px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: layout paint;
}
.studio-head h3 {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 4px;
  color: var(--mg-hi);
}
.studio-tip {
  display: none;
}
.studio-body label {
  font-size: 12px;
  font-weight: 600;
  color: var(--mg-muted);
  margin-top: 14px;
}
.studio-body select,
.studio-body input[type="text"],
.studio-body input[type="number"] {
  border: 1px solid var(--mg-hairline);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--mg-graphite);
  color: var(--mg-ivory);
  font: inherit;
}
.studio-body input[type="range"] {
  accent-color: var(--mg-amber);
  touch-action: none;
}
.intent-box {
  background: rgba(246, 230, 197, 0.06);
  border: 1px solid var(--mg-hairline);
  border-radius: 10px;
  color: var(--mg-copy);
  font-size: 12px;
  margin-top: 0;
}
.bg-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.bg-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.bg-swatch.is-on {
  border-color: var(--mg-amber);
  box-shadow: 0 0 0 1px rgba(242, 138, 45, 0.35);
}
.bg-swatch[data-fill="alpha"] {
  background:
    linear-gradient(45deg, #2a241d 25%, transparent 25%),
    linear-gradient(-45deg, #2a241d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a241d 75%),
    linear-gradient(-45deg, transparent 75%, #2a241d 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-color: #141210;
}
.btn--cta {
  background: var(--grad-cta);
  color: #1a0f08;
  border-radius: 12px;
  box-shadow: var(--mg-glow);
  min-height: 44px;
  font-weight: 700;
}
.btn--ghost {
  border-radius: 12px;
  background: transparent;
  border-color: var(--mg-border);
  color: var(--mg-ivory);
}
.more-box {
  border-top: 1px solid var(--mg-hairline);
  margin-top: 16px;
}
.more-box > summary {
  color: var(--mg-muted);
  font-weight: 600;
}
.panel-foot {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 900px) {
  .editor--studio,
  .editor--pro {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr auto;
  }
  .stage-bar {
    bottom: calc(56px + env(safe-area-inset-bottom));
  }
  .panel--studio {
    border-left: 0;
    border-top: 1px solid var(--mg-hairline);
    max-height: 42vh;
  }
  body.is-studio .mobile-dock {
    display: flex;
    background: rgba(16, 14, 11, 0.98);
    border-top: 1px solid var(--mg-hairline);
  }
  body.is-studio .dock-btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
  }
}

.hub-samples {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 8px 0 18px;
}
.sample {
  background: var(--mg-card);
  border: 1px solid var(--mg-hairline);
  border-radius: 14px;
  padding: 12px;
}
.sample b {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}
.sample p {
  margin: 4px 0 0;
  color: var(--mg-muted);
  font-size: 12px;
  line-height: 1.35;
}
.sample__shot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 92px;
  border-radius: 10px;
  overflow: hidden;
}
.sample__half,
.sample__shot span {
  display: grid;
  place-items: end start;
  padding: 8px;
  font-size: 11px;
  color: var(--mg-ivory);
}
.sample__half--before { background: #3a342c; }
.sample__half--after { background: repeating-conic-gradient(#2a241d 0% 25%, #141210 0% 50%) 0 0 / 12px 12px; }
.sample__shot--crop span:first-child { background: #f28a2d; color: #1a0f08; }
.sample__shot--crop span:last-child { background: #1c1914; }
.sample__shot--light span:first-child { background: #2a241d; }
.sample__shot--light span:last-child { background: linear-gradient(160deg, #f6e6c5, #f28a2d); color: #1a0f08; }
.hub-card.is-locked,
.hub-action.is-locked { opacity: 0.72; }
.plan-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--mg-copy);
  font-size: 13px;
}
.plan-list li { margin: 4px 0; }
.sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}
.sheet__card {
  width: min(420px, 100%);
  background: var(--mg-card);
  color: var(--mg-ivory);
  border: 1px solid var(--mg-hairline);
  border-radius: 16px;
  padding: 18px;
}
.sheet__card h3 { margin: 0 0 8px; font-family: var(--display); }
.sheet__card p { color: var(--mg-copy); font-size: 14px; }
.sheet__card input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--mg-hairline);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--mg-graphite);
  color: var(--mg-ivory);
}
.sheet__row { display: flex; gap: 8px; }
.sheet__row .btn { flex: 1; }
@media (max-width: 800px) {
  .hub-samples { grid-template-columns: 1fr; }
}
