/* ==========================================================================
   Avadis button — THE button of the front. One component, every button of the site is an .av-btn.
   Render it with avadis_button() (functions/button.php); do not style a button with utility classes.

   Variants : --primary (orange, the CTA) | --secondary (deep purple) | --outline (purple outline)
              --soft (pale purple, for "show more" style actions) | --light, --outline-light (on dark backgrounds)
   Icon     : .av-btn--icon = a square button with only an icon (avadis_button icon_only); --ghost = no fill until hover
   Sizes    : --sm | (md, default) | --lg        --block = full width
   Its shape, type and sizes come from the identity tokens in css/identity.css (--av-btn-*); the colours of a
   variant are set once as --_bg/--_fg/--_bd (+ -h for hover), the rest is shared. Needs css/identity.css first.
   ========================================================================== */
.av-btn {
  --_bg: var(--av-orange);
  --_fg: var(--av-white);
  --_bd: var(--av-orange);
  --_bg-h: var(--av-orange-dark);
  --_fg-h: var(--av-white);
  --_bd-h: var(--av-orange-dark);
  --_shadow-h: var(--av-shadow-orange);
  --_h: var(--av-btn-h-md);
  --_px: var(--av-btn-px-md);
  --_fs: var(--av-btn-fs-md);

  box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--av-btn-gap);
  min-height: var(--_h); margin: 0; padding: 0 var(--_px);
  border: var(--av-btn-border) solid var(--_bd); border-radius: var(--av-btn-radius);
  background: var(--_bg); color: var(--_fg);
  font-family: inherit; font-size: var(--_fs); font-weight: var(--av-btn-weight); line-height: 1.4;
  text-align: center; text-decoration: none; white-space: nowrap;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: transform .2s var(--av-ease), box-shadow .2s, background-color .2s, color .2s, border-color .2s;
}
.av-btn:hover, .av-btn:focus-visible {
  background: var(--_bg-h); color: var(--_fg-h); border-color: var(--_bd-h);
  transform: translateY(var(--av-btn-lift)); box-shadow: var(--_shadow-h); text-decoration: none;
}
.av-btn:active { transform: none; box-shadow: none; }
.av-btn:focus-visible { outline: var(--av-focus); outline-offset: 3px; }
.av-btn[disabled], .av-btn[aria-disabled="true"] { opacity: .55; pointer-events: none; transform: none; box-shadow: none; }

/* ---- variants ---- */
.av-btn--secondary {
  --_bg: var(--av-purple); --_bd: var(--av-purple); --_bg-h: var(--av-purple-800); --_bd-h: var(--av-purple-800);
  --_shadow-h: var(--av-shadow-purple);
}
.av-btn--outline {
  --_bg: transparent; --_fg: var(--av-purple); --_bd: var(--av-purple);
  --_bg-h: var(--av-purple); --_fg-h: var(--av-white); --_bd-h: var(--av-purple); --_shadow-h: var(--av-shadow-purple);
}
.av-btn--soft {
  --_bg: var(--av-purple-100); --_fg: var(--av-purple); --_bd: var(--av-purple-100);
  --_bg-h: var(--av-purple); --_fg-h: var(--av-white); --_bd-h: var(--av-purple); --_shadow-h: var(--av-shadow-purple);
}
.av-btn--light {
  --_bg: var(--av-white); --_fg: var(--av-purple); --_bd: var(--av-white);
  --_bg-h: var(--av-orange); --_fg-h: var(--av-white); --_bd-h: var(--av-orange); --_shadow-h: var(--av-shadow-orange);
}
.av-btn--outline-light {
  --_bg: transparent; --_fg: var(--av-white); --_bd: rgba(255, 255, 255, .6);
  --_bg-h: var(--av-white); --_fg-h: var(--av-purple); --_bd-h: var(--av-white); --_shadow-h: none;
}

.av-btn--ghost {
  --_bg: transparent; --_fg: var(--av-text); --_bd: transparent;
  --_bg-h: var(--av-purple-100); --_fg-h: var(--av-purple); --_bd-h: var(--av-purple-100); --_shadow-h: none;
}

/* ---- sizes ---- */
.av-btn--sm { --_h: var(--av-btn-h-sm); --_px: var(--av-btn-px-sm); --_fs: var(--av-btn-fs-sm); }
.av-btn--lg { --_h: var(--av-btn-h-lg); --_px: var(--av-btn-px-lg); --_fs: var(--av-btn-fs-lg); }
.av-btn--block { display: flex; width: 100%; }
.av-btn--wrap { white-space: normal; }

/* ---- icon (the arrow points the way the text goes: left in RTL; it nudges forward on hover) ---- */
.av-btn__icon {
  flex: none; width: 1.15em; height: 1.15em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s var(--av-ease);
}
.av-btn:hover .av-btn__icon--dir, .av-btn:focus-visible .av-btn__icon--dir { transform: translateX(-3px); }
[dir="ltr"] .av-btn__icon--dir { transform: scaleX(-1); }
[dir="ltr"] .av-btn:hover .av-btn__icon--dir, [dir="ltr"] .av-btn:focus-visible .av-btn__icon--dir { transform: scaleX(-1) translateX(-3px); }

/* ---- icon only: a square button (hover lifts the button, the icon stays) ---- */
.av-btn--icon { --_h: var(--av-btn-h-icon); width: var(--_h); min-width: var(--_h); padding: 0; position: relative; }
.av-btn--icon.av-btn--sm { --_h: var(--av-btn-h-sm); }
.av-btn--icon.av-btn--lg { --_h: var(--av-btn-h-lg); }
.av-btn--icon > svg { flex: none; width: 20px; height: 20px; }
.av-btn--icon > svg:not(.av-btn__icon) { fill: currentColor; } /* brand logos handed in as icon_html */
.av-btn--icon .av-btn__icon { width: 20px; height: 20px; }
.av-btn--icon:hover .av-btn__icon, .av-btn--icon:focus-visible .av-btn__icon { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .av-btn, .av-btn__icon { transition: none; }
  .av-btn:hover, .av-btn:focus-visible { transform: none; }
}

/* ---- a row of buttons ---- */
.av-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.av-btns--center { justify-content: center; }

/* ==========================================================================
   Bridge: buttons whose markup comes from a plugin (the Newsletter form's submit is an <input>, so it cannot carry
   .av-btn). They get the primary skin from the same identity tokens. Specificity is raised on purpose: the older
   theme rules for these use !important.
   ========================================================================== */
html body input.tnp-submit,
html body #footer-newsletter input.tnp-submit {
  box-sizing: border-box !important; display: inline-flex !important; align-items: center !important; justify-content: center !important;
  width: auto !important; min-height: var(--av-btn-h-md) !important; margin: 0 !important; padding: 0 var(--av-btn-px-md) !important;
  border: var(--av-btn-border) solid var(--av-orange) !important; border-radius: var(--av-btn-radius) !important;
  background: var(--av-orange) !important; color: var(--av-white) !important;
  font-family: inherit !important; font-size: var(--av-btn-fs-md) !important; font-weight: var(--av-btn-weight) !important; line-height: 1.4 !important;
  cursor: pointer; transition: transform .2s var(--av-ease), box-shadow .2s, background-color .2s !important;
}
html body input.tnp-submit:hover,
html body #footer-newsletter input.tnp-submit:hover {
  background: var(--av-orange-dark) !important; border-color: var(--av-orange-dark) !important;
  transform: translateY(var(--av-btn-lift)); box-shadow: var(--av-shadow-orange);
}
