/* The delete project dialog that asks you to type the name. The danger zone card of a made up deploy tool sits on
   white; the dialog springs out of its button over a dark veil, the field draws the project's name as ghost letters
   and lights each one you type right, the red button fills from the left as the name grows, and the dialog's shell
   finally shrinks into a dark toast with Undo. */
:root {
  --u: clamp(0.9375px, min(0.1375vw, 0.1875vh), 1.875px); /* one design pixel: the whole component grows with the screen */
  --page: #ffffff;          /* the page */
  --ink: #14161b;           /* the words */
  --muted: #6c7180;         /* the small words */
  --faint: #a9aeb9;         /* the ghost letters */
  --line: rgba(20, 22, 27, 0.08);   /* thin edges */
  --line-strong: rgba(20, 22, 27, 0.14); /* the field's edge */
  --surface: #ffffff;       /* the card and the dialog */
  --well: #f6f7f9;          /* the field */
  --red: #e5484d;           /* the danger colour */
  --red-deep: #c8333a;      /* the bottom of the red button */
  --red-soft: #fff0f0;      /* the pale red of the button not armed yet */
  --scrim: rgba(17, 19, 25, 0.44); /* the veil over the page */
  --toast: #17191f;         /* the toast */
  --avatar-a: #6d5efc;      /* the project's avatar, top */
  --avatar-b: #22b8cf;      /* the project's avatar, bottom */
}

* { 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;
}

button { font: inherit; color: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: calc(12 * var(--u));
  overflow: hidden;
}

/* the frame holds the card, the dialog and the toast in the same spot */
.frame {
  position: relative;
  width: min(calc(600 * var(--u)), 94vw);
  height: min(calc(470 * var(--u)), 96vh);
  display: grid;
  place-items: center;
}

/* ---------------------------------------------------------------- the danger zone card */
.panel {
  position: relative;
  width: min(calc(540 * var(--u)), 100%);
  padding: clamp(calc(14 * var(--u)), 3.4vh, calc(22 * var(--u))) clamp(calc(14 * var(--u)), 4vw, calc(24 * var(--u)));
  border-radius: calc(18 * var(--u));
  background: var(--surface);
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 1px 2px rgba(20, 22, 27, 0.04),
    0 calc(12 * var(--u)) calc(32 * var(--u)) calc(-18 * var(--u)) rgba(20, 22, 27, 0.18);
  will-change: filter, transform;
}

.panel__crumb {
  margin: 0;
  display: flex;
  align-items: center;
  gap: calc(5 * var(--u));
  font-size: calc(12 * var(--u));
  color: var(--muted);
  font-stretch: 105%;
  white-space: nowrap;
  overflow: hidden;
}

.panel__crumb svg {
  width: calc(11 * var(--u));
  height: calc(11 * var(--u));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}

.panel__title {
  margin: calc(6 * var(--u)) 0 clamp(calc(10 * var(--u)), 2.6vh, calc(16 * var(--u)));
  font-size: clamp(calc(16 * var(--u)), 2.2vw + calc(6 * var(--u)), calc(19 * var(--u)));
  font-weight: 640;
  letter-spacing: -0.01em;
}

.panel__row {
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
  padding: calc(12 * var(--u));
  border-radius: calc(13 * var(--u));
  background: linear-gradient(#fffafa, #fff6f6);
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.16);
}

.avatar {
  flex: none;
  width: calc(36 * var(--u));
  height: calc(36 * var(--u));
  border-radius: calc(10 * var(--u));
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--avatar-a), var(--avatar-b));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 calc(4 * var(--u)) calc(10 * var(--u)) calc(-4 * var(--u)) rgba(109, 94, 252, 0.6);
  color: #fff;
  font-weight: 700;
  font-size: calc(15 * var(--u));
  text-transform: uppercase;
}

