/* SchoolCAD — Vector workspace (vector.html). Laid out the way Illustrator users expect: menus along the top, the
 * Control bar under them, the Tools panel on the left, docked panels on the right, the artboard in the middle. */
@font-face { font-family: 'Source Sans 3'; src: url('../vendor/vectorcraft/fonts/SourceSans3-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('../vendor/vectorcraft/fonts/SourceSans3-Semibold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('../vendor/vectorcraft/fonts/SourceSans3-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('../vendor/vectorcraft/fonts/SourceSans3-It.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Source Serif 4'; src: url('../vendor/vectorcraft/fonts/SourceSerif4-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../vendor/vectorcraft/fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../vendor/vectorcraft/fonts/Inter-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../vendor/vectorcraft/fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../vendor/vectorcraft/fonts/JetBrainsMono-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }

/* one column the width of the window: without it the column grows to fit the top bar on one line, and on a tablet or
   a small laptop (under about 1300 px) the panels and the Use in SchoolCAD button are pushed off the screen */
body.vx-body { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; overflow: hidden; margin: 0; }
.vx-top { gap: 10px; }
.vx-top .spacer { flex: 1; }
.vx-title { font-weight: 600; white-space: nowrap; }
.vx-adv { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 9px; background: var(--accent-weak); color: var(--accent); margin-left: 4px; vertical-align: 1px; }
a.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }

/* menus */
.vx-menubar { display: flex; gap: 0; margin-left: 6px; }
.vx-menubar > .vx-m { position: relative; }
.vx-menubar > .vx-m > button { background: none; border: 0; padding: 6px 9px; border-radius: 5px; font: inherit; color: inherit; cursor: default; }
.vx-menubar > .vx-m > button:hover, .vx-menubar > .vx-m.open > button { background: var(--panel-2); }
.vx-menu { position: absolute; top: 100%; left: 0; z-index: 50; min-width: 250px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow); padding: 4px 0; font-size: 13px; }
.vx-menu .vx-sub { position: relative; }
.vx-menu .vx-sub > .vx-menu { top: -5px; left: 100%; display: none; }
.vx-menu .vx-sub:hover > .vx-menu, .vx-menu .vx-sub:focus-within > .vx-menu { display: block; }
.vx-mi { display: flex; width: 100%; align-items: center; gap: 18px; background: none; border: 0; text-align: left; padding: 5px 14px 5px 26px; font: inherit; color: inherit; cursor: default; position: relative; }
.vx-mi:hover:not(:disabled), .vx-mi:focus-visible { background: var(--accent); color: var(--accent-ink); outline: none; }
.vx-mi:disabled { opacity: .45; }
.vx-mi .k { margin-left: auto; opacity: .7; font-size: 12px; white-space: nowrap; }
.vx-mi.on::before { content: '✓'; position: absolute; left: 9px; }
.vx-mi.has-sub::after { content: '▸'; margin-left: auto; padding-left: 12px; }
.vx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* control bar */
.vx-control { display: flex; align-items: center; gap: 10px; padding: 4px 10px; min-height: 34px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12px; overflow-x: auto; white-space: nowrap; }
.vx-control .vx-kind { font-weight: 600; min-width: 90px; }
.vx-control label { display: inline-flex; align-items: center; gap: 4px; }
.vx-control input[type=number], .vx-control input[type=text] { width: 62px; }
.vx-sep { width: 1px; align-self: stretch; background: var(--line); }
.vx-field { display: inline-flex; align-items: center; gap: 4px; }
.vx-field input, .vx-panel input[type=number], .vx-panel input[type=text], .vx-panel select, .vx-control select { font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); color: var(--ink); }
.vx-unit { color: var(--muted); }

