/* The name to claim: the address of a page claimed on a black page. One field with the address in it, the name
   drawn letter by letter over a real input in Mona Sans, and one colour, a lime that means free. */
:root {
  --page: #000000;          /* the page */
  --ink: #f2f1ec;           /* the letters */
  --muted: #7d7c77;         /* the start of the address, and the words under the field */
  --dim: #3a3936;           /* the edge of the field, and the words waiting in it */
  --box: #0e0e0d;           /* the inside of the field */
  --accent: #d6ff4b;        /* a free name, the caret, and the line under a claimed address */
  --go: #f2f1ec;            /* the button */
  --go-ink: #000000;        /* the button's words */
}

* {
  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: 40px 16px;
}

.claim {
  position: relative;
  width: min(500px, 100%);
  margin: 0;
}

.claim__title {
  margin: 0 0 14px 2px;
  font-size: 14px;
  font-weight: 560;
  font-stretch: 110%;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- the field */
.claim__box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
  padding: 0 8px 0 20px;
  border: 1px solid var(--dim);
  border-radius: 18px;
  background: var(--box);
  transition: border-color 0.25s ease;
}

.claim.is-focus .claim__box {
  border-color: #6b6a65;
}

.claim.is-wrong .claim__box {
  border-color: #6b6a65;
}

.claim__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 100%;
  cursor: text;
  overflow: hidden;
}

.claim__prefix {
  flex: none;
  font-size: 21px;
  font-weight: 460;
  font-stretch: 100%;
  line-height: 1;
  color: var(--muted);
  white-space: pre;
  transition: color 0.5s ease;
}

.claim.is-claimed .claim__prefix {
  color: var(--ink);
}

.claim__slot {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
}

.claim__input {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
  font: 520 21px/62px 'Mona Sans Variable', system-ui, sans-serif;
  font-stretch: 100%;
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

.claim__input::selection {
  background: rgba(214, 255, 75, 0.28);
  color: transparent;
}

/* the letters drawn over the field: every one in its own box, as wide as the letter at rest */
.claim__glyphs {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  pointer-events: none;
}

.g {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  justify-content: center;
  height: 100%;
  font-size: 21px;
  line-height: 62px;
  white-space: pre;
  color: var(--ink);
  will-change: transform;
}

.g > span {
  display: block;
  font-weight: var(--wg, 520);
  font-stretch: calc(var(--wd, 100) * 1%);
}

.claim.is-free .claim__glyphs .g {
  color: var(--accent);
}

.claim.is-taken .claim__glyphs .g {
  color: var(--muted);
}

.claim.is-claimed .claim__glyphs .g {
  color: var(--ink);
}

.claim__hint {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 21px;
  font-weight: 400;
  line-height: 62px;
  color: var(--dim);
  pointer-events: none;
  white-space: pre;
}

/* the line through a name that is taken */
.claim__strike {
  position: absolute;
  left: -2px;
  top: 50%;
  width: 0;
  height: 1.5px;
  margin-top: 1px;
  background: var(--muted);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* while the name is being checked: a short stroke that runs under it */
.claim__sweep {
  position: absolute;
  left: 0;
  bottom: 13px;
  width: 0;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.claim__sweep span {
  position: absolute;
  left: 0;
  top: 0;
  width: 34%;
  height: 100%;
  background: var(--accent);
}

/* the caret of the library's preview, which types without taking the focus */
.claim__caret {
  position: absolute;
  left: 0;
  top: 19px;
  width: 1.5px;
  height: 25px;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.claim__caret.is-on {
  animation: blink 1.06s steps(1) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }

  50.01%,
  100% {
    opacity: 0;
  }
}

/* the line under a claimed address */
.claim__line {
  position: absolute;
  left: 20px;
  bottom: 12px;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the button */
.go {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  height: 46px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--go-ink);
  font: 600 16px/1 'Mona Sans Variable', system-ui, sans-serif;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.go__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--go);
  transition: inset 0.6s cubic-bezier(0.3, 1.7, 0.45, 1), transform 0.16s ease-out, background-color 0.35s ease;
}

.claim.is-free .go__bg {
  background: var(--accent);
}

.go__label {
  position: relative;
  display: block;
  height: 46px;
}

.go__label .g {
  font-size: 16px;
  line-height: 46px;
  color: var(--go-ink);
}

.go__label .g > span {
  font-weight: var(--wg, 620);
}

@media (hover: hover) and (pointer: fine) {
  .go:not([aria-disabled='true']):hover .go__bg {
    inset: -2px -4px;
  }
}

.go:not([aria-disabled='true']):active .go__bg,
.go.is-pressed .go__bg {
  transform: scale(0.95);
}

.go[aria-disabled='true'] {
  cursor: default;
}

.go:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ---------------------------------------------------------------- under the field */
.claim__under {
  min-height: 74px;
  padding: 12px 2px 0;
}

.claim__status {
  position: relative;
  min-height: 20px;
  margin: 0;
  font-size: 14px;
  font-weight: 440;
  line-height: 20px;
  color: var(--muted);
}

.status__line {
  display: block;
}

.status__line.is-going {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  pointer-events: none;
}

.status__line b {
  font-weight: 600;
  color: var(--ink);
}

.status__line.is-free b {
  color: var(--accent);
}

.status__line.is-wrong {
  color: var(--ink);
}

.status__btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 620;
  font-stretch: 100%;
  cursor: pointer;
  transition: font-stretch 0.5s cubic-bezier(0.3, 1.7, 0.45, 1), color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .status__btn:hover {
    font-stretch: 120%;
    color: var(--accent);
  }
}

.status__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* the names offered when the one you want is taken */
.claim__ideas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.idea {
  height: 34px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--dim);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/1 'Mona Sans Variable', system-ui, sans-serif;
  font-stretch: 100%;
  cursor: pointer;
  transition: border-color 0.2s ease, font-stretch 0.5s cubic-bezier(0.3, 1.7, 0.45, 1), color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.idea span {
  color: var(--muted);
}

@media (hover: hover) and (pointer: fine) {
  .idea:hover {
    border-color: var(--accent);
    color: var(--accent);
    font-stretch: 112%;
  }
}

.idea:active {
  transform: scale(0.96);
}

.idea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

@media (max-width: 440px) {
  .claim__box {
    height: 60px;
    padding: 0 7px 0 15px;
    border-radius: 16px;
  }

  .claim__prefix,
  .claim__input,
  .g,
  .claim__hint {
    font-size: 17px;
  }

  .claim__input,
  .g,
  .claim__hint {
    line-height: 58px;
  }

  .claim__caret {
    top: 19px;
    height: 21px;
  }

  .go {
    height: 44px;
    padding: 0 15px;
  }

  .go__label {
    height: 44px;
  }

  .go__label .g {
    font-size: 15px;
    line-height: 44px;
  }

  .claim__line {
    left: 15px;
  }
}
