/* Fields and buttons. */

label,
legend {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
select {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  padding: 9px 12px;
  font: inherit;
  /* iPhones zoom into a field whose text is smaller than 16px. */
  font-size: 16px;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
}

input::placeholder {
  color: var(--placeholder);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid var(--focus);
}

/* Browsers draw a select shorter than a text field. This makes the two line up side by side. */
select {
  height: 44px;
}

select:disabled {
  color: var(--muted);
  background: var(--page);
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

fieldset {
  /* A fieldset is as wide as its content by default, which lets long content push the page wider. */
  min-width: 0;
  margin: 4px 0 20px;
  padding: 0;
  border: 0;
}

legend + .hint {
  margin: 0 0 12px;
}

/* The field above has a bottom margin for the next field. A hint belongs to its field, so it moves up. */
input + .hint {
  margin-top: -8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 1rem;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.check + .hint {
  margin: 4px 0 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.actions .message {
  margin: 0;
}

button {
  padding: 9px 20px;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--button-ink);
  background: var(--button);
  border: 1px solid var(--button);
  border-radius: var(--radius-button);
  cursor: pointer;
}

button:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button.wide {
  width: 100%;
  margin-top: 4px;
}

button.plain {
  color: var(--ink);
  background: var(--card);
  border-color: var(--line-strong);
}

button.plain:hover {
  background: var(--page);
}

button.quiet {
  padding: 6px 8px;
  color: var(--muted);
  background: none;
  border-color: transparent;
}

button.quiet:hover {
  color: var(--ink);
}

button.danger {
  color: var(--danger);
  background: var(--card);
  border-color: var(--danger-line);
}

button.danger:hover {
  background: var(--danger-tint);
}

@media (max-width: 600px) {
  .fields {
    grid-template-columns: 1fr;
  }
}