.panel__info {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.panel__name {
  position: relative;
  justify-self: start;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: calc(14 * var(--u));
  font-weight: 560;
}

.panel__strike {
  position: absolute;
  left: -2px;
  right: -2px;
  top: 52%;
  height: 1.5px;
  border-radius: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
}

.panel__meta {
  font-size: calc(12 * var(--u));
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.open {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: calc(6 * var(--u));
  height: calc(36 * var(--u));
  padding: 0 calc(13 * var(--u)) 0 calc(11 * var(--u));
  border: 0;
  border-radius: calc(10 * var(--u));
  background: #fff;
  color: var(--red);
  font-size: calc(13 * var(--u));
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.32), 0 1px 2px rgba(229, 72, 77, 0.12);
  transition: box-shadow 0.25s, background-color 0.25s;
}

.open__icon {
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.open:focus-visible,
.ghost:focus-visible,
.x:focus-visible,
.del:focus-visible,
.toast__undo:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.open.is-hover {
  background: var(--red-soft);
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.5), 0 calc(4 * var(--u)) calc(12 * var(--u)) calc(-4 * var(--u)) rgba(229, 72, 77, 0.35);
}

.open.is-gone {
  opacity: 0.4;
  pointer-events: none;
}

@media (hover: hover) {
  .open:hover {
    background: var(--red-soft);
    box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.5), 0 calc(4 * var(--u)) calc(12 * var(--u)) calc(-4 * var(--u)) rgba(229, 72, 77, 0.35);
  }
}

/* ---------------------------------------------------------------- the veil */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
}

.scrim.is-on { pointer-events: auto; }

/* ---------------------------------------------------------------- the dialog */
.panel,
.dialog { grid-area: 1 / 1; }

.dialog {
  position: relative;
  width: min(calc(400 * var(--u)), 92vw);
  z-index: 2;
}

.dialog[hidden],
.toast[hidden] { display: none; }

/* the shell is the material of the dialog; it is the part that later becomes the toast */
.dialog__shell {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: calc(20 * var(--u));
  overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #fcfcfd 100%);
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 1px rgba(17, 19, 25, 0.05),
    0 calc(10 * var(--u)) calc(20 * var(--u)) calc(-8 * var(--u)) rgba(17, 19, 25, 0.18),
    0 calc(36 * var(--u)) calc(70 * var(--u)) calc(-18 * var(--u)) rgba(17, 19, 25, 0.42);
}

/* the dark of the toast, coming up while the shell shrinks */
.dialog__dark {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1d2027, var(--toast));
  opacity: 0;
}

/* a red light in the corner that grows as the name is typed */
.dialog__glow {
  position: absolute;
  left: -30%;
  top: -55%;
  width: 110%;
  height: 110%;
  background: radial-gradient(closest-side, rgba(229, 72, 77, 0.16), rgba(229, 72, 77, 0) 72%);
  opacity: 0;
}

.dialog__body {
  position: relative;
  padding: clamp(calc(14 * var(--u)), 3.6vh, calc(22 * var(--u))) clamp(calc(16 * var(--u)), 4.6vw, calc(24 * var(--u))) clamp(calc(14 * var(--u)), 3.4vh, calc(20 * var(--u)));
}

.dialog__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.badge {
  width: clamp(calc(32 * var(--u)), 7vh, calc(40 * var(--u)));
  height: clamp(calc(32 * var(--u)), 7vh, calc(40 * var(--u)));
  border-radius: calc(12 * var(--u));
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fff4f4, #ffe9e9);
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.2), 0 0 0 calc(5 * var(--u)) rgba(229, 72, 77, 0.05);
  color: var(--red);
}

