/* O ESTÚDIO. The one room where a visitor MAKES something: QIQI stands big and
   still while his face band answers the hand. Only the band is a tool target;
   the body is not a verb. The room never scrolls, on any device — it is a
   second room of the studio and inherits the address.

   Geometry per docs/design-research/estudio-math-2026-08.md: whole-him canvas,
   integer device pixels per cell, band = rows 14..24 × cols 7..26. */

.maker {
  height: 100svh; padding-top: var(--bar); overflow: hidden;
  max-width: var(--wrap); margin-inline: auto;
}
.maker__frame {
  height: 100%;
  padding: 16px var(--gut);
  display: flex; gap: clamp(24px, 3vw, 56px);
  align-items: center; justify-content: flex-start;
}

.maker__art { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; align-self: stretch; }
.maker__canvasbox { display: grid; place-items: center; min-width: 0; min-height: 0; width: 100%; flex: 1 1 auto; }
.maker__canvas { display: block; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
/* a label that names a piece of art centers with that art */
.maker__caption { font-size: 10px; letter-spacing: .24em; color: var(--qevr-muted); text-align: center; height: 24px; line-height: 24px; }

.maker__tools {
  display: flex; flex-direction: column; gap: clamp(12px, 2vh, 20px);
  width: clamp(320px, 30vw, 520px); flex: none; min-width: 0;
}
.maker__row { display: flex; width: 100%; }
.maker .ctl, .switches button, .canon-door { min-width: 44px; min-height: 44px; }
.maker__label {
  color: var(--qevr-muted); font-size: 9px; letter-spacing: .14em;
  margin-bottom: 6px; display: block;
}
.maker__section { border-top: var(--rule) solid var(--qevr-hair); padding-top: clamp(10px, 1.6vh, 16px); }
.maker__section:first-child { border-top: 0; padding-top: 0; }

.maker__name {
  width: 100%; background: transparent; color: var(--qevr-light);
  font: inherit; font-weight: 700; letter-spacing: .1em; font-size: 14px;
  border: var(--rule) solid var(--qevr-hair); padding: 11px 12px; min-height: 44px;
}
.maker__name:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.maker__previews { display: flex; gap: 16px; align-items: flex-end; }
.preview { display: grid; justify-items: center; gap: 5px; }
.preview canvas { display: block; image-rendering: pixelated; }
.preview__chipname {
  width: 110px; height: 20px; line-height: 20px; overflow: hidden;
  color: var(--qevr-muted); font-size: 9.5px; letter-spacing: .1em; text-align: center;
  text-overflow: ellipsis; white-space: nowrap;
}
.preview__tag { font-size: 8px; letter-spacing: .16em; color: var(--qevr-muted); }

/* the code is data: the one sanctioned lowercase on the site */
.maker__code {
  font-size: 11px; letter-spacing: .08em; line-height: 1.7;
  color: var(--qevr-light); text-transform: none; word-break: break-all;
  border: var(--rule) solid var(--qevr-hair); padding: 10px 12px;
}

.maker__hint { font-size: 10px; letter-spacing: .14em; color: var(--qevr-muted); line-height: 1.7; }
.maker__hint.is-failure {
  border: var(--rule) solid var(--qevr-pink); color: var(--qevr-pink);
  padding: 8px;
}

/* the drag loupe: instrumentation, in grammar. phone drags only. */
.loupe {
  position: absolute; z-index: 5; pointer-events: none; display: none;
  border: var(--rule) solid var(--qevr-hair); background: var(--qevr-ink);
}
.loupe.on { display: block; }
.loupe canvas { display: block; image-rendering: pixelated; }

/* mode toggle (phone): whole him, or just the face for fine work */
.maker__zoom { display: none; }

/* Round 2 preview: this room has one destination-language action. Dock it in
   a reserved header slot so the old hanging switch cannot cover the face. */
html.is-next .bar__nav { margin-right: 44px; }
html.is-next .switches {
  top: env(safe-area-inset-top, 0px);
  height: calc(var(--bar) - env(safe-area-inset-top, 0px));
  padding: 0; flex-direction: row; z-index: var(--z-header);
}
html.is-next .switches button {
  width: 44px; height: 100%; min-height: 44px; padding: 0;
  border-top: 0; border-bottom: 0;
}

@media (max-width: 1023px) and (orientation: portrait) and (min-width: 721px) {
  /* portrait tablet: tools stack full width under the canvas */
  .maker__frame { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 14px; }
  .maker__tools { width: 100%; }
}

@media (max-width: 720px) {
  .bar__mark { margin-left: var(--rail); }
  .maker { height: auto; min-height: 100svh; overflow-y: auto; }
  .maker__frame {
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 8px; padding: 56px 12px 12px; height: auto; min-height: calc(100svh - var(--bar));
    /* top headroom clears the fixed EN switch so it never sits on his corner
       (walk finding, 2026-08-27) */
  }
  /* the name lives at the top: the keyboard rises from the bottom and can
     never cover it */
  .maker__tools { width: 100%; order: 2; gap: 8px; }
  .maker__art { order: 1; flex: none; min-height: 0; justify-content: center; }
  .maker__canvasbox { flex: none; min-height: 0; }
  .maker__previews canvas { height: 64px !important; width: auto !important; }
  .maker__zoom { display: flex; }
  .maker__previews { justify-content: center; }
  .maker__section { padding-top: 8px; }
  .maker__name { font-size: 13px; padding: 10px 11px; }
  .maker__topname { order: 0; }
}

.canon-door {
  position: fixed; display: flex; align-items: center;
  left: max(var(--rail), env(safe-area-inset-left, 0px));
  bottom: env(safe-area-inset-bottom, 0px);
  z-index: 20; padding: 8px 10px;
  border: var(--rule) solid var(--qevr-hair); border-left: 0; border-bottom: 0;
  background: var(--ground); color: var(--qevr-muted); text-decoration: none;
  font-size: 8px; letter-spacing: .18em;
}
.canon-door:hover, .canon-door:focus-visible { background: var(--qevr-light); color: var(--qevr-ink); outline: 0; }

@media (min-width: 721px) {
  .maker { position: relative; }
  .canon-door { position: absolute; left: 0; }
}

@media (min-width: 2200px) {
  .maker__tools { width: clamp(520px, 28vw, 820px); }
  .maker__frame { gap: clamp(60px, 4vw, 140px); }
}

@media (max-height: 499px) {
  /* landscape phones: side-by-side compact, whole and un-broken */
  .maker__frame { flex-direction: row; gap: 14px; padding: 8px 14px; }
  .maker__tools { width: 300px; gap: 6px; }
  .maker__caption { display: none; }
}

/* Shipped 2026-09-02 (R2, Fable): the round-2 "one fixed room" phone
   layout cut the share row under the CANON tab. Until the estúdio revamp the
   page scrolls on phones — everything reachable — and CANON is a quiet door
   in the flow at the end of the tools, not a tab floating over them. */
@media (max-width: 720px) {
  .canon-door {
    position: static; width: auto; display: flex; justify-content: center;
    margin: 12px var(--gut, 16px) calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 14px 10px;
    border: var(--rule) solid var(--qevr-hair);
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  html.is-next .maker__frame { flex-direction: column; }
  html.is-next .maker__art {
    height: clamp(240px, 42svh, 400px); min-height: 0; flex: 0 1 auto;
  }
  html.is-next .maker__canvasbox { flex: 1 1 auto; }
}

@media (orientation: landscape) and (max-height: 499px) {
  html.is-next .maker__frame {
    flex-direction: row; align-items: stretch; gap: 12px;
    padding: 8px 12px calc(44px + 8px + env(safe-area-inset-bottom, 0px));
  }
  html.is-next .maker__art { height: auto; min-width: 0; flex: 1 1 auto; }
  html.is-next .maker__canvasbox { flex: 1 1 auto; }
  html.is-next .maker__zoom { display: flex; }
  html.is-next .maker__tools {
    width: min(300px, 46vw); flex: 0 0 min(300px, 46vw);
    overflow-y: auto; padding-top: 44px;
  }
}
