/* css/buttons.css — the shared button subsystem, extracted from components.css (BRI-5422).
   Buttons are a first-class concern like navigation.css / hero.css / footer.css; this keeps
   components.css under the size bar and gives the button treatment its own home. Loaded via
   <link> immediately AFTER components.css on every page, so cascade order is unchanged. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.5;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-medium);
  text-align: center;
  /* position + overflow scaffold the shimmer sweep (.btn::before); overflow: hidden clips it to the
     pill. The element's own box-shadow (resting + focus ring) is not affected by overflow. */
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-btn-rest);
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out,
    border-color 0.15s ease-in-out, box-shadow 0.2s ease-in-out,
    transform 0.2s ease-in-out;
  border: 1px solid transparent;
  cursor: pointer;
}

/* Shimmer sweep: a white gradient overlay that slides left-to-right across the button on hover,
   clipped by the .btn overflow: hidden. Restores the pre-BRI-5391 effect removed in e326f85.
   pointer-events: none so it never intercepts clicks. */
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  /* Swept with transform, not left: the same motion runs on the compositor instead of triggering
     layout every frame. */
  transform: translateX(-100%);
  transition: transform 0.5s;
  pointer-events: none;
}

.btn:hover::before {
  transform: translateX(100%);
}

/* Flat brand fill with a colour-only hover state (BRI-5391). */
.btn-primary {
  background: var(--color-cta-background);
  color: var(--color-cta-text);
}

.btn-primary:hover {
  background: var(--color-cta-background-hover);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-secondary-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-secondary-hover);
}

/* Hover depth: lift + deepen the shadow on the filled variants (restores the pre-BRI-5391 look).
   These are the values that actually rendered before — animations.css overrode components.css with
   !important; that split is gone, this is the single owner and carries no !important. Placed before
   .btn:focus-visible so the focus-ring box-shadow still wins when a button is focused and hovered. */
.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn-hover);
}

/* Press-down: on :active the button settles from the hover lift and scales in slightly, with a
   snappier transition. Restores the pre-BRI-5391 press removed in e326f85. */
.btn:active {
  transform: translateY(-1px) scale(0.98);
  transition-duration: 0.1s;
}

.btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-focus-ring) 20%, transparent);
}

/* Native disabled buttons are already inert. The aria-disabled selector is defensive for anchor
   CTAs; any anchor that adopts it must also block click and keyboard activation in markup or JS. */
.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--color-background-muted);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Keep disabled CTAs fully inert: no shimmer sweep. Native :disabled buttons don't receive hover,
   but aria-disabled anchor CTAs still would, so suppress their ::before overlay too. */
.btn:disabled::before,
.btn[disabled]::before,
.btn[aria-disabled="true"]::before {
  display: none;
}

/* Native buttons don't inherit body/anchor typography; reset so .btn matches link CTAs */
button.btn {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

/* Guide landing pages (`body.landing-page`: get-the-guide, enterprise-ai-adoption,
   founder-decision-making) are the ONLY pages that carry this class, and none of them load
   animations.css — so pre-BRI-5391 they took button state from this file alone: a softer -1px lift,
   no shimmer, and an :active that settled flat. BRI-5391's handoff recorded that page-specific
   motion as intentional, and BRI-5422's AC keeps their gold CTA treatment unaffected. Scoped by body
   class inside this same file, so there is still one owner and no !important — this is NOT the
   animations.css split coming back. */
.landing-page .btn::before {
  display: none;
}

.landing-page .btn-primary:hover,
.landing-page .btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-hover-soft);
}

.landing-page .btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-btn-press);
}

/* Respect reduced motion: suppress the lift and the shimmer sweep (the motion), but keep the
   resting/hover shadows (static depth, not motion). The global block in animations.css only zeroes
   transition DURATION — it makes motion instant, not absent — so this explicitly removes it. */
@media (prefers-reduced-motion: reduce) {
  /* The .landing-page selectors are repeated here on purpose: they are more specific (0,3,0) than
     the bare .btn-primary:hover (0,2,0), so without them the guide carve-out would out-rank this
     guard and keep lifting under reduced motion. */
  .btn-primary:hover,
  .btn-secondary:hover,
  .btn:active,
  .landing-page .btn-primary:hover,
  .landing-page .btn-secondary:hover,
  .landing-page .btn:active {
    transform: none;
  }

  .btn::before,
  .btn:hover::before {
    transition: none;
    transform: translateX(-100%);
  }
}