.badge svg {
  width: 56%;
  height: 56%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.x {
  width: calc(30 * var(--u));
  height: calc(30 * var(--u));
  margin: calc(-4 * var(--u)) calc(-6 * var(--u)) 0 0;
  border: 0;
  border-radius: calc(9 * var(--u));
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.x svg {
  width: calc(15 * var(--u));
  height: calc(15 * var(--u));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

@media (hover: hover) {
  .x:hover { background: var(--well); color: var(--ink); }
}

.dialog__title {
  margin: clamp(calc(8 * var(--u)), 2vh, calc(14 * var(--u))) 0 calc(4 * var(--u));
  font-size: clamp(calc(16 * var(--u)), 1.4vw + calc(10 * var(--u)), calc(18 * var(--u)));
  font-weight: 660;
  letter-spacing: -0.012em;
}

.dialog__text {
  margin: 0;
  font-size: clamp(calc(12.5 * var(--u)), 0.4vw + calc(11 * var(--u)), calc(13.5 * var(--u)));
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.dialog__text strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- the field */
.confirm__label {
  display: block;
  margin: clamp(calc(10 * var(--u)), 2.6vh, calc(18 * var(--u))) 0 calc(7 * var(--u));
  font-size: calc(12.5 * var(--u));
  font-weight: 540;
  color: var(--ink);
}

.confirm__label code {
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: calc(12 * var(--u));
  padding: 1px calc(5 * var(--u));
  border-radius: calc(5 * var(--u));
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line);
}

.confirm {
  position: relative;
  height: clamp(calc(40 * var(--u)), 9vh, calc(46 * var(--u)));
  border-radius: calc(11 * var(--u));
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 2px rgba(17, 19, 25, 0.04);
  transition: box-shadow 0.25s, background-color 0.25s;
}

.confirm.is-focus {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(20, 22, 27, 0.32), 0 0 0 calc(4 * var(--u)) rgba(20, 22, 27, 0.06);
}

.confirm.is-wrong {
  background: #fff7f7;
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.7), 0 0 0 calc(4 * var(--u)) rgba(229, 72, 77, 0.12);
}

.confirm.is-match {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(20, 22, 27, 0.5), 0 0 0 calc(4 * var(--u)) rgba(229, 72, 77, 0.1);
}

.confirm__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 calc(14 * var(--u));
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: calc(15 * var(--u));
  outline: none;
  z-index: 2;
}

.confirm__input::selection { background: rgba(229, 72, 77, 0.18); }

.confirm__glyphs {
  position: absolute;
  left: calc(14 * var(--u));
  top: 50%;
  translate: 0 -50%;
  display: flex;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: calc(15 * var(--u));
  line-height: 1;
  pointer-events: none;
  white-space: pre;
}

.g {
  position: relative;
  display: inline-block;
  width: 1.02ch;
  margin-right: 0.08ch;
  height: 1.4em;
}

.g__ghost,
.g__ink {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-style: normal;
}

.g__ghost { color: var(--faint); }

.g__ink {
  color: var(--ink);
  font-weight: 600;
  opacity: 0;
}

.g__ink.is-wrong { color: var(--red); }

/* the short line under every letter, it fills when the letter is right */
.g__seat {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: calc(-3 * var(--u));
  height: 1.5px;
  border-radius: 2px;
  background: rgba(20, 22, 27, 0.12);
}

.g__seat::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ink);
  transform: scaleX(var(--s, 0));
  transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.g.is-wrong .g__seat::after {
  background: var(--red);
}

.confirm__caret {
  position: absolute;
  left: calc(14 * var(--u));
  top: 50%;
  width: 1.5px;
  height: calc(18 * var(--u));
  margin-top: calc(-9 * var(--u));
  border-radius: 1px;
  background: var(--red);
  opacity: 0;
  pointer-events: none;
}

.confirm__ok {
  position: absolute;
  right: calc(12 * var(--u));
  top: 50%;
  width: calc(18 * var(--u));
  height: calc(18 * var(--u));
  margin-top: calc(-9 * var(--u));
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.confirm__hint {
  min-height: calc(16 * var(--u));
  margin: calc(5 * var(--u)) 0 0;
  font-size: calc(11.5 * var(--u));
  color: var(--red);
  opacity: 0;
}

/* ---------------------------------------------------------------- the buttons */
.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: calc(8 * var(--u));
  margin-top: clamp(calc(6 * var(--u)), 1.6vh, calc(12 * var(--u)));
}

.ghost {
  height: calc(40 * var(--u));
  padding: 0 calc(15 * var(--u));
  border: 0;
  border-radius: calc(11 * var(--u));
  background: #fff;
  font-size: calc(13.5 * var(--u));
  font-weight: 560;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgba(17, 19, 25, 0.05);
  transition: background-color 0.2s;
}

@media (hover: hover) {
  .ghost:hover { background: var(--well); }
}

.del {
  --p: 0;
  position: relative;
  height: calc(40 * var(--u));
  padding: 0 calc(16 * var(--u)) 0 calc(13 * var(--u));
  border: 0;
  border-radius: calc(11 * var(--u));
  overflow: hidden;
  isolation: isolate;
  background: var(--red-soft);
  font-size: calc(13.5 * var(--u));
  font-weight: 620;
  cursor: not-allowed;
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.22);
}

