/* ============================================================================
 * Suunta.ai Landing v2 — Buttons
 * ----------------------------------------------------------------------------
 * Northern Lights -tyyli, Ops styleguide -periaatteet.
 *
 * GOLDEN RULE: Emerald-painikkeessa on AINA tumma teksti
 * (var(--text-on-accent) = brand-blue-700 = #12141c).
 * Tämä SÄILYY sekä dark- että light-themessä. EI valkoista tekstiä emerald-paossa.
 *
 * Variants:
 *   .btn--primary    Emerald-CTA, vain yksi per näkymä (Ops: "one CTA per view")
 *   .btn--secondary  Hairline border + transparent bg
 *   .btn--ghost      Tekstin värinen, Stripe-tyylinen animoitu underline
 *
 * Sizes: .btn--sm (36px hi)  .btn (40px hi default)  .btn--lg (48px hi)
 *
 * Transition: 180ms cubic-bezier(0.4, 0, 0.2, 1) — Ops standard.
 * Ei translateY-hoveria. Ei scale-clickia. Tasaisia pintoja.
 * ============================================================================ */

.btn {
  /* Base — flex inline rivit ovat yhtenäisiä */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: var(--tracking-tight);

  /* Default size — 40px hi */
  height: 40px;
  padding-inline: var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);

  cursor: pointer;
  user-select: none;
  text-decoration: none;

  /* V2.4 polish: hover-tilan box-shadow + transform on softer 220ms ease-out.
     Color/border 180ms — välitön responssi. */
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition-hover),
    transform var(--transition-hover);

  /* Disable buttons gracefully */
  &:disabled,
  &[aria-disabled='true'] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }

  /* Icon sizing (Font Awesome / svg) */
  & i,
  & svg {
    font-size: 0.875em;
    flex-shrink: 0;
  }
}

/* ─── Variant: Primary (emerald CTA) ───────────────────────────────────
 * GOLDEN RULE: --text-on-accent on AINA tumma. Hover tummenee, EI vaalene.
 * ──────────────────────────────────────────────────────────────────── */
.btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);          /* AINA tumma — molempi teema */
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-on-accent);          /* säilyy tumma hoverissakin */
  /* NEUTRAALI varjo (ei emerald-glow:ta) — Northern Lights -laki #1:
     elementin syvyys = tummempi sävy + 1px lift + neutraali varjo,
     EI väritettyä halo:a. Emerald rgba-glow poistettu tietoisesti. */
  box-shadow: 0 6px 16px -8px rgba(15, 23, 42, 0.30);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px -4px rgba(15, 23, 42, 0.24);
}

/* Dark-modissa accent-hover on emerald-400 (vaaleampi) — tumma teksti säilyy
 * silti hyvin luettavissa kontrastissa. */

/* ─── Variant: Secondary (hairline + transparent) ──────────────────── */
.btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn--secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-secondary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn--secondary:active {
  transform: translateY(0);
}

/* ─── Variant: Ghost (text-only + Stripe-tyylinen underline) ───────── */
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding-inline: var(--space-3);
  height: auto;                          /* ghost ei tarvitse height-painikkeeksi */
  padding-block: var(--space-2);
}

.btn--ghost:hover {
  background: transparent;
  color: var(--text-primary);
}

/* Underline animation — kasvaa hoverilla */
.btn--ghost::after {
  content: '';
  display: inline-block;
  width: 0.875em;
  height: 1px;
  background: currentColor;
  margin-left: var(--space-1);
  transition: width var(--transition);
}

.btn--ghost:hover::after {
  width: 1.25em;
}

/* ─── Sizes ──────────────────────────────────────────────────────── */
.btn--sm {
  height: 32px;
  font-size: var(--text-xs);
  padding-inline: var(--space-4);
  letter-spacing: var(--tracking-wide);
}

.btn--lg {
  height: 48px;
  font-size: var(--text-base);
  padding-inline: var(--space-6);
  gap: var(--space-3);
}

/* ─── Icon-only (square) ─────────────────────────────────────────── */
.btn--icon {
  width: 40px;
  padding-inline: 0;
}

.btn--icon.btn--sm { width: 32px; }
.btn--icon.btn--lg { width: 48px; }

/* ─── Arrow icon — moves on hover (subtle directional cue) ────────── */
.btn .icon-arrow {
  transition: transform var(--transition);
}

.btn:hover .icon-arrow {
  transform: translateX(2px);
}

/* ─── Full-width modifier ─────────────────────────────────────────── */
.btn--full {
  width: 100%;
}

/* ─── Button group (CTA + secondary inline) ──────────────────────── */
.btn-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .btn-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .btn-group .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ─── Focus ring — Ops style, 3px emerald @ 18% alpha ─────────────── */
.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
