
:root {
  --mandatory-field-text: var(--error-text);

  --form-section-title-hover: var(--profile-1);

  --form-input-max-length: 20rem;

  --form-title-transition-time: 0.2s;
  --form-title-transition-fun: ease-in-out;

  --popup-z-index: 1;
}

.body-grid .form {
  width: 100%;
  display: grid;
  grid-template-areas:
    "cover"
    "items";
  grid-template-rows: auto
                      auto;
  justify-items: center;
}

.form > .cover {
  grid-area: cover;
}

.form > .items {
  grid-area: items;
  width: 100%;
  max-width: 32rem;
}

.form > .items > .heading {
  display: grid;
  grid-template-areas:
    "heading button";
  grid-template-columns: 1fr auto;
  align-items: center;
}
.form > .items > .heading.first-item {
  align-items: start;
}
.form > .items > .heading h1,
.form > .items > .heading h2 {
  grid-area: heading;
}
.form > .items > .heading.first-item h1,
.form > .items > .heading.first-item h2,
.form > .items > .sep + .heading h1,
.form > .items > .sep + .heading h2 {
  margin-top: 0;
}
.form > .items > .heading button {
  grid-area: button;
}
.form > .items > .heading button,
.form > .items > .item button,
.form > .items .section > .item button {
  font-size: 100%;
  font-family: var(--normal-font-family);font-weight: var(--normal-font-weight);;
  padding: .2em .8em;
  border-radius: calc(.75 * var(--button-radius));
}

.form > .items > .item,
.form > .items .section > .item {
  display: grid;
}
.form > .items > .item.hidden,
.form > .items .section > .item.hidden {
  display: none !important;
}
.form > .items > .item.no-title,
.form > .items .section > .item.no-title {
  grid-template-areas:
    "value";
  grid-template-columns: 1fr;
  grid-template-rows: auto;
}
.form > .items > .item.long,
.form > .items > .item.short,
.form > .items .section > .item.long,
.form > .items .section > .item.short {
  margin-bottom: .2em;
}
.form > .items > .item.short,
.form > .items .section > .item.short {
  grid-template-areas:
    "title . value";
  grid-template-columns: auto 1fr minmax(0, var(--form-input-max-length));
  grid-template-rows: auto;
}
.form > .items > .item.short.no-title,
.form > .items .section > .item.short.no-title {
  grid-template-columns: auto 0rem 1fr;
  grid-template-rows: auto;
}
.form > .items > .item.short.left-align,
.form > .items .section > .item.short.left-align {
  grid-template-areas:
    "title . value .";
  grid-template-columns: auto 0rem minmax(0, var(--form-input-max-length)) 1fr;
}
@media (max-width: 600px) {
.form > .items > .item.short:not( .always-short
                                , .checkboxes.only-one-option.no-value-text
                                ),
.form > .items .section >
  .item.short:not( .always-short
                 , .checkboxes.only-one-option.no-value-text
                 ) {
  grid-template-areas:
    "title title"
    "value value";
  grid-template-columns: 1fr auto;
  grid-template-rows: auto
                      1fr;
}
.form > .items > .item.short:not(.always-short) > .title,
.form > .items .section > .item.short:not(.always-short) > .title {
  margin-top: 0;
  margin-bottom: .1em;
}}
.form > .items > .item.long,
.form > .items .section > .item.long {
  grid-template-areas:
    "title misc"
    "value value";
  grid-template-columns: 1fr auto;
  grid-template-rows: auto
                      1fr;
}

.form > .items > .item > .title,
.form > .items .section > .item > .title {
  grid-area: title;
  font-family: var(--bold-font-family);font-weight: var(--bold-font-weight);;
  margin-top: .1em;
  display: flex;
  align-items: center;
}
.form > .items > .item > .title > .text,
.form > .items .section > .item > .title > .text {
  transition: color var(--form-title-transition-time)
                    var(--form-title-transition-fun);
}
.form > .items > .item > .title > .text.has-error,
.form > .items .section > .item > .title > .text.has-error {
  color: var(--error-text);
}
.form > .items > .item.no-title > .title,
.form > .items .section > .item.no-title > .title {
  display: none;
}
.form > .items > .item > .title > .mandatory-symbol,
.form > .items .section > .item > .title > .mandatory-symbol {
  margin-left: .15em;
  color: var(--mandatory-field-text);
}
.form > .items > .item > .value,
.form > .items .section > .item > .value {
  grid-area: value;
}

