/* Figma Design 119:145: 94 × 44, 20 × 20 icon and an inside border. */
.xyp-bookmark {
  --bookmark-ink: #2444ad;
  --bookmark-bg: #ecf1ff;
  --bookmark-border: #b9c8e1;
  appearance: none;
  display: inline-flex;
  box-sizing: border-box;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  width: 94px;
  height: 44px;
  margin: 0;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 10px;
  background-color: var(--bookmark-bg);
  box-shadow: inset 0 0 0 1px var(--bookmark-border);
  color: var(--bookmark-ink);
  font: 500 14px/20px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: normal;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.xyp-bookmark[hidden] { display: none; }

.xyp-bookmark[aria-pressed="true"] {
  --bookmark-bg: #dfe8ff;
  --bookmark-border: #9fb3e4;
}

.xyp-bookmark[aria-busy="true"] { cursor: wait; }
.xyp-bookmark:focus-visible { outline: 2px solid var(--bookmark-ink); outline-offset: 2px; }

.xyp-bookmark .xyp-bookmark__label {
  flex: 0 0 42px;
  margin: 0;
  color: inherit;
  font: inherit;
}

.xyp-bookmark .xyp-bookmark__icon {
  position: relative;
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
}

.xyp-bookmark .xyp-bookmark__mark,
.xyp-bookmark .xyp-bookmark__fill,
.xyp-bookmark img.xyp-bookmark__outline,
.xyp-bookmark .xyp-bookmark__fill img {
  position: absolute;
  display: block;
  inset: 0;
  width: 20px;
  height: 20px;
  max-width: none;
  margin: 0;
  aspect-ratio: auto;
}

.xyp-bookmark__fill { clip-path: inset(17.5px 0 0); }
.xyp-bookmark[aria-pressed="true"] .xyp-bookmark__fill { clip-path: inset(0); }

.xyp-bookmark img.xyp-bookmark__spark {
  position: absolute;
  display: block;
  max-width: none;
  aspect-ratio: auto;
  opacity: 0;
}

.xyp-bookmark img.xyp-bookmark__spark--first {
  top: 1.5px;
  left: 15.5px;
  width: 2px;
  height: 2px;
  --spark-travel: translate(-1.5px, 2.5px);
}

.xyp-bookmark img.xyp-bookmark__spark--second {
  top: 6px;
  left: 18px;
  width: 1.5px;
  height: 1.5px;
  --spark-travel: translate(-2.5px, 1px);
}

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

@media (prefers-reduced-motion: no-preference) {
  .xyp-bookmark[data-motion="save"] { transition: background-color 220ms ease-out, box-shadow 220ms ease-out; }
  .xyp-bookmark[data-motion="remove"] { transition: background-color 100ms ease-out, box-shadow 100ms ease-out; }
  .xyp-bookmark[data-motion="save"] .xyp-bookmark__mark { animation: xyp-bookmark-save-lift 340ms both; }
  .xyp-bookmark[data-motion="save"] .xyp-bookmark__fill { animation: xyp-bookmark-save-fill 340ms both; }
  .xyp-bookmark[data-motion="save"] .xyp-bookmark__spark { animation: xyp-bookmark-spark 340ms both; }
  .xyp-bookmark[data-motion="remove"] .xyp-bookmark__mark { animation: xyp-bookmark-remove-lift 180ms both; }
  .xyp-bookmark[data-motion="remove"] .xyp-bookmark__fill { animation: xyp-bookmark-remove-fill 180ms both; }
}

/* The Figma flow uses 220 + 20 + 100ms for save, 100 + 20 + 60ms for remove. */
@keyframes xyp-bookmark-save-lift {
  0% { transform: translateY(0); animation-timing-function: ease-out; }
  64.706%, 70.588% { transform: translateY(-2px); animation-timing-function: ease-in-out; }
  100% { transform: translateY(0); }
}

@keyframes xyp-bookmark-save-fill {
  0% { clip-path: inset(17.5px 0 0); animation-timing-function: ease-out; }
  64.706%, 70.588% { clip-path: inset(2.5px 0 0); animation-timing-function: ease-in-out; }
  100% { clip-path: inset(0); }
}

@keyframes xyp-bookmark-spark {
  0% { opacity: 0; transform: var(--spark-travel); animation-timing-function: ease-out; }
  64.706%, 70.588% { opacity: 1; transform: translate(0); animation-timing-function: ease-in-out; }
  100% { opacity: 0; transform: var(--spark-travel); }
}

@keyframes xyp-bookmark-remove-lift {
  0% { transform: translateY(0); animation-timing-function: ease-out; }
  55.556%, 66.667% { transform: translateY(-1.5px); animation-timing-function: ease-in-out; }
  100% { transform: translateY(0); }
}

@keyframes xyp-bookmark-remove-fill {
  0% { clip-path: inset(0); animation-timing-function: ease-out; }
  55.556%, 100% { clip-path: inset(17.5px 0 0); }
}
