/* 3D models in lessons (assets/js/models3d.js). One figure at the end of the
   section it belongs to, in the lesson's own column and type. */
.m3d{margin:18px 0 24px;padding:14px 16px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--paper)}
.m3d-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;margin-bottom:10px}
.m3d-lbl{font-size:.74rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--brand)}
.m3d-title{font-weight:650;color:var(--ink)}
.m3d-pick{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.m3d-tab{font:inherit;font-size:.9rem;font-weight:600;padding:7px 14px;border-radius:999px;border:1.5px solid var(--line);
  background:var(--paper);color:var(--ink-soft);cursor:pointer;min-height:40px}
.m3d-tab:hover{border-color:var(--brand)}
.m3d-tab[aria-pressed="true"]{background:var(--brand);border-color:var(--brand);color:#fff}
.m3d-stage{position:relative;width:100%;max-width:560px;margin:0 auto;aspect-ratio:3/2;border-radius:12px;overflow:hidden;
  background:#f3f6fb;border:1px solid var(--line)}
.m3d-still,.m3d-canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.m3d-still{object-fit:contain}
.m3d-still[hidden],.m3d-canvas[hidden]{display:none}
.m3d-canvas{cursor:grab;touch-action:pan-y;-webkit-user-select:none;user-select:none}
.m3d-canvas:active{cursor:grabbing}
.m3d-canvas:focus-visible{outline:3px solid var(--brand);outline-offset:-3px;border-radius:12px}
.m3d-bar{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin:10px 0 4px}
.m3d-btn{font:inherit;font-size:.95rem;font-weight:600;min-width:42px;min-height:42px;padding:6px 10px;border-radius:9px;
  border:1.5px solid var(--line);background:var(--paper);color:var(--ink);cursor:pointer;line-height:1}
.m3d-btn:hover{border-color:var(--brand);color:var(--brand)}
.m3d-btn:focus-visible,.m3d-tab:focus-visible{outline:3px solid var(--brand);outline-offset:2px}
.m3d-wide{padding:6px 14px;font-size:.86rem}
.m3d-btn[aria-pressed="true"]{background:var(--brand-light);border-color:var(--brand);color:var(--brand-dark)}
.m3d-hint{font-size:.78rem;color:var(--muted);text-align:center;margin:2px 0 8px}
/* One hint for a mouse and keyboard, another for a touch screen. */
.m3d-hint .m3d-touch{display:none}
@media(pointer:coarse){
  .m3d-hint .m3d-mouse{display:none}
  .m3d-hint .m3d-touch{display:inline}
}
.m3d-measure{font-size:.92rem;font-weight:600;color:var(--ink);text-align:center;margin:0 0 8px;min-height:1.3em}
.m3d figcaption{font-size:.9rem;color:var(--ink-soft);line-height:1.5}
.m3d figcaption .desc,.m3d-note{display:block;margin:0 0 6px}
.m3d-note:empty,.m3d-read:empty{display:none}
.m3d-read{display:block;font-size:.8rem;color:var(--muted);margin:0 0 6px}
.m3d-key{display:flex;flex-wrap:wrap;gap:4px 14px;margin:2px 0 6px;font-size:.82rem;color:var(--ink-soft)}
.m3d-chip{display:inline-flex;align-items:center;gap:6px}
.m3d-chip i{width:12px;height:12px;border-radius:50%;border:1px solid rgba(0,0,0,.45);flex:none}
.m3d figcaption .credit{display:block;font-size:.74rem;color:var(--muted)}
.m3d figcaption .credit a{color:var(--muted);text-decoration:underline}
.m3d-words{margin-top:8px;font-size:.88rem;color:var(--ink-soft)}
.m3d-words summary{cursor:pointer;font-weight:600;color:var(--brand)}
.m3d-words p{margin:6px 0 0}
/* When only the still picture can be shown, the controls have nothing to work. */
.m3d-stillonly .m3d-bar,.m3d-stillonly .m3d-hint{display:none}

/* Scanned objects (assets/js/scans3d.js) use the same figure. One opens on a
   still picture with a button that loads the turning model and states its
   size; the controls appear once it has loaded. */
.m3d-ask{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px 14px;margin:10px 0 6px;text-align:center}
.m3d-ask[hidden],.m3d-bar[hidden],.m3d-hint[hidden]{display:none}
.m3d-load{background:var(--brand);border-color:var(--brand);color:#fff;font-size:.95rem;padding:9px 18px}
.m3d-load:hover{background:var(--brand-dark);border-color:var(--brand-dark);color:#fff}
.m3d-load[disabled]{opacity:.75;cursor:progress}
.m3d-asknote{flex-basis:100%;font-size:.8rem;color:var(--muted)}
.m3d-status{font-size:.86rem;color:var(--ink-soft);text-align:center;margin:0 0 6px}
.m3d-status:empty,.m3d-measure:empty{display:none}
.m3d-scan .m3d-measure{min-height:0}
/* The still picture is the stage's own shape and has the stage's colour painted in. */
.m3d-scan .m3d-still{object-fit:cover}

/* 360-degree views (assets/js/pano360.js). The whole view is shown at once as
   a strip, which is also a map: a frame on it marks the part in view. The view
   to turn is wider than a model's stage, as a panorama is. */
.m3d-strip{position:relative;width:100%;max-width:760px;margin:0 auto;line-height:0;border-radius:8px;overflow:hidden;background:#000}
.m3d-strip .m3d-still{position:static;display:block;width:100%;height:auto}
.m3d-win{position:absolute;top:0;height:100%;box-sizing:border-box;border:2px solid #f0c95a;box-shadow:0 0 0 1px rgba(0,0,0,.6);pointer-events:none}
.m3d-win[hidden]{display:none}
.m3d-pano .m3d-stage{max-width:760px;aspect-ratio:2/1;margin-top:10px}
.m3d-pano .m3d-stage[hidden]{display:none}
/* On a narrow screen a 2:1 window would be a thin slot; a squarer one shows the ground and the sky. */
@media(max-width:560px){.m3d-pano .m3d-stage{aspect-ratio:4/3}}
.m3d-pano .m3d-canvas{position:absolute;inset:0;width:100%;height:100%;cursor:grab}
.m3d-pano:not(.m3d-stillonly) .m3d-strip{cursor:pointer}
.m3d-pano .m3d-btn[disabled]{opacity:.45;cursor:default}

html[data-theme="dark"] .m3d{background:var(--paper)}
html[data-theme="dark"] .m3d-load,html[data-theme="dark"] .m3d-load:hover{color:#0f141d}
html[data-theme="dark"] .m3d-stage{background:#1b2432}
html[data-theme="dark"] .m3d-tab[aria-pressed="true"]{color:#0f141d}
html[data-theme="dark"] .m3d-chip i{border-color:rgba(255,255,255,.4)}

@media(max-width:560px){
  .m3d{padding:12px 10px 10px}
  .m3d-btn{min-width:44px;min-height:44px}
}
/* A reader who has asked for less motion, in the browser or in the site's own
   accessibility panel, is not offered the spinning view; the step buttons stay. */
@media(prefers-reduced-motion:reduce){
  .m3d [data-m3d="spin"]{display:none}
}
body.a11y-reduce-motion .m3d [data-m3d="spin"]{display:none}
body.a11y-contrast .m3d,body.a11y-contrast .m3d-stage,body.a11y-contrast .m3d-btn,body.a11y-contrast .m3d-tab{border-color:currentColor}
@media print{
  .m3d-bar,.m3d-hint,.m3d-pick,.m3d-ask,.m3d-status{display:none}
  /* A turning scan may print blank, so paper gets its still picture. */
  .m3d-scan .m3d-canvas{display:none}
  .m3d-scan .m3d-still[hidden]{display:block}
  /* A 360-degree view prints as its strip, the whole view. */
  .m3d-pano .m3d-stage,.m3d-pano .m3d-win{display:none}
  .m3d{break-inside:avoid}
  .m3d-words[open] summary,.m3d-words summary{list-style:none}
}
