/* tokens.css is linked before this file by the page header (components/_header.php) */

/* Layout */
.bb-section { padding: var(--pad-section) 0; }
.bb-section--oat { background: var(--bb-oat); }
/* Stage title with Ben's stage icon beside it (icons inherit currentColor; cream, as in his proofs) */
.bb-stage-title { display: flex; align-items: center; gap: var(--s-5); }
.bb-stage-title--center { justify-content: center; }
.bb-stage-title h2 { margin: 0; }
.bb-stage-icon {
  flex: none;
  width: clamp(var(--t-4xl), 6vw, var(--t-5xl));   /* same size as the stage heading */
  height: clamp(var(--t-4xl), 6vw, var(--t-5xl));
  color: var(--bb-cream);
  fill: currentColor;   /* Ben's paths carry no fill; inherit it through <use> */
}
/* Flame band: terracotta surface, cream type. Use for short, high-intensity content (Flame stage,
   stat/proof bands) — cream on #B85937 is ~4.6:1, so avoid long-form reading copy here. */
.bb-section--flame { background: var(--bb-terracotta); color: var(--bb-cream); }
.bb-section--flame .bb-display,
.bb-section--flame .bb-h2,
.bb-section--flame .bb-body { color: var(--bb-cream); }
.bb-section--flame .bb-rule { background: rgba(255,252,244,.3); }
.bb-section--flame .bb-btn { color: var(--bb-cream); }
.bb-section--flame .bb-btn:hover { border-bottom-color: var(--bb-cream); }
.bb-container { max-width: var(--container-wide); margin: 0 auto; padding: 0 var(--container-padding); }
.bb-container--narrow { max-width: var(--container-narrow); }
.bb-container--mid { max-width: 720px; }

/* Typography */
.bb-label {
  font-family: 'DM Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: var(--eyebrow-tracking);
  font-size: var(--t-eyebrow);
  font-weight: var(--w-black);
  color: inherit;
  display: block;
}
.bb-display {
  font-family: 'Caladea', serif;
  font-weight: var(--w-reg);
  font-size: clamp(var(--t-3xl), 5vw, var(--t-5xl));
  line-height: var(--lh-heading);
  letter-spacing: 0;
  color: var(--bb-charcoal);
}
.bb-h2 {
  font-family: 'Caladea', serif;
  font-weight: var(--w-reg);
  font-size: var(--t-h2);
  line-height: var(--lh-heading);
  color: var(--bb-charcoal);
}
.bb-body {
  font-size: var(--t-lg);
  line-height: var(--lh-body);
  color: var(--bb-charcoal);
  font-weight: var(--w-reg);
}
body { margin: 0; font-family: 'DM Sans', sans-serif; line-height: var(--lh-body); color: var(--bb-charcoal); background: var(--bb-cream); }
h1, h2, h3 { line-height: var(--lh-heading); }
.bb-rule {
  border: 0;
  height: 1px;
  background: var(--bb-line);
  margin: var(--s-12) 0;
}

/* Button: bare text-link style */
.bb-btn {
  display: inline-block;
  color: var(--bb-blue);
  text-decoration: none;
  letter-spacing: var(--btn-tracking);
  text-transform: uppercase;
  font-size: var(--t-eyebrow);
  font-weight: var(--w-black);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color .3s ease;
  background: transparent;
  border-radius: 0;
  padding-inline: 0;
}
.bb-btn:hover { border-bottom-color: var(--bb-blue); }
/* Ghost variant for dark/hero backgrounds */
.bb-btn--ghost {
  color: var(--bb-cream);
  border-bottom-color: transparent;
}
.bb-btn--ghost:hover { border-bottom-color: var(--bb-cream); }
/* Nav CTA: solid yellow button on the blue bar */
.bb-nav .bb-btn {
  border: 1px solid var(--bb-yellow);
  background: var(--bb-yellow);
  padding: var(--s-2) var(--s-6);
  color: var(--bb-charcoal);
  transition: background .2s ease, border-color .2s ease;
}
.bb-nav .bb-btn:hover { background: var(--bb-cream); border-color: var(--bb-cream); }

/* Navigation */
.bb-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  padding: 0 var(--container-padding);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: var(--bb-blue);
}
.bb-nav__brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-lg);
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--bb-cream);
  text-decoration: none;
  font-weight: var(--w-reg);
}
.bb-nav__brand { position: relative; }
.bb-nav__logo {
  display: block;
  height: 64px;       /* resting state reads ~12px cap height; expanded state still fits the 72px bar */
  width: auto;
}
/* Hover animation: 30-frame sprite of Ben's Web_Hover (a CSS sprite, not a GIF or blob:,
   because the site CSP only allows img-src 'self'). Restarts on every hover, holds the last frame. */
