/* =====================================================================
   BHM Membership Cards — stylesheet
   --------------------------------------------------------------------
   Renders the regular (non-gift) membership tiers as cards inside an
   Individual / Joint tab switcher. Visually matches the gift cards
   but is fully self-contained — no dependency on the gift plugin's
   CSS. Class names share the .bhm-tier base for visual consistency
   but every rule is scoped under .bhm-membership-tiers so the two
   plugins coexist without colliding.

   All colours are from the BHM brand palette (site_colours.css).
   ===================================================================== */

.bhm-membership-cards {
  --bhm-ink:       #283545;  /* Flint Grey */
  --bhm-ink-soft:  #4a5667;
  --bhm-line:      #e7eaee;
  --bhm-paper:     #ffffff;  /* Chalk White */
  --bhm-orange:    #FF9113;  /* Discovery Orange */
  --bhm-teal:      #00D8BD;  /* Willett Turquoise */
  --bhm-wine:      #810045;  /* Fitzherbert Wine */
  --bhm-violet:    #7F5DA4;  /* Nash Violet */
  --bhm-azure:     #006CBF;  /* Stanford Azure */
  --bhm-radius:    8px;

  margin: 24px 0 32px;
}

/* =========  Tabs  ========================================= */

.bhm-membership-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 48px;
  border-bottom: 2px solid var(--bhm-line);
}

.bhm-membership-tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;  /* overlap the tablist border so the active state sits flush */
  padding: 14px 28px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--bhm-ink-soft);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.bhm-membership-tab:hover {
  color: var(--bhm-ink);
}

.bhm-membership-tab.is-active,
.bhm-membership-tab[aria-selected="true"] {
  color: var(--bhm-ink);
  border-bottom-color: var(--bhm-ink);
}

.bhm-membership-tab:focus-visible {
  outline: 3px solid var(--bhm-azure);
  outline-offset: 2px;
  border-radius: 4px;
}

.bhm-membership-panel[hidden] {
  display: none;
}

/* =========  Card grid  ====================================
   Individual tab has 2 cards, Joint tab has 3. Pinning to
   minmax(260px, 360px) per column keeps card widths in the
   same visual range across both tabs so switching tabs
   doesn't feel like a different page. justify-content: start
   keeps the left edge of the first card aligned with the
   panel-intro heading / paragraph above, so there's a clean
   continuous left margin down the page (matters most in the
   Individual tab where two cards leave empty horizontal space). */

.bhm-membership-tiers {
  display: grid;
  gap: 24px;
  justify-content: start;
}

.bhm-membership-tiers--individual {
  grid-template-columns: repeat(2, minmax(260px, 360px));
}

.bhm-membership-tiers--joint,
.bhm-membership-tiers--gift {
  grid-template-columns: repeat(3, minmax(260px, 360px));
}

@media (max-width: 760px) {
  .bhm-membership-tiers--individual,
  .bhm-membership-tiers--joint,
  .bhm-membership-tiers--gift {
    grid-template-columns: 1fr;
  }
}

/* =========  Card frame  ===================================
   Mirrors .bhm-gift-tiers .bhm-tier from the gift plugin, but
   scoped to this plugin's container. */

.bhm-membership-tiers .bhm-tier {
  position: relative;
  background: var(--bhm-paper);
  border: 1px solid var(--bhm-line);
  border-radius: var(--bhm-radius);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.bhm-membership-tiers .bhm-tier:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(40, 53, 69, 0.10);
}

/* =========  Coloured header band  ========================= */

.bhm-membership-tiers .bhm-tier-band {
  padding: 28px 28px 24px;
  color: var(--bhm-ink);
  border-top-left-radius: var(--bhm-radius);
  border-top-right-radius: var(--bhm-radius);
}

/* Band colour variants. Light-band variants keep Flint Grey
   text; dark-band variants flip to Chalk White for contrast. */
