/* The turnstile button: a graphite pill on a black page, with the head of a tripod turnstile in its round left end and
   a card reader of dark glass in its right end. The arms, the hub and their shadows are drawn by script.js on a canvas
   (their colours come from here); the pill, the words, the reader and the pass are CSS. */
:root {
  --page: #000000;          /* the page */
  --pill: #1f2226;          /* the pill, at its top */
  --pill-deep: #111316;     /* the pill, at its foot */
  --socket: #07080a;        /* the round socket the turnstile's head turns in */
  --ink: #f1efe9;           /* the words */
  --muted: #8b9199;         /* the small words, and the words while it works */
  --steel-light: #f7f9fb;   /* the arms, where the light catches them */
  --steel: #a9b0b8;         /* the arms */
  --steel-dark: #3c4249;    /* the arms, on their dark side */
  --glass: #0b0d10;         /* the reader's glass */
  --read: #ffb24a;          /* the reader's waves, while it reads the pass */
  --go: #52d08f;            /* the arrow that lets you through */
  --pass: #f4f1ea;          /* the pass */
  --pass-band: #e2563f;     /* the band printed on the pass */
  --focus: #f1efe9;         /* the ring of the keyboard's focus */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
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', 'Mona Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* the room above the pill is where the pass comes down to the reader */
.gate {
  position: relative;
  display: grid;
  justify-items: center;
  padding-top: 36px;
}

/* ---------------------------------------------------------------- the pill */
.gate__btn {
  position: relative;
  display: block;
  /* the script sets the width from the words; this is the width before it does */
  width: 210px;
  max-width: calc(100vw - 32px);
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.gate__btn[aria-disabled='true'] {
  cursor: progress;
}

/* the fill is a layer of its own, so it can swell past the pill with a bounce without moving anything */
.gate__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(80% 140% at 30% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
    linear-gradient(180deg, var(--pill), var(--pill-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: inset 0.6s cubic-bezier(0.34, 1.9, 0.45, 1), box-shadow 0.4s ease;
}

.gate__btn:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 5px;
}

html[data-using='pointer'] .gate__btn:focus-visible {
  outline: none;
}

/* the canvas covers the round left end of the pill, and a little more: the arms reach out of their socket */
.gate__rotor {
  position: absolute;
  left: 0;
  top: -6px;
  width: 84px;
  height: 72px;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the words */
.gate__faces {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 78px;
  right: 60px;
  pointer-events: none;
}

.gate__face {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: max-content;
  display: flex;
  align-items: center;
  text-align: left;
  white-space: nowrap;
}

.gate__face--busy,
.gate__face--done {
  opacity: 0;
  visibility: hidden;
}

/* the words at rest widen on the typeface's width axis under the pointer; the wide copy, invisible and zero high,
   holds their room, so the pill never changes size */
.gate__word {
  display: inline-grid;
  padding-bottom: 1px;
  font-size: 17px;
  font-weight: 620;
  font-stretch: 100%;
  letter-spacing: -0.008em;
  line-height: 1;
  transition: font-stretch 0.6s cubic-bezier(0.34, 1.9, 0.45, 1), font-weight 0.6s cubic-bezier(0.34, 1.9, 0.45, 1);
}

.gate__word::before {
  content: attr(data-wide);
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 118%;
  font-weight: 680;
}

/* while it works: the words in a quieter tone, with a sheen running through them */
.gate__shine,
.gate__gone {
  padding-bottom: 1px;
  font-size: 17px;
  font-weight: 560;
  letter-spacing: -0.004em;
  line-height: 1;
  color: var(--muted);
}

.gate__shine {
  background: linear-gradient(100deg, var(--muted) 0%, var(--muted) 38%, var(--ink) 50%, var(--muted) 62%, var(--muted) 100%);
  background-size: 260% 100%;
  background-position: var(--sheen, 100%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* signed in: a small line over the name, and the little Log out pill */
.gate__face--done {
  gap: 14px;
}

.gate__who {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.gate__lead {
  font-size: 11.5px;
  font-weight: 520;
  letter-spacing: 0.012em;
  line-height: 1;
  color: var(--muted);
}

.gate__name {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 660;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.gate__out {
  flex: none;
  display: grid;
  place-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(241, 239, 233, 0.09);
  box-shadow: inset 0 0 0 1px rgba(241, 239, 233, 0.12);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* ---------------------------------------------------------------- the reader */
.gate__reader {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 46%),
    var(--glass);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 2px 5px rgba(0, 0, 0, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.gate__waves,
.gate__arrow {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 24px;
  height: 24px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gate__waves {
  stroke: var(--muted);
  stroke-width: 1.8;
  opacity: 0.75;
}

.gate__arrow {
  stroke: var(--go);
  stroke-width: 2.4;
  opacity: 0;
  visibility: hidden;
}

/* ---------------------------------------------------------------- the pass */
.gate__pass {
  position: absolute;
  right: 14px;
  top: 55px;
  z-index: 2;
  width: 32px;
  height: 21px;
  border-radius: 3.5px;
  background: linear-gradient(150deg, #ffffff, var(--pass) 55%, #ddd8cd);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 6px 14px -4px rgba(0, 0, 0, 0.7),
    0 1px 2px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
}

.gate__band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: var(--pass-band);
}

.gate__chip {
  position: absolute;
  left: 4px;
  top: 8.5px;
  width: 6.5px;
  height: 5px;
  border-radius: 1.2px;
  background: linear-gradient(135deg, #f3d58b, #b88a34);
}

.gate__lines {
  position: absolute;
  left: 13px;
  right: 4px;
  top: 9px;
  height: 6px;
  background:
    linear-gradient(rgba(40, 40, 40, 0.55), rgba(40, 40, 40, 0.55)) 0 0 / 100% 1.4px no-repeat,
    linear-gradient(rgba(40, 40, 40, 0.3), rgba(40, 40, 40, 0.3)) 0 4px / 66% 1.4px no-repeat;
}

/* ---------------------------------------------------------------- under the pointer */
@media (hover: hover) and (pointer: fine) {
  .gate__btn:not([aria-disabled='true']):hover .gate__fill {
    inset: -2px -7px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      inset 0 -1px 0 rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(255, 255, 255, 0.09);
  }

  .gate__btn:not([aria-disabled='true']):hover .gate__word {
    font-stretch: 118%;
    font-weight: 680;
  }

  .gate__btn:not([aria-disabled='true']):hover .gate__out {
    background: rgba(241, 239, 233, 0.16);
    box-shadow: inset 0 0 0 1px rgba(241, 239, 233, 0.22);
  }
}

/* the keys bring the focus: the words widen as under the pointer */
html[data-using='keys'] .gate__btn:focus-visible .gate__word {
  font-stretch: 118%;
  font-weight: 680;
}

/* ---------------------------------------------------------------- reduced motion: no swelling, no widening */
@media (prefers-reduced-motion: reduce) {
  .gate__fill,
  .gate__word {
    transition: box-shadow 0.3s ease, filter 0.3s ease;
  }

  html[data-using='keys'] .gate__btn:focus-visible .gate__word {
    font-stretch: 100%;
    font-weight: 620;
  }
}

@media (prefers-reduced-motion: reduce) and (hover: hover) and (pointer: fine) {
  .gate__btn:not([aria-disabled='true']):hover .gate__fill {
    inset: 0;
    filter: brightness(1.25);
  }

  .gate__btn:not([aria-disabled='true']):hover .gate__word {
    font-stretch: 100%;
    font-weight: 620;
  }
}