.del.is-armed {
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(150, 20, 26, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 1px 2px rgba(200, 51, 58, 0.3),
    0 calc(8 * var(--u)) calc(22 * var(--u)) calc(-6 * var(--u)) rgba(229, 72, 77, 0.55);
}

/* the red fills from the left; its leading edge is a soft line of light */
.del__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #ef5a5f 0%, var(--red) 45%, var(--red-deep) 100%);
  transform-origin: left center;
  transform: scaleX(var(--p));
}

.del__fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
  opacity: calc(1 - var(--p) * var(--p) * var(--p));
}

/* a streak of light that runs across the button once it is armed */
.del__shine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.42) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-10%) skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.del__label {
  display: inline-flex;
  align-items: center;
  gap: calc(7 * var(--u));
  white-space: nowrap;
}

.del__label--off { color: rgba(229, 72, 77, 0.62); }

/* the white words are the same words, cut to the part of the button already red */
.del__label--on {
  position: absolute;
  left: calc(13 * var(--u));
  top: 50%;
  translate: 0 -50%;
  color: #fff;
  clip-path: inset(calc(-4 * var(--u)) calc(100% - var(--cut, 0px)) calc(-4 * var(--u)) calc(-4 * var(--u)));
}

.bin {
  width: calc(17 * var(--u));
  height: calc(17 * var(--u));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

/* ---------------------------------------------------------------- the toast */
.toast-slot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(calc(6 * var(--u)), 3vh, calc(22 * var(--u)));
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: calc(9 * var(--u));
  height: calc(46 * var(--u));
  padding: 0 calc(6 * var(--u)) 0 calc(14 * var(--u));
  border-radius: calc(14 * var(--u));
  overflow: hidden;
  white-space: nowrap;
  color: #f2f3f5;
  font-size: calc(13.5 * var(--u));
  font-weight: 560;
  background: linear-gradient(180deg, #1d2027, var(--toast));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 calc(12 * var(--u)) calc(28 * var(--u)) calc(-10 * var(--u)) rgba(17, 19, 25, 0.55),
    0 2px calc(6 * var(--u)) rgba(17, 19, 25, 0.2);
}

.toast__icon svg {
  display: block;
  width: calc(19 * var(--u));
  height: calc(19 * var(--u));
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast__icon circle { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1.4; }

.toast__icon path {
  stroke: #ff8a8d;
  stroke-width: 1.9;
}

.toast__dot { color: rgba(255, 255, 255, 0.35); }

.toast__undo {
  display: inline-flex;
  align-items: center;
  gap: calc(6 * var(--u));
  height: calc(34 * var(--u));
  padding: 0 calc(11 * var(--u)) 0 calc(9 * var(--u));
  border: 0;
  border-radius: calc(10 * var(--u));
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: calc(13.5 * var(--u));
  font-weight: 620;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: background-color 0.2s;
}

.toast__undo svg {
  width: calc(14 * var(--u));
  height: calc(14 * var(--u));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast__undo.is-hover { background: rgba(255, 255, 255, 0.16); }

@media (hover: hover) {
  .toast__undo:hover { background: rgba(255, 255, 255, 0.16); }
}

/* the time left to undo, draining along the bottom edge */
.toast__drain {
  position: absolute;
  left: calc(14 * var(--u));
  right: calc(14 * var(--u));
  bottom: 0;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 138, 141, 0), #ff8a8d 30%, #ff8a8d);
  transform-origin: left center;
  opacity: 0.8;
}

/* ---------------------------------------------------------------- the morph: the shell becomes the toast */
.dialog.is-morph .dialog__shell { will-change: left, top, width, height; }

@media (max-width: 420px) {
  .panel__row { flex-wrap: wrap; }
  .open { width: 100%; justify-content: center; }
  .dialog__text { font-size: calc(12.5 * var(--u)); line-height: 1.45; }
}

@media (max-height: 470px) {
  .panel__crumb { display: none; }
  .dialog__text { line-height: 1.4; }
}
