/* Copyright Ayers Electronics Inc. All rights reserved. */
/* The homepage's CAD window and the suite of panels under it. The window keeps CAD's own dark
   drawing colours whatever the page's theme; everything around it uses the site's roles. */
.cad,
.suite {
  margin: 72px 0;
}
.cad-heading {
  margin: 0 0 8px;
  font-family: var(--face-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.cad-intro {
  max-width: 62ch;
  margin: 0 0 24px;
  color: var(--ink-muted);
}
.cad-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.cad-window {
  --cad-chrome: #2b3038;
  --cad-chrome-2: #353b45;
  --cad-line: #4a525e;
  --cad-ink: #e4e7eb;
  --cad-ink-dim: #a3abb6;
  --cad-model: #212830;
  --cad-grid: #2c3540;
  --cad-accent: #4aa3df;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--cad-line);
  border-radius: 10px;
  background: var(--cad-chrome);
  color: var(--cad-ink);
  font: 13px/1.4 var(--face-text);
  box-shadow: 0 30px 70px rgb(0 0 0 / 35%);
}
.cad-titlebar {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 14px;
  background: #1d2127;
  color: var(--cad-ink-dim);
  font-size: 12px;
}
.cad-dots {
  display: flex;
  gap: 6px;
}
.cad-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cad-line);
}
.cad-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 10px 0;
  background: var(--cad-chrome);
  color: var(--cad-ink-dim);
  font-size: 12px;
}
.cad-tabs span {
  padding: 5px 12px;
  border-radius: 4px 4px 0 0;
}
.cad-tabs .cad-tab {
  background: var(--cad-chrome-2);
  color: var(--cad-ink);
  font-weight: 600;
}
.cad-ribbon {
  display: flex;
  overflow-x: auto;
  background: var(--cad-chrome-2);
  border-bottom: 1px solid var(--cad-line);
  scrollbar-width: thin;
}
.cad-panel {
  display: flex;
  flex: none;
  flex-direction: column;
  border-right: 1px solid var(--cad-line);
}
.cad-panel-body {
  display: flex;
  flex: 1;
  gap: 4px;
  align-items: flex-start;
  padding: 6px;
}
.cad-panel-title {
  padding: 2px 8px 4px;
  color: var(--cad-ink-dim);
  font-size: 11px;
  text-align: center;
}
.cad-rows {
  display: grid;
  gap: 2px;
}
.cad-row {
  display: flex;
  gap: 2px;
}
.cad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--cad-ink);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.cad-btn:hover,
.cad-btn:focus-visible {
  border-color: var(--cad-line);
  background: var(--cad-chrome);
}
.cad-btn:focus-visible {
  outline: 2px solid var(--cad-accent);
  outline-offset: 1px;
}
.cad-btn-active {
  border-color: var(--cad-accent);
  background: rgb(74 163 223 / 18%);
}
.cad-btn-large {
  flex-direction: column;
  gap: 4px;
  width: 72px;
  min-height: 68px;
  padding: 6px 4px;
  text-align: center;
}
.cad-btn-small {
  min-width: 24px;
  height: 24px;
  padding: 2px 4px;
  white-space: nowrap;
}

