/* The free tools (tool-*.html): the calculator's form and its answer, on the
   guides' layout (site.css). */

.cc-form {
  margin: 1.5rem 0;
  display: grid;
  gap: 1rem;
}

.cc-form fieldset {
  margin: 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.cc-form legend {
  padding: 0 0.35rem;
  font-weight: 600;
}

.cc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem;
}

.cc-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.cc-form input,
.cc-form select {
  width: 100%;
  font-size: 1rem; /* 16px or more keeps iPhones from zooming in on focus */
}

.cc-hint,
.cc-optional {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.cc-form > fieldset > p.cc-hint {
  margin: 0 0 0.75rem;
}

.cc-bills {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0 !important;
  display: grid;
  gap: 0.75rem;
}

.cc-bill {
  margin: 0 !important;
  display: grid;
  grid-template-columns: 2fr 1.4fr 1.2fr auto;
  gap: 0.6rem;
  align-items: end;
}

@media (max-width: 560px) {
  .cc-bill {
    grid-template-columns: 1fr 1fr;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
  }

  .cc-bill label:first-child {
    grid-column: 1 / -1;
  }
}

.cc-form button.cc-remove {
  padding: 0.5rem 0.75rem;
}

.cc-form > .btn {
  justify-self: start;
}

.cc-error {
  margin: 0;
  color: var(--color-danger);
}

.cc-error[hidden],
.cc-result[hidden] {
  display: none;
}

.cc-result {
  margin: 1.5rem 0 2rem;
  scroll-margin-top: 1rem;
}

.cc-answer {
  padding: 1rem 1.15rem;
  border-left: 4px solid var(--color-success);
  border-radius: var(--radius-sm);
  background: var(--color-success-soft);
}

.cc-answer.is-short {
  border-left-color: var(--color-warning);
  background: var(--color-warning-soft);
}

.cc-answer p {
  margin: 0 0 0.5rem;
}

.cc-answer p:last-child {
  margin-bottom: 0;
}

.cc-result h3 {
  margin-top: 1.25rem;
}

.cc-table .cc-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cc-table thead th:nth-child(n + 3) {
  text-align: right;
}

.cc-table tr.is-payment td {
  font-weight: 600;
}

.cc-table tr.is-low td:last-child {
  color: var(--color-danger);
}