/* swatch buttons */
.vx-sw { width: 22px; height: 22px; border-radius: 3px; border: 1px solid var(--line-strong); cursor: pointer; padding: 0; position: relative; background: #fff; flex: none; }
.vx-sw.none { background: #fff linear-gradient(to top right, transparent calc(50% - 1px), #e00 calc(50% - 1px), #e00 calc(50% + 1px), transparent calc(50% + 1px)); }
.vx-sw.stroke::after { content: ''; position: absolute; inset: 5px; background: var(--panel); border: 1px solid var(--line-strong); }
.vx-sw.stroke.none::after { display: none; }
.vx-pop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow); padding: 8px; display: grid; gap: 6px; width: 228px; font-size: 12px; }
.vx-pop .grid, .vx-swatches { display: grid; grid-template-columns: repeat(10, 18px); gap: 3px; }
.vx-pop .grid button, .vx-swatches button { width: 18px; height: 18px; border: 1px solid rgba(0,0,0,.2); border-radius: 2px; padding: 0; cursor: pointer; }
.vx-swatches button.none, .vx-pop .grid button.none { background: #fff linear-gradient(to top right, transparent calc(50% - 1px), #e00 calc(50% - 1px), #e00 calc(50% + 1px), transparent calc(50% + 1px)); }
.vx-laser-row { display: flex; gap: 4px; flex-wrap: wrap; }
.vx-laser-row button { font-size: 11px; padding: 3px 7px; }
.vx-laser-row i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* main grid */
main.vx { display: grid; grid-template-columns: 70px 1fr 290px; min-height: 0; }
body.vx-panels-hidden main.vx { grid-template-columns: 70px 1fr 0; }
body.vx-panels-hidden .vx-panels { display: none; }
/* a phone or a narrow window: one column of tools, and the panels under the drawing rather than beside it (beside it
   they left the drawing 30 px wide) */
@media (max-width: 720px) {
  main.vx, body.vx-panels-hidden main.vx { grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .vx-tools { grid-template-columns: 1fr; padding: 4px 3px; }
  .vx-panels { grid-column: 1 / -1; max-height: 26vh; border-left: 0; border-top: 1px solid var(--line); }
  .vx-top .brand { flex-wrap: wrap; row-gap: 2px; }
  .vx-top .spacer { display: none; }
  .vx-top { gap: 6px; padding-block: 6px; }
  .vx-top .vx-title { display: none; }
  .vx-top .btn { padding: 5px 8px; font-size: 13px; }
  .vx-menubar { flex-wrap: wrap; margin-left: 0; }
  .vx-menubar > .vx-m > button { padding: 6px 7px; }
}

/* tools */
.vx-tools { background: var(--panel); border-right: 1px solid var(--line); padding: 6px 5px; display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 2px; overflow-y: auto; }
.vx-tool { width: 28px; height: 28px; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--ink); display: grid; place-items: center; cursor: default; padding: 0; }
.vx-tool:hover { background: var(--panel-2); border-color: var(--line); }
.vx-tool.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.vx-tool svg { width: 18px; height: 18px; }
.vx-tools hr { grid-column: 1 / -1; width: 100%; border: 0; border-top: 1px solid var(--line); margin: 3px 0; }
.vx-fs { grid-column: 1 / -1; position: relative; height: 56px; margin: 4px 2px 0; }
.vx-fs .vx-sw { position: absolute; width: 30px; height: 30px; }
.vx-fs .f { left: 4px; top: 2px; z-index: 2; }
.vx-fs .s { left: 20px; top: 18px; z-index: 1; }
.vx-fs.stroke-front .s { z-index: 3; }
.vx-fs .s::after { inset: 7px; }
.vx-fs .swap, .vx-fs .def { position: absolute; border: 0; background: none; color: var(--muted); font-size: 11px; padding: 0; cursor: pointer; line-height: 1; }
.vx-fs .swap { right: 0; top: 0; } .vx-fs .def { left: 0; bottom: 0; }
.vx-fsmini { grid-column: 1 / -1; display: flex; justify-content: center; gap: 3px; margin-top: 2px; }
.vx-fsmini button { width: 18px; height: 18px; padding: 0; border: 1px solid var(--line-strong); border-radius: 2px; cursor: pointer; }

/* stage */
.vx-stage { position: relative; background: var(--stage); overflow: hidden; min-width: 0; }
.vx-corner { position: absolute; left: 0; top: 0; width: 16px; height: 16px; background: var(--panel-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); z-index: 2; }
.vx-ruler { position: absolute; z-index: 1; }
#vx-ruler-x { left: 16px; right: 0; top: 0; height: 16px; width: calc(100% - 16px); border-bottom: 1px solid var(--line); }
#vx-ruler-y { left: 0; top: 16px; bottom: 0; width: 16px; height: calc(100% - 16px); border-right: 1px solid var(--line); }
body.vx-no-rulers .vx-corner { display: none; }
body.vx-no-rulers #vx-canvas { left: 0; top: 0; width: 100%; height: 100%; }
#vx-canvas { position: absolute; left: 16px; top: 16px; width: calc(100% - 16px); height: calc(100% - 16px); touch-action: none; user-select: none; cursor: default; display: block; }
#vx-canvas[data-tool=pen], #vx-canvas[data-tool=pencil], #vx-canvas[data-tool=rect], #vx-canvas[data-tool=rrect], #vx-canvas[data-tool=ellipse], #vx-canvas[data-tool=polygon], #vx-canvas[data-tool=star], #vx-canvas[data-tool=line], #vx-canvas[data-tool=addAnchor], #vx-canvas[data-tool=delAnchor], #vx-canvas[data-tool=anchor], #vx-canvas[data-tool=rotate], #vx-canvas[data-tool=reflect], #vx-canvas[data-tool=scale], #vx-canvas[data-tool=shapebuilder] { cursor: crosshair; }
#vx-canvas[data-tool=type] { cursor: text; }
#vx-canvas[data-tool=hand] { cursor: grab; }
#vx-canvas[data-tool=zoom] { cursor: zoom-in; }
#vx-canvas[data-tool=eyedropper] { cursor: copy; }
body.vx-space #vx-canvas { cursor: grab !important; }
/* Outline view (Ctrl+Y): every path a thin black line, no fills */
#vx-canvas.vx-outline #vx-art * { fill: none !important; stroke: #000 !important; stroke-width: 0.5px !important; vector-effect: non-scaling-stroke; }
#vx-canvas.vx-outline #vx-art image { opacity: .35; }
#vx-art .vx-editing { opacity: .25; }
.vx-text-edit { position: fixed; z-index: 40; border: 1px dashed #3fa9ff; background: rgba(255,255,255,.96); color: #000; padding: 2px 4px; resize: none; line-height: 1.2; outline: none; overflow: hidden; white-space: pre; }

/* panels */
.vx-panels { background: var(--panel-2); border-left: 1px solid var(--line); overflow-y: auto; font-size: 12px; }
.vx-panel { background: var(--panel); border-bottom: 1px solid var(--line); }
.vx-panel > h3 { margin: 0; font-size: 12px; font-weight: 600; padding: 6px 10px; display: flex; align-items: center; gap: 6px; cursor: default; user-select: none; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.vx-panel > h3::before { content: '▾'; font-size: 10px; color: var(--muted); width: 10px; }
.vx-panel.closed > h3::before { content: '▸'; }
.vx-panel.closed > .vx-pb { display: none; }
.vx-panel > h3 .x { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.vx-pb { padding: 8px 10px; display: grid; gap: 8px; }
.vx-pb h4 { margin: 2px 0 0; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: none; }
.vx-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vx-row > label { display: inline-flex; align-items: center; gap: 4px; }
.vx-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vx-grid2 label { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 4px; }
.vx-grid2 input { width: 100%; box-sizing: border-box; }
.vx-ibtns { display: flex; gap: 3px; flex-wrap: wrap; }
.vx-ibtns button, .vx-ib { width: 28px; height: 26px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 4px; cursor: pointer; color: var(--ink); }
.vx-ibtns button:hover, .vx-ib:hover { background: var(--panel-2); }
.vx-ibtns button.on { background: var(--accent-weak); border-color: var(--accent); }
.vx-ibtns svg, .vx-ib svg { width: 18px; height: 18px; }
.vx-qa { display: flex; flex-wrap: wrap; gap: 4px; }
.vx-qa .btn { font-size: 12px; padding: 4px 8px; }
.vx-empty { color: var(--muted); }
.vx-refpt { display: grid; grid-template-columns: repeat(3, 8px); gap: 2px; padding: 2px; }
.vx-refpt button { width: 8px; height: 8px; padding: 0; border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; }
.vx-refpt button.on { background: var(--ink); }
.vx-range { display: grid; grid-template-columns: 74px 1fr 40px; align-items: center; gap: 6px; }
.vx-range input[type=range] { width: 100%; }
.vx-range output { text-align: right; font-variant-numeric: tabular-nums; }

/* layers */
.vx-layers { display: grid; border: 1px solid var(--line); border-radius: 4px; max-height: 320px; overflow-y: auto; }
.vx-lr { display: grid; grid-template-columns: 20px 20px 6px 1fr auto; align-items: center; gap: 4px; padding: 3px 6px; border-bottom: 1px solid var(--line); cursor: default; }
.vx-lr.obj { grid-template-columns: 20px 20px 6px 1fr auto; padding-left: 22px; color: var(--muted); }
.vx-lr.cur { background: var(--accent-weak); }
.vx-lr.sel .nm { font-weight: 600; color: var(--ink); }
.vx-lr button { border: 0; background: none; padding: 0; width: 18px; height: 18px; cursor: pointer; color: var(--muted); }
.vx-lr .vx-chip { display: block; width: 4px; height: 14px; border-radius: 1px; }
.vx-lr .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-lr .dot { display: block; width: 8px; height: 8px; border: 1px solid var(--line-strong); }
.vx-lr .dot.on { background: currentColor; }
.vx-lbar { display: flex; gap: 4px; justify-content: flex-end; }

/* status */
.vx-status { display: flex; gap: 14px; align-items: center; padding: 3px 10px; font-size: 12px; background: var(--panel); border-top: 1px solid var(--line); color: var(--muted); white-space: nowrap; overflow: hidden; }
.vx-status input { width: 54px; font: inherit; font-size: 12px; padding: 1px 4px; }
.vx-status .busy::before { content: ''; display: inline-block; width: 10px; height: 10px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; margin-right: 6px; vertical-align: -1px; animation: vxspin .8s linear infinite; }
@keyframes vxspin { to { transform: rotate(360deg); } }
#vx-toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 8px 14px; border-radius: 6px; font-size: 13px; max-width: min(720px, 90vw); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 70; }
#vx-toast.show { opacity: .95; }

/* dialogs */
.vx-dlg { border: 1px solid var(--line-strong); border-radius: 8px; padding: 0; box-shadow: var(--shadow); background: var(--panel); color: var(--ink); min-width: 340px; max-width: 560px; }
.vx-dlg::backdrop { background: rgba(0,0,0,.2); }
.vx-dlg form { padding: 14px 16px; display: grid; gap: 10px; font-size: 13px; }
.vx-dlg h2 { margin: 0; font-size: 15px; }
.vx-dlg .bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.vx-dlg .bar .left { margin-right: auto; }
.vx-dlg label.f { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 8px; }
.vx-dlg input[type=number], .vx-dlg input[type=text], .vx-dlg select { font: inherit; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); color: var(--ink); }
.vx-dlg .note { color: var(--muted); font-size: 12px; margin: 0; }
.vx-dlg table { border-collapse: collapse; font-size: 12px; width: 100%; }
.vx-dlg td { padding: 2px 6px; border-bottom: 1px solid var(--line); }
.vx-dlg td:last-child { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.vx-dlg .scroll { max-height: 60vh; overflow-y: auto; }

/* print: only the drawing, at its real size, on a page the size of the artboard */
#vx-print { display: none; }
@media print {
  body.vx-printing > *:not(#vx-print) { display: none !important; }
  body.vx-printing { display: block; height: auto; overflow: visible; background: #fff; }
  body.vx-printing #vx-print { display: block; margin: 0; padding: 0; }
  body.vx-printing #vx-print svg { display: block; }
}

/* font picker */
.vx-fontbtn { justify-content: space-between; width: 100%; font-size: 14px; text-align: left; }
.vx-fontpick { width: 340px; max-height: 470px; grid-template-rows: auto auto 1fr auto; padding: 8px; }
.vx-fsearch { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); color: var(--ink); }
.vx-fcats { display: flex; flex-wrap: wrap; gap: 3px; }
.vx-fcats button { font: inherit; font-size: 11px; padding: 2px 7px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.vx-fcats button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vx-frows { overflow-y: auto; min-height: 120px; max-height: 330px; border: 1px solid var(--line); border-radius: 4px; }
.vx-frow { display: grid; grid-template-columns: 1fr; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 5px 8px; text-align: left; cursor: pointer; gap: 1px; }
.vx-frow:hover, .vx-frow:focus-visible { background: var(--accent-weak); outline: none; }
.vx-frow.on { background: var(--accent-weak); box-shadow: inset 3px 0 var(--accent); }
.vx-frow .nm { font-size: 11px; color: var(--muted); }
.vx-frow .nt { font-size: 11px; color: var(--ok); }
.vx-fprev { height: 30px; width: 100%; display: block; }
