/* ==========================================================================
   Form pages: sponsor, report, claim, add, manage, dates — and the pages a
   form leads to (thanks, not accepting, already managed, link invalid).
   templates/inquiries/*.html, templates/organizers/*.html, loaded through
   {% block extra_css %}. Fields, buttons, notices, cards and the festival
   card are site.css components as they are (DESIGN.md, "Forms"); only how
   they sit together on these pages lives here.

   One order on every form page, at every width (DESIGN.md, "Страницы →
   Формы"):  crumbs → heading → what the visitor should know first (the
   festival the form is about, or who can be listed) → the form. From 56rem
   a side column (.layout-split) holds what happens after sending. Nothing is
   reordered, so focus follows the screen.
   ========================================================================== */

/* A festival name in a heading can be long, and a pasted word unbroken. */
.page-head h1,
.status-page h1 { overflow-wrap: break-word; }

/* 1. Main column ---------------------------------------------------------------
   The column is the form's own width, so the festival box, the notices and
   the fields share one left and one right edge. */
.form-main { max-width: 36rem; min-width: 0; }
.form-main > * + * { margin-top: var(--space-6); }
.form-main > .notice + .notice { margin-top: var(--space-3); }
.form-main .form { max-width: none; }

/* The festival the form is about (catalog/includes/form_festival.html):
   the compact card, then its public facts under a hairline, in one box. */
.form-main > .form-festival {
  padding: var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
}
@media (min-width: 30rem) { .form-main > .form-festival { padding: var(--space-5); } }
.form-main > .form-festival .facts {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-line);
}
.form-festival .facts dd { min-width: 0; overflow-wrap: break-word; }

/* Who can be listed / Already listed? over the add form. */
.form-before { --stack-gap: var(--space-3); }

/* Send button: the full width of a phone, its own width from 30rem. */
@media (max-width: 29.99rem) {
  .form__actions .btn { flex: 1 1 100%; }
}

/* 2. Groups of fields (add, manage) -------------------------------------------
   Each group starts under a hairline with its name as a small heading; the
   fields inside keep the form's own spacing. A fieldset's default min-width
   would let a long web address push the page sideways. */
.manage-group {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
  margin: var(--space-3) 0 0;
  padding: var(--space-5) 0 0;
  border: 0;
  border-top: 1px solid var(--color-line);
}
.manage-group > legend {
  float: left;            /* keeps the legend inside the grid flow */
  width: 100%;
  padding: 0;
  font: 600 var(--text-lg)/1.2 var(--font-display);
  letter-spacing: -0.01em;
}
.manage-group > legend + * { clear: left; }
.manage-group .form__note { overflow-wrap: anywhere; }

/* Cultures on the manage page: some fifty short names, alphabetical down the
   columns (two on a phone, three in the form column) instead of one long
   list. Every row keeps its 44px label from .field--choices. Without :has()
   the list stays one column. */
.manage-group .field--choices:has(> #id_cultures) > div { display: block; columns: 9.5rem 3; column-gap: var(--space-4); }
.manage-group .field--choices:has(> #id_cultures) > div > div { break-inside: avoid; }

/* Sponsor packages on the manage page (organizers/includes/manage_packages.html):
   a group like the ones around it; each package is a small boxed group of
   its fields, the way each photo is below. Numbers, the date and the place
   in the order are short values, so their boxes stay narrow, and from 30rem
   they sit in pairs (price | book by, spots in all | taken) with their boxes
   on one line; the name, what is included and "Remove" take the full width.
   Without :has() every field sits in the two columns. */
.manage-packages, .package-edit { scroll-margin-top: var(--space-5); }
.package-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  min-width: 0;
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
}
@media (min-width: 30rem) {
  .package-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; padding: var(--space-5); }
  .package-edit > .notice,
  .package-edit > .field--check,
  .package-edit > .field:has(> textarea),
  .package-edit > .field:has(> input[name$="-name"]) { grid-column: 1 / -1; }
}
.package-edit__legend {
  float: left;            /* keeps the legend inside the grid, as in .manage-group */
  grid-column: 1 / -1;
  width: 100%;
  padding: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.package-edit__legend + * { clear: left; }
.package-edit input[type="number"],
.package-edit input[type="date"],
.package-edit select { max-width: 12rem; }

/* Photos on the manage page (organizers/includes/manage_photos.html): a
   section of its own under the page's form, opened by a hairline like the
   groups above. Each photo is a small group: the preview, then its caption,
   place and "Remove". From 30rem the preview stands beside the fields. */
.manage-photos {
  display: grid;
  gap: var(--space-5);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-line);
  scroll-margin-top: var(--space-5);
}
.manage-photos > * { margin: 0; }
.manage-photos__title { font: 600 var(--text-lg)/1.2 var(--font-display); letter-spacing: -0.01em; }   /* as the groups' names above */
.photo-upload__title { margin: 0; font: 600 var(--text-md)/1.2 var(--font-display); }
.photo-edit__list { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.photo-edit__item {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
}
.photo-edit__legend {
  float: left;            /* keeps the legend inside the grid, as in .manage-group */
  grid-column: 1 / -1;
  width: 100%;
  padding: 0;
  font-weight: 600;
}
.photo-edit__legend + * { clear: left; }
.photo-edit__thumb {
  display: block;
  width: 100%;
  max-width: 12rem;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--color-teal-wash);
}
.photo-edit__thumb--missing {
  display: grid;
  place-items: center;
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.photo-edit__fields { display: grid; gap: var(--space-4); min-width: 0; }
.photo-edit__fields select { max-width: 8rem; }   /* a number from 1 to 8 */
@media (min-width: 30rem) {
  .photo-edit__item { grid-template-columns: 9rem minmax(0, 1fr); align-items: start; }
  .photo-edit__thumb { max-width: none; }
}

/* 3. Dates page ------------------------------------------------------------------
   What we have for the year is one fact tile; the two dates that go with
   "we have the dates" sit together on a quiet panel under the answers. */
.form-main > .dates-known { margin-bottom: 0; grid-template-columns: minmax(0, 1fr); }
.dates-other {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  margin: 0;
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius);
  background: var(--color-teal-wash);
}
@media (min-width: 30rem) { .dates-other { padding: var(--space-5); } }
.dates-other .form__note { font-size: var(--text-sm); }

/* 4. Side column ----------------------------------------------------------------- */
.form-aside { --stack-gap: var(--space-4); }
.form-aside .steps { margin-bottom: 0; }
.form-aside .btn--secondary { width: 100%; }
.form-aside .btn--quiet { padding-inline: 0; }

/* 5. After the form: thanks, not accepting, already managed ----------------------
   The heading, then what happened in a success notice, then what happens
   next and the way back to the festival. */
.done__notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  margin-block: var(--space-5);
  font-size: var(--text-md);
  line-height: 1.5;
}
.done__notice > .icon { width: 1.5rem; height: 1.5rem; margin-top: 0.1em; color: var(--color-confirmed); }
.done__notice > p { margin: 0; }
.done__notice > p:only-child { grid-column: 1 / -1; }   /* no icon (received, not delivered yet) */
.done__notice + .notice { margin-top: calc(-1 * var(--space-2)); }
.status-page .actions { margin-bottom: 0; }
/* The website offer under a claim's thank-you (organizers/includes/website_offer.html). */
.status-page > .website-offer { margin-top: var(--space-6); }
/* "Get found by organizers" under a vendor application's thank-you (story 128). */
.status-page > .get-found { margin-top: var(--space-6); }
.get-found h2 { margin-bottom: var(--space-2); }
.get-found .actions { margin-top: var(--space-4); }
