/* The Bio field of a profile, alone on white. The box is one element moved by GSAP (the tremor); its ring, edge and
   colours live in CSS on classes. The extra letters are marked in a mirror laid exactly under the transparent
   textarea, with the same type, padding and wrapping. A GSAP element never has a transform in the CSS. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #17171c;           /* the text and the label */
  --muted: #8d8c96;         /* the note, the hint, the counter at rest */
  --line: #e3e2e8;          /* the box edge at rest */
  --line-hover: #c9c8d1;    /* the box edge under the pointer */
  --track: #ecebf0;         /* the ring track */
  --ring: #2b2a33;          /* the ring while there is room */
  --warn: #d98a06;          /* the ring near the end */
  --over: #e0453a;          /* past the limit: ring, number, marks, hint */
  --button: #17171c;        /* the Save button */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.bio {
  width: min(400px, calc(100vw - 32px));
  display: grid;
}

.bio__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 2px 9px;
}

.bio__label {
  font-size: 13.5px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: 0.005em;
}

.bio__note { font-size: 12px; font-weight: 450; color: var(--muted); }

/* ---- the box ---- */
.box {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfbfc, #ffffff 30%);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 1px rgba(20, 20, 30, 0.035),
    0 2px 6px -2px rgba(20, 20, 30, 0.06);
  transition: border-color 0.12s, box-shadow 0.12s;
  cursor: text;
}

.box__ring {
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(23, 23, 28, 0.07);
  opacity: 0;
  transition: opacity 0.2s, box-shadow 0.3s;
}

@media (hover: hover) {
  .box:hover { border-color: var(--line-hover); }
  .save:not(:disabled):hover .save__face { background: #2a2a31; box-shadow: 0 1px 0 rgba(255,255,255,0.14) inset, 0 6px 14px -6px rgba(20, 20, 30, 0.45); }
}

.box.is-focus { border-color: #9f9ea8; }
.box.is-focus .box__ring { opacity: 1; }
.box.is-over { border-color: var(--over); transition: border-color 0.3s, box-shadow 0.3s; }
.box.is-over .box__ring { opacity: 1; box-shadow: 0 0 0 3px rgba(224, 69, 58, 0.1); }

.box__area { position: relative; }

/* the textarea and its mirror share every measure */
.txt, .mirror {
  display: block;
  width: 100%;
  padding: 14px 16px 6px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 450;
  line-height: 23px;
  letter-spacing: 0.002em;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  tab-size: 4;
}

.txt {
  position: relative;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--ink);
  caret-color: var(--ink);
  min-height: calc(23px * 4 + 20px);
}

.txt::placeholder { color: #c1c0c8; }

.mirror {
  position: absolute;
  inset: 0;
  color: transparent;
  pointer-events: none;
  overflow: hidden;
}

/* the extra letters: a soft red mark behind them, drawn in the mirror */
.mirror mark {
  color: transparent;
  background: rgba(224, 69, 58, 0.16);
  border-radius: 3px;
  box-shadow: 0 1.5px 0 rgba(224, 69, 58, 0.55);
}

.box__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 10px 10px 16px;
  height: 44px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 450;
  color: #a9a8b1;
}

.chip svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the ring counter ---- */
.meter {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

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

.meter__track { fill: none; stroke: var(--track); stroke-width: 2.2; }

.meter__arc {
  fill: none;
  stroke: var(--ring);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.meter__num {
  position: relative;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--warn);
  opacity: 0;
}

/* ---- under the box ---- */
.bio__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 0;
}

.hint {
  position: relative;
  height: 18px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 450;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.hint__line { display: block; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint.is-over { color: var(--over); }

.save {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  flex: none;
}

.save:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.save:disabled { cursor: default; }

.save__face {
  position: relative;
  display: grid;
  place-items: center;
  height: 40px;
  min-width: 92px;
  padding: 0 20px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--button);
  color: #fff;
  font-size: 14px;
  font-weight: 560;
  font-stretch: 104%;
  box-shadow: 0 1px 0 rgba(255,255,255,0.14) inset, 0 4px 10px -6px rgba(20, 20, 30, 0.5);
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}

.save:disabled .save__face { background: #f1f0f4; color: #b4b3bc; box-shadow: 0 0 0 1px #e6e5ea inset; }

.save.is-saving .save__face { background: var(--button); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,0.14) inset, 0 4px 10px -6px rgba(20, 20, 30, 0.5); }

.save__label, .save__done { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.save__done { opacity: 0; }
.save__done svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* a thin light that crosses the button once it is saved */
.save__sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  opacity: 0;
  pointer-events: none;
}

/* the drawn pointer of the autopilot */
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

.ghost path { fill: #17171c; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }

@media (max-width: 480px) {
  .txt, .mirror { font-size: 16px; padding: 12px 14px 4px; }
  .box__foot { padding: 0 8px 8px 14px; }
}
