/*
 * Treatment cards: the cards of [boon_treatments_by_category] on /treatments/,
 * the homepage and a clinic's treatment list (Phase 3 plan 09).
 * Markup: includes/treatment-cards/treatment-cards.php.
 *
 * Part A is the "Treatments cards" block that lived in Appearance > Customize >
 * Additional CSS. Same rules, same order, nothing added to a selector.
 * Don't tie these rules to a wrapper or make them stronger without checking
 * the pages:
 * - h3.boon-tcard-title and h2.boon-cat-title are exactly as strong as the
 *   theme's and Elementor's heading rules and win only by coming later.
 * - .boon-cat also spaces the sections of the price list on /pricing/
 *   ([boon_treatment_grid] in treatment-grid.php prints section.boon-cat too).
 *
 * treatment-cards.php prints this file straight after Additional CSS, the last
 * styles in the page head, on every front-end page. Keep it there.
 *
 * Part B is new: the two clinic buttons of one card, and the buttons' hover.
 */

/* ==================================================================
   Part A - from Additional CSS
   ================================================================== */

.boon-tcard{
  border-radius: 15px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: row;  /* image left, content right */
  height: 100%;
}

/* Left image column */
.boon-tcard-media{
  width: 38%;
  flex: 0 0 38%;
  overflow: hidden;
  line-height: 0;
  aspect-ratio: 4 / 3;     /* tweak: 3/2, 16/10 etc */
}

/* Image fills the left column */
.boon-tcard-img{
  width: 100%;
  height: 100%!important;
  display: block;
  object-fit: cover;
}


/* Right content column */
.boon-tcard-inner{
  padding: 2em;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0; /* prevents overflow issues */
}

/* Title */
h3.boon-tcard-title{
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 12px;
}

.boon-tcard-title a{
  color: inherit;
  text-decoration: none;
}

/* Excerpt */
.boon-tcard-excerpt{
  padding-bottom: 0.5em;
  font-size: 14px;
  line-height: 1.6;
  color: #272727;
}

/* Button pinned to bottom. Since 2026-11-17 the look is the canonical
   .boon-opt-btn family (Additional CSS, plan 14): the markup wears
   boon-opt-btn--dark, so colours, type, padding, caret size and the
   dark-stays-dark hover all come from the family. This rule keeps only
   what the card layout needs on top of it (full width wins by coming
   after Additional CSS at equal strength). */
.boon-tcard-btn{
  margin-top: auto;
  width: 100%;
}

/* =========================================
   Category titles
   ========================================= */

.boon-cat{
  margin-bottom: 2.5em; /* space between sections */
}

h2.boon-cat-title{
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;

  margin: 0 0 1.6rem;
  color: #272727;
}

/* subtle divider (optional but looks polished) */
.boon-cat-title::after{
  content: "";
  display: block;
  width: 48px;
  height: 2px;
  background: #FDC7B0;
  margin-top: 10px;
}


/* =========================================================
   Grid layout (use fewer columns because cards are wider)
   ========================================================= */

.boon-grid--treatments{
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* better for horizontal cards */
  gap: 28px;
}

@media (max-width: 1024px){
  .boon-grid--treatments{
    grid-template-columns: 1fr;
  }
}

/* Stack image on top on mobile */
@media (max-width: 768px){
  .boon-tcard{
    flex-direction: column;
  }

  .boon-tcard-media{
    width: 100%;
    flex: none;
    height: 220px !important; /* bring back a tidy fixed height on mobile */
  }
}

/* ==================================================================
   Part B - two buttons on one card ("Explore Leicester" above
   "Explore Birmingham", on a page with no clinic), and the hover
   ================================================================== */

/* The pair takes the single button's place at the bottom of the card. Written
   with two classes so they win over the one-class button rule above. */
