/* Under the pointer a filled button takes the theme's colours for its kind (區塊模型 5.3), else its
   own deepened. The theme's effect says how: rising (--btn-lift), its arrow going on (--btn-arrow),
   or a layer of the colour growing from one side (--btn-fill-…); the colour itself comes in under
   that layer once it has grown, so the layer is what is seen. A theme without one sets none. */
.part--button {
  --button-bg: var(--btn-primary-bg);
  --button-fg: var(--btn-primary-fg);
  --button-bd: var(--btn-primary-bd);
  --button-hover-bg: var(
    --btn-primary-hbg,
    color-mix(in srgb, var(--button-bg) 86%, var(--color-heading))
  );
  --button-hover-fg: var(--btn-primary-hfg, var(--button-fg));
  --button-hover-bd: var(
    --btn-primary-hbd,
    color-mix(in srgb, var(--button-bd) 86%, var(--color-heading))
  );
  --button-scale: 1;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  width: 100%;
  min-width: 0;
  padding: calc(var(--btn-py) * var(--button-scale)) calc(var(--btn-px) * var(--button-scale));
  overflow: var(--btn-fill-clip, visible);
  border: var(--btn-primary-bw) solid var(--button-bd);
  border-radius: var(--btn-primary-r);
  background: var(--button-bg);
  color: var(--button-fg);
  font-family: var(--font-body);
  font-size: var(--sc-fz, var(--btn-fz));
  font-weight: var(--sc-fw, var(--btn-primary-w));
  line-height: 1.3;
  letter-spacing: var(--sc-ls, normal);
  text-align: center;
  text-decoration: none;
  text-transform: var(--sc-tt, var(--btn-primary-tt));
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease,
    translate 0.2s ease;
}
.part--button.button--secondary {
  --button-bg: var(--btn-secondary-bg);
  --button-fg: var(--btn-secondary-fg);
  --button-bd: var(--btn-secondary-bd);
  --button-hover-bg: var(
    --btn-secondary-hbg,
    color-mix(in srgb, var(--button-fg) 10%, var(--button-bg))
  );
  --button-hover-fg: var(--btn-secondary-hfg, var(--button-fg));
  --button-hover-bd: var(--btn-secondary-hbd, var(--button-bd));
  border-width: var(--btn-secondary-bw);
  border-radius: var(--btn-secondary-r);
  font-weight: var(--sc-fw, var(--btn-secondary-w));
  text-transform: var(--sc-tt, var(--btn-secondary-tt));
}
.part--button.button--custom {
  --button-bg: var(--custom-bg);
  --button-fg: var(--custom-fg);
  --button-bd: var(--custom-bd);
}
.part--button.button--custom.has-hover-bg {
  --button-hover-bg: var(--custom-hbg);
}
.part--button.button--custom.has-hover-fg {
  --button-hover-fg: var(--custom-hfg);
}
.part--button.button--custom.has-hover-bd {
  --button-hover-bd: var(--custom-hbd);
}
.part--button.button--small {
  --button-scale: 0.72;
  font-size: var(--sc-fz, calc(var(--btn-fz) * 0.875));
}
.part--button.button--large {
  --button-scale: 1.28;
  font-size: var(--sc-fz, calc(var(--btn-fz) * 1.125));
}
.part--button.is-square {
  border-radius: 0;
}
.part--button.is-rounded {
  border-radius: var(--radius-small);
}
.part--button.is-pill {
  border-radius: 999px;
}
.part--button:not(.button--link):hover {
  border-color: var(--button-hover-bd);
  background: var(--button-hover-bg);
  color: var(--button-hover-fg);
  translate: var(--btn-lift, none);
  transition-delay: var(--btn-fill-wait, 0s), 0s, 0s, 0s, 0s;
}
/* 边框颜色 left unset: no border, not one in the text's colour (the border keeps its width, so
   the button is as big as the others). */
.part--button.button--custom.is-borderless,
.part--button.button--custom.is-borderless:hover {
  border-color: transparent;
}
.part--button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  display: var(--btn-fill, none);
  background: var(--button-hover-bg);
  scale: var(--btn-fill-scale, 1);
  transform-origin: var(--btn-fill-origin, center);
  transition: scale 0.3s ease;
}
.part--button:hover::before {
  scale: 1;
}
.part--button.button--link {
  --button-fg: var(--btn-secondary-fg);
  width: auto;
  padding: 0.25em 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
}
.part--button.button--link::before {
  display: none;
}
.part--button.button--link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.part--button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}
.part--button .button__text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.part--button .button__icon {
  display: inline-flex;
  flex: none;
  font-size: 1.15em;
  transition:
    transform 0.25s ease,
    translate 0.25s ease;
}
.part--button.button--icon-end .button__icon {
  order: 1;
}
/* With an icon after the text, 图标 is the one before it, wherever 图标位置 says. */
.part--button.has-icon-end .button__icon:not(.button__icon--end) {
  order: 0;
}
.part--button.button--link.button--icon-end:hover .button__icon,
.part--button.button--link:hover .button__icon--end {
  transform: translateX(3px);
}
.part--button.button--link.has-icon-end:hover .button__icon:not(.button__icon--end) {
  transform: none;
}
/* 箭头前移: the icon after the text, which an old 图标 at 文字后 is. */
.part--button:hover .button__icon--end,
.part--button.button--icon-end:not(.has-icon-end):hover .button__icon {
  translate: var(--btn-arrow, none);
}
@media (prefers-reduced-motion: reduce) {
  .part--button::before {
    display: none;
  }
  .part--button:not(.button--link):hover {
    translate: none;
    transition-delay: 0s;
  }
  .part--button:hover .button__icon {
    translate: none;
  }
}
