/* Le Chonk Studio: a photo with stickers, captions, frame and tag on one canvas.
 * Builds on the tokens and form parts in style.css (.btn, .field, .seg, .swatch, .range-row). */

/* room for the My Chonk button and toasts, so the last control can scroll clear of them */
.studio-page { padding-bottom: 120px; }

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); /* preview about 60 %, controls about 40 % */
  gap: 18px;
  align-items: start;
}
.studio-grid > * { min-width: 0; }

/* ---------- stage: the preview, or the drop zone while there is no picture ---------- */
.studio-stage {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.studio-stage.is-over {
  border-color: var(--orange-hi);
  box-shadow: 0 0 0 4px rgba(255, 122, 0, 0.35);
}

.studio-drop {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  min-height: clamp(280px, 52vh, 480px);
  padding: 28px 20px;
  text-align: center;
  border-radius: 18px;
  border: 2px dashed var(--border-warm);
  background:
    radial-gradient(70% 60% at 50% 30%, rgba(255, 122, 0, 0.18), rgba(0, 0, 0, 0) 70%),
    #0b0a09;
}
.studio-stage.is-over .studio-drop { border-color: var(--cream); }
.studio-drop img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--orange), 0 10px 30px rgba(255, 122, 0, 0.3);
}
.studio-drop-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 112%;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.studio-drop-line { max-width: 40ch; color: var(--muted); font-size: 15px; }
.studio-drop .hint-line { max-width: 42ch; }

/* the letterbox colour shows wherever object-fit leaves room, so the whole picture stays visible */
.studio-canvas-wrap {
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #0b0a09;
  border: 1px solid var(--border);
}
.studio-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78vh, 920px);
  object-fit: contain;
  border-radius: 17px;
  touch-action: none;        /* drags stay on the sticker instead of scrolling the page */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.studio-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.studio-toolbar .note { flex: 1 1 200px; min-height: 1.3em; margin: 0; }

/* ---------- controls: stacked cards (Photo, Stickers, Caption, Extras, Templates, Export) ---------- */
.studio-controls { display: grid; gap: 14px; min-width: 0; }
.studio-sec {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
}
.studio-sec h2 { font-size: 20px; }
.studio-sec .btn { justify-self: start; }
.studio-sec .field { min-width: 0; }
.studio-sec input[type="range"] {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--orange);
}
.studio-sec .seg { min-height: 44px; }
.studio-sec .swatch { width: 44px; height: 44px; }
.studio-sec #studio-top,
.studio-sec #studio-bottom { text-transform: uppercase; }   /* what you type looks like the caption */

/* ---------- stickers ---------- */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.sticker-btn {
  appearance: none;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #0b0a09;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.2s;
}
.sticker-btn img { width: 100%; height: 100%; object-fit: cover; }
.sticker-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--border-warm); }
.sticker-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.sticker-sel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}
.sticker-sel .btn { justify-self: start; }
.sel-line { font-size: 14px; font-weight: 700; color: var(--muted); }
.sel-line.is-on { color: var(--orange-hi); }

/* ---------- templates: contain-fit thumbnails, never cropped ---------- */
.studio-templates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.studio-tpl {
  appearance: none;
  position: relative;
  aspect-ratio: 1;
  min-height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 2px solid transparent;
  background: #0b0a09;
  overflow: hidden;
  cursor: pointer;
}
.studio-tpl img { width: 100%; height: 100%; object-fit: contain; }
.studio-tpl[aria-pressed="true"] {
  border-color: var(--orange-hi);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.3);
}

/* ---------- export ---------- */
.studio-export {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.studio-export .btn-primary { grid-column: 1 / -1; }
.studio-tips { margin-top: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .studio-page { padding-bottom: 132px; }
  .studio-drop { min-height: 300px; padding: 22px 16px; }
  .sticker-grid { gap: 8px; }
  .studio-export { grid-template-columns: minmax(0, 1fr); }
  .studio-export .btn-primary { grid-column: auto; }
}
