/* ===========================================================================
   Studio layout — sidebar workflow + full canvas.
   Loaded AFTER app.css; overrides the legacy fixed canvas/workbench layout
   while reusing the wb-* control styles.
   =========================================================================== */

/* ----- Shell ----- */
.studio {
  position: fixed;
  top: 56px; /* navbar height */
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: hsl(25 18% 12%);
}

/* ----- Sidebar ----- */
.sidebar {
  display: flex;
  flex-direction: column;
  width: 380px;
  min-width: 380px;
  background: linear-gradient(180deg, hsl(25 20% 17%) 0%, hsl(25 18% 14%) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.sidebar-sheet-handle {
  display: none; /* mobile only */
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem 2rem;
}

/* Numbered workflow sections */
.side-section {
  padding: 1rem 0 1.25rem;
}

.side-section + .side-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.side-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--brand-font-headline);
  font-size: 16px;
  font-weight: var(--brand-font-semibold);
  color: hsl(39 25% 88%);
  margin-bottom: 0.35rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-primary-500);
  color: white;
  font-size: 13px;
  flex-shrink: 0;
}

.side-help {
  font-size: 12.5px;
  line-height: 1.45;
  color: hsl(25 18% 64%);
  margin: 0 0 0.85rem;
}

.side-help--center {
  text-align: center;
  margin: 0.4rem 0 0;
}

.side-label {
  display: block;
  font-size: 12px;
  font-weight: var(--brand-font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(25 18% 64%);
  margin-bottom: 0.5rem;
}

/* Per-control plain-English help */
.side-control {
  margin-bottom: 0.9rem;
}

.side-control-help {
  font-size: 11.5px;
  line-height: 1.4;
  color: hsl(25 18% 55%);
  margin: 0.15rem 0 0 2px;
}

/* ----- "What are you making?" cards ----- */
.make-mode {
  margin: 1rem 0;
}

.make-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.make-card {
  cursor: pointer;
  margin: 0;
}

.make-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--brand-radius-md);
  background: rgba(255, 255, 255, 0.03);
  transition: all var(--brand-transition-fast);
}

.make-card-inner i {
  font-size: 20px;
  color: hsl(25 18% 64%);
}

.make-card-inner strong {
  font-size: 14px;
  color: hsl(39 25% 88%);
}

.make-card-inner small {
  font-size: 10.5px;
  line-height: 1.3;
  color: hsl(25 18% 58%);
}

.make-card input:checked + .make-card-inner {
  border-color: var(--brand-primary-500);
  background: rgba(74, 124, 89, 0.12);
}

.make-card input:checked + .make-card-inner i,
.make-card input:checked + .make-card-inner strong {
  color: var(--brand-primary-400);
}

/* ----- Sidebar footer ----- */
.sidebar-footer {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: hsl(25 20% 13%);
}

.footer-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.25rem;
  background: none;
  border: none;
  font-size: 12.5px;
  color: hsl(25 18% 64%);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--brand-transition-fast), background var(--brand-transition-fast);
}

.footer-btn:hover {
  color: var(--brand-primary-400);
  background: rgba(255, 255, 255, 0.04);
}

/* ----- Canvas ----- */
.studio .canvas {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.canvas-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

/* The artboard frame: content fills the largest square that fits, centered */
.canvas-artboard {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  container-type: size;
}

.canvas-artboard > * {
  width: min(100cqw, 100cqh);
  height: min(100cqw, 100cqh);
  max-width: none;
  max-height: none;
  margin: 0 auto;
  flex: none;
}

/* The 512px preview canvas scales up to fill its square */
#preview-container canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
}

/* Generated SVG fills its square */
#svg-preview svg {
  width: 100%;
  height: 100%;
}

/* The 3D viewer canvas covers its container edge to edge */
#threemf-preview-container {
  overflow: hidden;
}

#threemf-preview-container canvas {
  display: block;
}

/* Downloads block inside step ③ */
.side-downloads {
  margin-top: 1rem;
}

.side-downloads-title {
  text-align: center;
}

/* ----- My Maps slide-over ----- */
.side-panel {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  width: 380px;
  background: hsl(25 20% 15%);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.4);
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  z-index: 1041;
  display: flex;
  flex-direction: column;
  color: hsl(39 25% 88%);
}

.side-panel .wb-mymaps-name {
  color: hsl(39 25% 90%);
}

.side-panel .wb-mymaps-date,
.side-panel .wb-mymaps-meta {
  color: hsl(25 18% 62%);
}

.side-panel .wb-mymaps-btn {
  color: hsl(39 25% 85%);
}

.side-panel.open {
  transform: translateX(0);
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

/* ----- Console drawer ----- */
.console-drawer {
  position: fixed;
  bottom: 0;
  left: 380px; /* clear the sidebar on desktop */
  right: 0;
  z-index: 1040;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.console-drawer.expanded {
  transform: translateY(0);
}

.console-drawer-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  background: hsl(25 20% 18%);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: hsl(39 25% 85%);
  font-size: 13px;
}

.console-drawer-body {
  height: 32vh;
  background: hsl(25 18% 10%);
  overflow: hidden;
  display: flex;
}

.console-drawer-body .wb-console {
  flex: 1;
  margin: 0;
  padding: 0.75rem 1rem;
  overflow-y: auto;
  font-size: 12px;
}

/* Progress bar sits inside step ③ in the sidebar */
#generation-progress {
  margin: 0.75rem 0 0;
}

/* ----- Mobile: sidebar becomes a bottom sheet ----- */
@media (max-width: 768px) {
  .studio {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    min-width: 0;
    max-height: 62vh;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px 14px 0 0;
    transition: max-height 0.3s ease;
    z-index: 1030;
  }

  .sidebar.collapsed {
    max-height: 96px; /* handle + footer visible */
  }

  .sidebar.collapsed .sidebar-scroll {
    overflow: hidden;
  }

  .sidebar-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.4rem 0 0.2rem;
    background: none;
    border: none;
    cursor: pointer;
  }

  .sidebar-sheet-handle .handle-bar {
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
  }

  .studio .canvas {
    position: absolute;
    inset: 0;
  }

  .side-panel {
    width: 100%;
  }

  .console-drawer {
    left: 0;
  }

  .make-mode-options {
    grid-template-columns: 1fr 1fr;
  }
}
