/* The autosave status badge of a document editor, on white, in the style of clean product interface pieces. */
:root {
  --fondo: #ffffff;            /* the page */
  --pillola: #ffffff;          /* the pill */
  --inchiostro: #18181b;       /* the strong word: Saved, Syncing */
  --testo: #3f3f46;            /* the icon */
  --grigio: #71717a;           /* the soft words: just now, 1 min ago, Saving */
  --bordo: rgba(24, 24, 27, 0.11);
  --accento: #16a34a;          /* the check of Saved */
  --offline: #b45309;          /* text and icon when offline */
  --offline-fondo: #fffbeb;    /* the pill when offline */
  --offline-bordo: rgba(217, 119, 6, 0.32);
  --suggerimento: #18181b;     /* the tooltip */
}

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

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

/* the pill and the room under it for the tooltip, together, so the pair sits in the middle */
.zone {
  position: relative;
  width: min(320px, 100%);
  height: 132px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10px;
}

/* ---------- the pill ---------- */
.badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 11px;
  border: 1px solid var(--bordo);
  border-radius: 999px;
  background: var(--pillola);
  color: var(--testo);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.05), 0 6px 16px -10px rgba(24, 24, 27, 0.22);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.badge.is-hover {
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 10px 22px -10px rgba(24, 24, 27, 0.3);
}
@media (hover: hover) {
  .badge:hover { box-shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 10px 22px -10px rgba(24, 24, 27, 0.3); }
}
.badge:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 3px; }

.badge__ico { width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.badge__ico svg { width: 18px; height: 18px; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.i-track { stroke: currentColor; stroke-width: 1.8; opacity: 0.16; }
.i-arc { stroke: currentColor; stroke-width: 1.8; stroke-dasharray: 26 100; }
.i-cloud { stroke: currentColor; stroke-width: 1.7; stroke-dasharray: 100 102; stroke-dashoffset: 101; }
.i-check { stroke: var(--accento); stroke-width: 1.9; stroke-dasharray: 100 102; stroke-dashoffset: 101; }
.i-up { stroke: currentColor; stroke-width: 1.7; }
.i-cut { stroke: var(--pillola); stroke-width: 4.6; stroke-dasharray: 100 102; stroke-dashoffset: 101; }
.i-slash { stroke: currentColor; stroke-width: 1.7; stroke-dasharray: 100 102; stroke-dashoffset: 101; }

/* the ring that opens once around the pill when it is saved, or when it goes offline */
.badge__halo {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
}

/* the words: each one is placed by the script and rolls inside this window */
.badge__say {
  position: relative;
  display: block;
  height: 20px;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 20px;
  font-weight: 560;
  letter-spacing: -0.006em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: left;
}
.w {
  position: absolute;
  left: 0; top: 0;
  display: block;
  white-space: pre;
  will-change: transform;
}

/* the hidden twin that measures the next line of words */
.badge__measure {
  position: absolute;
  left: 0; top: 0;
  visibility: hidden;
  pointer-events: none;
  font-size: 13.5px;
  line-height: 20px;
  font-weight: 560;
  letter-spacing: -0.006em;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}
.badge__measure span { display: inline-block; }

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- the tooltip ---------- */
.tip {
  position: absolute;
  left: 0; right: 0;
  top: 56px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}
.tip__box {
  position: relative;
  opacity: 0;
  visibility: hidden;
}
.tip__in {
  position: relative;
  padding: 9px 13px 10px;
  border-radius: 12px;
  background: var(--suggerimento);
  color: #fafafa;
  box-shadow: 0 12px 28px -12px rgba(24, 24, 27, 0.55), 0 2px 6px -2px rgba(24, 24, 27, 0.25);
  white-space: nowrap;
  overflow: hidden;
}
.tip__arrow {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 10px; height: 10px;
  margin-left: -5px;
  border-radius: 2px;
  background: var(--suggerimento);
  transform: rotate(45deg);
}
.tip__top { font-size: 11px; line-height: 15px; font-weight: 520; color: rgba(250, 250, 250, 0.55); letter-spacing: 0.01em; }
.tip__main {
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
  font-size: 13px; line-height: 18px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tip__main svg { width: 14px; height: 14px; flex: none; fill: none; stroke: rgba(250, 250, 250, 0.7); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tip__sub { margin-top: 2px; font-size: 11.5px; line-height: 15px; font-weight: 460; color: rgba(250, 250, 250, 0.62); }

/* ---------- the drawn pointer of the autopilot ---------- */
.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 360px) {
  .badge__say, .badge__measure { font-size: 13px; }
}
