/* Model page only. Shared look (fonts, header, footer, buttons, loading screen) is in site.css. */
main>canvas{cursor:grab}
main>canvas:active{cursor:grabbing}

@media(max-width:1200px){footer small{display:none}}

/* skin switcher: the chosen skin grows into a big blob */
#skin-picker{position:absolute;width:max-content;max-width:calc(100vw - 20px);left:50%;bottom:calc(clamp(46px,5vh,50px) + var(--model-footer-lift,0px));transform:translateX(-50%);z-index:3;display:flex;align-items:center;justify-content:center;gap:20px;height:90px;margin:0;pointer-events:auto}
.skin-choice{font-size:30px;transition:width .34s cubic-bezier(.18,.85,.28,1),height .34s cubic-bezier(.18,.85,.28,1),font-size .34s cubic-bezier(.18,.85,.28,1),transform .18s ease}
.skin-choice[aria-pressed="true"]{width:90px;height:90px;color:var(--pos-ink);font-size:48px}   /* the chosen one, 25% smaller than it used to be */
.skin-choice[aria-pressed="true"] path{fill:var(--pos-paper);stroke:var(--pos-title);stroke-width:4}
@keyframes skin-pop{0%{transform:scale(1)}48%{transform:scale(1.075,.96)}76%{transform:scale(.985,1.025)}100%{transform:scale(1)}}
.skin-choice[aria-pressed="true"] svg{transform-origin:center;animation:skin-pop .34s ease-out both}

/* clickable marker over the pencil in the scene */
#scene-link{position:absolute;width:48px;height:48px;z-index:1;transform:translate(-50%,-50%);border-radius:50%;cursor:pointer}
#scene-link:focus-visible{outline:3px solid var(--pos-focus-blue);outline-offset:3px}