.bhm-membership-tiers .bhm-tier-band--teal   { background: var(--bhm-teal); }
.bhm-membership-tiers .bhm-tier-band--orange { background: var(--bhm-orange); }
.bhm-membership-tiers .bhm-tier-band--wine   { background: var(--bhm-wine);   color: #ffffff; }
.bhm-membership-tiers .bhm-tier-band--violet { background: var(--bhm-violet); color: #ffffff; }
.bhm-membership-tiers .bhm-tier-band--azure  { background: var(--bhm-azure);  color: #ffffff; }

.bhm-membership-tiers .bhm-tier-name {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0 0 14px;
  color: inherit;
  /* Reserve space for two lines so all bands match height regardless
     of which tier name wraps. (2 × line-height 1.1 = 2.2em.) */
  min-height: 2.2em;
}

.bhm-membership-tiers .bhm-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.bhm-membership-tiers .bhm-price-currency { font-size: 22px; font-weight: 600; }
.bhm-membership-tiers .bhm-price-amount {
  font-weight: 800;
  font-size: 52px;
  line-height: 1;
  letter-spacing: -0.025em;
}
.bhm-membership-tiers .bhm-price-period { font-size: 14px; font-weight: 600; opacity: 0.8; }

/* =========  Featured ribbon  ============================== */

.bhm-membership-tiers .bhm-ribbon {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bhm-ink);   /* Flint Grey — no pure-black in palette */
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(40, 53, 69, 0.18);
}

/* =========  Card body  ==================================== */

.bhm-membership-tiers .bhm-tier-body {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.bhm-membership-tiers .bhm-tier-tagline {
  font-size: 15px;
  color: var(--bhm-ink-soft);
  margin: 0 0 18px;
  line-height: 1.5;
}

.bhm-membership-tiers .bhm-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  flex-grow: 1;
}

.bhm-membership-tiers .bhm-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--bhm-ink);
  padding: 8px 0;
  border-top: 1px solid var(--bhm-line);
}

.bhm-membership-tiers .bhm-benefits li:first-child {
  border-top: none;
  padding-top: 4px;
}

.bhm-membership-tiers .bhm-benefits li svg {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--bhm-ink);
}

/* =========  CTA  ==========================================
   Same two-tone Flint-Grey body + coloured tile pattern as
   the gift cards, applied to a <button> inside the Spektrix
   <spektrix-memberships> web component. Padding sized so
   "Join now" + chevron tile fits cleanly on one line. */

.bhm-membership-tiers .bhm-cta {
  position: relative;
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 18px 64px 18px 18px;
  background: var(--bhm-ink);     /* Flint Grey */
  color: #ffffff;                  /* Chalk White */
  font-family: inherit;
  font-size: 16px;
  /* Matches the gift cards' CTA weight (400) so the two card sets
     have visually consistent button styling. */
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: left;
  text-decoration: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.bhm-membership-tiers .bhm-cta-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bhm-membership-tiers .bhm-cta::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56px;
  /* Default tile colour — overridden per tier via :has() below. */
  background-color: var(--bhm-orange);
  background-image: url("/wp-content/themes/rpmt/assets/images/svgs/cta-find-out-more-arrow-black.svg");
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 14px;
  transition: background-color 0.15s ease;
}

.bhm-membership-tiers .bhm-cta:hover {
  background: var(--bhm-orange);
  color: var(--bhm-ink);
}

.bhm-membership-tiers .bhm-cta:hover::after {
  background-color: var(--bhm-ink);
  background-image: url("/wp-content/themes/rpmt/assets/images/svgs/cta-find-out-more-arrow.svg");
}

.bhm-membership-tiers .bhm-cta:focus-visible {
  outline: 3px solid var(--bhm-azure);
  outline-offset: 3px;
}

/* =========  Per-tier tile colour  ========================
   The chevron tile on each card matches that card's header
   band. Uses :has() (Chrome 105+, Safari 15.4+, Firefox 121+).
   Older Firefox falls back to the base orange tile — still
   on-palette. */

.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--teal) .bhm-cta::after {
  background-color: var(--bhm-teal);
  /* black arrow already default */
}
.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--teal) .bhm-cta:hover {
  background: var(--bhm-teal);
  color: var(--bhm-ink);
}

.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--wine) .bhm-cta::after {
  background-color: var(--bhm-wine);
  /* Dark tile — switch to white arrow for AA contrast. */
  background-image: url("/wp-content/themes/rpmt/assets/images/svgs/cta-find-out-more-arrow.svg");
}
.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--wine) .bhm-cta:hover {
  background: var(--bhm-wine);
  color: #ffffff;
}