.bb-nav__logo-fx {
  display: none;
  position: absolute;
  inset: 0;
  background: url('/assets/logo/logo-hover-sprite.webp') 0 0 / 100% 3000% no-repeat;
}
.bb-nav__brand.is-hover .bb-nav__logo { visibility: hidden; }
.bb-nav__brand.is-hover .bb-nav__logo-fx {
  display: block;
  animation: bb-logo-hover .9s steps(30, jump-none) forwards;
}
@keyframes bb-logo-hover {
  from { background-position: 0 0; }
  to   { background-position: 0 100%; }
}
/* Mouse-leave: instead of snapping back to the still, play the rest of Ben's load animation
   (60-frame sprite). Hover frame k == load frame k, so it starts at --leave-from (the frame the
   hover had reached, max 29) and runs through the contraction to the resting state. */
.bb-nav__brand.is-leaving .bb-nav__logo { visibility: hidden; }
.bb-nav__brand.is-leaving .bb-nav__logo-fx {
  display: block;
  background-image: url('/assets/logo/logo-leave-sprite.webp');
  background-size: 100% 6000%;
  animation: bb-logo-leave 1.8s steps(60, jump-none) forwards;
  animation-delay: calc(var(--leave-from, 29) * -30ms);
}
@keyframes bb-logo-leave {
  from { background-position: 0 0; }
  to   { background-position: 0 100%; }
}
/* Re-entering mid-leave resumes the hover from the matching pose instead of restarting small */
.bb-nav__brand.is-hover .bb-nav__logo-fx { animation-delay: calc(var(--hover-from, 0) * -30ms); }
@media (prefers-reduced-motion: reduce) {
  .bb-nav__brand.is-hover .bb-nav__logo,
  .bb-nav__brand.is-leaving .bb-nav__logo { visibility: visible; }
  .bb-nav__brand.is-hover .bb-nav__logo-fx,
  .bb-nav__brand.is-leaving .bb-nav__logo-fx { display: none; }
}
.bb-logo-mark {
  width: 1.4em;
  height: 1.4em;
  color: var(--bb-cream);
  flex-shrink: 0;
}
.bb-nav__links {
  display: flex;
  gap: var(--s-8);
  list-style: none;
  align-items: center;
}
.bb-nav__links a {
  color: var(--bb-cream);
  text-decoration: none;
  font-size: var(--nav-link-size);
  letter-spacing: var(--nav-tracking);
  text-transform: uppercase;
  font-weight: var(--w-black);
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  transition: color .2s;
}
.bb-nav__links a:hover { color: var(--bb-yellow); }
/* Services dropdown */
.bb-nav__dropdown-wrap { position: relative; }
.bb-nav__dropdown-wrap::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 8px;
}
.bb-nav__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bb-cream);
  border: 1px solid var(--bb-line);
  min-width: 220px;
  list-style: none;
  padding: var(--s-3) 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  z-index: 200;
}
.bb-nav__dropdown-wrap:hover .bb-nav__dropdown,
.bb-nav__dropdown-wrap:focus-within .bb-nav__dropdown,
.bb-nav__dropdown.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity .2s ease, transform .2s ease;
}
.bb-nav__dropdown li a {
  display: block;
  padding: var(--s-2) var(--s-5);
  font-size: var(--nav-link-size);
  letter-spacing: var(--nav-tracking);
  text-transform: uppercase;
  color: var(--bb-charcoal);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  transition: color .2s;
}
.bb-nav__dropdown li a { font-weight: var(--w-med); }
.bb-nav__dropdown li a:hover { color: var(--bb-blue); }
/* Hamburger */
.bb-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-2);
}
.bb-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--bb-cream);
  transition: transform .3s ease, opacity .3s ease;
}
.bb-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.bb-hamburger.open span:nth-child(2) { opacity: 0; }
.bb-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
/* Mobile nav drawer */
.bb-mobile-nav {
  display: none;
  position: fixed;
  top: var(--nav-height);
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--bb-cream);
  border-left: 1px solid var(--bb-line);
  transform: translateX(100%);
  transition: transform .35s ease;
  z-index: 99;
  overflow-y: auto;
  padding: var(--s-8) var(--s-6);
}
.bb-mobile-nav.open { transform: none; }
.bb-mobile-nav ul { list-style: none; }
.bb-mobile-nav a {
  display: block;
  padding: var(--s-4) 0;
  font-size: var(--nav-link-size);
  letter-spacing: var(--nav-tracking);
  text-transform: uppercase;
  font-family: 'DM Sans', sans-serif;
  color: var(--bb-charcoal);
  text-decoration: none;
  border-bottom: 1px solid var(--bb-line);
}
.bb-mobile-nav a:hover { color: var(--bb-blue); }
.bb-mobile-nav .bb-mobile-nav__sub { padding-left: var(--s-4); }
.bb-mobile-nav .bb-mobile-nav__sub a { font-size: var(--t-xs); color: var(--bb-charcoal); }

