/* LeonSim CAD on the Pro shell (../pro.css): title bar, the command ribbon, the model tree over the properties on the
   left, the ray-marched view with its heads-up toolbar, view cube, triad and scale, and the status bar with the tool's
   hints.  On phones the view comes first and the tree and properties stack below it. */
:root {
  /* read by cad.js (themeColors): the view's background, workplane, selection and hole ghosts */
  --bg-top: #3a4350; --bg-bot: #121519; --plate: #1b2129; --plate-line: #5f6c7a; --ghost: #7cc8e0; --sel: #4ea1ff;
}

.cad {
  height: 100%; display: grid;
  grid-template-columns: minmax(250px, 18rem) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "tb tb" "rb rb" "left view" "sb sb";
}
.cad > .tb { grid-area: tb; }
.cad > .rb { grid-area: rb; }
.cad > .sbar { grid-area: sb; }
.dock.left { grid-area: left; border-right: 1px solid var(--line); }
.tree-body { flex: 0 0 auto; max-height: 40%; }
.props-body { flex: 1 1 0; min-height: 0; }

.rstack .s input[type="number"] { width: 4.6rem; }
#shapes .cmd { min-width: 48px; }
.rstack label.s input[type="checkbox"] { margin-right: 2px; }

/* the model tree */
.ptree ul { padding-left: 14px; }
.ptree .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; border: 1px solid rgb(0 0 0 / 0.3); }
.ptree .sw.hole { background: repeating-linear-gradient(45deg, var(--ghost) 0 1.5px, transparent 1.5px 3.5px) !important; border-color: var(--ghost); }
.ptree .node.ghost { color: var(--muted); }

/* properties */
#props { padding-bottom: 10px; }
#props .swatches { display: flex; flex-wrap: wrap; gap: 4px; }
#props .swatches button { width: 18px; height: 18px; border-radius: 3px; border: 1px solid rgb(0 0 0 / 0.35); cursor: pointer; padding: 0; }
#props .swatches button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
#props .tool-help { margin: 10px; padding: 9px 11px; border-radius: 5px; background: var(--well); border: 1px solid var(--line); color: var(--ink-2); font-size: 11.5px; line-height: 1.5; }
#props .tool-help b { color: var(--ink); }
#props .acts { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px 0; }
#props .corners { display: grid; gap: 3px; }
#props .corner { display: grid; grid-template-columns: 1.2rem 5.2rem minmax(0, 1fr) auto auto; gap: 4px; align-items: center; }
#props .corner .hint { font-family: var(--mono); font-size: 10.5px; }
#props .corner input { width: 100%; }
#props .mini { min-height: 22px; padding: 0 7px; font-size: 11px; }

/* the view */
.view { grid-area: view; position: relative; min-height: 0; overflow: hidden; background: linear-gradient(180deg, var(--vp-top), var(--vp-bot)); touch-action: none; }
#gl, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { pointer-events: none; }
.view[data-cursor="move"] #gl { cursor: move; }
.view[data-cursor="pointer"] #gl { cursor: pointer; }
.view[data-cursor="grab"] #gl { cursor: grabbing; }
.view[data-cursor="cross"] #gl { cursor: crosshair; }
.veil { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(18, 20, 23, 0.9); padding: 24px; text-align: center; color: var(--ink-2); }

#stats { color: var(--muted); }

@media (max-width: 900px) {
  .cad { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 62vh auto auto; grid-template-areas: "tb" "rb" "view" "left" "sb"; height: auto; min-height: 100%; }
  .dock.left { border-right: 0; border-top: 1px solid var(--line); }
  .tree-body { max-height: none; }
  .tb { flex-wrap: wrap; height: auto; padding: 6px 10px; row-gap: 6px; }
  .tb .apps { order: 5; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tb .doc input { width: 8rem; }
  .tb .doc small, .tb > .sep { display: none; }
  .job { order: 6; width: 100%; max-width: none; }
  .vp-title { display: none; }
  .vp-hud { top: auto; bottom: 8px; max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
  .vtriad, .vruler { display: none; }
  .sbar { flex-wrap: wrap; height: auto; }
  .sbar > .grow, #stats { display: none; }
}
