/* ---------- canvas ---------- */
/* The dots fade as the canvas is zoomed out, gone when it is far out (--dot-z, set by applyView, section 8b). It is not
   inherited, so setting it restyles the canvas alone, never what is on it. */
@property --dot-z { syntax: '<number>'; inherits: false; initial-value: 1; }
#canvas {
  position: fixed; inset: 0; outline: none; touch-action: none;
  background-color: var(--canvas);
  background-image: radial-gradient(color-mix(in srgb, var(--dot-ink) calc(var(--dot-z, 1) * 100%), transparent) var(--dot-r), transparent calc(var(--dot-r) + .3px));
  background-size: 24px 24px; background-position: 12px 12px;
}
/* A finger held still opens CoordXYZ's menu (section 14), not iOS's preview of the picture or link under it. */
#canvas img, #canvas a { -webkit-touch-callout: none; }
#world, #cam, #camk, #objs, #gl, #ghosts { position: absolute; inset: 0; }
#cam, #camk, #ghosts { transform-origin: 0 0; }        /* the camera (section 8b) moves the open canvas (#cam) and scales it from its top-left (#camk, which holds #objs) */
#cam { pointer-events: none; }
/* Copies of what is leaving or changing shape (section 8, motion): seen, never touched. */
#ghosts { pointer-events: none; }
#ghosts > .obj { pointer-events: none !important; }
#objs { pointer-events: none; }        /* only what is on it takes a press: an arrow by its line alone (section 22) */
#objs > .obj { pointer-events: auto; }
#objs > .obj.arrow { pointer-events: none; }
body.panning, body.panning * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
#world { z-index: 1; }
#gl { pointer-events: none; contain: strict; }
#gl, #marq { z-index: 2; }        /* above a sheet still settling (section 11) */
#gl.out { opacity: 0; transition: opacity 80ms ease-out; }
#gl.abort { opacity: 0; transition: opacity 120ms ease-in; }

