/**
 * Form API styling carried over from Drupal 7 core, limited to node forms.
 *
 * Drupal 7 styled forms from modules/system/system.theme.css and
 * system.base.css, which every theme inherited. Drupal 11 core moved that
 * styling into Claro and Olivero, so a front-end theme built on stable9, like
 * this one, gets none of it: the required asterisks disappeared, textareas fell
 * back to their narrow default width, and the "Edit summary" toggle became a
 * bordered button. The rules are copied from those two D7 files, scoped to
 * .node-form so the exposed filters and the search forms, which this theme
 * styles itself, keep their look.
 */

/* system.theme.css: markup generated by Form API. */
.node-form .form-item,
.node-form .form-actions {
  margin-top: 1em;
  margin-bottom: 1em;
}
.node-form .form-item .description {
  font-size: 0.85em;
}
.node-form label,
.node-form legend {
  display: block;
  font-weight: bold;
}
.node-form label.option {
  display: inline;
  font-weight: normal;
}
.node-form .form-type-checkbox .description,
.node-form .form-type-radio .description {
  margin-left: 2.4em;
}
.node-form input.form-checkbox,
.node-form input.form-radio {
  vertical-align: middle;
}

/*
 * D7 printed <span class="form-required">*</span> inside the label. D11 puts
 * the class on the label (or on the fieldset legend / h4 of a multi-part
 * widget such as Date) and leaves the asterisk to the theme.
 */
.node-form legend.form-required::after,
.node-form h4.form-required::after {
  content: " *";
  color: #f00;
}
/*
 * Only the asterisk is red; the label text keeps its colour. The class sits on
 * the label here, so colouring .form-required itself would redden the text.
 * D7 printed "Summary * (Edit summary)", so the label is a flex row that puts
 * the asterisk ahead of the "(Edit summary)" toggle.
 */
.node-form label.form-required {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}
.node-form label.form-required::after {
  content: "*";
  color: #f00;
  order: 1;
  margin-left: 0.25em;
}
.node-form label.form-required .field-edit-link {
  order: 2;
  margin-left: 0.25em;
}
.node-form .form-item input.error,
.node-form .form-item textarea.error,
.node-form .form-item select.error {
  border: 2px solid red;
}

/*
 * system.base.css: textareas fill the form width. D7 reached them through a
 * .form-textarea-wrapper div; Drupal 11's textarea template no longer prints
 * it, so the textarea's own class is the hook.
 */
.node-form .form-textarea-wrapper textarea,
.node-form textarea.form-textarea {
  display: block;
  margin: 0;
  width: 100%;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

/*
 * text.js on D7 added "(Edit summary)" as a plain link beside the label;
 * Drupal 11's text.js adds a <button class="link">, which the theme's button
 * rules would otherwise draw with a border.
 */
.node-form .link-edit-summary,
.node-form .field-edit-link .link {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: normal;
  color: #999;
  text-decoration: underline;
  cursor: pointer;
}
.node-form .field-edit-link {
  font-weight: normal;
}
