/* Pull request page rules kept out of the theme files, which are at their size limit. */

/*
 * A merge scheduled for when checks succeed. Forgejo prints a blue notice above the merge button;
 * here it is one more section of the merge box, like the rows above it: a round status icon, the
 * sentence, and the bar with the merge button and "Cancel" below. Its measurements are the merge
 * box's own (--merge-section-*), set where the other rows are styled.
 */
.github-pull-review .pull-merge-actions > #pull-request-merge-form:has(.ui.info.message) {
  flex: 0 0 100%;
}

.github-pull-review .pull-merge-actions .ui.info.message {
  position: relative;
  display: block;
  min-height: var(--merge-section-height);
  margin: calc(-1 * var(--merge-section-padding)) calc(-1 * var(--merge-section-padding)) var(--merge-section-padding);
  padding: 20px var(--merge-section-padding) 20px calc(var(--merge-section-padding) + var(--merge-section-icon) + 8px);
  border: 0;
  border-bottom: 1px solid var(--merge-section-divider);
  border-radius: 0;
  background: var(--color-body);
  box-shadow: none;
  color: var(--color-text);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

/* The status icon: a white clock on the accent colour. The notice itself carries no icon element. */
.github-pull-review .pull-merge-actions .ui.info.message::before {
  content: "";
  position: absolute;
  top: var(--merge-section-padding);
  left: var(--merge-section-padding);
  width: var(--merge-section-icon);
  height: var(--merge-section-icon);
  border-radius: 50%;
  background: var(--github-bgColor-accent-emphasis)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm7-3.25v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5a.75.75 0 0 1 1.5 0Z'/%3E%3C/svg%3E")
    center / 16px no-repeat;
}

.github-pull-review .pull-merge-actions .ui.info.message relative-time {
  color: var(--color-text-light-1);
  font-weight: 400;
}

/* The buttons under the notice sit 8px apart. */
.github-pull-review .pull-merge-actions .tw-flex {
  align-items: center;
  gap: 8px;
}

.github-pull-review .pull-merge-actions .tw-flex > form {
  margin: 0 !important;
}

/*
 * "Compare changes" / new pull request (repo/diff/compare.tmpl), like GitHub's: a title over a divider, a compact branch
 * bar, then a notice with its text on the left and the button on the right.
 */
.page-content.github-compare > .ui.container > h2.ui.header {
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-light-border);
  font-size: 24px;
  font-weight: 400;
  line-height: 36px;
}

.page-content.github-compare > .ui.container > h2.ui.header > .sub.header {
  margin-top: 0;
  color: var(--color-text-light-1);
  font-size: 14px;
  line-height: 21px;
}

.page-content.github-compare .ui.segment.choose.branch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  background: var(--color-box-header);
}

.page-content.github-compare .ui.segment.choose.branch .ui.basic.small.button {
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0 8px;
  font-size: 12px;
  line-height: 18px;
}

.page-content.github-compare .github-compare-notice {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 20px 16px;
  border-radius: var(--border-radius);
  color: var(--color-text);
  font-size: 14px;
  line-height: 21px;
}

.page-content.github-compare .github-compare-notice.tw-hidden {
  display: none !important;
}

.page-content.github-compare .github-compare-notice.warning {
  border: 1px solid var(--color-warning-border);
  background: var(--color-warning-bg);
}

.page-content.github-compare .github-compare-notice.info {
  border: 1px solid var(--color-info-border);
  background: var(--color-info-bg);
}

.page-content.github-compare .github-compare-notice a {
  color: var(--color-primary);
  text-decoration: underline;
}

.page-content.github-compare .github-compare-notice > .button {
  flex: none;
  margin: 0;
}

/* An open pull request for this comparison: a card with its title and "View pull request". */
.page-content.github-compare .ui.segment.grid.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 16px;
  border-radius: var(--border-radius);
}

.page-content.github-compare .ui.segment.grid.title > .column {
  width: auto !important;
  padding: 0 !important;
}

.page-content.github-compare .ui.segment.grid.title h1 {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

/*
 * "Close pull request" uses Forgejo's closed-issue icon, which the theme colours as done (purple). GitHub shows a red
 * closed pull request icon; issues keep theirs.
 */
.page-content.github-pull-review #status-button[value="close"] > svg {
  color: var(--color-red) !important;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1m9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75m-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.75.75 0 0 1-.018 1.042.75.75 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.75.75 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0M3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5m9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5'/%3E%3C/svg%3E")
    center / 16px no-repeat;
}

.page-content.github-pull-review #status-button[value="close"] > svg > * {
  visibility: hidden;
}

/* "base:" and "compare:" are muted in GitHub's branch buttons. */
.page-content.github-compare .compare-ref-label {
  color: var(--color-text-light-1);
}

/* "N commits · N files changed · N contributors" over the commits. */
.page-content.github-compare .github-compare-summary {
  display: flex;
  justify-content: space-around;
  gap: 16px;
  margin: 0 0 16px;
  padding: 8px 16px;
  border: 1px solid var(--color-light-border);
  border-radius: var(--border-radius);
  color: var(--color-text-light-1);
  font-size: 14px;
  line-height: 21px;
}

.page-content.github-compare .github-compare-summary > span > svg,
.page-content.github-compare .diff-compare-stats > span > svg {
  margin-right: 6px;
  vertical-align: text-bottom;
}

.page-content.github-compare .github-compare-summary strong {
  color: var(--color-text);
}

/* The diff: GitHub's "Showing N changed files..." row with Split/Unified, no review toolbar or file tree. The toolbar
   stays in the page, hidden, as diff-view.js reads its search field and settings. */
.page-content.github-compare #diff-container > .diff-content-controls {
  display: none;
}

.page-content.github-compare #diff-container > #diff-content-container {
  padding: 0;
}

.page-content.github-compare .diff-compare-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 16px;
  font-size: 14px;
  line-height: 21px;
}

.page-content.github-compare .diff-compare-stats > span > strong:first-of-type {
  color: var(--color-primary);
}

.page-content.github-compare .diff-compare-style {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--border-radius);
  background: var(--color-box-header);
}

.page-content.github-compare .diff-compare-style > a {
  padding: 2px 8px;
  border-radius: calc(var(--border-radius) - 2px);
  color: var(--color-text);
  font-size: 12px;
  line-height: 18px;
}

.page-content.github-compare .diff-compare-style > a.active {
  background: var(--color-body);
  box-shadow: 0 0 0 1px var(--color-light-border);
  font-weight: 600;
}