#empty {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -60%);   /* above #world: its one button stays clickable */
  width: min(460px, calc(100% - 32px)); text-align: center;
  pointer-events: none; user-select: none; -webkit-user-select: none;
  transition: opacity 240ms ease-out 200ms, visibility 0s;
}
#empty p { margin: 0; }
/* The words that talk to you are in the book serif; the small print is an instrument's label, its keys raised caps. */
#empty strong { display: block; font: 400 28px/1.2 var(--f-display); letter-spacing: -.014em; color: var(--ink); text-wrap: balance; font-optical-sizing: auto; }
#empty strong em { font-style: italic; }
#empty span { display: block; margin-top: 10px; font: 400 16.5px/1.5 var(--f-display); color: var(--ink-2); text-wrap: balance; font-optical-sizing: auto; }
#empty small { display: block; margin-top: 18px; font: 500 10px/22px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-q); text-wrap: balance; }
#empty kbd {      /* the dock's key cap (.sbtn kbd): hairline, its lower edge heavier */
  display: inline-block; min-width: 10px; margin: 0 3px; padding: 0 5px; border-radius: 3px; font: inherit; line-height: 15px; letter-spacing: .06em;
  color: var(--ink-2); background: transparent; border: 1px solid var(--rule-2); border-bottom-width: 2px;
}
#empty .e-touch { display: none; }
#empty .e-preset {
  pointer-events: auto; margin-top: 24px; height: 34px; padding: 0 16px; border: 0; border-radius: 10px; cursor: pointer;
  font: 500 12.5px/34px var(--f-ui); color: var(--ink-2); background: var(--canvas); box-shadow: var(--raise-sm), var(--edge);
  transition: color 160ms ease-out, box-shadow 160ms ease-out, translate 160ms ease-out;
}
@media (hover: hover) { #empty .e-preset:hover { color: var(--ink); box-shadow: var(--raise), var(--edge); translate: 0 -1px; } }
#empty .e-preset:active { background: var(--press-bg); box-shadow: var(--press); translate: none; }
#empty .e-preset:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 3px; }
/* The way in (Axio, 2026-11-09): 30s tutorial, the one in colour, XYZ purple with a light passing over it once, as
   Settings' Select plan (.cx-up); under it Start with a template, or, Start with AI, those two one width. */
#empty .e-tut {
  pointer-events: auto; position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 216px; margin: 24px auto 0; height: 40px; padding: 0 20px 0 16px; border: 0; border-radius: 10px; cursor: pointer;
  font: 600 13px/1 var(--f-ui); color: var(--on-tc); background: var(--z);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px color-mix(in srgb, var(--z) 40%, transparent), 0 10px 24px -10px color-mix(in srgb, var(--z) 85%, transparent);
  transition: background-color 200ms ease, box-shadow 200ms ease, translate 200ms ease;
}
#empty .e-tut span { display: inline; margin: 0; font: inherit; color: inherit; }
#empty .e-tut svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5px; stroke-linejoin: round; }
#empty .e-tut svg path { fill: currentColor; stroke: none; }
#empty .e-tut::after {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none; transform: translateX(-110%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .38) 50%, transparent 70%);
}
@media (prefers-reduced-motion: no-preference) { #empty:not(.gone) .e-tut::after { animation: e-tut-sheen 1100ms 900ms cubic-bezier(.4, .2, .2, 1) both; } }
@keyframes e-tut-sheen { to { transform: translateX(110%); } }
@media (hover: hover) {
  #empty .e-tut:hover { background: color-mix(in srgb, var(--z) 90%, var(--on-tc)); translate: 0 -1px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 4px color-mix(in srgb, var(--z) 35%, transparent), 0 14px 30px -10px color-mix(in srgb, var(--z) 90%, transparent); }
}
#empty .e-tut:active { translate: none; }
#empty .e-tut:focus-visible { outline: 2px solid var(--z); outline-offset: 3px; }
#empty .e-start { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 216px; margin-inline: auto; }
#empty .e-root .e-start { margin-top: 12px; }
#empty .e-ai .e-start { margin-top: 0; }
#empty .e-or { margin: 8px 0 6px; font: italic 400 15px/20px var(--f-display); color: var(--ink-3); }
/* a touch screen draws with a finger, and the tutorial is a mouse's (section 25c) */
@media (hover: none) and (pointer: coarse) { #empty .e-tut { display: none; } #empty .e-root .e-start { margin-top: 24px; } }
@media (hover: none) and (pointer: coarse) {
  #empty .e-fine { display: none; }
  #empty .e-touch { display: block; }
}
/* Draw a shape, get a thing (section 25): from the anchor (the mark's dot and cross) a hand draws down and to the right,
   wide, then square, then tall, the shape in the type's colour and the chip saying what each one makes, as a real
   drag does; it lets go and starts again, and after two loops rests on the square (below). With motion reduced it
   holds still there: a Board. Everything hangs from one point, the anchor's middle (30.5, 12.5: on a pixel's middle,
   so the 1px cross is sharp): the dot and the cross are centred on it, the shape's outline (1.5px, measured to the
   middle of its stroke) starts on it, so its top and left edges run along the cross, and the hand (a mouse) is just
   off the shape's far corner. The anchor sits on a dot of the canvas (demoSnap, section 25) and the shapes are whole
   dot steps (6 × 1, 3 × 3, 2 × 4), so every corner is on a dot.
   It keeps a real drag's time (section 4's classify, run on the hand's eased path): the chip shows at 16px out (10.93%),
   then the type changes as the angle passes the sector's bound and its hysteresis (26.5° at 37.84%, 55.6° at 61.78%).
   Its colours are a real drag's, day and night (Axio 2026-10-11): grey until the chip shows, then the Text's, the
   Board's (the depth colour) and the Table's hue, each easing in over 140ms (2.5%) as the preview's does. The keyframes
   move plain amounts (--ed-1 to --ed-3, how much of each type's hue lies over the one before), never a colour, so a
   theme switch mid-loop takes at once (keyframes holding var() colours can keep the old theme's values in some
   browsers). With motion reduced it is the Board's. */
@property --ed-1 { syntax: '<percentage>'; inherits: true; initial-value: 100%; }
@property --ed-2 { syntax: '<percentage>'; inherits: true; initial-value: 100%; }
@property --ed-3 { syntax: '<percentage>'; inherits: true; initial-value: 0%; }
#empty .e-demo {
  position: relative; width: 240px; height: 134px; translate: var(--snap, 0 0); margin: 0 auto 10px;
  --tc: color-mix(in srgb, var(--c-table) var(--ed-3), color-mix(in srgb, var(--c-board) var(--ed-2), color-mix(in srgb, var(--c-text) var(--ed-1), var(--ink-3))));
}
.e-demo > *, .ed-k > * { position: absolute; left: 0; top: 0; }
.ed-o { left: 30.5px; top: 12.5px; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; }
.ed-o::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1.5px var(--canvas); }
.ed-o::before {
  content: ""; position: absolute; left: -8px; top: -8px; width: 21px; height: 21px; opacity: .8;
  background: linear-gradient(var(--ink-3), var(--ink-3)) center / 100% 1px no-repeat, linear-gradient(var(--ink-3), var(--ink-3)) center / 1px 100% no-repeat;
}
.ed-r {
  left: 29.75px; top: 11.75px; width: 73.5px; height: 73.5px; box-sizing: border-box; border-radius: 2px;      /* size: the shape's + 1.5 */
  border: 1.5px solid var(--tc); background: color-mix(in srgb, var(--tc) var(--g-fill), transparent);
}
.ed-k { left: 30.5px; top: 12.5px; translate: 72px 72px; }
/* The hand is a mouse, flat (Axio, 2026-11-09): just off the shape's far corner, its held button in the shape's colour.
   The loop plays twice: the right button held, then the left with + Shift beside it (a trackpad's way), and again. */
