/* The loading skeleton: a profile card on a white page. While it loads every piece is a pale grey bone with one
   glint running across all of them; loaded, the card has a warm cover of hills, a round avatar with initials, the
   words, three numbers and a black Follow button. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #17171b;           /* text, the button */
  --muted: #7c7c86;
  --line: #ececf1;          /* the card's edge */
  --bone: #eeeef2;          /* a bone */
  --glint: #f9f9fb;         /* the glint running across the bones */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

/* quick taps never become a double tap that zooms the page */
html {
  touch-action: manipulation;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Hanken Grotesk Variable', 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: 32px 16px;
}

.profile {
  display: grid;
  justify-items: center;
  gap: 22px;
  width: min(360px, 100%);
}

/* ---------------------------------------------------------------- the card */
.card {
  --b: 0px;                 /* where the glint is, from the card's left edge */
  --cw: 360px;              /* the card's width (the script keeps it) */
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--page);
  box-shadow: 0 1px 2px rgba(23, 23, 27, 0.04), 0 16px 40px -18px rgba(23, 23, 27, 0.18);
}

.card__cover {
  display: block;
  height: 132px;
}

.card__hills {
  display: block;
  width: 100%;
  height: 100%;
}

.card__body {
  padding: 0 22px 22px;
}

.card__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: -38px;
}

.card__avatar {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border: 4px solid var(--page);
  border-radius: 50%;
  background: var(--page);
}

.card__face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffb48f, #e0654c);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.card__follow {
  height: 40px;
  margin-bottom: 4px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.card__follow:focus-visible,
.reload:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.card__name {
  margin: 14px 0 0;
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.card__role {
  margin: 2px 0 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.4;
}

.card__bio {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.5;
}

.card__bio .bone {
  display: block;
  width: fit-content;
}

.card__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.card__stats div {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 2px;
}

.card__stats dt {
  font-size: 13px;
  color: var(--muted);
}

.card__stats dd {
  margin: 0;
  font-size: 19px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the bones: a veil over each piece */
.bone {
  position: relative;
}

span.bone,
dt.bone,
dd.bone {
  display: inline-block;
}

/* the words under a bone are see-through until their turn: their tips would peek out round the veil */
.bone.is-hidden {
  color: transparent;
}

/* the veil: the same moving gradient on every bone, shifted by where the bone is, so the glint is one */
.bone__veil {
  position: absolute;
  inset: 0.2em 0;
  border-radius: 7px;
  background-image: linear-gradient(100deg, var(--bone) 0%, var(--bone) 42%, var(--glint) 50%, var(--bone) 58%, var(--bone) 100%);
  background-size: calc(var(--cw) * 2) 100%;
  background-position: calc(var(--b) - var(--x, 0px) - var(--cw)) 0;
  background-repeat: no-repeat;
  background-color: var(--bone);
  pointer-events: none;
}

/* a pixel bigger than their pieces: on the very same edge, the smoothing would let a hairline of colour through */
.card__cover > .bone__veil,
.card__follow > .bone__veil {
  inset: -1px;
}

.card__cover > .bone__veil {
  border-radius: 0;
}

.card__avatar > .bone__veil {
  inset: -4px;
  border: 4px solid var(--page);
  border-radius: 50%;
}

.card__follow > .bone__veil {
  border-radius: 999px;
}

/* ---------------------------------------------------------------- load again */
.reload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reload svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) and (pointer: fine) {
  .reload:hover {
    background: #f4f4f7;
  }
}
