/*
 * Apertera Design System — Buttons
 * Source: Apertera Figma Design System
 * Reusable, semantic, opt-in components.
 */

:root {
  --ap-btn-flux: #0D7E89;
  --ap-btn-flux-light: #D2E1E3;
  --ap-btn-parchment: #F4EEE6;
  --ap-btn-parchment-light: #FBFAF6;
  --ap-btn-duration: 260ms;
}

/* Shared foundation */
.apertera-ds-btn {
  position: relative !important;
  isolation: isolate;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;

  box-sizing: border-box !important;
  width: auto;
  min-width: 0;
  min-height: 40px !important;
  padding: 8px 24px !important;

  border: 1px solid transparent !important;
  border-radius: 0 !important;

  font-family: "IBM Plex Sans Condensed", sans-serif !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  font-style: normal !important;
  line-height: 24px !important;
  letter-spacing: 1.6px !important;
  text-transform: uppercase !important;
  text-align: center !important;
  text-decoration: none !important;

  white-space: normal;
  cursor: pointer;
  overflow: hidden;

  transition:
    background-color var(--ap-btn-duration) ease,
    color var(--ap-btn-duration) ease,
    border-color var(--ap-btn-duration) ease !important;
}

.apertera-ds-btn,
.apertera-ds-btn:hover,
.apertera-ds-btn:focus-visible {
  transform: none !important;
  box-shadow: none !important;
}

.apertera-ds-btn:focus-visible {
  outline: 2px solid currentColor !important;
  outline-offset: 3px;
}

/* Primary */
.apertera-ds-btn--primary {
  background: var(--ap-btn-flux) !important;
  color: var(--ap-btn-parchment-light) !important;
}

.apertera-ds-btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    110deg,
    transparent 0 32%,
    rgba(0,0,0,.12) 33% 60%,
    transparent 61%
  );
  transform: translateX(-110%);
  transition: transform var(--ap-btn-duration) ease;
  pointer-events: none;
}

.apertera-ds-btn--primary:hover::before,
.apertera-ds-btn--primary:focus-visible::before {
  transform: translateX(110%);
}

.apertera-ds-btn--primary:hover {
  background: var(--ap-btn-flux) !important;
  color: var(--ap-btn-parchment-light) !important;
}

/* Secondary — light */
.apertera-ds-btn--secondary-light {
  background: transparent !important;
  border-color: var(--ap-btn-parchment) !important;
  color: var(--ap-btn-parchment) !important;
}

.apertera-ds-btn--secondary-light:hover,
.apertera-ds-btn--secondary-light:focus-visible {
  background: var(--ap-btn-parchment) !important;
  color: var(--ap-btn-flux) !important;
}

/* Secondary — dark */
.apertera-ds-btn--secondary-dark {
  background: transparent !important;
  border-color: var(--ap-btn-flux) !important;
  color: var(--ap-btn-flux) !important;
}

.apertera-ds-btn--secondary-dark:hover,
.apertera-ds-btn--secondary-dark:focus-visible {
  background: var(--ap-btn-flux-light) !important;
  border-color: var(--ap-btn-flux-light) !important;
  color: var(--ap-btn-flux) !important;
}

/* Tertiary — text buttons */
.apertera-ds-btn--tertiary-dark,
.apertera-ds-btn--tertiary-light {
  background: transparent !important;
  border: 0 !important;
  min-height: 24px !important;
  padding: 0 !important;
  gap: 8px !important;
  overflow: visible;
}

.apertera-ds-btn--tertiary-dark {
  color: var(--ap-btn-flux) !important;
}

.apertera-ds-btn--tertiary-light {
  color: var(--ap-btn-parchment-light) !important;
}

.apertera-ds-btn--tertiary-dark::after,
.apertera-ds-btn--tertiary-light::after {
  content: "";
  width: 0;
  height: 0;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 9px solid currentColor;
  flex: 0 0 auto;
}

.apertera-ds-btn--tertiary-dark:hover,
.apertera-ds-btn--tertiary-dark:focus-visible {
  color: var(--ap-btn-flux) !important;
  text-decoration: underline !important;
}

.apertera-ds-btn--tertiary-light:hover,
.apertera-ds-btn--tertiary-light:focus-visible {
  color: var(--ap-btn-parchment-light) !important;
  text-decoration: underline !important;
}

/* Responsive */
@media (max-width: 767px) {
  .apertera-ds-btn {
    max-width: 100%;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .apertera-ds-btn,
  .apertera-ds-btn::before {
    transition: none !important;
  }
}

/* Theme buttons: same weight, alignment and hover as the design-system buttons. */
html body .apertera-button {
  font-weight: 600 !important;
  text-align: center !important;
  transition: background-color .26s ease, border-color .26s ease, color .26s ease !important;
}
html body .apertera-button::before { display: none !important; }
html body .apertera-button--solid:is(:hover, :focus-visible) {
  background-color: #0C6D77 !important;
  border-color: #0C6D77 !important;
  color: #FBFAF6 !important;
}
html body .apertera-button--outline:is(:hover, :focus-visible) {
  background-color: #F4EEE6 !important;
  border-color: #F4EEE6 !important;
  color: #0D7E89 !important;
}
/* Outline buttons on light backgrounds. */
html body .apertera-process-list .apertera-button--outline:is(:hover, :focus-visible) {
  background-color: #0D7E89 !important;
  border-color: #0D7E89 !important;
  color: #FBFAF6 !important;
}

/* Resource card buttons: same weight, height and colours as the other buttons. */
html body a.apertera-resource-card__button {
  font-weight: 600 !important;
  height: 42px !important;
  min-height: 42px !important;
  color: #FBFAF6 !important;
  text-align: center !important;
}
html body a.apertera-resource-card__button:is(:hover, :focus-visible) {
  background-color: #0C6D77 !important;
  border-color: #0C6D77 !important;
}
