/* Workshop tool for digitizing parts. Layout-fluid blue, machined aluminium, paper. Amber means "look here". */
:root {
  --blue: #16357e;
  --blue-deep: #0e2358;
  --blue-wash: #e2e8f5;
  --steel: #e8ebed;
  --steel-mid: #c4cbd0;
  --steel-dark: #5d6971;
  --ink: #18222b;
  --paper: #ffffff;
  --amber: #a85f00;
  --amber-bright: #ffb000;
  --amber-wash: #fdf1dc;
  --red: #a4231b;
  --red-wash: #fbe9e7;
  --line: #19e68c;
  --type: Bahnschrift, "DIN Alternate", "DIN Next", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --step-1: 0.875rem;
  --step0: 1rem;
  --step1: 1.25rem;
  --step2: 1.75rem;
  --step3: 2.75rem;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font-family: var(--type);
  font-size: var(--step0);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.15; }
h1 { font-size: var(--step3); letter-spacing: -0.01em; }
h2 { font-size: var(--step2); }
h3 { font-size: var(--step1); }
p { margin: 0 0 0.75rem; max-width: 68ch; }
a { color: var(--blue); }
small, .quiet { color: var(--steel-dark); font-size: var(--step-1); }
:focus-visible { outline: 3px solid var(--amber-bright); outline-offset: 2px; }

/* top bar */
.bar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.65rem 1.5rem;
  background: var(--blue); color: var(--paper);
}
.bar a { color: var(--paper); text-decoration: none; }
.bar a:hover { text-decoration: underline; }
.brand { font-size: var(--step1); font-weight: 600; margin-right: auto; }
.page { max-width: 1240px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* controls */
button, .button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  padding: 0.55rem 1.1rem; border: 2px solid var(--blue); border-radius: 3px;
  background: var(--blue); color: var(--paper);
}
button:hover, .button:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
button.quiet-button, .button.quiet-button { background: transparent; color: var(--blue); font-weight: 500; padding: 0.3rem 0.7rem; }
button.quiet-button:hover, .button.quiet-button:hover { background: var(--blue-wash); }
button.danger { background: transparent; border-color: var(--red); color: var(--red); font-weight: 500; padding: 0.3rem 0.7rem; }
button.danger:hover { background: var(--red-wash); }
button[disabled] { opacity: 0.5; cursor: not-allowed; }
button.active { background: var(--amber-bright); border-color: var(--amber-bright); color: var(--ink); }
label { display: block; font-weight: 500; margin-bottom: 0.8rem; }
label small { display: block; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  display: block; width: 100%; margin-top: 0.2rem; padding: 0.5rem 0.6rem;
  font: inherit; color: inherit; background: var(--paper);
  border: 1px solid var(--steel-dark); border-radius: 3px;
}
input.needed { border: 2px solid var(--amber); background: var(--amber-wash); }
details { margin-bottom: 0.8rem; }
summary { cursor: pointer; font-weight: 500; color: var(--blue); }
details[open] summary { margin-bottom: 0.7rem; }

/* messages */
.note { padding: 0.7rem 0.9rem; border-left: 4px solid var(--steel-dark); background: var(--paper); margin-bottom: 1rem; }
.note.error { border-color: var(--red); background: var(--red-wash); }
.note.warn { border-color: var(--amber); background: var(--amber-wash); }
.note p:last-child { margin-bottom: 0; }

/* sign-in pages */
.door { max-width: 26rem; margin: 3rem auto; padding: 0 1.5rem; }
.door h1 { font-size: var(--step2); margin-bottom: 1.2rem; }

