/* Backboard: grainy fields, display type and motion. Reads its variables from tokens.css. */

/* Display type: Backboard Display, capitals only, so the board O shows. */
.bb-display {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 0.92;
  font-kerning: normal;
}

/* The logo as live text. Needs the Backboard Display font; use the SVG files where it cannot load. */
.bb-logo {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 1;
  white-space: nowrap;
}

/* A grainy field. Put content inside; it sits above the colour and the grain. */
.bb-field {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--sky);
  color: var(--on-field);
}
.bb-field::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: -2;
  background:
    radial-gradient(42% 46% at 24% 30%, var(--sun) 0%, transparent 70%),
    radial-gradient(40% 44% at 78% 72%, var(--sky-deep) 0%, transparent 72%),
    radial-gradient(36% 40% at 70% 22%, var(--sky-light) 0%, transparent 70%),
    var(--sky);
}
.bb-field::after {
  content: "";
  position: absolute;
  inset: -120px;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1.9 0 0 0 -0.45 1.9 0 0 0 -0.45 1.9 0 0 0 -0.45 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 300px 300px;
  mix-blend-mode: overlay;
  opacity: var(--grain-strength);
  pointer-events: none;
}
.bb-field--grass { background-color: var(--grass); }
.bb-field--grass::before {
  background:
    radial-gradient(42% 46% at 22% 28%, var(--sun) 0%, transparent 70%),
    radial-gradient(40% 44% at 80% 74%, var(--grass-deep) 0%, transparent 72%),
    radial-gradient(34% 38% at 72% 20%, var(--sky-light) 0%, transparent 70%),
    var(--grass);
}
.bb-field--daylight { background-color: var(--daylight); }
.bb-field--daylight::before {
  background:
    radial-gradient(44% 48% at 20% 26%, var(--sun-white) 0%, transparent 70%),
    radial-gradient(40% 44% at 80% 76%, var(--sun) 0%, transparent 72%),
    radial-gradient(34% 38% at 74% 18%, var(--grass-pale) 0%, transparent 70%),
    var(--daylight);
}
.bb-field--evening { background-color: var(--evening); color: var(--on-evening); }
.bb-field--evening::before {
  background:
    radial-gradient(44% 48% at 22% 78%, var(--evening-green) 0%, transparent 72%),
    radial-gradient(38% 42% at 80% 22%, var(--evening-blue) 0%, transparent 72%),
    var(--evening);
}

