/*
 * Book Buddy Connect — card grid for courses and events.
 *
 * Everything is namespaced .bbc- so a theme's own rules cannot reach in, and
 * nothing here styles a bare element selector, so these cards cannot leak out
 * into the rest of the page either.
 *
 * The palette is the Book Buddy Academy site palette: cream page, white cards
 * on a warm hairline border, deep navy type, gold accent. Colours come from
 * custom properties on .bbc-wrap, so a page that needs a variant overrides
 * those values and touches nothing else.
 *
 * There is deliberately NO dark-scheme block. These cards are a fixed part of
 * the brand's light design; letting the visitor's OS setting repaint them made
 * them stop matching every other section on the page.
 */

.bbc-wrap {
  /* Brand */
  --bbc-gold:     #F4B400;   /* bars, borders, button fill — never small text */
  --bbc-gold-ink: #8A6508;   /* the same gold darkened for text on white, which
                                #F4B400 is far too pale to be legible as */
  --bbc-navy:     #07273A;

  /* Roles */
  --bbc-text:     #07273A;
  --bbc-soft:     #47606F;
  --bbc-mute:     #8A99A3;
  --bbc-line:     #ECE7DD;
  --bbc-card:     #FFFFFF;
  --bbc-thumb-bg: #F2EFE9;
  --bbc-radius:   24px;

  color: var(--bbc-text);
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0 0 2rem;
}

.bbc-heading {
  margin: 0 0 1.6rem;
  color: var(--bbc-navy);
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.01em;
}

.bbc-grid {
  display: grid;
  gap: 2.2rem;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

/* One column on phones regardless of the requested count, two at tablet width,
   the requested count only when there is genuinely room for it. */
@media (min-width: 560px) {
  .bbc-cols-2, .bbc-cols-3, .bbc-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .bbc-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bbc-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.bbc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bbc-card);
  border: 1px solid var(--bbc-line);
  border-radius: var(--bbc-radius);
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(7, 39, 58, .05);
  transition: transform .35s ease, box-shadow .35s ease;
}

/* The gold cap along the top edge. Above the thumbnail rather than behind it,
   so a card with an image still reads as the same component as one without. */
.bbc-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 100%;
  height: 5px;
  background: var(--bbc-gold);
  transition: height .35s ease;
}

.bbc-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 70px rgba(7, 39, 58, .12);
}

.bbc-card:hover::before { height: 7px; }

/* Hover lift only where hovering is a real gesture. On touch it would stick
   after a tap and leave one card raised for no reason. */
@media (hover: none) {
  .bbc-card:hover { transform: none; box-shadow: 0 15px 40px rgba(7, 39, 58, .05); }
}

@media (prefers-reduced-motion: reduce) {
  .bbc-card, .bbc-card::before, .bbc-btn { transition: none; }
  .bbc-card:hover { transform: none; }
}

.bbc-thumb {
  aspect-ratio: 16 / 9;
  background: var(--bbc-thumb-bg);
  overflow: hidden;
}

.bbc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bbc-body {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 2rem 1.9rem 1.9rem;
  flex: 1;
}

.bbc-tag {
  align-self: flex-start;
  padding: .5rem 1.05rem;
  border: 1px solid var(--bbc-gold);
  border-radius: 999px;
  background: transparent;
  color: var(--bbc-gold-ink);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.2;
}

.bbc-title {
  margin: .3rem 0 0;
  color: var(--bbc-navy);
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
}

.bbc-desc {
  margin: 0;
  color: var(--bbc-soft);
  font-size: .98rem;
  line-height: 1.75;
}

.bbc-meta {
  margin: 0;
  color: var(--bbc-mute);
  font-size: .88rem;
  line-height: 1.5;
}

.bbc-scarce {
  margin: 0;
  color: #B4552A;
  font-size: .85rem;
  font-weight: 600;
}

/* Pushed to the bottom so buttons line up across cards of unequal height. The
   rule above it repeats the card's hairline, matching the site's meta divider. */
.bbc-foot {
  margin-top: auto;
  padding-top: 1.4rem;
  border-top: 1px solid var(--bbc-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  flex-wrap: wrap;
}

.bbc-price {
  color: var(--bbc-navy);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.bbc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .85rem 1.7rem;
  border: 0;
  border-radius: 14px;
  background: var(--bbc-gold);
  color: var(--bbc-navy) !important;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none !important;
  transition: background .3s ease, color .3s ease;
}

.bbc-btn:hover,
.bbc-btn:focus-visible {
  background: var(--bbc-navy);
  color: #FFFFFF !important;
}

/* Keyboard users get a ring the gold fill cannot swallow. */
.bbc-btn:focus-visible {
  outline: 3px solid var(--bbc-gold);
  outline-offset: 3px;
}

.bbc-btn-off,
.bbc-btn-off:hover {
  background: #EDEAE3;
  color: var(--bbc-mute) !important;
  cursor: default;
}

/* Event date chip, top-right of the card, clear of the gold cap. */
.bbc-card-event .bbc-date {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.4rem;
  padding: .5rem .4rem .55rem;
  border-radius: 14px;
  background: var(--bbc-navy);
  color: #FFFFFF;
  line-height: 1;
}

.bbc-date-d { font-size: 1.35rem; font-weight: 800; }
.bbc-date-m {
  margin-top: .2rem;
  color: var(--bbc-gold);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Keep the title clear of the date chip. */
.bbc-card-event .bbc-body { padding-right: 5.4rem; }
.bbc-card-event .bbc-foot { padding-right: 0; }

/* Single call-to-action card: membership, consultation. Capped in width so it
   does not stretch into a banner on a wide page, and given more breathing room
   than a grid card because it is never seen next to a sibling. */
.bbc-offer { max-width: 34rem; }

.bbc-offer .bbc-body { padding: 2.4rem 2.2rem 2.2rem; gap: .8rem; }

.bbc-offer-title { font-size: 1.75rem; }

.bbc-period {
  color: var(--bbc-mute);
  font-size: .85rem;
  font-weight: 600;
}

.bbc-empty {
  color: var(--bbc-soft, #47606F);
  font-style: italic;
  margin: 1rem 0;
}

.bbc-error {
  border-left: 4px solid #C0392B;
  background: #FDF1F0;
  color: #7A2018;
  padding: .85rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  margin: 1rem 0;
}

@media (max-width: 600px) {
  .bbc-body                  { padding: 1.6rem 1.4rem 1.5rem; }
  .bbc-card-event .bbc-body  { padding-right: 5rem; }
  .bbc-offer .bbc-body       { padding: 1.8rem 1.5rem 1.6rem; }
  .bbc-title                 { font-size: 1.3rem; }
  .bbc-offer-title           { font-size: 1.45rem; }
  .bbc-grid                  { gap: 1.6rem; }
  .bbc-btn                   { width: 100%; }
}
