:root {
  --line: #d4d4d4;
  --ink: #111;
  --muted: #666;
  --accent: #c2410c;
  --accent-soft: #fde7da;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100dvh;
  background: #fff;
  color: var(--ink);
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}

aside {
  padding: 1.5rem;
  border-right: 1px solid var(--line);
}

h1,
h2 {
  font-family: var(--mono);
}

aside h1 {
  font-size: 1.25rem;
}

aside h1 a {
  color: inherit;
  text-decoration: none;
}

.home .viewer,
.home #parts {
  display: none;
}

.home a {
  color: inherit;
}

.home th {
  border-top: none;
  border-bottom: 1px solid var(--line);
}

.home td:last-child,
.home th:last-child {
  padding-left: 2rem;
}

.muted {
  color: var(--muted);
}

nav h2 {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
}

nav a {
  display: block;
  margin-top: 0.25rem;
  padding: 0.4rem 0;
  color: inherit;
}

nav a.active {
  font-weight: 600;
}

nav small {
  display: block;
  font-family: var(--mono);
  color: var(--muted);
}

main {
  padding: 1.5rem;
  max-width: 960px;
}

main h1 {
  font-size: 1.4rem;
}

#entry-head small {
  font-family: var(--mono);
  color: var(--muted);
}

.viewer {
  position: relative;
  margin-top: 1rem;
  border: 1px solid var(--line);
}

#canvas {
  height: 480px;
  cursor: grab;
}

.controls {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: grid;
  gap: 0.25rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.controls label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.part-info {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  min-height: 5.5rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.chips button {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.chips button.replaced {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chips button.selected {
  outline: 2px solid var(--ink);
}

.badge {
  margin-left: 0.5rem;
  padding: 0.1rem 0.4rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
}

article h2 {
  margin-top: 2rem;
  font-size: 1rem;
  text-transform: uppercase;
}

article ul {
  padding-left: 1.25rem;
}

article li {
  margin-top: 0.5rem;
}

table {
  margin-top: 0.5rem;
  border-collapse: collapse;
}

td,
th {
  padding: 0.25rem 2rem 0.25rem 0;
  text-align: left;
}

td:last-child,
th:last-child {
  font-family: var(--mono);
  text-align: right;
  padding-right: 0;
}

th {
  border-top: 1px solid var(--line);
}


@media (max-width: 800px) {
  body {
    grid-template-columns: 1fr;
  }
  aside {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  #canvas {
    height: 360px;
  }
}