/* home: the drop zone is the marker sheet */
.bench { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 2.5rem; align-items: start; }
.sheet {
  position: relative; display: block; width: 100%; aspect-ratio: 215.9 / 279.4;
  background: var(--paper) url("/api/marker-ring.svg") center / 100% 100% no-repeat;
  box-shadow: 0 1px 0 var(--steel-mid), 0 10px 24px rgba(20, 32, 43, 0.22);
  cursor: pointer; transition: transform 120ms ease-out;
}
.sheet:hover .sheet-words { color: var(--blue); }
.sheet.over { transform: scale(1.015); outline: 4px solid var(--blue); }
.sheet input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sheet:focus-within { outline: 3px solid var(--amber-bright); outline-offset: 3px; }
.sheet-words {
  position: absolute; left: 13%; right: 13%; top: 16%; bottom: 13%;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; pointer-events: none;
}
.sheet-words strong { font-size: var(--step2); line-height: 1.1; font-weight: 600; margin-bottom: 0.5rem; }
.tray { margin-bottom: 1.25rem; }
.part-group { background: var(--paper); padding: 0.8rem; margin-bottom: 0.8rem; border-top: 3px solid var(--blue); }
.part-group header { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.6rem; }
.part-group header input { margin: 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.thumb { width: 118px; font-size: var(--step-1); }
.thumb img { display: block; width: 118px; height: 118px; object-fit: cover; background: var(--steel); }
.thumb .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0.2rem 0; }
.thumb select { padding: 0.15rem 0.25rem; font-size: var(--step-1); }
.send { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.progress { height: 6px; background: var(--steel-mid); margin-top: 0.6rem; }
.progress div { height: 100%; width: 0; background: var(--blue); transition: width 120ms linear; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.jobs { margin-top: 2.5rem; }
.jobs h2 { margin-bottom: 0.8rem; }
.job-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center;
  padding: 0.65rem 0.9rem; background: var(--paper); margin-bottom: 2px; text-decoration: none; color: inherit;
}
a.job-row:hover { background: var(--blue-wash); }
.job-row .job-name { font-weight: 500; overflow-wrap: anywhere; }
.status { font-size: var(--step-1); font-weight: 500; padding: 0.1rem 0.5rem; border-radius: 2px; background: var(--steel); white-space: nowrap; }
.status-review { background: var(--amber-wash); color: var(--amber); }
.status-done { background: var(--blue); color: var(--paper); }
.status-failed { background: var(--red-wash); color: var(--red); }
.guide li { margin-bottom: 0.3rem; max-width: 60ch; }
.guide ol { padding-left: 1.3rem; margin: 0.4rem 0 0.8rem; }

/* review screen */
.review { display: grid; grid-template-columns: minmax(0, 1fr) 370px; height: calc(100vh - 50px); }
.stage { position: relative; background: var(--blue-deep); min-height: 62vh; display: flex; flex-direction: column; overflow: hidden; }
.stage-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.5rem 0.7rem; background: var(--blue); color: var(--paper); }
.stage-tools button { background: transparent; border-color: rgba(255,255,255,0.65); color: var(--paper); padding: 0.25rem 0.65rem; font-weight: 500; }
.stage-tools button:hover { background: rgba(255,255,255,0.14); border-color: var(--paper); }
.stage-tools button.active { background: var(--amber-bright); border-color: var(--amber-bright); color: var(--ink); }
.stage-tools .spacer { margin-left: auto; }
.viewport { flex: 1; position: relative; min-height: 0; }
.viewport > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.viewport > svg.dragging { cursor: grabbing; }
.viewport > svg.picking { cursor: crosshair; }
.prompt { position: absolute; top: 0.7rem; left: 50%; transform: translateX(-50%); background: var(--amber-bright); color: var(--ink); padding: 0.3rem 0.8rem; font-weight: 500; border-radius: 2px; max-width: 90%; text-align: center; pointer-events: none; }
.rule-scale { position: absolute; left: 0.8rem; bottom: 0.8rem; pointer-events: none; color: var(--ink); background: linear-gradient(#f2f4f5, #cfd5d9); padding: 0.1rem 0.4rem 0.2rem; border-radius: 1px; box-shadow: 0 1px 3px rgba(0,0,0,0.5); font-size: var(--step-1); }
.rule-ticks { display: block; }
.page-gap { height: 1rem; }
.panel { background: var(--steel); padding: 1.1rem 1.2rem 2.5rem; overflow-y: auto; }
.panel h1 { font-size: var(--step2); overflow-wrap: anywhere; margin-bottom: 0.3rem; }
.panel section { padding: 1rem 0; border-top: 1px solid var(--steel-mid); }
.panel section:first-of-type { border-top: 0; }
.panel h3 { margin-bottom: 0.6rem; }
.size-table { width: 100%; border-collapse: collapse; margin-bottom: 0.6rem; }
.size-table th { text-align: left; font-weight: 500; font-size: var(--step-1); color: var(--steel-dark); padding: 0 0.35rem 0.2rem 0; }
.size-table td { padding: 0.2rem 0.35rem 0.2rem 0; vertical-align: middle; }
.size-table td:first-child { white-space: nowrap; }
.size-table input { margin: 0; padding: 0.25rem 0.35rem; }
.flag { display: block; width: 100%; text-align: left; font-weight: 400; background: var(--amber-wash); border: 0; border-left: 4px solid var(--amber); color: var(--ink); padding: 0.45rem 0.6rem; margin-bottom: 0.35rem; border-radius: 0; font-size: var(--step-1); }
.flag:hover { background: #f9e4bb; border-color: var(--amber); }
.flag.plain { cursor: default; }
.flag.info { background: var(--paper); border-left-color: var(--steel-dark); }
.flag.error { background: var(--red-wash); border-left-color: var(--red); }
.unit-switch { display: inline-flex; margin-bottom: 0.8rem; }
.unit-switch button { padding: 0.15rem 0.7rem; border-radius: 0; font-weight: 500; background: transparent; color: var(--blue); }
.unit-switch button.on { background: var(--blue); color: var(--paper); }
.edit-row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; background: var(--paper); padding: 0.3rem 0.5rem; margin-bottom: 2px; font-size: var(--step-1); }
.edit-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.5rem; }
.line-key { display: flex; gap: 0.9rem; font-size: var(--step-1); }
.line-key span { border-bottom: 3px solid; padding-bottom: 1px; }
.key-line { border-color: #0fa864; }
.key-arc { border-color: #3d84d6; }
.key-curve { border-color: #d9b800; }
.results { background: var(--paper); margin: 0 -1.2rem; padding: 1rem 1.2rem; border-top: 3px solid var(--blue); }
.results h3 { margin-bottom: 0.4rem; }
.downloads { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
.page.narrow { max-width: 720px; }
.page.narrow section { margin-top: 1.8rem; }
.drawing { display: block; width: 100%; max-width: 420px; height: auto; margin: 0.6rem 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.8rem; margin: 0.6rem 0 0; font-size: var(--step-1); }
.facts dt { color: var(--steel-dark); }
.facts dd { margin: 0; }
.model-view { position: absolute; inset: 0; background: linear-gradient(#20345f, #0e2358); display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.waiting { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; color: var(--paper); text-align: center; padding: 2rem; }
.waiting strong { font-size: var(--step2); font-weight: 600; }
.spinner-line { width: 180px; height: 3px; margin-top: 1rem; background: rgba(255,255,255,0.25); overflow: hidden; position: relative; }
.spinner-line::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--paper); animation: slide 1.1s ease-in-out infinite alternate; }
@keyframes slide { to { transform: translateX(150%); } }
.toast { position: fixed; right: 1rem; bottom: 1rem; background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem; border-radius: 2px; z-index: 5; }
.copy-line { word-break: break-all; background: var(--paper); padding: 0.5rem; font-size: var(--step-1); border: 1px solid var(--steel-mid); margin: 0.5rem 0; }
.users td, .users th { padding: 0.4rem 0.6rem 0.4rem 0; text-align: left; }
.users { border-collapse: collapse; width: 100%; background: var(--paper); margin: 0.8rem 0 1.5rem; }
.users td:first-child, .users th:first-child { padding-left: 0.6rem; }
.users tr + tr { border-top: 1px solid var(--steel); }
.users td { overflow-wrap: anywhere; }
.users button { margin-right: 0.3rem; }

@media (max-width: 900px) {
  .bench { grid-template-columns: 1fr; }
  .sheet { max-width: 340px; margin: 0 auto; }
  .review { grid-template-columns: 1fr; height: auto; }
  .stage { height: 62vh; }
  .panel { overflow: visible; }
  .panel { padding-bottom: 3rem; }
  h1 { font-size: var(--step2); }
  .page { padding: 1.25rem 1rem 3rem; }
  .bar { padding: 0.6rem 1rem; gap: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.site-foot { padding: 1.5rem 1rem; text-align: center; font-size: var(--step-1); }
.site-foot a { color: var(--steel-dark); }

.part-type { border: 0; padding: 0; margin: 0 0 1rem; }
.part-type legend { font-weight: 500; padding: 0; margin-bottom: 0.4rem; }
.part-type label { display: flex; gap: 0.5rem; align-items: baseline; margin-bottom: 0.4rem; font-weight: 400; }
.part-type input { width: auto; flex: none; margin: 0; }

.experimental { border-left: 3px solid var(--amber-bright); padding-left: 0.75rem; }
.experimental-badge { background: var(--amber-wash); color: var(--amber); font-size: var(--step-1); padding: 0.1rem 0.4rem; border-radius: 3px; }
.regen-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.regen-row span { flex: 1; }
.regen-ask { display: flex; gap: 0.5rem; margin-bottom: 0.25rem; }
.regen-ask input { flex: 1; }
