.muji-bookmark-toggle {
  --muji-leaf: #83aa3b;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  background-color: transparent;

  /* Follow scheme: default=black, inverse/dark=white */
  color: var(--cs-color-primary, currentColor);
  cursor: pointer;
  line-height: 0;
  text-decoration: none;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
  transition: none;
}

/* Kill Blueprint `button` / `button:hover` — never paint the control, only the icon */
.muji-bookmark-toggle:hover,
.muji-bookmark-toggle:focus,
.muji-bookmark-toggle:active,
.muji-bookmark-toggle.is-on,
.muji-bookmark-toggle.is-on:hover,
.muji-bookmark-toggle.is-on:focus {
  background: transparent;
  background-color: transparent;
  box-shadow: none;
  color: var(--cs-color-primary, currentColor);
  outline: none;
}

.muji-bookmark-toggle:focus-visible {
  outline: 2px solid var(--cs-color-primary, currentColor);
  outline-offset: 2px;
}

.muji-bookmark-toggle__icon {
  display: block;
  width: 22px;
  height: 22px;
}

/* Default: stroke only; dash runner hidden until busy */
.muji-bookmark-toggle__track,
.muji-bookmark-toggle__dash {
  fill: none;
}

.muji-bookmark-toggle__dash {
  opacity: 0;
}

/* is-on: solid leaf fill (hover intentionally no fill) */
.muji-bookmark-toggle.is-on
  .muji-bookmark-toggle__leaf.muji-bookmark-toggle__track {
  fill: var(--muji-leaf);
}

.muji-bookmark-toggle:focus-visible
  .muji-bookmark-toggle__leaf.muji-bookmark-toggle__track {
  fill: var(--muji-leaf);
}

/* Same look as video .cs-tooltip, but opens upward */
.muji-bookmark-toggle .cs-tooltip {
  position: absolute;
  width: max-content;
  bottom: calc(100% + 15px);
  left: -9999px;
  padding-left: 50%;
  padding-top: 0.5rem;
  transform: translateY(30%);
  transition: transform 0.5s;
  z-index: 5;
  pointer-events: none;
}

.muji-bookmark-toggle .cs-tooltip span {
  background: #ffffff;
  display: block;
  position: relative;
  padding: 1rem;
  margin: 0;
  opacity: 0;
  color: #000000;
  transform: translate(-50%, 0);
  transition: opacity 0.5s;
  font-family: var(--cs-font-secondary-family), sans-serif;
  font-size: var(--cs-font-secondary-size);
  font-weight: var(--cs-font-secondary-weight);
  font-style: var(--cs-font-secondary-style);
  letter-spacing: var(--cs-font-secondary-letter-spacing);
  text-transform: var(--cs-font-secondary-text-transform);
  line-height: 1.2;
  white-space: nowrap;
}

.muji-bookmark-toggle .cs-tooltip span:after {
  top: 100%;
  left: 50%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
  border-color: transparent;
  border-top-color: #ffffff;
  border-width: 7px;
  margin-left: -7px;
}

.muji-bookmark-toggle:hover .cs-tooltip,
.muji-bookmark-toggle:focus-visible .cs-tooltip {
  transform: translateY(0);
  left: 0;
}

.muji-bookmark-toggle:hover .cs-tooltip span,
.muji-bookmark-toggle:focus-visible .cs-tooltip span {
  opacity: 1;
}

/* Busy: faint full outline + 1/4 dash running the edge */
.muji-bookmark-toggle[aria-busy="true"] .muji-bookmark-toggle__track,
.muji-bookmark-toggle[aria-busy="true"].is-on .muji-bookmark-toggle__track {
  fill: none;
  opacity: 0.28;
}

.muji-bookmark-toggle[aria-busy="true"] .muji-bookmark-toggle__dash {
  opacity: 1;
  fill: none;
  stroke-dasharray: 25 75; /* pathLength=100 → 1/4 of outline */
  stroke-dashoffset: 0;
  animation: muji-bookmark-dash 0.9s linear infinite;
}

@keyframes muji-bookmark-dash {
  to {
    stroke-dashoffset: -100;
  }
}

/* List cards: icon + tooltip */
.muji-bookmark-toggle--list {
  width: 2rem;
  display: inline-flex;
  margin: 0;
  position: relative;
  z-index: 2;
  border-color: transparent;
  float: right;
  margin-left: 1rem;
  margin-top: -0.4em;
}

.cs-entry__inner.cs-entry__content > .muji-bookmark-toggle--list {
}

/* Post singular: full button with border + visible status text */
section.cs-custom-content-post-before:has(.muji-bookmark-toggle--full) {
  text-align: right;
}
.muji-bookmark-toggle--full {
  width: auto;
  min-width: 0;
  height: auto;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  margin: 0;
  border: 1px solid var(--cs-color-primary, currentColor);
  line-height: 1.2;
  border-radius: 8px;
}

.muji-bookmark-toggle--full .muji-bookmark-toggle__label {
  font-family: var(--cs-font-secondary-family), sans-serif;
  font-size: var(--cs-font-secondary-size, 0.875rem);
  font-weight: var(--cs-font-secondary-weight, 400);
  letter-spacing: var(--cs-font-secondary-letter-spacing);
  white-space: nowrap;
}

.muji-bookmark-toggle--full:hover,
.muji-bookmark-toggle--full:focus,
.muji-bookmark-toggle--full:active,
.muji-bookmark-toggle--full.is-on,
.muji-bookmark-toggle--full.is-on:hover,
.muji-bookmark-toggle--full.is-on:focus {
  border-color: var(--cs-color-primary, currentColor);
  background: transparent;
  background-color: transparent;
}

article .cs-entry__post-meta:empty,
article .cs-entry__post-meta:not(:has(*)) {
  display: none;
}

article .cs-entry__post-meta:empty ~ .cs-entry__title-wrapper,
article .cs-entry__post-meta:not(:has(*)) ~ .cs-entry__title-wrapper {
  margin-top: 0;
}

@media (max-width: 1020px) {
  section.cs-custom-content-post-before:has(.muji-bookmark-toggle--full) {
    text-align: center;
  }
}
