/* GitHub's "Create new issue": the page heading over the form, which is repo/issue/new_form (theme-issue-form) on the
   new issue page and the compare page alike: labelled title and description fields, the buttons at the right below
   them, and the metadata sidebar as on an issue. The template chooser shares the page heading. These rules were part
   of the theme stylesheets; they load right after the theme, before the component and page stylesheets.

   Measured on GitHub's new issue page at 1x (the reporter's screenshot of #227): the author's 32px avatar left of the
   heading, the heading and form 12px past it; 8px from the heading to "Add a title", 4px from a label to its field,
   16px between fields; a 296px sidebar whose sections hold 280px of content, 24px from the form. */

.page-content.repository.new.issue.github-issue-new {
  & > .ui.container {
    width: calc(100% - 64px) !important;
    max-width: 1232px !important;
    margin: 24px auto !important;
  }
  & .issue-new-heading {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    line-height: 32px;
  }
  /* The author's avatar to the left of the heading and the form. GitHub shows it from the medium breakpoint up
     (Primer's d-none d-md-block); a project's side panel has no room for it. */
  & .issue-new-author {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }
  & .issue-new-avatar {
    display: flex;
    flex: none;
  }
  & .issue-new-avatar > img.ui.avatar {
    width: 32px;
    height: 32px;
    margin: 0;
    border-radius: 50%;
  }
  & .issue-new-main {
    flex: 1;
    min-width: 0;
  }
  /* GitHub's description box is 438px tall. */
  & .ui.form.theme-issue-form {
    --theme-editor-min-height: 438px;
  }
}
@media (max-width: 767.98px) {
  .page-content.repository.new.issue.github-issue-new {
    & > .ui.container {
      width: calc(100% - 32px) !important;
      margin: 16px auto !important;
    }
    & .issue-new-avatar {
      display: none;
    }
  }
}
.github-embedded .page-content.github-issue-new .issue-new-avatar {
  display: none;
}

.ui.form.theme-issue-form.issue-content {
  display: grid;
  /* The sections' content is 280px; their triggers reach 8px past it on each side (the theme's issue_picker), 24px
     from the form, so the sidebar is GitHub's 296px. */
  grid-template-columns: minmax(0, 1fr) 280px;
}
/* On both pages of the form, in place of the 24px gap issue_sidebar gives Forgejo's issue layout. */
:is(.page-content.repository.new.issue, .page-content.repository.diff.compare.pull)
  .ui.form.theme-issue-form.issue-content {
  column-gap: 32px;
}
.ui.form.theme-issue-form.issue-content {
  & > .issue-content-left {
    width: auto;
    min-width: 0;
  }
  & > .issue-content-left > .field {
    margin: 0 0 16px;
  }
  /* "Title *" and "Description": GitHub's form labels. Template forms label their fields with an h3. */
  & > .issue-content-left > .field > label,
  & .theme-issue-form-label,
  & > .issue-content-left > .field > h3 {
    display: block;
    margin: 0 0 4px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
  }
  /* The required marker in the danger colour, as Forgejo marks a template's required fields. */
  & .theme-issue-form-required {
    color: var(--color-red);
  }
  /* A template's description under its label, as GitHub's muted field caption. */
  & > .issue-content-left > .field > .help {
    display: block;
    margin: 0 0 4px;
    padding: 0;
    color: var(--color-text-light-1);
    font-size: 12px;
    line-height: 20px;
    & > p {
      margin: 0;
    }
  }
  /* The title and a template's text fields are GitHub's 32px inputs. */
  & #issue_title,
  & > .issue-content-left > .field > input:is([type="text"], [type="number"]) {
    height: 32px;
    padding: 5px 12px;
    font-size: 14px;
    line-height: 20px;
  }
  & .title_wip_desc {
    margin-top: 4px;
    color: var(--color-text-light-1);
    font-size: 12px;
    line-height: 20px;
  }
  & .theme-issue-form-description > .field {
    margin: 0 0 8px;
  }
  & .theme-issue-form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    & > .ui.button {
      margin: 0;
    }
  }
  /* The sidebar as on GitHub: muted headings with the gear at the right edge, the value 4px below, 15px to a divider
     and 8px from it to the next heading, whose trigger rises 4px (issue_picker). Loaded after the theme's
     issue_sidebar, whose padded rows it replaces here. */
  & > .issue-content-right.ui.segment {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
    & > .divider {
      width: 100%;
      margin: 15px 0 12px;
      border-color: color-mix(in srgb, var(--color-light-border) 70%, transparent);
    }
    & strong {
      color: var(--color-text-light-1);
      font-size: 12px;
      font-weight: 600;
    }
    & > .ui.list {
      margin: 0;
      padding: 0;
    }
    & :is(.no-select:not(:where(.menu *)), .theme-issue-development-ref) {
      padding: 0;
      font-size: 12px;
      line-height: 18px;
    }
  }
}
@media (max-width: 767.98px) {
  .ui.form.theme-issue-form.issue-content {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The template chooser: one box with a row per template, its description below the name and a chevron. */
.page-content.theme-issue-choose .theme-issue-choose-list > .theme-box-list-row {
  min-height: 0;
  margin: 0;
  padding: 0;
  & > a {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 16px;
    min-width: 0;
    padding: 12px 16px;
    color: var(--color-text);
    text-decoration: none;
    &:hover {
      background: var(--color-hover);
    }
  }
  & .theme-box-list-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    line-height: 20px;
  }
  & .theme-box-list-main > strong {
    font-weight: 600;
  }
  &:first-child > a {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
  }
  &:last-child > a {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
  }
  &:only-child > a {
    border-radius: var(--border-radius);
  }
}
.page-content.theme-issue-choose .theme-issue-choose-action {
  display: flex;
  flex: none;
  color: var(--color-text-light-1);
}
/* Forgejo's "Get started" and "Open" stay for screen readers; GitHub shows only the icon. */
.page-content.theme-issue-choose .theme-issue-choose-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