/* Live fields: the colour drifts slowly and the grain flickers. */
.bb-field--live::before {
  animation: bb-drift var(--duration-drift) var(--ease-in-out) infinite alternate;
  will-change: transform;
}
.bb-field--live::after {
  animation: bb-grain var(--duration-grain) steps(1, end) infinite;
}
@keyframes bb-drift {
  0% { transform: translate3d(-6%, -4%, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(5%, 3%, 0) rotate(8deg) scale(1.08); }
  100% { transform: translate3d(-3%, 6%, 0) rotate(-6deg) scale(1.04); }
}
@keyframes bb-grain {
  0% { transform: translate3d(0, 0, 0); }
  17% { transform: translate3d(-37px, 23px, 0); }
  33% { transform: translate3d(41px, -52px, 0); }
  50% { transform: translate3d(-64px, -18px, 0); }
  67% { transform: translate3d(29px, 61px, 0); }
  83% { transform: translate3d(-12px, -44px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Type reveal: each line rises from behind its own baseline, one after the other.
   Markup: <span class="bb-line" style="--i: 0"><span>LINE</span></span> */
.bb-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}
.bb-line > span {
  display: block;
  animation: bb-rise var(--duration-reveal) var(--ease-out-soft) both;
  animation-delay: calc(var(--i, 0) * var(--duration-stagger));
}
@keyframes bb-rise {
  from { transform: translate3d(0, 108%, 0); }
  to { transform: translate3d(0, 0, 0); }
}

/* Fade up: for body copy and captions that follow a headline. */
.bb-fade-up {
  animation: bb-fade-up var(--duration-move) var(--ease-out-soft) both;
  animation-delay: calc(var(--i, 0) * var(--duration-stagger));
}
@keyframes bb-fade-up {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .bb-field--live::before,
  .bb-field--live::after,
  .bb-line > span,
  .bb-fade-up {
    animation: none;
  }
}

/* ===== Interface components ===== */

/* Colour roles. Components draw with --bb-fg (ink) and --bb-on-fg (what sits on ink).
   Fields and the header over a hero re-point them, so components work on any ground. */
:root, [data-theme] {
  --bb-fg: var(--ink);
  --bb-on-fg: var(--ground);
  --bb-muted: var(--ink-muted);
}
.bb-field { --bb-fg: var(--on-field); --bb-on-fg: #ffffff; --bb-muted: var(--on-field); }
.bb-field--evening { --bb-fg: var(--on-evening); --bb-on-fg: var(--evening); --bb-muted: var(--on-evening); }

/* Button: a board-shaped layer behind the label. On hover the board extends sideways; the label stays put. */
.bb-button {
  --bb-h: 48px;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--bb-h);
  min-width: calc(var(--bb-h) * 1.62);
  margin: 0;
  padding: 0 var(--space-6);
  border: 0;
  background: none;
  color: var(--bb-on-fg);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bb-button::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: -1;
  box-sizing: border-box;
  border-radius: calc(var(--bb-h) * 0.275);
  background: var(--bb-fg);
  border: 2px solid var(--bb-fg);
  transition:
    left var(--duration-quick) var(--ease-out-soft),
    right var(--duration-quick) var(--ease-out-soft),
    transform var(--duration-quick) var(--ease-out-soft);
}
.bb-button:hover::before { left: calc(var(--bb-h) * -0.21); right: calc(var(--bb-h) * -0.21); }
.bb-button:active::before { transform: scale(0.98); }
.bb-button:focus-visible { outline: 2px solid var(--bb-fg); outline-offset: 5px; border-radius: calc(var(--bb-h) * 0.275); }
/* Buttons and links keep their own width inside a flex or grid column instead of stretching. */
.bb-button, .bb-link { align-self: flex-start; justify-self: start; }
.bb-button--secondary { color: var(--bb-fg); }
.bb-button--secondary::before { background: transparent; }
.bb-button--small { --bb-h: 40px; padding: 0 var(--space-4); font-size: 14px; }
.bb-button[disabled], .bb-button[aria-disabled="true"] { cursor: not-allowed; opacity: 0.45; }
.bb-button[disabled]::before, .bb-button[aria-disabled="true"]::before { left: 0; right: 0; transform: none; }

/* Text link: the living field fill. No line. On hover a grainy Sky field wipes into the words from the left,
   then drifts slowly and its grain shifts while the pointer stays. The field copy is a ::after layer built
   from data-text, so the layout never moves. The ink words underneath turn blue so no dark edge shows. */
.bb-link {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  color: var(--bb-fg);
  text-decoration: none;
  transition: color 480ms var(--ease-out-soft);
  -webkit-tap-highlight-color: transparent;
}
.bb-link::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='2.2 0 0 0 -0.6 2.2 0 0 0 -0.6 2.2 0 0 0 -0.6 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, var(--sky-deep) 0%, #3fa6fb 35%, #1f86e8 70%, var(--sky-deep) 100%);
  background-size: 80px 80px, 180% 100%;
  background-blend-mode: overlay, normal;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 480ms var(--ease-out-soft);
}
.bb-link:hover { color: var(--sky-deep); }
.bb-link:hover::after { clip-path: inset(0 0 0 0); animation: bb-link-live 9s var(--ease-in-out) infinite alternate; }
@keyframes bb-link-live {
  0%   { background-position: 0 0, 0% 0; }
  50%  { background-position: -9px 7px, 50% 0; }
  100% { background-position: 6px -8px, 100% 0; }
}
.bb-link:focus-visible { outline: 2px solid var(--bb-fg); outline-offset: 3px; border-radius: 2px; }
/* With no line at rest, a link inside running text is told apart by weight. */
p .bb-link { font-weight: 600; }

/* Tag: a small label in capitals, in the text colour. No border. */
.bb-tag {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0;
  color: var(--bb-fg);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Text field: label above, a board-shaped box, then a hint or an error. */
.bb-textfield { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; color: var(--bb-fg); font-family: var(--font-sans); }
.bb-textfield__label { font-size: 14px; font-weight: 600; line-height: 20px; }
.bb-textfield__hint { margin: 0; font-size: 13px; line-height: 18px; color: var(--bb-muted); }
.bb-textfield__error { margin: 0; font-size: 13px; line-height: 18px; color: var(--danger); font-weight: 600; }
.bb-input {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--control-border);
  border-radius: 13px;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1;
}
.bb-input::placeholder { color: var(--ink-muted); opacity: 1; }
.bb-input:hover { border-color: var(--ink); }
.bb-input:focus { outline: 2px solid var(--bb-fg); outline-offset: 2px; border-color: var(--ink); }
.bb-textfield--error .bb-input, .bb-input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.bb-field .bb-input { background: #ffffff; color: #0b0a09; border-color: #0b0a09; }
.bb-field .bb-input::placeholder { color: #6b6560; }
.bb-field .bb-textfield__error { color: var(--bb-fg); }
.bb-field .bb-textfield__error::before { content: "! "; }

/* Newsletter sign-up: a field and a button as one pair; the button drops below on narrow screens. */
.bb-signup { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; color: var(--bb-fg); font-family: var(--font-sans); }
.bb-signup__row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.bb-signup__row .bb-input { flex: 1 1 220px; width: auto; min-width: 0; }
.bb-signup__row .bb-button { flex: 0 0 auto; }
.bb-signup__done { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }

/* Card: a small grainy field with a tag at the top and the title and one line at the bottom.
   Combine with bb-field and one field variant. The only place small fields, and several fields on a page, are allowed. */
.bb-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  min-height: 280px;
  padding: var(--space-6);
  border-radius: 13px;
  text-decoration: none;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}
.bb-card__body { display: flex; flex-direction: column; gap: var(--space-2); }
.bb-card__title {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.bb-card__text { margin: 0; font-size: 15px; line-height: 22px; }
a.bb-card .bb-card__title {
  display: inline;
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-size: 0% 2px;
  background-repeat: no-repeat;
  transition: background-size var(--duration-quick) var(--ease-out-soft);
}
a.bb-card:hover .bb-card__title { background-size: 100% 2px; }
a.bb-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.bb-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }

/* Header: clear over the hero, white with a hairline once the page scrolls. Collapses to a menu button below 768 px. */
.bb-header {
  container-type: inline-size;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  color: var(--bb-fg);
  font-family: var(--font-sans);
  background-color: transparent;
  box-shadow: 0 0 0 0 transparent;
  transition: background-color var(--duration-quick) ease, box-shadow var(--duration-quick) ease;
}
.bb-header--static { position: relative; }
.bb-header--over-field { --bb-fg: var(--on-field); --bb-on-fg: #ffffff; }
.bb-header--over-evening { --bb-fg: var(--on-evening); --bb-on-fg: var(--evening); }
.bb-header.is-scrolled, .bb-header.is-open {
  --bb-fg: var(--ink);
  --bb-on-fg: var(--ground);
  background-color: var(--ground);
  box-shadow: 0 1px 0 0 var(--rule);
}
.bb-header__bar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  height: 72px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-16);
}
/* While the header is clear over a Sky field, a Sky wipe would vanish into it, so the nav wipe is ink there. */
.bb-header--over-field:not(.is-scrolled):not(.is-open) .bb-link:hover { color: var(--on-field); }
.bb-header--over-field:not(.is-scrolled):not(.is-open) .bb-link::after {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='2.2 0 0 0 -0.6 2.2 0 0 0 -0.6 2.2 0 0 0 -0.6 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, #0b0a09 0%, #24211f 35%, #141210 70%, #0b0a09 100%);
  background-blend-mode: soft-light, normal;
}
.bb-header__logo { color: inherit; text-decoration: none; font-size: 22px; }
.bb-header__logo:focus-visible { outline: 2px solid var(--bb-fg); outline-offset: 4px; border-radius: 2px; }
.bb-header__nav { display: flex; align-items: center; gap: var(--space-8); }
.bb-header__links { display: flex; gap: var(--space-6); margin: 0; padding: 0; list-style: none; font-size: 15px; font-weight: 500; }
.bb-header__toggle {
  appearance: none;
  display: none;
  align-items: center;
  gap: var(--space-2);
  min-width: 44px;
  height: 44px;
  margin: 0 calc(var(--space-2) * -1) 0 0;
  padding: 0 var(--space-2);
  border: 0;
  background: none;
  color: inherit;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.bb-header__toggle:focus-visible { outline: 2px solid var(--bb-fg); outline-offset: 2px; border-radius: 6px; }
.bb-header__bars { position: relative; width: 20px; height: 12px; }
.bb-header__bars::before, .bb-header__bars::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform var(--duration-quick) var(--ease-out-soft), top var(--duration-quick) var(--ease-out-soft);
}
.bb-header__bars::before { top: 0; }
.bb-header__bars::after { top: 10px; }
.bb-header.is-open .bb-header__bars::before { top: 5px; transform: rotate(45deg); }
.bb-header.is-open .bb-header__bars::after { top: 5px; transform: rotate(-45deg); }
.bb-header__sheet {
  box-sizing: border-box;
  padding: 0 var(--space-4) var(--space-6);
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}
.bb-header__sheet[hidden] { display: none; }
.bb-header__sheet-links { margin: 0 0 var(--space-6); padding: 0; list-style: none; }
.bb-header__sheet-links a {
  display: flex;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.bb-header__sheet-links a:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.bb-header__sheet .bb-button { width: 100%; }
@container (max-width: 767px) {
  .bb-header__bar { height: 64px; padding: 0 var(--space-4); }
  .bb-header__nav { display: none; }
  .bb-header__toggle { display: inline-flex; }
  .bb-header__logo { font-size: 20px; }
}
@container (min-width: 768px) {
  .bb-header__sheet { display: none; }
}

/* Footer: the logo and a short line, columns of links, then the small print. */
.bb-footer { container-type: inline-size; background: var(--ground); color: var(--ink); border-top: 1px solid var(--rule); font-family: var(--font-sans); }
.bb-footer__inner {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-16) var(--space-16) var(--space-8);
}
.bb-footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-12); }
.bb-footer__brand { display: flex; flex-direction: column; gap: var(--space-4); flex: 1 1 320px; max-width: 420px; }
.bb-footer__logo { color: inherit; text-decoration: none; font-size: 28px; align-self: flex-start; }
.bb-footer__tagline { margin: 0; font-size: 16px; line-height: 24px; color: var(--ink-muted); }
.bb-footer__cols { display: flex; flex-wrap: wrap; gap: var(--space-12); }
.bb-footer__col { display: flex; flex-direction: column; gap: var(--space-3); min-width: 140px; }
.bb-footer__heading { margin: 0; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.bb-footer__list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; font-size: 15px; line-height: 24px; }
/* An optional line above the small print, such as an Acknowledgement of Country. */
.bb-footer__ack { margin: 0 0 calc(var(--space-6) * -1); max-width: 640px; font-size: 14px; line-height: 22px; color: var(--ink-muted); }
.bb-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
}
.bb-footer__small { display: flex; flex-wrap: wrap; gap: var(--space-6); margin: 0; padding: 0; list-style: none; }
/* Small print links keep a 24 px tap target. */
.bb-footer__small .bb-link { min-height: 24px; line-height: 24px; }
.bb-footer__small .bb-link { color: var(--ink-muted); }
.bb-footer__small .bb-link:hover { color: var(--sky-deep); }
@container (max-width: 767px) {
  .bb-footer__inner { padding: var(--space-12) var(--space-4) var(--space-6); gap: var(--space-12); }
}

@media (prefers-reduced-motion: reduce) {
  .bb-button::before,
  .bb-link,
  .bb-link::after,
  a.bb-card .bb-card__title,
  .bb-header,
  .bb-header__bars::before,
  .bb-header__bars::after {
    transition: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bb-link:hover::after { animation: none; }
}
