/* ==========================================================================
   BMA Base
   Everything here is scoped under .bma — the wrapper that page content sits
   inside. This is the fix for the biggest problem in the old CSS, which used
   bare `*`, `body`, `section` and `footer` selectors and therefore restyled
   the entire theme, admin bar and all.

   RULE: no selector in this file may appear outside `.bma`.
   ========================================================================== */

.bma {
  font-family: var(--bma-font-body);
  font-weight: var(--bma-w-body);
  color: var(--bma-text);
  background: var(--bma-cream);
  line-height: 1.65;
  font-size: 16px;
}

/* Scoped box-sizing reset. The old `* { margin:0; padding:0 }` was global and
   is why theme components kept collapsing unpredictably. */
.bma *,
.bma *::before,
.bma *::after { box-sizing: border-box; }

/* --- Headings ---------------------------------------------------------- */
.bma h1, .bma h2, .bma h3, .bma h4 {
  font-family: var(--bma-font-head);
  color: var(--bma-navy);
  line-height: 1.2;
  margin: 0 0 16px;
  overflow-wrap: break-word;
}

.bma h1 { font-size: clamp(32px, 5vw, 56px); font-weight: var(--bma-w-head-black); }
.bma h2 { font-size: clamp(26px, 4vw, 40px); font-weight: var(--bma-w-head-bold); }
.bma h3 { font-size: clamp(20px, 2.6vw, 26px); font-weight: var(--bma-w-head-semi); }
.bma h4 { font-size: 18px; font-weight: var(--bma-w-head-semi); }

.bma p  { margin: 0 0 18px; }
.bma p:last-child { margin-bottom: 0; }

.bma a { color: var(--bma-gold); text-decoration: underline; text-underline-offset: 2px; }
.bma a:hover { color: var(--bma-navy); }

.bma strong { font-weight: var(--bma-w-body-bold); }

.bma ul, .bma ol { margin: 0 0 18px; padding-left: 22px; }
.bma li { margin-bottom: 8px; }

/* --- Media defaults ---------------------------------------------------- */
/* Spec: card images use aspect-ratio + cover + centre.
   Hero and layer diagrams opt out explicitly — see components. */
.bma img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Accessibility ----------------------------------------------------- */
.bma :focus-visible {
  outline: 3px solid var(--bma-gold-mid);
  outline-offset: 2px;
}

.bma-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .bma *,
  .bma *::before,
  .bma *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
