.btn {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  padding-left: 40px;
  padding-right: 40px;
  white-space: nowrap;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-foundation-white);
  background-color: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent-medium-blue);
  outline-offset: 3px;
}

.btn[data-size="default"] { height: 51px; }
.btn[data-size="large"]   { height: 56px; }
.btn[data-size="compact"] { height: 50px; }

.btn[data-shape="swoopy"]  { border-radius: var(--radius-25) var(--radius-6) var(--radius-25) var(--radius-6); }
.btn[data-shape="rounded"] { border-radius: var(--radius-12); }

.btn[data-emphasis="filled"] {
  background-color: var(--color-accent-medium-blue);
}
.btn[data-emphasis="filled"]:hover,
.btn[data-emphasis="filled"]:focus-visible {
  background-color: var(--color-accent-medium-blue-hover, #5d8199);
  color: var(--color-foundation-white);
}

/* Only filled blue buttons with equal rounded corners introduce the circle-right icon on hover */
.btn[data-shape="rounded"][data-emphasis="filled"]:not(:has(> i))::before {
  content: "\f35a";
  font-family: "Font Awesome 7 Pro", "Font Awesome 6 Pro", "Font Awesome 6 Free", "FontAwesome", sans-serif;
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
  display: inline-block;
  opacity: 0;
  max-width: 0;
  margin-right: 0;
  transform: translateX(-8px) scale(0.7);
  overflow: visible;
  vertical-align: middle;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn[data-shape="rounded"][data-emphasis="filled"]:not(:has(> i)):hover::before,
.btn[data-shape="rounded"][data-emphasis="filled"]:not(:has(> i)):focus-visible::before {
  opacity: 1;
  max-width: 26px;
  margin-right: 12px;
  transform: translateX(0) scale(1);
}

.btn[data-shape="rounded"][data-emphasis="filled"][data-size="large"]:not(:has(> i))::before {
  font-size: 24px;
}
.btn[data-shape="rounded"][data-emphasis="filled"][data-size="large"]:not(:has(> i)):hover::before,
.btn[data-shape="rounded"][data-emphasis="filled"][data-size="large"]:not(:has(> i)):focus-visible::before {
  max-width: 30px;
  margin-right: 14px;
}

.btn[data-emphasis="outline"] {
  background: transparent;
  /* Figma strokeAlign is INSIDE: the 1px stroke sits within the 40px padding and does not add to
     the box. An intrinsically-sized inline-flex adds border width on top of padding, so padding is
     reduced by the border to keep the total inset at exactly 40. Measured better than an inset
     box-shadow (corner blob 59 vs 67). */
  border: 1px solid var(--color-foundation-white);
  padding-left: 39px;
  padding-right: 39px;
}
.btn[data-emphasis="outline"]:hover,
.btn[data-emphasis="outline"]:focus-visible {
  background: var(--color-foundation-white-a20);
  color: var(--color-foundation-white);
  border-color: var(--color-foundation-white);
}

.btn[data-fill="primary-blue-a50"] { background: var(--color-primary-blue-a50); }
.btn[data-fill="primary-blue-a50"]:hover,
.btn[data-fill="primary-blue-a50"]:focus-visible {
  background: var(--color-primary-blue);
  color: var(--color-foundation-white);
}

.btn > i {
  display: block;
  width: auto;
  height: auto;
  line-height: 1;
  vertical-align: baseline;
  text-align: left;
  letter-spacing: 0;
  font-style: normal;
  color: inherit;
  transition: color 0.25s ease;
}
.btn[data-size="default"] > i,
.btn[data-size="compact"] > i { font-size: 18px; }
.btn[data-size="large"]   > i { font-size: 24px; }

.btn > i + .btn__label { margin-left: 12px; }

/* ==========================================================================
   Mobile (< 1200px) — labels stay legible and inside the viewport
   ========================================================================== */

@media (max-width: 1199px) {
  .btn {
    padding-left: clamp(18px, 4.5vw, 34px);
    padding-right: clamp(18px, 4.5vw, 34px);
    max-width: 100%;
    white-space: normal;
    text-align: center;
    justify-content: center;
    line-height: 1.25;
  }
  .btn[data-emphasis="outline"] {
    padding-left: calc(clamp(18px, 4.5vw, 34px) - 1px);
    padding-right: calc(clamp(18px, 4.5vw, 34px) - 1px);
  }
  .btn[data-size="default"],
  .btn[data-size="compact"] {
    height: auto;
    min-height: 52px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .btn[data-size="large"] {
    height: auto;
    min-height: 58px;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .btn > i + .btn__label { margin-left: 10px; }

  /* The label scales with the rest of the type ramp (.page-builder .type-button
     in sections.css); the icons beside and inside the button have to follow it
     or they end up outweighing the words they sit next to. These were fixed at
     18/24px with a single step down at 560px, which read as a jump mid-range. */
  .btn[data-size="default"] > i,
  .btn[data-size="compact"] > i { font-size: clamp(15px, 2.6vw, 18px); }
  .btn[data-size="large"]   > i { font-size: clamp(19px, 3.4vw, 24px); }

  /* Hover affordance on filled rounded buttons — same treatment. */
  .btn[data-shape="rounded"][data-emphasis="filled"]:not(:has(> i))::before {
    font-size: clamp(15px, 2.6vw, 18px);
  }
  .btn[data-shape="rounded"][data-emphasis="filled"][data-size="large"]:not(:has(> i))::before {
    font-size: clamp(19px, 3.4vw, 24px);
  }
}
