/* The merge button with the checks that tick and the branches that join: a dark card for a change request in
   Brackwater, an invented code host, alone on black. */
:root {
  --page: #000000;          /* the page */
  --card: #111317;          /* the card */
  --card-2: #171a20;        /* the raised parts of the card */
  --ink: #eef0f4;           /* the words */
  --muted: #8a909c;         /* the small words */
  --line: #262a32;          /* the thin lines and the waiting button */
  --accent: #6e8bff;        /* the ready button and the feature branch */
  --done: #46d3a0;          /* the passed checks and the merged state */
  --tint: #6e8bff;          /* set by the script: the light at the top of the card */
}

* { box-sizing: border-box; }
html { touch-action: manipulation; }
html, body { margin: 0; overflow-x: clip; }

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 32px) 12px;
  position: relative;
  overflow: hidden;
}

.pr {
  position: relative;
  width: min(420px, 92vw);
  padding: clamp(14px, 3.4vh, 24px) clamp(14px, 4vw, 24px) clamp(12px, 2.8vh, 20px);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--card-2), var(--card) 46%);
  border: 1px solid #23262e;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .06) inset,
    0 2px 4px rgba(0, 0, 0, .5),
    0 16px 34px rgba(0, 0, 0, .55),
    0 40px 90px rgba(0, 0, 0, .5);
  overflow: hidden;
}

.pr__light {
  position: absolute;
  inset: -40% -10% auto;
  height: 70%;
  background: radial-gradient(50% 60% at 50% 100%, var(--tint), transparent 70%);
  opacity: .16;
  pointer-events: none;
  transition: background .6s;
}

.pr__head { display: flex; align-items: center; gap: 10px; position: relative; }

.pr__icon {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: #1d2129;
  border: 1px solid #2b303a;
}
.pr__icon svg { width: 17px; height: 17px; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; }

.pr__meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pr__repo { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr__num { font-size: 12.5px; font-weight: 600; }

.pr__state {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 4px 10px;
  border-radius: 99px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  overflow: hidden;
  display: inline-grid;
}
.pr__state.is-merged { color: var(--done); background: color-mix(in srgb, var(--done) 14%, transparent); border-color: color-mix(in srgb, var(--done) 30%, transparent); }
.pr__state-in { display: block; }

.pr__title {
  position: relative;
  margin: clamp(10px, 2.2vh, 16px) 0 clamp(6px, 1.2vh, 10px);
  font-size: clamp(17px, 2.6vh, 20px);
  line-height: 1.22;
  font-weight: 640;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -.01em;
}

.pr__graph { position: relative; height: clamp(44px, 8vh, 56px); margin-bottom: clamp(6px, 1.4vh, 12px); }
.pr__graph svg { width: 100%; height: 100%; overflow: visible; }
.g-main { fill: none; stroke: #3a3f4a; stroke-width: 2; }
.g-feat { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.g-join { fill: none; stroke: var(--done); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.g-node { fill: var(--card); stroke: #4a505c; stroke-width: 2; }
.g-node--feat { stroke: var(--accent); }
.g-node--merge { stroke: var(--done); fill: var(--card); opacity: 0; }
.pr__branch {
  position: absolute;
  font-size: 10.5px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}
.pr__branch--feat { left: 40%; top: -4px; color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.pr__branch--main { left: 0; bottom: -2px; }
.pr__branch--feat.is-gone { text-decoration: line-through; opacity: .45; }

.pr__checks {
  list-style: none;
  margin: 0 0 clamp(10px, 2vh, 16px);
  padding: 4px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(4px, 1vh, 7px) 2px;
  font-size: 13.5px;
}
.check__icon { width: 18px; height: 18px; flex: none; }
.check__icon svg { width: 100%; height: 100%; overflow: visible; }
.check__ring {
  fill: none;
  stroke: #3a3f4a;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-dasharray: .28 .72;
  transform-origin: 10px 10px;
}
.check__tick { fill: none; stroke: var(--done); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.check.is-running .check__ring { stroke: var(--accent); }
.check.is-done .check__ring { stroke: color-mix(in srgb, var(--done) 55%, transparent); stroke-dasharray: 1 0; }
.check__name { flex: 1; min-width: 0; }
.check__sub { color: var(--muted); font-size: 12px; margin-left: 4px; }
.check__time { color: var(--muted); font-size: 12px; font-variant-numeric: lining-nums; }

.pr__actions { display: flex; align-items: center; gap: 8px; position: relative; }

.merge {
  position: relative;
  flex: 1;
  height: clamp(42px, 7vh, 48px);
  border: 0;
  border-radius: 99px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 620;
  color: var(--muted);
  background: var(--line);
  overflow: hidden;
  cursor: not-allowed;
  isolation: isolate;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
  -webkit-tap-highlight-color: transparent;
}
.merge:not(:disabled) { cursor: pointer; color: #fff; }
.merge__fill {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  transform: scaleX(0);
  transform-origin: left center;
  z-index: -1;
}
.merge.is-merged .merge__fill { background: linear-gradient(180deg, color-mix(in srgb, var(--done) 80%, #fff), var(--done)); }
.merge.is-merged { color: #06261a; }
.merge__shine {
  position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: translateX(-120%) skewX(-18deg);
  pointer-events: none;
}
.merge__icon { width: 18px; height: 18px; flex: none; display: grid; }
.merge__icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.merge__icon--done { display: none; }
.merge__icon--done svg path { stroke-width: 2.2; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.merge.is-merged .merge__icon { display: none; }
.merge.is-merged .merge__icon--done { display: grid; }
.merge__labels { display: grid; overflow: hidden; height: 1.3em; }
.merge__label { display: block; line-height: 1.3em; white-space: nowrap; }
.merge__bar { position: absolute; left: 18px; right: 18px; bottom: 6px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .22); opacity: 0; overflow: hidden; }
.merge__bar-in { display: block; height: 100%; width: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }

.del {
  height: clamp(42px, 7vh, 48px);
  border-radius: 99px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  padding: 0 14px;
  display: none;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.del svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.pr__note {
  position: relative;
  margin: clamp(8px, 1.6vh, 12px) 2px 0;
  font-size: 12px;
  color: var(--muted);
}

@media (hover: hover) {
  .merge:not(:disabled):not(.is-merged):hover .merge__icon { transform: translateX(1px); }
  .del:hover { border-color: #3a3f4a; background: #171a20; }
}

.pointer {
  position: absolute;
  left: 0; top: 0;
  width: 22px; height: 22px;
  fill: #fff;
  stroke: #000;
  stroke-width: 1.2;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 380px) {
  .pr__branch--feat { left: 34%; }
  .check { font-size: 12.5px; }
  .del span { display: none; }
}
