/* The login form with tightening screws: a hairline card on a white page, four steel cross-head screws in its
   corners and one accent for the focus, the error and the tick. The words are Archivo, whose width moves under the
   pointer. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --ink: #171614;           /* the words and the button */
  --muted: #8a867e;         /* the small lines and the labels */
  --line: #e4e1da;          /* the card outline and the field lines at rest */
  --accent: #e2522c;        /* the focus line, the error and the tick */
  --shadow: 23 20 14;       /* the colour of the soft shadows, as r g b */
}

* {
  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: 'Archivo Variable', 'Archivo', system-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: 24px 16px;
}

/* the panel: GSAP moves it (the seat and the tremble), the shadow lives on the CSS of the same element */
.panel {
  position: relative;
  width: min(328px, 100%);
  padding: clamp(22px, 5.2vh, 34px) clamp(22px, 7vw, 34px) clamp(20px, 4.6vh, 30px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow:
    0 1px 0 rgb(var(--shadow) / 0.03),
    0 10px 30px -14px rgb(var(--shadow) / 0.22),
    0 2px 6px -3px rgb(var(--shadow) / 0.08);
}

/* ---------------------------------------------------------------- the screws */
.screw {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: auto;
}

.screw--tl { top: 12px; left: 12px; }
.screw--tr { top: 12px; right: 12px; }
.screw--bl { bottom: 12px; left: 12px; }
.screw--br { bottom: 12px; right: 12px; }

/* the recess the screw sits in: a faint ring printed in the card */
.screw::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  box-shadow: inset 0 1px 1.5px rgb(var(--shadow) / 0.16), 0 0.5px 0 #ffffff;
  background: #f3f1ec;
}

.screw__shadow {
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  background: rgb(var(--shadow) / 0.34);
  filter: blur(1.6px);
  transform-origin: 50% 50%;
}

.screw__head {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ---------------------------------------------------------------- the words */
.panel__body {
  display: grid;
}

.brand {
  margin: 0 0 clamp(10px, 2.4vh, 18px);
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.title {
  margin: 0;
  font-size: clamp(24px, 6.4vh, 30px);
  line-height: 1;
  font-weight: 620;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.02em;
  text-align: center;
}

.sub {
  margin: 8px 0 clamp(14px, 3.6vh, 26px);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ---------------------------------------------------------------- the fields */
.field {
  position: relative;
  display: grid;
  margin-bottom: clamp(10px, 2.6vh, 18px);
}

.field__label {
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 0.25s ease;
}

.field__box {
  position: relative;
  display: flex;
  align-items: center;
}

.field__input {
  width: 100%;
  min-width: 0;
  padding: 8px 0 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.field__input::placeholder {
  color: #c2beb5;
}

.field[data-field='pass'] .field__input {
  padding-right: 34px;
}

/* the line under a field: a hairline, and over it the accent that grows from the left with the focus */
.field__line {
  position: relative;
  height: 1px;
  background: var(--line);
}

.field__line > span {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1), background-color 0.25s ease;
}

.field.is-focus .field__line > span {
  transform: scaleX(1);
}

.field.is-focus .field__label {
  color: var(--ink);
}

.field.is-bad .field__line > span {
  transform: scaleX(1);
  background: var(--accent);
}

.field.is-bad .field__label {
  color: var(--accent);
}

.field__msg {
  height: 0;
  overflow: hidden;
  font-size: 11.5px;
  color: var(--accent);
  opacity: 0;
}

/* the eye that shows the password */
.eye {
  position: absolute;
  right: -4px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.eye svg {
  width: 19px;
  height: 19px;
  overflow: visible;
}

.eye__lid,
.eye__slash {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eye__ball {
  fill: currentColor;
}

.eye:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: -2px;
}

/* ---------------------------------------------------------------- the button */
.go {
  position: relative;
  margin-top: clamp(4px, 1.6vh, 10px);
  height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.go__bg {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 6px 16px -10px rgb(var(--shadow) / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.12);
}

.go__text {
  position: relative;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variation-settings: 'wdth' var(--w, 100);
}

.go:focus-visible {
  outline: 0;
}

.go:focus-visible .go__bg {
  outline: 1.5px solid var(--ink);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- signed in */
.done {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  text-align: center;
  pointer-events: none;
  visibility: hidden;
}

.done__tick {
  width: 46px;
  height: 46px;
  margin-bottom: 8px;
  overflow: visible;
}

.done__tick circle,
.done__tick path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.done__tick circle {
  stroke: var(--line);
}

.done__title {
  margin: 0;
  font-size: 24px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.done__sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

@media (hover: hover) {
  .eye:hover {
    color: var(--ink);
  }
}