.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--violet) .bhm-cta::after {
  background-color: var(--bhm-violet);
  background-image: url("/wp-content/themes/rpmt/assets/images/svgs/cta-find-out-more-arrow.svg");
}
.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--violet) .bhm-cta:hover {
  background: var(--bhm-violet);
  color: #ffffff;
}

.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--azure) .bhm-cta::after {
  background-color: var(--bhm-azure);
  background-image: url("/wp-content/themes/rpmt/assets/images/svgs/cta-find-out-more-arrow.svg");
}
.bhm-membership-tiers .bhm-tier:has(.bhm-tier-band--azure) .bhm-cta:hover {
  background: var(--bhm-azure);
  color: #ffffff;
}

/* =========  Spektrix web component plumbing  ============= */

/* The <spektrix-memberships> custom element renders as inline by
   default in some browsers; force block so it doesn't squeeze the
   button. margin-top: auto pushes the component (and its CTA) to the
   bottom of the flex card body so cards with different tagline
   lengths still align their buttons along the same baseline. */
.bhm-membership-tiers spektrix-memberships,
.bhm-membership-tiers .bhm-spektrix-membership {
  display: block;
  margin-top: auto;
}

/* Autorenew checkbox is hidden + checked, matching the existing
   [member_join] shortcode's behaviour (renew="true"). Users land in
   the basket with autorenew on by default. If you ever want it
   surfaced as an explicit opt-in, switch .bhm-autorenew-hidden to a
   visible label and uncheck the input. */
.bhm-membership-tiers .bhm-autorenew-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Component status messages — shown by the Spektrix component on
   success/failure. */
.bhm-membership-tiers .bhm-cta-status {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
}
.bhm-membership-tiers .bhm-cta-status--success {
  background: rgba(0, 216, 189, 0.12);   /* Willett Turquoise 12% */
  color: var(--bhm-ink);
}
.bhm-membership-tiers .bhm-cta-status--fail {
  background: rgba(230, 31, 31, 0.10);   /* Booth Red 10% */
  color: var(--bhm-ink);
}
.bhm-membership-tiers .bhm-cta-status[hidden] {
  display: none;
}

/* =========  API-error fallback  ========================== */

.bhm-membership-tiers-error {
  padding: 20px 24px;
  border: 1px solid var(--bhm-line);
  border-radius: var(--bhm-radius);
  background: #faf7f1;
  color: var(--bhm-ink);
  font-size: 15px;
  line-height: 1.55;
}
.bhm-membership-tiers-error a {
  color: inherit;
  text-decoration: underline;
  font-weight: 700;
}

/* =====================================================================
   Panel intros — heading + paragraph that sit above each tab's card
   grid. Shared by all three tabs (Individual / Joint / Gift) so they
   feel like the same kind of content even though the copy differs.
   ===================================================================== */

.bhm-membership-cards .bhm-panel-intro {
  margin: 0 0 40px;
}
.bhm-membership-cards .bhm-panel-intro-heading {
  font-weight: 800;
  font-size: 22px;
  line-height: 1.2;
  color: #283545;             /* Flint Grey */
  margin: 0 0 8px;
}
.bhm-membership-cards .bhm-panel-intro-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: #4a5667;
}

/* =====================================================================
   Gift tab — content that sits below the gift card grid
   --------------------------------------------------------------------
   Specific to the Gift tab — the "How gifting works" reassurance box
   that explains the gift pack / PDF delivery flow. The panel-intro
   heading + paragraph above the cards uses the shared rules in the
   previous section.
   ===================================================================== */

/* "How gifting works" reassurance strip — sits between the gift card
   grid and the secondary form-link. Beige background to mirror the
   gift voucher form panel inside the modal. */
.bhm-membership-cards .bhm-gift-note {
  margin: 24px 0 16px;
  padding: 24px 28px;
  background: #D7CCBD;        /* Palmeira Porcelain */
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  color: #283545;
}
/* Theme overrides — the ACF Standard Text wrapper applies
   font-size: clamp(16px, 4vw, 20px) to paragraphs inside the
   .flex-text-block.standard-text container, which inflates the
   body copy above what's intended here. Force the heading larger
   than the body and lock the paragraph down to a readable size.
   !important is the cleanest win against the theme's higher
   specificity rule. */