/* Hero */
.bb-hero {
  min-height: var(--hero-min-height);
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--hero-margin-bottom);
}
.bb-hero__media { position: absolute; inset: 0; z-index: -1; background: #24211d center / cover no-repeat; }  /* poster is set inline as the background */
.bb-hero__media img, .bb-hero__media video { width: 100%; height: 100%; object-fit: cover; }
/* The video stays invisible until it is really playing, so a blocked/failed autoplay (iOS Low Power Mode,
   Data Saver, reduced motion) shows the poster underneath instead of a black box with a crossed-out play icon. */
.bb-hero__media video { opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.bb-hero__media video.is-playing { opacity: 1; }
.bb-hero__media video::-webkit-media-controls,
.bb-hero__media video::-webkit-media-controls-start-playback-button,
.bb-hero__media video::-webkit-media-controls-overlay-play-button { display: none !important; -webkit-appearance: none; }
.bb-hero__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(42,37,32,.2), rgba(42,37,32,.5));
}
.bb-hero__content {
  position: relative;
  color: var(--bb-cream);
  max-width: 900px;
  padding: 0 var(--container-padding);
}
.bb-hero__title {
  font-size: var(--t-hero);
  font-weight: var(--w-light);
  line-height: var(--lh-heading);
  letter-spacing: var(--hero-tracking);
}

/* Brand image treatment — Ben Gough's photo grade (warm, lifted shadows, richer colour, fine grain),
   fitted to his Image Treatment proofs; see #bb-grade in components/_svg-defs.php. Applies to all
   photography automatically; opt out with .bb-no-treatment (decorative/aria-hidden graphics like the
   world map are excluded by default). */
img:not([aria-hidden="true"]):not(.bb-logo-mark):not(.bb-no-treatment) {
  filter: url(#bb-grade);
}

/* Image statement */
.bb-image-statement {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-16);
  align-items: center;
}
.bb-image-statement__img img { width: 100%; height: auto; display: block; }

/* Reveal: hidden only when JS is active; visible by default for no-JS / screenshots */
html.js .bb-reveal { opacity: 0; transform: translateY(20px); transition: opacity .8s ease, transform .8s ease; }
html.js .bb-reveal--in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .bb-reveal { opacity: 1; transform: none; transition: none; }
}

/* Footer */
.bb-footer {
  background: var(--bb-footer-bg);
  color: var(--bb-charcoal);
  padding: var(--s-24) 0 var(--s-12);
}
/* No bullets / underlines on footer link lists (the site has no global list reset) */
.bb-footer ul { list-style: none; padding: 0; margin: 0; }
.bb-footer a { text-decoration: none; }
.bb-footer a:hover { text-decoration: underline; }
.bb-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--s-16);
}

.bb-services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-8);
  margin-top: var(--s-8);
}
.bb-service-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-8);
  border: 1px solid var(--bb-line);
  background: var(--bb-cream);
  color: inherit;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease;
}
.bb-service-card:hover { border-color: var(--bb-terracotta); transform: translateY(-2px); }
/* Stage-coloured card (Ember yellow / Flame terracotta / Mastery blue) via --tier */
.bb-service-card--tier { border-top: 4px solid var(--tier); }
.bb-service-card--tier:hover { border-color: var(--tier); }
.bb-service-card h3 {
  font-size: var(--t-xl);
  font-weight: var(--w-light);
  color: var(--bb-charcoal);
  letter-spacing: 0;
  margin: 0;
}
.bb-service-card p {
  font-size: var(--t-sm);
  color: var(--bb-charcoal);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}
.bb-service-card__more {
  font-size: var(--t-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--bb-terracotta);
  margin-top: var(--s-4);
}

.bb-events-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-8);
  margin-top: var(--s-8);
}
.bb-event-card {
  display: flex;
  flex-direction: column;
  background: var(--bb-cream);
  border: 1px solid var(--bb-line);
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.bb-event-card:hover { border-color: var(--bb-terracotta); transform: translateY(-2px); }
.bb-event-card__media {
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--bb-oat);
}
.bb-event-card__body { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-6); }
.bb-event-card__body h3 { font-size: var(--t-lg); font-weight: var(--w-light); color: var(--bb-charcoal); letter-spacing: 0; margin: 0; }
.bb-event-card__meta { font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--bb-charcoal); margin: 0; }
.bb-event-card__blurb { font-size: var(--t-sm); color: var(--bb-charcoal); line-height: 1.55; margin: 0; flex: 1; }
.bb-event-card__more {
  align-self: flex-start;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: var(--t-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--bb-terracotta);
  cursor: pointer;
  padding: 0;
  margin-top: var(--s-2);
}
.bb-event-card__more:hover { text-decoration: underline; }

