/* The palette is the landing page's, which is taken from the logo: blue, gold, cyan.
   The two sites are read one after the other, so they should look like one thing. */
:root {
  --bg: #040a18;
  --bg-2: #071229;
  --surface: rgba(15, 37, 82, .35);
  --surface-solid: #0a1734;
  --border: rgba(110, 160, 255, .14);
  --border-strong: rgba(110, 160, 255, .3);
  --text: #e8eefc;
  --muted: #8ea2c9;
  --blue: #1f6bff;
  --blue-2: #3d8bff;
  --navy: #0f3d82;
  --cyan: #38d6ff;
  --gold: #ffc531;
  --gold-2: #ffdf7a;
  --ok: #3ddc97;
  --bad: #ff7a7a;
  --radius: 18px;
  --font-head: "Poppins", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

/* A `display` of our own outranks the browser's rule for [hidden], so an element that
   is meant to be absent renders as an empty box until this puts it back. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* The glow sits behind everything and does not scroll with the content: a faucet is one
   screen, and a background that moves draws the eye away from the single field. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(760px 480px at 50% -8%, rgba(31, 107, 255, .34), transparent 70%),
    radial-gradient(520px 340px at 84% 22%, rgba(255, 197, 49, .10), transparent 70%),
    radial-gradient(640px 420px at 12% 12%, rgba(15, 61, 130, .45), transparent 70%),
    var(--bg);
}

a { color: inherit; }

/* ---------- header ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 4vw, 2.25rem);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .3px;
}

/* bkc-icon.png is square; bkc-logo.png is 724x360 and gets squashed by a square box. */
.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.brand .thin {
  font-weight: 500;
  color: var(--muted);
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 500;
  transition: color .2s;
}

nav a:hover { color: var(--text); }

/* ---------- main ---------- */

/* Two columns where there is room: the page is one screen's worth of content, and a
   single narrow column pushed half of it below the fold while the width sat empty. */
main {
  flex: 1;
  width: min(100% - 2.5rem, 1040px);
  margin: 0 auto;
  /* Padding that answers to the viewport's height, not its width: what decides whether
     this page fits on one screen is how tall the screen is, and a short wide laptop was
     reserving a desktop's worth of margin it did not have. */
  padding: clamp(1rem, 3vh, 2.75rem) 0 clamp(1rem, 2.5vh, 1.75rem);
  display: grid;
  gap: 1.75rem;
  /* Centred in the space between header and footer, so a short page sits in the middle
     rather than clinging to the top with a hole beneath it. `safe` keeps the top
     reachable when the content is taller than the screen, which it is on a phone. */
  align-content: safe center;
}

@media (min-width: 900px) {
  main {
    grid-template-columns: 1fr 1fr;
    gap: 2rem 3rem;
  }

  .intro { grid-column: 1; align-self: center; }
  form { grid-column: 2; }
  output { grid-column: 2; }

  /* Across the foot of both columns: four short fields read better side by side than
     stacked beside the form, which left one column twice the height of the other. */
  .network { grid-column: 1 / -1; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .85rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
}

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, .18);
}

h1 {
  margin: 0 0 .55rem;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -.02em;
}

/* The logo's gold runs through the word it names. */
.accent {
  background: linear-gradient(100deg, var(--gold) 0%, var(--gold-2) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

/* ---------- form ---------- */

form {
  position: relative;
  padding: 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20, 50, 110, .45), rgba(8, 20, 48, .55));
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9);
}

/* A hairline of the brand gradient along the top edge, instead of a coloured border all
   the way round, which would fight the field inside it. */
form::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, var(--blue-2) 20%, var(--cyan) 50%, var(--gold) 80%, transparent);
  opacity: .8;
}

label {
  display: block;
  margin-bottom: .55rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .95rem;
}

input {
  width: 100%;
  padding: .9rem 1.05rem;
  background: rgba(4, 10, 24, .75);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  font: 400 .95rem/1.4 var(--font-mono);
  transition: border-color .2s, box-shadow .2s;
}