.ed-m { left: 2px; top: 3px; width: 14px; height: 20px; overflow: visible; }
.ed-mb { fill: var(--canvas); stroke: var(--ink); stroke-width: 1.3px; }
.ed-mk { fill: none; stroke: var(--ink); stroke-width: 1.1px; }
.ed-ml, .ed-mr { fill: var(--tc); opacity: 0; }
.ed-mr { opacity: 1; }                       /* held still (motion reduced): the right button */
.ed-s { left: 20px; top: 14px; font: 500 10px/15px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; color: var(--ink-2); opacity: 0; }
#empty .ed-s kbd { margin: 0 0 0 2px; }
.ed-c {
  left: 16px; top: -10px; display: grid; height: 21px; padding: 5px 7px; box-sizing: border-box; border-radius: 2px;
  font: 500 10.5px/11px var(--f-mono); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap;
  background: var(--tc); color: var(--on-tc);
}
.ed-c > i { grid-area: 1 / 1; font-style: normal; opacity: 0; }
.ed-c > i:nth-child(2) { opacity: 1; }
/* It plays its two loops and stops (Axio, 2026-11-16: "the animation keeps on playing"): the right button's, Shift's,
   then the right button's again as far as the square, where it rests, held there (forwards: 2.5 loops of 5.6s end
   halfway through one, the Board's; 1.25 of the buttons' 11.2s, a quarter in, the right one held), as still as it is
   with motion reduced. 14s in all, counted only while it can be seen. */
