/* Shade Studio — mobile-first */

.studio-page {
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}

.studio-main {
  position: relative;
  z-index: 1;
  padding: 1rem 0 1.5rem;
}

.studio-wrap {
  width: min(100% - 1.25rem * 2, 1120px);
  margin-inline: auto;
}

.studio-head {
  margin-bottom: 1rem;
}

.studio-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.5rem);
  margin: 0 0 0.35rem;
}

.studio-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.studio-layout {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .studio-main {
    padding: 1.5rem 0 3rem;
  }
  .studio-layout {
    grid-template-columns: 1.15fr 0.95fr;
    align-items: start;
    gap: 1.5rem;
  }
}

.studio-stage {
  background: rgba(18, 24, 52, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 0.75rem;
  backdrop-filter: blur(10px);
}

/* Mobile: keep canvas from eating the whole screen / blocking scroll */
.studio-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: min(100%, 520px);
  margin-inline: auto;
  aspect-ratio: 1;
  max-height: min(48vh, 420px);
  border-radius: 12px;
  overflow: hidden;
  background: #0a0c1c;
  border: 2px solid rgba(240, 193, 75, 0.3);
  /* allow page scroll; JS locks this while dragging shades */
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

@media (min-width: 900px) {
  .studio-canvas-wrap {
    max-width: none;
    max-height: none;
  }
}

.studio-canvas-wrap.is-dragging {
  cursor: grabbing;
  touch-action: none;
}

#studioCanvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: inherit;
}

.studio-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem;
  pointer-events: none;
  color: var(--text-muted);
}

.studio-empty[hidden] {
  display: none !important;
}

.studio-empty p {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
}

.studio-empty-sub {
  margin-top: 0.4rem !important;
  font-size: 0.85rem;
  font-weight: 400 !important;
  color: var(--text-muted) !important;
}

.studio-stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  justify-content: stretch;
}

.studio-stage-actions .btn,
.studio-stage-actions .studio-upload-btn {
  flex: 1 1 auto;
  justify-content: center;
  min-height: 44px;
}

@media (min-width: 900px) {
  .studio-stage-actions {
    justify-content: flex-start;
  }
  .studio-stage-actions .btn,
  .studio-stage-actions .studio-upload-btn {
    flex: 0 0 auto;
  }
}

.studio-download-row {
  margin-top: 0.65rem;
  display: flex;
  justify-content: stretch;
}

.studio-download-btn {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  font-weight: 700;
}

@media (min-width: 900px) {
  .studio-download-row {
    justify-content: flex-start;
  }
  .studio-download-btn {
    width: auto;
    min-width: 160px;
  }
}

/* Size slider docked under the photo so you can see changes live */
.studio-size-dock {
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
}

.studio-size-dock .control-hint {
  margin-top: 0.35rem;
}

.studio-size-dock .transform-row {
  margin-top: 0.65rem;
}

.studio-size-dock .scale-slider-wrap + .transform-row {
  margin-top: 0.55rem;
}

.pair-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.pair-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pair-chip {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
}

.pair-chip.is-active {
  border-color: rgba(240, 193, 75, 0.65);
  background: linear-gradient(135deg, rgba(255, 99, 71, 0.35), rgba(240, 193, 75, 0.22));
  color: #fff;
}

.pair-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.studio-upload-btn {
  cursor: pointer;
}

.studio-share-tip {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 900px) {
  .studio-share-tip {
    text-align: left;
  }
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(240, 193, 75, 0.45);
  background: rgba(240, 193, 75, 0.15);
  color: var(--gold-bright);
  font: inherit;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
}

.chip-btn:hover {
  background: rgba(240, 193, 75, 0.28);
}

.studio-controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.control-block {
  background: rgba(18, 24, 52, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.control-block h2 {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  font-family: var(--font-display);
  color: var(--gold-bright);
}

/* Page tabs: ~4 visible, swipe for more */
.pack-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  padding-bottom: 0.35rem;
  max-width: 100%;
}

.pack-tabs::-webkit-scrollbar {
  height: 4px;
}

.pack-tabs::-webkit-scrollbar-thumb {
  background: rgba(240, 193, 75, 0.5);
  border-radius: 999px;
}

.pack-tab {
  flex: 0 0 calc((100% - 1.2rem) / 4);
  max-width: calc((100% - 1.2rem) / 4);
  scroll-snap-align: start;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.55rem 0.3rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 42px;
}

.pack-tab.is-active {
  border-color: rgba(240, 193, 75, 0.55);
  background: linear-gradient(135deg, rgba(255, 99, 71, 0.35), rgba(240, 193, 75, 0.25));
  color: #fff;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  max-height: min(38vh, 280px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-right: 0.1rem;
}

.frame-grid::-webkit-scrollbar {
  width: 4px;
}

.frame-grid::-webkit-scrollbar-thumb {
  background: rgba(240, 193, 75, 0.45);
  border-radius: 999px;
}

@media (min-width: 500px) {
  .frame-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: min(45vh, 340px);
  }
}

.frame-thumb {
  aspect-ratio: 1.35;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: #12182e;
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  min-height: 64px;
}

.frame-thumb canvas {
  width: 100%;
  height: auto;
  max-height: 40px;
}

.frame-thumb span {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.frame-thumb.is-active {
  border-color: #f0c14b;
  box-shadow: 0 0 0 1px rgba(240, 193, 75, 0.35);
}

.lens-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.lens-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
}

.lens-swatch.is-active {
  border-color: #ffe08a;
  box-shadow: 0 0 0 2px rgba(240, 193, 75, 0.4);
}

.control-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.studio-select,
.control-block input[type="range"] {
  width: 100%;
}

.studio-select {
  appearance: none;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  font: inherit;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  min-height: 44px;
}

.control-hint {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.scale-row .control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#scaleValue {
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.scale-slider-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem;
  align-items: center;
}

.scale-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: #f0c14b;
  height: 1.75rem;
}

.scale-end {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.studio-disclaimer {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.studio-footer {
  position: relative;
  z-index: 1;
}

.studio-canvas-wrap.is-dragover {
  border-color: #2dd4bf;
  box-shadow: inset 0 0 0 2px rgba(45, 212, 191, 0.35);
}

/* Mobile sticky bar removed — actions live around the picture frame */
