/* The pictures. Their colours are written out rather than variables, as
   saving a picture as png copies these rules into it without the app's. */
.measurement-app svg {
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: white;
}

/* Handles and buttons: pale fills and thin outlines, so the profile itself
   stays the strongest thing in the picture. */
.measurement-app svg circle {
  fill: #e3f3e8;
  stroke: #2f7d4f;
  stroke-width: .75;
}

.measurement-app svg circle.invalid {
  fill: #fde4e2;
  stroke: #c0392b;
}

.measurement-app svg .remove circle {
  fill: #fde4e2;
  stroke: #c0392b;
}

.measurement-app svg .add circle {
  fill: #e3f3e8;
}

.measurement-app svg .finish circle {
  fill: #f3f3f3;
  stroke: #666;
}

.measurement-app svg .button {
  stroke-width: .5;
  cursor: pointer;
}

.measurement-app svg path {
  fill: none;
}

/* The profile: rounded joins and ends, like a bent sheet. */
.measurement-app svg path.width-line {
  stroke: #2b2b2b;
  stroke-width: 3.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Wider than the material when unfolded. */
.measurement-app svg path.width-line.invalid {
  stroke: #c0392b;
}

.measurement-app svg text {
  font-size: .4rem;
  fill: #2b2b2b;
}

/* The drawing scales down with the screen, so on phones its texts would
   be only a few pixels high. */
@media (max-width: 30rem) {
  .measurement-app svg text {
    font-size: .6rem;
  }
}

/* The angle guides and ruler: in the background, but readable, and never
   in the way of a part's handle under them. */
.measurement-app svg .reference-text,
.measurement-app svg path.reference-line,
.measurement-app svg .axis {
  pointer-events: none;
}

.measurement-app svg .reference-text {
  fill: #5f8fb3;
}

.measurement-app svg path.reference-line {
  fill: none;
  stroke: #8fb8d6;
  stroke-dasharray: 3;
  opacity: .55;
}

.measurement-app svg .axis {
  color: #8fb8d6;
  opacity: .55;
}
.measurement-app svg .domain {
  display: none
}

/* The app around the pictures: in the embedding site's look (its theme:
   Roboto, grey text, #dadada borders, 2px corners, blue for focus), and
   in its font and size, inherited. */
.measurement-app {
  --text: #5a5a5a;
  --strong: #3f3f3f;
  --muted: #8a8a8a;
  --border: #dadada;
  --surface: #fefefe;
  --accent: #007ca8;
  --danger: #c0392b;
  --danger-tint: #fde4e2;
  --radius: 2px;
  --control-height: 38px;

  color: var(--text);
}

/* The cards: the instructions, each picture and adding one look alike. */
.measurement-app .instructions,
.measurement-app .picture,
.measurement-app fieldset.add-picture {
  margin: 0 0 1rem;
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
}

/* A picture's card: the drawing on top, edge to edge, its form below. */
.measurement-app .picture {
  padding: 0;
  overflow: hidden;
}

.measurement-app .picture svg {
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--border);
}

/* A picture's form: label above each field, side by side while they fit. */
.measurement-app .picture fieldset {
  display: grid;
  /* 11rem: wide enough for the longest label on one line; on phones, so
     only one field fits a row and they all line up. */
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .75rem 1rem;
  align-items: end;
  margin: 0;
  padding: .75rem 1rem 1rem;
  border: none;
}

/* The price and the buttons: a row of their own under the fields. */
.measurement-app .picture .picture-footer {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.measurement-app .FormItem {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.measurement-app .FormItem:empty {
  display: none;
}

/* The site's labels have room above them, and a star when required:
   not ours, which sit close to their fields */
.measurement-app label {
  margin: 0;
}

.measurement-app label::after {
  content: none;
}

.measurement-app label span {
  font-weight: 700;
  color: var(--strong);
}

/* Fields and buttons: one height, so that labels and fields line up. */
/* Fields as the site's: a slight inset, pale, thin border */
.measurement-app input,
.measurement-app select,
.measurement-app button {
  box-sizing: border-box;
  height: var(--control-height);
  margin: 0;
  padding: 6px 12px;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
  box-shadow: inset 0 1px 1px rgb(0 0 0 / .1);
}

.measurement-app input:hover,
.measurement-app select:hover {
  border-color: #b8b8b8;
}

/* Buttons as the site's: light grey, raised a little */
.measurement-app button,
.measurement-app input[type=button] {
  padding: 6px 12px;
  border-color: #cfcfcf;
  background-color: #f5f5f5;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), 0 1px 2px rgb(0 0 0 / .1);
  cursor: pointer;
}

.measurement-app button:hover,
.measurement-app input[type=button]:hover {
  background-color: #fbfbfb;
}

.measurement-app .picture-actions {
  display: flex;
  gap: .5rem;
}

/* Removing is red, as the drawing's remove buttons. */
.measurement-app button.remove-picture {
  color: var(--danger);
  border-color: #e3a49c;
}

.measurement-app button.remove-picture:hover {
  background-color: var(--danger-tint);
}

.measurement-app input:focus-visible,
.measurement-app select:focus-visible,
.measurement-app button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.measurement-app input[type=number].invalid {
  border-color: var(--danger);
  background-color: var(--danger-tint);
}

/* The price, or why there's none: red as in the picture. */
.measurement-app .price {
  margin: 0;
  font-size: 1.25em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.measurement-app .price.invalid {
  font-size: 1em;
  font-weight: 600;
  color: var(--danger);
}

.measurement-app fieldset.add-picture .FormItem {
  max-width: 20rem;
}

.measurement-app input[type=submit][disabled] {
  cursor: not-allowed;
}

/* The guide above the pictures. */
.measurement-app .instructions {
  padding-block: .625rem;
}

.measurement-app .instructions summary {
  font-weight: 600;
  cursor: pointer;
}

.measurement-app .instructions .steps {
  padding-left: 1.5rem;
}

.measurement-app .instructions .steps li + li {
  margin-top: .25rem;
}

.measurement-app .instructions .legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: .4rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.measurement-app .instructions .legend li {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* The symbols: small, without the pictures' frame, and not clickable. */
.measurement-app .instructions .legend svg {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  background: none;
}

.measurement-app .instructions .legend .button {
  cursor: default;
}

.measurement-app .instructions .legend text {
  font-size: 6px;
}

.measurement-app .instructions .hint {
  color: var(--muted);
  font-size: .9em;
}

/* The site's own contact form after the tool (#ContactForm, which app.js
   adds the order to) keeps the site's look; only its send button shows
   that it waits until every picture is ready. */
#ContactFormSubmit:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Which parts were joined into one straight part, for a few seconds */
.measurement-app .join-notice {
  margin: 0;
  font-size: .9em;
  color: #2f6b3a;
}
