:root {
  /* BCG DOC Brand Guide - V1 Classic Corporate */
  --bcg-red: #E11827;
  --ink: #161616;
  --graphite: #4A4A4A;
  --muted: #8A8A8A;
  --hairline: #E5E5E5;
  --paper: #FDFDFD;
  --checker-black: #111111;
  --pure-white: #FFFFFF;

  /* Palette roles remapped for a dark surface.
     Chrome sits a step above the page so the divider's black stroke and checker
     read against it; ink stays the card fill. */
  --surface: var(--checker-black);
  --chrome: #232323;
  --card: var(--ink);
  --text-primary: var(--paper);
  --text-secondary: var(--muted);
  --rule: var(--graphite);

  --page-inset: 64px;
}

body,
html {
  overflow-x: hidden;
  padding: 0;
  margin: 0;
  color: var(--text-primary);
  font-family: "Barlow", Arial, sans-serif;
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
}

header {
  position: fixed;
  top: 0;
  z-index: 1000;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 10px var(--page-inset) 26px;
  background-color: var(--chrome);
}

header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
  background:
    linear-gradient(90deg, var(--bcg-red) 0 42%, var(--checker-black) 42%) 0 0 / 100% 4px no-repeat,
    repeating-conic-gradient(var(--checker-black) 0% 25%, var(--pure-white) 0% 50%) 0 4px / 12px 12px repeat-x;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  max-width: 100%;
  height: 78px;
}

/* Bar type is fluid between 1180px and 2560px, growing 15px -> 24px. Below 1180
   it holds the drawn size, because that is where the header's spare width runs
   out; above 2560 it caps so the nav stays secondary to the logo. The logo itself
   is fixed, which keeps the header height — and the offsets pages use to clear
   it — identical at every width. */
.nav-menu {
  display: flex;
  align-items: center;
  gap: clamp(1.75rem, 10.9px + 1.45vw, 3rem);
}

.nav-menu a {
  font-family: "Barlow Condensed", Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(15px, 7.3px + .652vw, 24px);
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text-primary);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: border-color .25s ease;
}

.nav-menu a:hover {
  border-bottom-color: var(--bcg-red);
}

.social-links {
  display: flex;
  align-items: center;
  gap: clamp(.9rem, 6.2px + .7vw, 1.5rem);
}

.social-links a {
  color: var(--text-secondary);
  font-size: clamp(1.15rem, 9.3px + .768vw, 29px);
  transition: color .25s;
}

.social-links a:hover {
  color: var(--bcg-red);
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.support-btn {
  position: relative;
  overflow: hidden;
  padding: .5rem 1.5rem;
  color: #4caf50;

  /* Same type treatment as the nav links it sits beside; the tracking leaves a
     trailing gap after the last letter, which text-indent pushes back to centre */
  font-family: "Barlow Condensed", Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(15px, 7.3px + .652vw, 24px);
  text-transform: uppercase;
  letter-spacing: .18em;
  text-indent: .18em;

  text-decoration: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, .5);
  white-space: nowrap;
  background: linear-gradient(90deg, #1a1a1a 0%, #333 50%, #1a1a1a 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
  border: 2px solid #4caf50;
  border-radius: 0;
  animation: pulse 2s infinite;
  transition: all .3s ease;
}

.support-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(76, 175, 80, .4), transparent);
  animation: shine 2s infinite;
}

.support-btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(76, 175, 80, .1) 0%, transparent 70%);
  animation: rotate 4s linear infinite;
}

.support-btn:hover {
  background: linear-gradient(90deg, #333 0%, var(--card) 50%, #333 100%);
  box-shadow: 0 4px 20px rgba(76, 175, 80, .4);
  border-color: #45a049;
  transform: translateY(-2px) scale(1.05);
  animation: none;
}

.support-btn:active {
  transform: translateY(0) scale(.95);
}

@keyframes shine {
  0% { left: -100%; }
  20% { left: 100%; }
  100% { left: 100%; }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { box-shadow: 0 2px 5px rgba(0, 0, 0, .3); }
  50% { box-shadow: 0 2px 15px rgba(76, 175, 80, .3); }
  100% { box-shadow: 0 2px 5px rgba(0, 0, 0, .3); }
}


.nav-menu a.active {
  border-bottom-color: var(--bcg-red);
}

footer {
  position: fixed;
  bottom: 0;
  z-index: 1000;
  box-sizing: border-box;
  width: 100%;
  padding: 14px var(--page-inset);
  background-color: var(--chrome);
  border-top: 1px solid var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
}

footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
  background: var(--bcg-red);
}