@media (prefers-reduced-motion: no-preference) {
  #empty .e-demo { animation: ed-tc 5.6s linear 2.5 forwards; }
  .ed-r { animation: ed-r 5.6s cubic-bezier(.45, 0, .25, 1) 2.5 forwards, ed-on 5.6s linear 2.5 forwards; }
  .ed-k { animation: ed-k 5.6s cubic-bezier(.45, 0, .25, 1) 2.5 forwards, ed-hand 5.6s linear 2.5 forwards; }
  .ed-o { animation: ed-on 5.6s linear 2.5 forwards; }
  .ed-c { animation: ed-chip 5.6s linear 2.5 forwards; }
  .ed-c > i { animation: 5.6s linear 2.5 forwards; }
  .ed-c > i:nth-child(1) { animation-name: ed-l1; }
  .ed-c > i:nth-child(2) { animation-name: ed-l2; }
  .ed-c > i:nth-child(3) { animation-name: ed-l3; }
  /* the buttons and + Shift over two loops: held from the press to the let go (6% to 74% of each) */
  .ed-mr { animation: ed-pr 11.2s linear 1.25 forwards; }
  .ed-ml { animation: ed-pl 11.2s linear 1.25 forwards; }
  .ed-s { animation: ed-sh 11.2s linear 1.25 forwards; }
  /* Wherever it can't be seen it waits, all of it at once: the box's own colour loop (ed-tc) with its parts, so they
     keep one clock, and a page with something on it has nothing left running (nor one the 30s tutorial is on). */
  :is(#empty.gone, body.drawing #empty, body.ghosting #empty, #empty.dv-off, body.tut-on #empty) .e-demo,
  :is(#empty.gone, body.drawing #empty, body.ghosting #empty, #empty.dv-off, body.tut-on #empty) .e-demo * { animation-play-state: paused; }
}
@keyframes ed-tc {
  0%, 10.93% { --ed-1: 0%; --ed-2: 0%; --ed-3: 0%; }
  13.43%, 37.84% { --ed-1: 100%; --ed-2: 0%; --ed-3: 0%; }
  40.34%, 61.78% { --ed-1: 100%; --ed-2: 100%; --ed-3: 0%; }
  64.28%, 100% { --ed-1: 100%; --ed-2: 100%; --ed-3: 100%; }
}
@keyframes ed-chip { 0%, 10.92% { opacity: 0; } 10.93%, 100% { opacity: 1; } }
@keyframes ed-r {
  0%, 8% { width: 1.5px; height: 1.5px; }
  22%, 32% { width: 145.5px; height: 25.5px; }
  46%, 56% { width: 73.5px; height: 73.5px; }
  70%, 100% { width: 49.5px; height: 97.5px; }
}
@keyframes ed-k {
  0%, 8% { translate: 0 0; }
  22%, 32% { translate: 144px 24px; }
  46%, 56% { translate: 72px 72px; }
  70%, 100% { translate: 48px 96px; }
}
@keyframes ed-on { 0% { opacity: 0; } 5%, 86% { opacity: 1; } 94%, 100% { opacity: 0; } }
@keyframes ed-hand { 0% { opacity: 0; } 5%, 80% { opacity: 1; } 85%, 100% { opacity: 0; } }
@keyframes ed-l1 { 0%, 37.83% { opacity: 1; } 37.84%, 100% { opacity: 0; } }
@keyframes ed-l2 { 0%, 37.83% { opacity: 0; } 37.84%, 61.77% { opacity: 1; } 61.78%, 100% { opacity: 0; } }
@keyframes ed-l3 { 0%, 61.77% { opacity: 0; } 61.78%, 100% { opacity: 1; } }
@keyframes ed-pr { 0%, 2.99% { opacity: 0; } 3%, 37% { opacity: 1; } 37.01%, 100% { opacity: 0; } }
@keyframes ed-pl { 0%, 52.99% { opacity: 0; } 53%, 87% { opacity: 1; } 87.01%, 100% { opacity: 0; } }
@keyframes ed-sh { 0%, 51% { opacity: 0; } 53%, 87% { opacity: 1; } 90%, 100% { opacity: 0; } }
@media (hover: none) and (pointer: coarse) {      /* a finger, not a pointer */
  .ed-m, .ed-s { display: none; }
  .ed-k::before { content: ""; position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 30%, transparent); }
  .ed-c { left: 20px; }
}
body.drawing #empty, #empty.gone { opacity: 0; transition: opacity 120ms ease-out, visibility 0s linear 120ms; }
body.previewing #empty { opacity: 0; transition: none; }     /* never under a ghost, even on a fast first drag */
#empty.gone { visibility: hidden; }