.form > .items > .item.long > .title,
.form > .items .section > .item.long > .title {
  margin-top: 0;
  margin-bottom: .1em;
}
.form > .items > .item.short > .title,
.form > .items .section > .item.short > .title {
  padding-right: .5em;
}
.form > .items > .item.short > .title:empty,
.form > .items .section > .item.short > .title:empty {
  padding-right: 0;
}

.form > .items > .item > .value > input,
.form > .items > .item > .value > .input,
.form > .items > .item > .value > select,
.form > .items .section > .item > .value > input,
.form > .items .section > .item > .value > .input,
.form > .items .section > .item > .value > select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
.form > .items > .item > .value select,
.form > .items .section > .item > .value select {
  height: 100%;
}
.form > .items > .item > .value > .input,
.form > .items .section > .item > .value > .input {
  background-color: var(--input-bg);
  padding: 0;
}
.form > .items > .item > .value > .input > input,
.form > .items .section > .item > .value > .input > input {
  border: none;
  flex: 1;
  min-width: 2em;
}
.form > .items > .item > .value > .input > input:active,
.form > .items > .item > .value > .input > input:focus,
.form > .items .section > .item > .value > .input > input:active,
.form > .items .section > .item > .value > .input > input:focus {
  border: none;
  box-shadow: none;
}
.form > .items > .item > .value > .input > input:focus,
.form > .items .section > .item > .value > .input > input:focus {
  border: none;
}
.form > .items > .item > .value.has-error > input,
.form > .items > .item > .value.has-error > .input,
.form > .items > .item > .value.has-error > button,
.form > .items > .item > .value.has-error > select,
.form > .items > .item > .value.has-error > textarea,
.form > .items .section > .item > .value.has-error > input,
.form > .items .section > .item > .value.has-error > .input,
.form > .items .section > .item > .value.has-error > button,
.form > .items .section > .item > .value.has-error > select,
.form > .items .section > .item > .value.has-error > textarea {
  border-color: var(--error-text);
}

.form > .items > .item.long > .misc,
.form > .items .section > .item.long > .misc {
  grid-area: misc;
}
.form > .items > .item.as-heading > .title,
.form > .items .section > .item.as-heading > .title {
  font-size: 150%;
  font-family: var(--heading-font-family);font-weight: var(--heading-font-weight);;
}
.form > .items > .section-heading {
  display: grid;
  grid-template-areas:
    "heading arrow";
  grid-template-columns: 1fr auto;
    align-items: center;
  transition: all var(--hover-out-time) var(--hover-out-fun);
  margin-top: 1rem;
}
.form > .items > .section-heading:first-child {
  margin-top: 0;
}
.form > .items > .section-heading:hover {
  cursor: pointer;
  color: var(--form-section-title-hover);
  transition: all var(--hover-in-time) var(--hover-in-fun);
}
.form > .items > .section-heading:hover svg .colorable {
  fill: var(--form-section-title-hover);
}
.form > .items > .section-heading h2 {
  grid-area: heading;
}
.form > .items > .section-heading svg {
  grid-area: arrow;
  margin-top: .3rem;
  width: 1.2rem;
  transform: rotate(0);
  transition: transform var(--open-time) var(--open-fun);
}
.form > .items > .section-heading svg .colorable {
  transition: fill var(--hover-out-time) var(--hover-out-fun);
}
.form > .items > .section-heading:hover svg .colorable {
  transition: fill var(--hover-in-time) var(--hover-in-fun);
}
.form > .items > .section-heading.is-open svg {
  transform: rotate(-90deg);
}

.form > .items > .sep,
.form > .items .section > .sep {
  margin-top: 1.25rem;
}
.form > .items > .sep.long,
.form > .items .section > .sep.long {
  margin-top: 2.5rem;
}
.form > .items > .sep.mid,
.form > .items .section > .sep.mid {
  margin-top: 1.75rem;
}
.form > .items > .sep.thin,
.form > .items .section > .sep.thin {
  margin-top: .5rem;
}
.form > .items > .errors {
  margin: 1rem 0;
  color: var(--error-text);
}
.form > .items > .errors:first-child {
  margin-top: 0;
}