.cad-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 420px;
}
.cad-canvas {
  position: relative;
  margin: 0;
  background-color: var(--cad-model);
  background-image:
    linear-gradient(var(--cad-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cad-grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
.cad-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
}
.cad-sheet {
  fill: rgb(255 255 255 / 3%);
  stroke: #f2f2f2;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.cad-offset {
  fill: none;
  stroke: #8f9aa7;
  stroke-dasharray: 6 4;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.cad-part rect {
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.cad-part text {
  fill: var(--cad-ink);
  font-family: var(--face-text);
  text-anchor: middle;
  dominant-baseline: middle;
}
.cad-part .cad-dim-text {
  fill: var(--cad-ink-dim);
}
.cad-part-0 rect { fill: rgb(255 191 0 / 22%); stroke: #ffbf00; }
.cad-part-1 rect { fill: rgb(0 255 255 / 18%); stroke: #00d6d6; }
.cad-part-2 rect { fill: rgb(0 255 63 / 16%); stroke: #3fdc5f; }
.cad-part-3 rect { fill: rgb(255 0 255 / 16%); stroke: #e45ee4; }
.cad-part-4 rect { fill: rgb(255 127 0 / 18%); stroke: #ff8c1a; }
.cad-part-5 rect { fill: rgb(127 159 255 / 20%); stroke: #8fa8ff; }

.cad-palette {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border-left: 1px solid var(--cad-line);
  background: var(--cad-chrome);
}
.cad-palette h3 {
  margin: 0;
  color: var(--cad-ink-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.cad-palette fieldset {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.cad-palette legend {
  margin-bottom: 4px;
  font-weight: 600;
}
.cad-palette legend small {
  color: var(--cad-ink-dim);
  font-weight: 400;
}
.cad-palette label {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--cad-ink-dim);
}
.cad-palette input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--cad-line);
  border-radius: 3px;
  background: var(--cad-model);
  color: var(--cad-ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.cad-palette label input {
  width: 86px;
}
.cad-palette input:focus-visible {
  border-color: var(--cad-accent);
  outline: none;
}
.cad-palette input:invalid {
  border-color: #e0605a;
}
.cad-parts {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.cad-parts th {
  padding: 0 2px 4px;
  color: var(--cad-ink-dim);
  font-size: 11px;
  font-weight: 400;
  text-align: left;
}
.cad-parts th:first-child {
  width: 30%;
}
.cad-parts th:last-child {
  width: 24px;
}
.cad-parts td {
  padding: 2px;
}
.cad-parts input {
  padding: 3px 4px;
  font-size: 12px;
}
.cad-remove,
.cad-link {
  border: 0;
  background: none;
  color: var(--cad-ink-dim);
  font: inherit;
  cursor: pointer;
}
.cad-link {
  justify-self: start;
  padding: 2px 0;
  color: var(--cad-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.cad-remove:hover,
.cad-remove:focus-visible {
  color: var(--cad-ink);
}
.cad-yield {
  margin: 0;
  color: var(--cad-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cad-command {
  min-height: 9.2em;
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid var(--cad-line);
  background: #1d2127;
  color: var(--cad-ink-dim);
  font: 12px/1.5 var(--face-mono);
  list-style: none;
}
.cad-command li:last-child {
  color: var(--cad-ink);
}

.cad-selected rect,
.cad-sheet-group.cad-selected .cad-sheet {
  stroke-dasharray: 5 3;
  filter: drop-shadow(0 0 2px var(--cad-accent));
}
.cad-crossing {
  fill: rgb(63 220 95 / 10%);
  stroke: #3fdc5f;
  stroke-dasharray: 6 4;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.cad-left-out rect {
  fill: rgb(224 96 90 / 14%);
  stroke: #e0605a;
  stroke-dasharray: 4 3;
}

.cad-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 22px;
  height: 22px;
  margin: -2px 0 0 -3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.cad-cursor-visible {
  opacity: 1;
}
.cad-cursor svg {
  width: 100%;
  height: 100%;
  fill: #fff;
  stroke: #111;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 50%));
  transition: transform 0.12s;
  transform-origin: 20% 10%;
}
.cad-cursor-press svg {
  transform: scale(0.86);
}
.cad-click-ring {
  position: absolute;
  top: -14px;
  left: -14px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 2px solid var(--cad-accent);
  border-radius: 50%;
  pointer-events: none;
  animation: cad-ring 0.55s ease-out forwards;
}
@keyframes cad-ring {
  from { opacity: 0.9; scale: 0.4; }
  to { opacity: 0; scale: 1.4; }
}
.cad-controls button:disabled {
  opacity: 0.45;
  cursor: default;
}
.cad-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.cad-palette fieldset:disabled {
  opacity: 0.75;
}

.suite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 16px;
}
.suite-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-panel);
}
.suite-card h3 {
  margin: 0;
  font-size: 1.05rem;
}
.suite-card ul {
  margin: 0;
  padding-left: 1.1em;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .cad-click-ring {
    animation: none;
    opacity: 0;
  }
}

@media (max-width: 860px) {
  .cad-body {
    grid-template-columns: 1fr;
  }
  .cad-palette {
    border-top: 1px solid var(--cad-line);
    border-left: 0;
  }
  .cad-canvas svg {
    min-height: 260px;
  }
}