footer p {
  margin: 0;
}

footer .legal-links {
  position: absolute;
  right: var(--page-inset);
  top: 50%;
  transform: translateY(-50%);
}

footer .legal-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .25s;
}

footer .legal-links a + a::before {
  content: "\00b7";
  margin: 0 10px;
  color: var(--rule);
}

footer .legal-links a:hover {
  color: var(--paper);
}

@media screen and (max-width: 900px) {
  :root { --page-inset: 28px; }
}

@media screen and (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .5rem;
  }

  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
  }

  .header-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
  }

  .support-btn {
    padding: .5rem .8rem;
    font-size: 13px;
  }

  .social-links {
    margin: .5rem 0;
    font-size: 1.05rem;
  }

  .logo img {
    height: 64px;
  }
}

/* The copyright is centred in the full width while the legal links are pinned
   right, so the two collide once the bar is narrower than about 790px. */
@media screen and (max-width: 800px) {
  footer .legal-links {
    position: static;
    display: block;
    transform: none;
    margin-top: 6px;
  }
}

/* Landscape phones and other short viewports.
   Must follow the width breakpoints above so it can undo the column stacking:
   on a 360px-tall screen the stacked header claimed ~60% of the display. Here
   the chrome is held to a single row and the nav takes the leftover width,
   spreading its links across it instead of clustering at content width. */
@media screen and (orientation: landscape) and (max-height: 540px) {
  header {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    text-align: left;
    gap: clamp(.4rem, 1.4vw, 1.25rem);
    padding-top: 6px;
    padding-bottom: 20px;
  }

  .logo img {
    height: clamp(34px, 6.5vh, 56px);
  }

  .nav-menu {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: space-evenly;
    gap: clamp(.25rem, 1.2vw, 1.75rem);
  }

  .nav-menu a {
    font-size: clamp(11px, 1.45vw, 15px);
    letter-spacing: clamp(.05em, .35vw, .18em);
    white-space: nowrap;
  }

  .social-links {
    margin: 0;
    gap: clamp(.3rem, .9vw, .9rem);
    font-size: clamp(.8rem, 1.5vw, 1.15rem);
  }

  .header-buttons {
    flex-wrap: nowrap;
  }

  .support-btn {
    padding: .3rem clamp(.45rem, 1.1vw, 1.5rem);
    font-size: clamp(10px, 1.25vw, 15px);
  }

  /* Pages clear the fixed header with a hand-tuned margin sized for the tall
     desktop chrome, which would strand up to 125px of empty space above the
     content once the bar collapses to one row. reaction-game.html places its
     own main with position:fixed, so it deliberately carries no .site-main. */
  main.site-main {
    margin-top: 76px;
  }

  /* Rather than stacking the footer onto two lines as the narrow-width rule
     does, split it left/right so it keeps to one line and spends no extra
     height, which is the scarce axis here. */
  footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  footer .legal-links {
    margin-top: 0;
  }

  /* Below roughly a landscape iPhone there is no room for secondary chrome;
     the nav and Support link matter more than the social icons. */
  @media (max-width: 780px) {
    .social-links {
      display: none;
    }
  }
}


/* Letterhead type system - display + section headings (Barlow Condensed),
   labels wide-tracked, per BCG DOC Brand Guide V1 */
h1, h2, h3 {
  font-family: "Barlow Condensed", Arial, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  letter-spacing: -.005em;
}

h2, h3 {
  letter-spacing: .04em;
}

h4, h5, h6 {
  font-family: "Barlow Condensed", Arial, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
}

.bcg-mono {
  font-family: "JetBrains Mono", monospace;
  font-size: .82em;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
