/* Foghorn shared call-to-action treatment.
   The surface stays still while the label gives way to the action icon. */

.foghorn-cta.foghorn-cta {
  position: relative;
  isolation: isolate;
  display: inline-grid;
  grid-template-areas: "cta-stack";
  place-items: center;
  justify-content: center;
  align-content: center;
  min-height: 48px;
  padding: 0 20px;
  overflow: hidden;
  border: 1px solid var(--red, #d5010d);
  border-radius: 999px;
  color: #fff;
  background: var(--red, #d5010d);
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(213, 1, 13, .24);
  transform: none;
  transition: background-color 220ms ease, box-shadow 280ms ease, border-color 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

.foghorn-cta.foghorn-cta:hover,
.foghorn-cta.foghorn-cta:focus-visible,
.foghorn-cta.foghorn-cta:active {
  color: #fff;
  border-color: #ef0714;
  background: #ef0714;
  box-shadow: 0 8px 24px rgba(213, 1, 13, .3);
  transform: none;
}

/* CTA surfaces never lift. The hero button is the reference: the pill stays
   fixed while its label gives way to the centred action icon. */
html .foghorn-cta.foghorn-cta,
html .foghorn-cta.foghorn-cta:hover,
html .foghorn-cta.foghorn-cta:focus-visible,
html .foghorn-cta.foghorn-cta:active {
  border-color: var(--red, #d5010d);
  background: var(--red, #d5010d);
  box-shadow: 0 8px 24px rgba(213, 1, 13, .24);
  transform: none;
}

html .foghorn-cta.foghorn-cta:hover,
html .foghorn-cta.foghorn-cta:focus-visible,
html .foghorn-cta.foghorn-cta:active {
  border-color: #ef0714;
  background: #ef0714;
  box-shadow: 0 8px 24px rgba(213, 1, 13, .3);
}

.foghorn-cta__label,
.foghorn-cta__action {
  position: relative;
  z-index: 1;
  grid-area: cta-stack;
  display: grid;
  place-items: center;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0 !important;
  text-align: center;
  transition:
    opacity 420ms cubic-bezier(.8, 0, .2, 1),
    filter 500ms cubic-bezier(.8, 0, .2, 1),
    transform 560ms cubic-bezier(.8, 0, .2, 1);
  will-change: opacity, filter, transform;
}

.foghorn-cta__label {
  opacity: 1;
  filter: blur(0);
  white-space: nowrap;
  transform: translate3d(0, 0, 0);
}

.foghorn-cta__action {
  opacity: 0;
  filter: blur(4px);
  line-height: 0;
  transform: translate3d(0, 13px, 0) scale(.76) rotate(-7deg);
}

.foghorn-cta__action > .ui-icon,
.foghorn-cta__action > i.ui-icon,
.foghorn-cta__action > svg {
  --ui-icon-size: 24px;
  width: var(--ui-icon-size);
  height: var(--ui-icon-size);
  margin: 0;
  color: currentColor;
}

/* The hero CTA predates the shared component and absolutely positions both
   animation states. Make those layers fill the pill instead of inheriting a
   zero-sized grid area from the older navigation rules. */
.hero > .nav .nav-cta .foghorn-cta__label,
.hero > .nav .nav-cta .foghorn-cta__action {
  position: absolute;
  inset: 0;
  grid-area: auto;
  align-self: auto;
  justify-self: auto;
  width: auto;
  height: auto;
  display: grid;
  place-items: center;
}

@media (hover: hover) and (pointer: fine) {
  .foghorn-cta:not(:disabled):hover .foghorn-cta__label {
    opacity: 0;
    filter: blur(4px);
    transform: translate3d(0, -13px, 0) scale(.96);
  }

  .foghorn-cta:not(:disabled):hover .foghorn-cta__action {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
}

.foghorn-cta:not(:disabled):focus-visible .foghorn-cta__label {
  opacity: 0;
  filter: blur(4px);
  transform: translate3d(0, -13px, 0) scale(.96);
}

.foghorn-cta:not(:disabled):focus-visible .foghorn-cta__action {
  opacity: 1;
  filter: blur(0);
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
}

.foghorn-cta:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.foghorn-cta:disabled {
  cursor: default;
  opacity: .64;
  box-shadow: none;
}

/* Preserve context-specific sizing while unifying the visual language. */
.mobile-menu-cta.foghorn-cta { display: grid; width: 100%; }
.conversation-actions .foghorn-cta { min-width: 148px; }
.approach-copy > .foghorn-cta { display: inline-grid; padding-inline: 18px; }
.contact-form > .foghorn-cta,
.viewer-contact-form > .foghorn-cta,
.inline-contact-submit.foghorn-cta { width: 100%; }
.viewer-web-cta.foghorn-cta { display: grid; width: 100%; min-height: 58px; margin-top: 24px; border-radius: 999px; }
.viewer-page .viewer-signal-cta .foghorn-cta { display: inline-grid; min-height: 58px; padding-inline: 24px; border-radius: 999px; }

/* The About closing CTA uses absolutely stacked animation states. Give the
   stack a definite block size and let both states fill it, keeping the label
   and replacement icon optically centred in the pill. */
.viewer-about-cta .nav-cta.foghorn-cta {
  display: inline-grid;
  height: 50px;
  min-height: 50px;
  place-items: center;
}

.viewer-about-cta .nav-cta .foghorn-cta__label,
.viewer-about-cta .nav-cta .foghorn-cta__action {
  position: absolute;
  inset: 0;
  grid-area: auto;
  align-self: auto;
  justify-self: auto;
  display: grid;
  width: auto;
  height: auto;
  place-items: center;
}

@media (max-width: 760px) {
  .foghorn-cta.foghorn-cta { min-height: 50px; }
  .conversation-actions .foghorn-cta { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .foghorn-cta__label,
  .foghorn-cta__action { transition: none; }
  .foghorn-cta:not(:disabled):is(:hover, :focus-visible) .foghorn-cta__label {
    opacity: 1;
    filter: none;
    transform: none;
  }
  .foghorn-cta:not(:disabled):is(:hover, :focus-visible) .foghorn-cta__action { opacity: 0; }
}
