/* ---------------------------------------------------------------
   CONNECTING YOUR TOOLING — the </> button and its panel
   ---------------------------------------------------------------
   Its own stylesheet for the same reason connect.ts is its own script: two
   pages want it, and it was living in one of them.

   All of this used to sit in terminal.css, which the deck loads and the
   new-truth page does not. So the button there rendered as a bare browser
   button, and the panel — appended to the end of the body and never told to
   be a centred fixed dialog — laid out as a plain block at the bottom of a
   long form. Focusing it then scrolled the page to it, and clicking the
   connector "just took you to the bottom of the page".

   A stylesheet that only one of two pages loads is not a small oversight
   here; it is the difference between a dialog and a scroll.
   --------------------------------------------------------------- */

/* The connector.

   It was faint text in a faint border, which on a pointer is a thing you
   discover by hovering and on a phone is a thing that never looks like
   anything at all. There is no hover on a phone, so the resting state has to
   carry the whole message: this is a control, and it is the developer one.

   So it wears the accent at rest, and it answers a press. A tap that changes
   nothing under your finger reads as a dead button even when the panel it
   opened is sitting behind your hand. */
.tokenBtn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--accent-ink);
  cursor: pointer;
  font: 700 10px/1 var(--mono);
  letter-spacing: .1em;
  transition: background 200ms var(--ease), border-color 200ms var(--ease),
              color 200ms var(--ease), transform 90ms var(--ease);
}
.tokenBtn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
}
/* The press, which is the only feedback a finger gets. */
.tokenBtn:active {
  transform: scale(.93);
  background: color-mix(in srgb, var(--accent) 26%, var(--panel));
}
.tokenBtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* While its panel is open, so a second tap reads as closing the thing you
   opened rather than as the same button doing nothing twice. */
.tokenBtn.is-open {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 24%, var(--panel));
}

.tokenPanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 420;
  width: min(560px, calc(100vw - 32px));
  /* It grows when the steps appear, and a phone held sideways is not tall.
     Capped and scrolled rather than allowed to run off both ends, because a
     dialog whose close button is off screen is a trap. */
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 40px 90px -30px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tokenPanel__head { display: flex; align-items: center; gap: 14px; }

.tokenPanel__title {
  font: 700 13px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}

.tokenPanel__shut {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-faint);
  padding: 6px 10px;
  cursor: pointer;
  font: 700 9px/1 var(--mono);
  letter-spacing: .12em;
}
.tokenPanel__shut:hover { color: var(--accent); border-color: var(--accent); }

.tokenPanel__why {
  margin: 0;
  font: 400 12px/1.55 var(--sans, inherit);
  color: var(--ink-faint);
}

.tokenPanel__row { display: flex; gap: 9px; }

.tokenPanel__go {
  flex: 1 1 0;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  font: 700 10px/1 var(--mono);
  letter-spacing: .12em;
  transition: opacity 200ms var(--ease);
}
.tokenPanel__go:hover { opacity: .85; }

/* Full access is the sharper choice, so it does not get the inviting fill.
   The recommended one is the one that looks like the button. */
.tokenPanel__go--full {
  background: transparent;
  color: var(--ink-faint);
  border-color: var(--line);
}
.tokenPanel__go--full:hover { color: var(--ink); border-color: var(--ink-faint); }

.tokenPanel__out {
  width: 100%;
  resize: none;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  color: var(--ink);
  font: 500 10.5px/1.5 var(--mono);
  word-break: break-all;
}
.tokenPanel__out:focus { outline: none; border-color: var(--accent); }

/* ---------- connecting your tooling ----------

   The command, under the token it carries. This is the half that was
   missing: a token on its own leaves you to work out the environment
   variable it goes in, the config file it goes in, the path beside it, and
   the name of a server nobody has told you. */
.tokenPanel__cmd {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.tokenPanel__cmd[hidden] { display: none; }

.tokenPanel__out--cmd {
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

.tokenPanel__cmdRow {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.tokenPanel__hint {
  margin: 9px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-faint);
}
.tokenPanel__hint code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--hover-2);
  color: var(--accent-ink);
  font: 600 10.5px/1.5 var(--mono);
}

.tokenPanel__say {
  margin: 0;
  font: 500 11px/1.5 var(--mono);
  color: var(--accent);
  min-height: 16px;
}

/* The armed state of a control that hands out something irreversible. Red
   rather than the accent, because the accent is what every safe button on
   this site already wears. */
.tokenPanel__go--full.is-armed {
  background: #c8322b;
  border-color: #c8322b;
  color: #fff;
}
.tokenPanel__go--full.is-armed:hover { opacity: .9; }

.tokenPanel__say.is-warning {
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #c8322b;
  background: color-mix(in srgb, #c8322b 12%, transparent);
  font: 400 11.5px/1.55 var(--sans, inherit);
}
.tokenPanel__say.is-warning strong { color: #ff6b63; }

/* ---------- phone ----------

   The connector stays. It was dropped below 700px on the reasoning that
   nobody wires up an editor from a phone, which was fair while the panel
   handed over a bare token. It hands over a whole command now, and copying
   that on the phone in your hand to paste at the desk you are walking to is
   exactly what somebody does with it. */
@media (max-width: 700px) {
  .tokenBtn { padding: 7px 10px; }
}


/* ---------- the one button ----------

   One, because the panel used to open on a choice between READ-ONLY and
   FULL ACCESS put to somebody who had not yet been told what either was
   for. The safe one is now simply what the button does. */
.tokenPanel__get {
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--on-accent, #06080e);
  cursor: pointer;
  font: 700 12px/1 var(--mono);
  letter-spacing: .12em;
  transition: opacity 180ms var(--ease), transform 90ms var(--ease);
}
.tokenPanel__get:hover { opacity: .88; }
.tokenPanel__get:active { transform: scale(.985); }
.tokenPanel__get:disabled { opacity: .5; cursor: default; }
.tokenPanel__get:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- then what to do with it ---------- */
.tokenPanel__steps {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.tokenPanel__steps[hidden] { display: none; }

.tokenPanel__step { display: flex; gap: 11px; align-items: flex-start; }

/* The number, so three things read as three things in order rather than as
   a paragraph somebody has to parse into steps. */
.tokenPanel__num {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 20%, var(--hover-2));
  color: var(--accent-ink);
  font: 700 10px/1 var(--mono);
}

.tokenPanel__stepBody {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-dim);
}
.tokenPanel__stepBody code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--hover-2);
  color: var(--accent-ink);
  font: 600 10.5px/1.5 var(--mono);
  word-break: break-all;
}

.tokenPanel__cmdRow {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}
.tokenPanel__cmdRow .tokenPanel__out--cmd { flex: 1 1 auto; min-width: 0; }
.tokenPanel__go--copy { flex: 0 0 auto; align-self: stretch; }

/* ---------- the quiet door ----------

   For somebody who already knows they want a token that can delete things.
   A line rather than a button, because it should not compete with the one
   above it. */
.tokenPanel__more {
  margin-top: 2px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.tokenPanel__more[hidden] { display: none; }

.tokenPanel__link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font: 500 11.5px/1.5 inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.tokenPanel__link:hover { color: var(--ink); text-decoration-color: var(--ink-faint); }
.tokenPanel__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.tokenPanel__link.is-armed {
  color: #ff6b63;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration-color: #ff6b63;
}