.bhm-membership-cards .bhm-gift-note h3 {
  font-weight: 800 !important;
  font-size: 22px !important;
  line-height: 1.2 !important;
  margin: 0 0 10px !important;
  color: inherit;
}
.bhm-membership-cards .bhm-gift-note p {
  margin: 0 !important;
  font-size: 16px !important;
  line-height: 1.55 !important;
  font-weight: 400 !important;
  color: inherit;
}
.bhm-membership-cards .bhm-gift-note a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
}

/* Quiet secondary "Or buy a gift voucher using the form" opener. */
.bhm-membership-cards .bhm-gift-buy-link-wrap {
  margin: 8px 0 0;
  font-size: 15px;
  color: #4a5667;
  text-align: left;
}
.bhm-membership-cards .bhm-gift-buy-link {
  color: #283545;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.bhm-membership-cards .bhm-gift-buy-link:hover {
  text-decoration-thickness: 2px;
}

/* On mobile the gift-note becomes a stack rather than a row. */
@media (max-width: 640px) {
  .bhm-membership-cards .bhm-gift-note {
    flex-direction: column;
    gap: 12px;
  }
}

/* =====================================================================
   Gift voucher modal
   --------------------------------------------------------------------
   Used by the Gift tab's cards. Native <dialog> provides display:none
   default, ESC-to-close, focus trap, and ::backdrop. We add the panel
   styling, close button chrome, animation, and the body scroll-lock
   (the latter from JS). Lives at .bhm-gift-modal so it doesn't fight
   the existing membership tier styles.
   ===================================================================== */

.bhm-gift-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
  color: #283545;            /* Flint Grey */
}

/* Only switch to flex when [open] — closed dialog stays display:none. */
.bhm-gift-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bhm-gift-modal::backdrop {
  background: rgba(40, 53, 69, 0.65);
}

/* The panel inside the dialog — sized like a centred card on desktop,
   full-screen on mobile. */
.bhm-gift-modal .bhm-gift-buy {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  max-height: min(90vh, 920px);
  margin: 0;
  padding: 56px 28px 28px;
  background: #f3f0eb;        /* Sand — matches Spektrix iframe body */
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  overflow-y: auto;
}

.bhm-gift-modal .bhm-gift-buy-heading {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 900;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: #283545;             /* Flint Grey */
  margin: 0 0 8px;
  padding: 0;
}
.bhm-gift-modal .bhm-gift-buy-heading:focus {
  outline: none;
}

.bhm-gift-modal .bhm-gift-buy-intro {
  margin: 0 0 20px;
  padding: 0;
  font-size: 16px;
  color: #283545;             /* Flint Grey */
}

.bhm-gift-modal .bhm-gift-buy-iframe-wrap {
  background: transparent;
  margin: 0;
}

/* Close (X) button — top-right of the panel. */
.bhm-gift-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(40, 53, 69, 0.08);
  color: #283545;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s ease, color 0.15s ease;
}
.bhm-gift-modal-close:hover,
.bhm-gift-modal-close:focus-visible {
  background: #283545;
  color: #ffffff;
}
.bhm-gift-modal-close:focus-visible {
  outline: 3px solid #FF9113;  /* Discovery Orange */
  outline-offset: 2px;
}

/* Entrance animation. Respects prefers-reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  .bhm-gift-modal[open] .bhm-gift-buy {
    animation: bhm-gift-modal-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .bhm-gift-modal[open]::backdrop {
    animation: bhm-gift-modal-backdrop-in 220ms ease-out;
  }
}
@keyframes bhm-gift-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes bhm-gift-modal-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Full-screen on small viewports. */
@media (max-width: 640px) {
  .bhm-gift-modal[open] {
    align-items: stretch;
    justify-content: stretch;
  }
  .bhm-gift-modal .bhm-gift-buy {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    padding: 64px 20px 20px;
  }
  .bhm-gift-modal-close {
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
  }
}