.form > .items > .item button.controller,
.form > .items .section > .item button.controller {
  width: 1.5em;
  height: 1.5em;
  padding: 0;
  font-size: 80%;
  border-radius: .3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form > .items > .item button.controller.first-item,
.form > .items .section > .item button.controller.first-item {
  margin-left: 0;
}
.form > .items > .item button.controller:disabled svg,
.form > .items > .item button.controller:disabled svg.edit-symbol path,
.form > .items .section > .item button.controller:disabled svg,
.form > .items .section > .item button.controller:disabled svg.edit-symbol
  path
{
  fill: var(--button-text-disabled);
}

.form > .items > .buttons {
  margin-top: 1rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
}
@media (max-width: 400px) {
.form > .items > .buttons {
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}}
.form > .items > .buttons.first-item {
  margin-top: 0;
}

/* Groups are cards laid out as the groups of a show page are (see
 * css/show.css.php): stacked in one column, or on a larger screen in two,
 * the aside groups stacked in the right one beside the others. */
.body-grid > .main > .content:has(> .form > .items > .groups) {
  max-width: 64rem;
}
.form > .items:has(> .groups) {
  max-width: 32rem;
}
.form > .items > .groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.form > .items > .groups > .asides {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
@media (min-width: 800px) {
.form > .items:has(> .groups) {
  max-width: 64rem;
}
/* --form-columns is set by the form builder's setColumnWidths(). A fixed
 * width squeezes the other column, which may shrink to nothing. */
.form > .items > .groups {
  grid-template-columns: var(--form-columns, repeat(2, minmax(0, 1fr)));
}
/* Asides holding a description take most of the width, unless the form says
 * otherwise. */
.form > .items > .groups:has(> .asides > .group.description) {
  --form-columns: minmax(0, 1fr) 58%;
}
.form > .items > .groups:has(> .asides) {
  row-gap: 0;
  margin-bottom: -1rem;
}
.form > .items > .groups:has(> .asides) > .group {
  grid-column: 1;
  margin-bottom: 1rem;
}
.form > .items > .groups > .asides {
  grid-column: 2;
  /* One row more than there are other groups, so that those are stacked at
     the top rather than spread out over the height of the asides */
  grid-row: 1 / span calc(var(--form-asides-row-span, 0) + 1);
  min-height: 0;
  margin-bottom: 1rem;
}}

.form > .items > .groups .group {
  border: 1px solid var(--main-border);
  border-radius: .8rem;
  min-width: 0;
}
.form > .items > .groups .group > .header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  background-color: var(--main-border);
  border-radius: calc(.8rem - 1px) calc(.8rem - 1px) 0 0;
  font-family: var(--bold-font-family);font-weight: var(--bold-font-weight);;
}
.form > .items > .groups .group > .header > .image {
  display: flex;
  flex: none;
  width: 1.5em;
  height: 1.5em;
}
.form > .items > .groups .group > .header > .image > * {
  width: 100%;
  height: 100%;
}
.form > .items > .groups .group > .body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem;
}
.form > .items > .groups .group > .body > .item {
  margin-bottom: 0;
}

/* An input shown as the heading of the page, where a show page has its h1 */
.form > .items > .item.as-page-heading {
  display: block;
  margin-bottom: 1rem;
}
.form > .items > .item.as-page-heading > .title {
  display: none;
}
.form > .items > .item.as-page-heading > .value > input {
  font-size: 300%;
  font-family: var(--heading-font-family);font-weight: var(--heading-font-weight);;
  text-align: center;
  background-color: transparent;
  border: none;
  border-bottom: 2px dashed var(--main-border);
  border-radius: 0;
  padding: 0 0 .2rem;
}
@media (max-width: 799px) {
.form > .items > .item.as-page-heading > .value > input {
  font-size: 200%;
  text-align: left;
}}
.form > .items > .item.as-page-heading > .value > input:focus {
  border-bottom-color: var(--input-border-active);
  box-shadow: none;
}
.form > .items > .item.as-page-heading > .value.has-error > input {
  border-bottom-color: var(--error-text);
}

/* The buttons, and the errors above them, as they stand among the items of a
 * group */
.form > .items > .groups .group > .body > .buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: center;
  margin-top: .5rem;
}
.form > .items > .groups .group > .body > .errors {
  color: var(--error-text);
}

.blocking-modal .form {
  margin: 1rem 0;
}
.blocking-modal .form:last-child {
  margin-bottom: 0;
}
.blocking-modal .form .items {
  padding: 0;
}

