/* packages/ui/sketcher.css — SHARED sketcher-canvas THEME CONTRACT (slice P1).
 *
 * Declares the --sk-* custom properties the #ui renderer will consume in P2 (routed via inline
 * style="...:var(--sk-…,#fallback)" — note: var() is invalid in raw SVG presentation attributes).
 * (Task 614: the canvas DEFAULTS below are the Fusion colours, the owner's look; a host that themes its own canvas overrides them.)
 * The DEFAULTS below were SketchStudio's colors, so linking this file changes NOTHING until P2
 * actually references the vars — P1 is byte-identical by construction.
 *
 * Each app retheme = override these in its OWN :root, loaded AFTER this file (Shaper sets a dark palette).
 * Framework-neutral plain custom properties (NO Tailwind). The JS-side glyph fallback stays in
 * #core/constants.js CONSTRAINT_COLORS (the brain never learns about CSS).
 */
:root {
  /* Canvas surface (SketchStudio: #svgCanvas bg / .snapping) */
  --sk-canvas-bg: #ffffff;
  --sk-canvas-bg-snapping: #F3F8FB;

  /* Grid (the SVG <pattern> strokes in index.html) */
  --sk-grid-minor: #CDD3DA;
  --sk-grid-major: #A9B2BD;

  /* Geometry (joints + lines) coloured by solve status */
  --sk-geo-fixed: #000000;          /* fully rigid / fixed — black */
  --sk-geo-constrained: #2563eb;    /* constrained — geometry blue */
  --sk-geo-free: #3b82f6;           /* free / under-constrained — light blue */
  --sk-geo-fully: #10b981;          /* fully constrained — green */
  --sk-construction: #A9744F;       /* construction geometry — brown */
  --sk-muted: #9ca3af;              /* faint guides / muted */

  /* Joints */
  --sk-joint-fill: #ffffff;
  --sk-joint-ring: #333333;         /* ring of a point drawn at rest — 80% black */
  --sk-joint-ring-hover: #000000;   /* ring of a hovered point — 100% black */
  --sk-joint-selected: #76A4E4;

  /* TASK 648: the drag-arrow handle (drag-arrow-handle.js): light grey fill, dark outline, darker on hover / drag */
  --sk-arrow-fill: #e5e7eb;
  --sk-arrow-fill-hover: #c3c7ce;
  --sk-arrow-fill-drag: #9ca3af;
  --sk-arrow-stroke: #374151;

  /* Constraint glyphs (mirror #core CONSTRAINT_COLORS) */
  --sk-constraint-fill: #2B9BD6;
  --sk-constraint-stroke: #1F2937;
  --sk-perpendicular-stroke: #0891b2;

  /* Dimensions */
  --sk-dimension: #2563eb;
  --sk-dimension-snap: #10b981;

  /* Selection / hover / origin */
  --sk-selection: #017AFD;
  --sk-hover: #017AFD;
  /* TASK 642: the green check-mark Done button (done-button.js) */
  --sk-done: #00D100;
  /* TASK 588: a constraint's GLYPH and the geometry it binds, lit when the glyph is hovered / selected (blue stays the geometry's own hover /
     selection). Warm yellow (owner), apart from the blues in hue and lightness and from construction orange (#f97316) in hue; the selected one
     deeper (stronger) than the hovered one. */
  --sk-glyph-hover: #eab308;
  --sk-glyph-selected: #ca8a04;
  --sk-origin: #3B82F6;

  /* Feedback */
  --sk-error: #ef4444;
  /* TASK 646: a warning on the canvas: the part of a line a fillet would EXTEND past its far end (fillet-tool.js preview) */
  --sk-warning: #f59e0b;
}

/* TASK 661: an inactive sketch's drawing (svg-renderer.js groups each run of its markup) is dimmed as ONE group, so overlapping strokes do not double-darken. */
.sketch-inactive { opacity: var(--sk-inactive-sketch-opacity); } /* the token is written on the render target by draw() from the INACTIVE_SKETCH_OPACITY setting (Style panel), its one source */

/* TASK 619 -- Shared header tokens and height: 44 px desktop, 0 px on phones (no header bar; stage tabs + actions move into the drawer). */
:root {
  --sk-header-h: 44px;
  --sk-header-bg: #ffffff;
  --sk-header-fg: #334155;
  --sk-header-sep: #cbd5e1;
  --sk-header-hover: rgba(0, 0, 0, 0.05);
}
@media (max-width: 640px) {
  :root { --sk-header-h: 0px; }
}

/* TASK 602 -- the SHORT viewport (a phone in LANDSCAPE): the query is SHORT_VIEWPORT_QUERY in #ui/short-viewport.js (a static stylesheet cannot import
 * it; tests/short-viewport-node.test.js checks this copy is identical). The canvas needs the height: no header bar; the tool ribbon's rail is in
 * #ui/tool-ribbon.js. */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  :root { --sk-header-h: 0px; }
}

/* TASK 648: the shared drag arrow (drag-arrow-handle.js) */
.sk-drag-arrow { fill: var(--sk-arrow-fill); stroke: var(--sk-arrow-stroke); stroke-linejoin: round; }
.sk-drag-arrow[data-state="hover"] { fill: var(--sk-arrow-fill-hover); }
.sk-drag-arrow[data-state="drag"] { fill: var(--sk-arrow-fill-drag); }