@media(min-width:821px){#skin-picker{bottom:calc(clamp(46px,5vh,50px) + 30px + var(--model-footer-lift,0px))}}   /* desktop: the circles and the print button sit 30px higher, clear of the footer */
@media(max-width:820px){#skin-picker{gap:10px;height:72px;bottom:calc(64px + var(--model-footer-lift,0px))}.skin-choice{width:36px;height:36px;font-size:26px}.skin-choice[aria-pressed="true"]{width:72px;height:72px;font-size:39px}}
@media(max-width:540px){
  /* --others small circles (all but the chosen one, set by model-ui.js; 8 with nine figures), one 48px selection, as many gaps and
     12px on each edge: the circles are 27px while they fit, smaller on narrow phones, and the lettering follows their size. */
  #skin-picker{--others:8;gap:clamp(6px,calc((100vw - 72px - var(--others) * 27px) / var(--others)),12px);height:48px;bottom:calc(60px + var(--model-footer-lift,0px))}
  .skin-choice{--skin-size:min(27px,calc((100vw - 72px - var(--others) * 6px) / var(--others)));width:var(--skin-size);height:var(--skin-size);font-size:calc(var(--skin-size) * .7)}
  .skin-choice[aria-pressed="true"]{width:48px;height:48px;font-size:26px}
}
@media(prefers-reduced-motion:reduce){.skin-choice{transition:none}.skin-choice[aria-pressed="true"] svg{animation:none}}

/* the big print button: bottom left, level with the skin circles (their row is 120px high, centred 60px above its bottom edge) */
#pdf{position:absolute;left:var(--pos-gutter);bottom:calc(clamp(46px,5vh,50px) + 48px + var(--model-footer-lift,0px));z-index:3;display:inline-flex;align-items:center;justify-content:center;height:54px;padding:0 40px;font-size:38px;line-height:16px;border-width:3px;--bw:3px}
@media(max-width:900px){#pdf{left:0;right:0;margin:0 auto;width:max-content;bottom:calc(152px + var(--model-footer-lift,0px))}}   /* tablets and phones: centred right above the numbered circles */   /* the skin row is too wide to share the line: the button sits just above it */
@media(min-width:821px) and (max-width:1500px){#pdf{left:0;right:0;margin:0 auto;width:max-content;bottom:calc(clamp(46px,5vh,50px) + 134px + var(--model-footer-lift,0px))}}   /* narrower desktops: no room beside the circles, so centred above them */

/* PHONES, the same order as the Paint page: row 1 title | logo in the middle | EN + music; row 2 the page links; an uneven line; under it the
   page's own round buttons (P pause, L load a texture, and Back to skin when shown) on the left. At the bottom: the skin circles above the footer
   and the big print button centred just above them. --row3 (site.js) follows the real bottom of the page links. */
@media(max-width:540px){
  #reset{position:fixed;top:calc(var(--row3,98px) + 14px);left:18px;z-index:4}
  #pdf{left:0;right:0;margin:0 auto;width:max-content;bottom:calc(126px + var(--model-footer-lift,0px));height:48px;font-size:29px;padding:0 24px}
}

/* the figure's name written by hand next to it, with an arrow (model-callout.js); over the scene, under the header and the buttons */
#callout{position:absolute;inset:0;width:100%;height:100%;z-index:2;pointer-events:none;overflow:visible}
#callout g{transition:opacity .3s ease}
#callout g.gone{opacity:0}
#callout path{fill:none;stroke:var(--callout,var(--callout-1));stroke-linecap:round;stroke-linejoin:round}

/* Model diagnostics */
#debug{position:fixed;left:12px;top:50%;transform:translateY(-50%);z-index:8;width:min(380px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain;padding:14px;background:white;border:1px solid #aaa;border-radius:4px;color:#222;font:14px/1.4 system-ui,sans-serif;display:grid;gap:8px}
.debug-heading,.debug-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.debug-heading{justify-content:space-between}
#debug h2,#debug h3{margin:0;font:600 16px/1.25 system-ui,sans-serif;color:inherit}
#debug h3{border-top:1px solid #ddd;padding-top:8px;font-size:14px}
#debug button{appearance:auto;background:#f5f5f5;color:#222;border:1px solid #aaa;border-radius:3px;padding:4px 9px;font:inherit;line-height:1.2}
#debug button:hover{background:#e9e9e9}
.debug-options{display:grid;gap:3px}
.debug-options label{display:flex;align-items:center;gap:6px}
.debug-options input{margin:0}
#camText,#camInfo,.debug-metrics{font:12px/1.45 ui-monospace,Consolas,monospace;font-variant-numeric:tabular-nums}
#camText{width:100%;resize:vertical;border:1px solid #aaa;padding:5px}
#camInfo{white-space:pre-line;overflow-wrap:anywhere}
#camMessage:empty{display:none}

/* auto show: an orange ring fills inside the chosen circle; when full, the next figure comes on (model-ui.js) */
#skin-picker{--skin-time:10s}
.skin-choice>svg.ring{display:none;z-index:0;overflow:visible}
.skin-choice>svg.ring circle{fill:none;stroke:var(--pos-orange);stroke-width:3px;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-dasharray:100;stroke-dashoffset:100}
.skin-choice[aria-pressed="true"]>svg.ring{display:block;animation:none}
.skin-choice[aria-pressed="true"]>svg.ring circle{animation:skin-ring var(--skin-time) linear forwards}
@keyframes skin-ring{to{stroke-dashoffset:0}}
#skin-picker:hover .ring circle,body.scene-paused .ring circle,body.auto-paused .ring circle,body:has(#reset:not([hidden])) .ring circle{animation-play-state:paused!important}   /* !important: the animation shorthand on the chosen ring would reset it */
@media(prefers-reduced-motion:reduce){.skin-choice[aria-pressed="true"]>svg.ring{display:none}}
/* a skin that is still loading: its circle pulses (viewer.js adds .loading) */
@keyframes skin-loading{0%,100%{opacity:1}50%{opacity:.45}}
.skin-choice.loading{animation:skin-loading .8s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){.skin-choice.loading{animation:none;opacity:.6}}
/* debug: interface colour editor (ui-colors.js) */
.debug-colors{display:grid;grid-template-columns:1fr 1fr;gap:4px 12px}
.debug-colors label{display:flex;align-items:center;gap:6px;min-width:0;font-size:12px}
.debug-colors label span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.debug-colors input[type=color]{flex:none;width:30px;height:22px;padding:0;border:1px solid #aaa;background:none;cursor:pointer}
#uiColorsMessage{font-size:12px}