input::placeholder { color: #5f7098; }

input:focus {
  outline: none;
  border-color: var(--blue-2);
  box-shadow: 0 0 0 4px rgba(31, 107, 255, .18);
}

.hint {
  margin: .65rem 0 1.4rem;
  color: var(--muted);
  font-size: .85rem;
}

button {
  width: 100%;
  padding: .95rem 1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #1a1300;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  box-shadow: 0 10px 34px -10px rgba(255, 197, 49, .55);
  transition: transform .2s, box-shadow .2s, filter .2s;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -12px rgba(255, 197, 49, .7);
}

button:disabled {
  filter: grayscale(.35);
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(26, 19, 0, .25);
  border-top-color: #1a1300;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  button:hover:not(:disabled) { transform: none; }
}

/* Turnstile renders its own box; this only makes room for it. */
#captchaBox { margin-bottom: 1.25rem; }

/* ---------- result ---------- */

output {
  display: block;
  margin: 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 12px;
  background: var(--surface-solid);
  font-size: .95rem;
  overflow-wrap: anywhere;
}

output.ok { border-left-color: var(--ok); }
output.bad { border-left-color: var(--bad); }

output code {
  font-family: var(--font-mono);
  font-size: .85em;
  color: var(--cyan);
}

output a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
}

output a:hover { text-decoration: underline; }

/* ---------- network details ---------- */

.network {
  padding: 1.15rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.network h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
}

.network .sub {
  margin: .25rem 0 .95rem;
  color: var(--muted);
  font-size: .85rem;
}

.network dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .9rem 1.25rem;
  margin: 0;
}

.network dt {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.network dd { margin: .3rem 0 0; }

/* Each value is a button because the only reason to show it is to copy it. */
.copy {
  width: 100%;
  padding: .55rem .7rem;
  background: rgba(4, 10, 24, .6);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font: 400 .8rem/1.4 var(--font-mono);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  /* One line, clipped if it has to be: the value is copied by clicking, not read off the
     screen, and a wrapping cell makes the row taller than the one beside it. */
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color .2s, color .2s;
}

.copy:hover {
  border-color: var(--border-strong);
  transform: none;
  box-shadow: none;
}

.copy::after {
  content: " ⧉";
  color: var(--muted);
}

.copy[data-copied]::after {
  content: " copied";
  color: var(--ok);
  font-size: .78em;
}

/* The explorer is a destination rather than a value to paste, so it is a link -- and it
   reads whole instead of being clipped like the endpoints beside it. */
.network .out {
  display: inline-block;
  padding: .55rem 0;
  color: var(--cyan);
  font: 400 .8rem/1.4 var(--font-mono);
  text-decoration: none;
}

.network .out::after { content: " ↗"; }

.network .out:hover { text-decoration: underline; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
}

footer p {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}

/* ---------- short screens ---------- */

/* This is meant to be one screen, and on a laptop the captcha widget is the difference
   between fitting and not. Only padding gives way: every field stays, and so does every
   type size, so the page reads the same -- just tighter. Two steps, 850px and 770px. */
@media (max-height: 850px) {
  main { gap: 1.2rem 3rem; }
  .badge { margin-bottom: .55rem; }
  form { padding: 1.25rem; }
  .hint { margin: .5rem 0 .85rem; }
  #captchaBox { margin-bottom: .85rem; }
  button { padding: .8rem 1rem; }
  .network { padding: .95rem 1.2rem; }
  .network .sub { margin: .2rem 0 .7rem; }
  .network dl { gap: .65rem 1.25rem; }
}

@media (max-height: 770px) {
  main { gap: .9rem 3rem; }
  form { padding: 1rem 1.25rem; }
  .hint { margin: .45rem 0 .6rem; }
  #captchaBox { margin-bottom: .6rem; }
  .network { padding: .8rem 1.2rem; }
  .copy { padding: .45rem .7rem; }
  .network .out { padding: .45rem 0; }
}