.bb-slider { position: relative; display: flex; align-items: center; gap: var(--s-4); }
.bb-slider__track {
  display: flex;
  gap: var(--s-6);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: var(--s-4);
  flex: 1;
  scrollbar-width: thin;
}
.bb-slide { flex: 0 0 clamp(280px, 32vw, 360px); scroll-snap-align: start; }
.bb-slider__btn {
  background: var(--bb-cream);
  border: 1px solid var(--bb-line);
  color: var(--bb-charcoal);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: var(--t-base);
  flex-shrink: 0;
  transition: border-color .2s ease, color .2s ease;
}
.bb-slider__btn:hover { border-color: var(--bb-terracotta); color: var(--bb-terracotta); }

.bb-event-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: var(--s-6); }
.bb-event-modal[hidden] { display: none; }
.bb-event-modal__backdrop { position: absolute; inset: 0; background: rgba(42,37,32,.6); }
.bb-event-modal__panel {
  position: relative;
  background: var(--bb-cream);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--s-10);
}
.bb-event-modal__close {
  position: absolute;
  top: var(--s-3);
  right: var(--s-4);
  background: transparent;
  border: 0;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--bb-charcoal);
}
.bb-event-modal__hero { aspect-ratio: 16 / 9; background-size: cover; background-position: center; margin-bottom: var(--s-6); }
.bb-event-modal__panel h2 { font-size: var(--t-2xl); font-weight: var(--w-light); margin: var(--s-3) 0 var(--s-4); color: var(--bb-charcoal); }
.bb-event-modal__meta { font-size: var(--t-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--bb-charcoal); margin-bottom: var(--s-4); }
.bb-event-modal__blurb { font-size: var(--t-base); color: var(--bb-charcoal); line-height: 1.6; margin-bottom: var(--s-6); }

/* Responsive */
@media (max-width: 960px) {
  .bb-services-grid { grid-template-columns: repeat(2, 1fr); }
  .bb-events-grid { grid-template-columns: repeat(2, 1fr); }
}
/* Nav: the wide logo + Black-weight links need more room, so the full link row
   only shows on large screens and tightens before it swaps to the hamburger. */
@media (max-width: 1360px) {
  .bb-nav__logo { height: 52px; }
  .bb-nav__links { gap: var(--s-6); }
}
@media (max-width: 1260px) {
  .bb-nav .bb-btn { margin-left: auto; margin-right: var(--s-4); }
  .bb-nav__links { display: none; }
  .bb-hamburger { display: flex; }
  .bb-mobile-nav { display: block; }
}
@media (max-width: 768px) {
  /* Templates lay out two-, three- and four-up sections with inline grid-template-columns, which can't
     reflow on their own — on a phone the image column collapsed to a thumbnail and stats/tiles ran off
     the right edge. Stack them (minmax(0,1fr) lets columns shrink below their content width). */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: minmax(0, 1fr) !important; gap: var(--s-8) !important; }
  [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: var(--s-6) var(--s-5) !important; }
  /* An item that spans 2 columns makes a phantom implicit 2nd column in a now single-column grid (the FAQ
     collapsed to a zero-width column); make it span the explicit grid instead. */
  [style*="grid-column:span 2"] { grid-column: 1 / -1 !important; }
  /* Image-first sections read text-first on a phone, so two photos never sit back to back. */
  .bb-text-first-mobile > :first-child { order: 2; }
  /* Full-width photo hero (About): the wide landscape photo scaled down to a ~150px strip on a phone. Give it
     the same height as the service-page heroes and crop to the subject (his face sits at ~49% across) so it stays imposing. */
  .bb-photo-hero { min-height: max(60vh, 42vw); }   /* same height rule as the service-page heroes (service.php) */
  .bb-photo-hero > img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-height: none !important; object-fit: cover; object-position: 49% 30% !important; }
  .bb-nav__logo { height: 44px; }
  .bb-footer__grid { grid-template-columns: 1fr; }
  .bb-services-grid { grid-template-columns: 1fr; }
  .bb-events-grid { grid-template-columns: 1fr; }   /* was still 2-up: cards squeezed to ~105px text width */
}
@media (max-width: 560px) {
  .bb-nav .bb-btn { display: none; }   /* Contact stays reachable from the drawer */
}