.boon-tcard .boon-tcard-btns {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.boon-tcard .boon-tcard-btns .boon-tcard-btn {
  margin-top: 0;
}

/* The 2026-10-09 colour-swap hover lived here until 2026-11-17. It worked
   around the kit's link colour beating a one-class rule; the canonical
   family's !important colours make it unneeded, and the family's dark
   hover (dark stays dark, text to peach - plan 14) is what Part A had
   wanted all along. */

/* ---------------------------------------------------------------------------
   The tiles (Phase 3 plan 13, the homepages): [boon_treatments_by_category
   layout="tiles"]. New class names only; the parts above are untouched.
   The doubled selectors on the tile are load-bearing: the theme resets bare
   buttons to transparent at kit strength, and reset.css gives
   [type=button]:hover a #c36 background, so a single class loses both.
--------------------------------------------------------------------------- */

.boon-cattiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.boon-cattiles button.boon-cattile {
  padding: 0;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: #fff;
  /* Browsers give <button> white-space:nowrap by default; without this the
     long category names clip at laptop widths instead of wrapping. */
  white-space: normal;
  /* The kit's ".elementor-kit-25 button { border-radius: 0 }" beat the
     14px on .boon-cattile below, so every tile but View All (a link, not a
     button) had square corners until 2026-11-19. */
  border-radius: 14px;
}

/* Stays white on hover (Katie, 2026-11-19: the pale pink #F7EEE9 vanished
   against the pink section). Keep this rule even so: without it reset.css's
   [type=button]:hover paints the tile #c36. The lift and shadow below are
   the hover. */
.boon-cattiles button.boon-cattile:hover {
  background: #fff;
}

.boon-cattile {
  /* A flex column with the count pinned to the bottom (margin-top:auto on
     .boon-cattile-count): with names wrapping to two lines at laptop widths,
     this keeps every row's "N treatments" on one shared bottom line. */
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(39, 39, 39, .08);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.boon-cattile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(39, 39, 39, .14);
}

.boon-cattile.is-open {
  outline: 2px solid #272727;
  transform: none;
}

.boon-cattile-media {
  display: block;
  flex: none;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.boon-cattile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.boon-cattile-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 16px 16px;
}

.boon-cattile-name {
  display: block;
  color: #272727;
  font-weight: 600;
  font-size: 19px;
  line-height: 1.25;
}

.boon-cattile-count {
  display: block;
  margin-top: auto;
  padding-top: 6px;
  color: #B86B52;
  font-size: 14px;
  font-weight: 500;
}

.boon-cattile-chev {
  display: inline-block;
  font-size: 16px;
  transition: transform .25s ease;
}

.boon-cattile.is-open .boon-cattile-chev {
  transform: rotate(90deg);
}

.boon-cattile--all {
  background: #272727;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.boon-cattile--all .boon-cattile-allinner {
  padding: 20px;
}

.boon-cattile--all .boon-cattile-name {
  color: #FDC7B0;
}

.boon-cattile--all .boon-cattile-count {
  color: #fff;
  opacity: .75;
}

/* The panel: closed is height 0; the script animates to the measured height
   and the grid places it full width after the clicked tile's row. */
.boon-catpanel {
  grid-column: 1 / -1;
  overflow: hidden;
  height: 0;
  opacity: 0;
  transition: height .3s ease, opacity .3s ease;
}

.boon-catpanel.is-open {
  opacity: 1;
}

.boon-catpanel-inner {
  background: #fff;
  border-radius: 14px;
  padding: 8px 26px;
  box-shadow: 0 4px 14px rgba(39, 39, 39, .08);
}

.boon-catrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(39, 39, 39, .1);
}

.boon-catrow:last-child {
  border-bottom: 0;
}

.boon-catrow-text {
  flex: 1 1 auto;
  min-width: 0;
}

.boon-catrow-name {
  display: block;
  color: #272727;
  font-weight: 600;
  font-size: 17px;
}

/* The name is an h3 since 2026-11-24. Two classes, so the Elementor kit's
   `.elementor-kit-NNN h3` (and the theme's h3) cannot restyle it: it keeps
   the look it had as a span. */
.boon-catrow .boon-catrow-name {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: inherit;
  letter-spacing: normal;
  text-transform: none;
  color: #272727;
}

/* Text for search engines and screen readers only (the treatment's name in
   the panel buttons). */
.boon-catrow .boon-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.boon-catrow-excerpt {
  display: block;
  margin-top: 3px;
  color: #555;
  font-size: 14px;
  line-height: 1.45;
  max-width: 640px;
}

.boon-catrow-btns {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
}

/* The cards' button, resized for a row: its own rule says width 100%.
   font-size carries !important to outrank the family's, by specificity
   among important rules; the caret scales down with it. */
.boon-catrow-btns .boon-tcard-btn {
  margin: 0;
  width: auto;
  padding: 11px 18px;
  font-size: 14px !important;
  white-space: nowrap;
}

.boon-catrow-btns .boon-opt-btn-icon {
  font-size: 18px;
}

/* The consultation band's styles lived here until 2026-11-06, removed with
   the band itself: Severin and Katie called it redundant beside the
   homepages' own consultation sections. */

@media (max-width: 971px) {
  .boon-cattiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* A phone: one tile per row, the photo a square beside the name instead of
   on top (Katie, 2026-11-19). Two per row left each tile about 150px wide,
   so most names wrapped; photos on top made the section nearly three screens
   long. This way it stays about one screen. The row direction is written on
   the doubled tile selector, as strong as the tile's own rules above. */
@media (max-width: 767px) {
  .boon-cattiles {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .boon-cattiles button.boon-cattile {
    flex-direction: row;
    align-items: stretch;
  }

  .boon-cattile-media {
    width: 110px;
    aspect-ratio: 1 / 1;
  }

  .boon-cattile-name {
    font-size: 16px;
  }

  .boon-cattile-body {
    justify-content: center;
    padding: 12px 16px;
  }

  .boon-cattile-count {
    margin-top: 4px;
  }

  .boon-cattile--all {
    min-height: 72px;
  }

  .boon-catpanel-inner {
    padding: 4px 16px;
  }

  .boon-catrow {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* A phone has no room for "Explore Leicester" and "Explore Birmingham"
     side by side: at 390px the pair ran past the panel's edge and
     "Explore Birmingham" was cut off. Stacked full width instead. */
  .boon-catrow-btns {
    flex-direction: column;
    align-self: stretch;
  }

  .boon-catrow-btns .boon-tcard-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boon-cattile,
  .boon-cattile-chev,
  .boon-catpanel {
    transition: none;
  }
}
