/* ==========================================================================
   Bran Interactive — coming soon
   Colours are sampled from the logo. Type is on a pixel grid: Jersey 10 draws
   one "pixel" per 0.1072em, Silkscreen one per 0.125em, so sizes below are
   chosen to land those pixels on whole CSS pixels.
   ========================================================================== */

:root {
  --ink: #000;
  --cream: #fbe5bb;
  --cream-dim: #b7a37d;
  --cream-hot: #fff7dc;

  --blaze-hi: #fbe86d;
  --blaze: #fa7412;
  --blaze-lo: #cb280f;

  --volt-hi: #b8f1ff;
  --volt: #08d0f7;
  --volt-lo: #0278d0;

  --u: 4px;                 /* interface pixel */
  --footer-h: 44px;
  --seam: 0.5;              /* where fire meets lightning: 0 = far left, 1 = far right (script.js moves it) */

  /* Sized so the whole composition fits one screen: the HUD, footer and tagline
     take a fixed 215px, paddings take 14.5% of the height, and the logo plus the
     headline (which scales with it) take 0.825 x this width. */
  --logo-w: max(15rem, min(92vw, 50rem, 103.6vh - 215px));

  --font-display: 'Jersey 10', 'Arial Narrow', 'Roboto Condensed', Impact, sans-serif;
  --font-label: 'Silkscreen', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  color-scheme: dark;
}

@supports (height: 1svh) {
  :root { --logo-w: max(15rem, min(92vw, 50rem, 103.6svh - 215px)); }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;       /* no double-tap zoom while mashing */
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 400 16px/1 var(--font-label);
  -webkit-font-smoothing: none;     /* keep pixel type crisp */
  overflow-x: hidden;
}

::selection { background: var(--blaze); color: var(--ink); }

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: var(--u) solid var(--cream);
  outline-offset: var(--u);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- scene ---------------------------------------------------------- */

.scene {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

.fire {
  position: absolute;
  left: 0;
  bottom: var(--footer-h);          /* script.js fine-tunes this */
  z-index: 0;
  display: block;
  pointer-events: none;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* ---------- hero ----------------------------------------------------------- */

.stage {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1.5vh, 20px) 1rem clamp(56px, 11vh, 150px);
  padding: clamp(8px, 1.5svh, 20px) 1rem clamp(56px, 11svh, 150px);
  text-align: center;
}

.logo {
  margin: 0;
  line-height: 0;
}

.logo__lean {
  display: block;
  transform-origin: 50% 88%;
}

.logo img {
  display: block;
  width: var(--logo-w);
  height: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* "COMING SOON": cream face on a two-step base whose colour splits at the seam. */
.soon {
  --fpx: calc(var(--logo-w) / 47);                       /* one font pixel */
  /* 57.64% is the gap between the two words, so at rest each word gets one colour */
  --split: calc(57.64% + (var(--seam) - 0.5) * 100vw);

  position: relative;
  isolation: isolate;
  display: inline-block;
  margin: clamp(8px, 2vh, 24px) 0 calc(var(--fpx) * 2);
  font: 400 calc(var(--fpx) * 9.328) / 0.62 var(--font-display);
  letter-spacing: 0;
  word-spacing: 0.107em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--cream);
  user-select: none;
  -webkit-user-select: none;
}

@supports (width: round(nearest, 1px, 1px)) {
  .soon { --fpx: round(nearest, calc(var(--logo-w) / 47), 1px); }
}

.soon::before,
.soon::after {
  content: attr(data-text);
  content: attr(data-text) / '';
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.soon::before {
  transform: translateY(var(--fpx));
  background-image: linear-gradient(90deg, var(--blaze) 0 var(--split), var(--volt) var(--split) 100%);
}

.soon::after {
  transform: translateY(calc(var(--fpx) * 2));
  background-image: linear-gradient(90deg, var(--blaze-lo) 0 var(--split), var(--volt-lo) var(--split) 100%);
}

.tagline {
  margin: 12px 0 0;
  font: 400 27.984px/1.1 var(--font-display);            /* 3px font pixels */
  color: var(--cream);
}

@media (min-width: 700px) and (min-height: 640px) {
  .tagline { font-size: 37.312px; }                      /* 4px font pixels */
}

@media (max-height: 520px) {
  .tagline { font-size: 18.656px; }                      /* 2px font pixels */
}

.br-narrow { display: none; }

/* ---------- arm-wrestle HUD ------------------------------------------------ */

.hud { display: none; }

.js .hud {
  position: relative;
  z-index: 2;
  order: -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'blaze  meter  volt'
    '.      prompt .';
  align-items: center;
  column-gap: calc(var(--u) * 5);
  row-gap: calc(var(--u) * 2);
  width: min(100% - 2rem, 70rem);
  margin: 0 auto;
  padding-top: max(12px, env(safe-area-inset-top));
  user-select: none;
  -webkit-user-select: none;
}

.fighter {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 2);
  margin: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.fighter--blaze { grid-area: blaze; justify-self: start; --side: var(--blaze); --side-lo: var(--blaze-lo); }
.fighter--volt  { grid-area: volt;  justify-self: end;   --side: var(--volt);  --side-lo: var(--volt-lo); }

.fighter__name {
  font: 400 27.984px/1 var(--font-display);
  text-transform: uppercase;
  color: var(--side);
}

.fighter.is-hit .fighter__name { color: var(--cream-hot); }

.fighter__wins {
  min-width: 24px;
  padding: 3px 4px 5px;
  font: 400 16px/1 var(--font-label);
  text-align: center;
  color: var(--cream);
  box-shadow: inset 0 0 0 2px var(--side-lo);
}

.key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding-bottom: 3px;
  margin-bottom: var(--u);
  font: 700 16px/1 var(--font-label);
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 var(--u) 0 #8c7650;
}

.fighter:active .key,
.fighter.is-hit .key {
  transform: translateY(var(--u));
  box-shadow: none;
}

/* The bar: one track, two fills that meet at the seam. */
.meter {
  grid-area: meter;
  position: relative;
  height: 16px;
  margin: var(--u);
  background: var(--ink);
  box-shadow:
    0 calc(var(--u) * -1) 0 var(--cream),
    0 var(--u) 0 var(--cream),
    calc(var(--u) * -1) 0 0 var(--cream),
    var(--u) 0 0 var(--cream);
}

.meter__fill,
.meter__ticks {
  position: absolute;
  inset: 0;
}

.meter__fill--blaze {
  transform-origin: 0 50%;
  transform: scaleX(var(--seam));
  background: linear-gradient(var(--blaze-hi) 0 4px, var(--blaze) 4px 12px, var(--blaze-lo) 12px);
}

.meter__fill--volt {
  transform-origin: 100% 50%;
  transform: scaleX(calc(1 - var(--seam)));
  background: linear-gradient(var(--volt-hi) 0 4px, var(--volt) 4px 12px, var(--volt-lo) 12px);
}

.meter__ticks {
  background: linear-gradient(90deg, transparent 0 12px, var(--ink) 12px 16px) calc(50% - 6px) 0 / 16px 100% repeat-x;
}

.meter__pin {
  position: absolute;
  top: calc(var(--u) * -2);
  bottom: calc(var(--u) * -2);
  left: -2px;
  width: 4px;
  background: var(--cream-hot);
  box-shadow: -4px 0 0 var(--ink), 4px 0 0 var(--ink);
  /* script.js slides this along the bar */
}

.hud__prompt {
  grid-area: prompt;
  min-height: 16px;
  margin: 0;
  font: 400 16px/1 var(--font-label);
  text-align: center;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.hud__prompt b { font-weight: 400; }
.k-blaze { color: var(--blaze); }
.k-volt  { color: var(--volt); }
.hud__prompt.is-blaze { color: var(--blaze); }
.hud__prompt.is-volt  { color: var(--volt); }

.touch-only { display: none; }

@media (hover: none) and (pointer: coarse) {
  .keys-only, .key { display: none; }
  .touch-only { display: inline; }
}

/* ---------- footer --------------------------------------------------------- */

.footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: calc(var(--footer-h) + env(safe-area-inset-bottom));
  padding: var(--u) max(1rem, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(1rem, env(safe-area-inset-right));
  background: var(--ink);
  font: 400 16px/1 var(--font-label);
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* the floor the fire stands on */
.footer::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: var(--u);
  background: linear-gradient(90deg, var(--blaze) 0 calc(var(--seam) * 100%), var(--volt) calc(var(--seam) * 100%) 100%);
}

.footer__copy { margin: 0; white-space: nowrap; }

.fx {
  display: none;
  margin: 0;
  padding: 8px 0 8px 8px;
  border: 0;
  background: none;
  text-transform: inherit;
  cursor: pointer;
}

.js .fx { display: block; }
.fx b { font-weight: 400; color: var(--cream); }
.fx:focus-visible { outline-offset: calc(var(--u) * -1); }   /* keep the ring inside the footer */

/* win flash */
.flash {
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 404 page -------------------------------------------------------- */

.scene--lost .soon { --split: 50%; }                     /* splits the middle 0 */

.logo--small { display: block; }
.logo--small img { width: min(60vw, 20rem); }

.back {
  display: inline-block;
  margin-top: 28px;
  padding: 9px 14px 11px;
  font: 400 16px/1 var(--font-label);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 var(--u) 0 #8c7650;
}

.back:hover { background: var(--cream-hot); }

.back:active {
  transform: translateY(var(--u));
  box-shadow: none;
}

/* ---------- motion --------------------------------------------------------- */

@keyframes slam {
  from { opacity: 0; transform: scale(1.28); }
  25%  { opacity: 1; }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes wipe {
  from { clip-path: inset(-10% 100% -60% 0); }
  to   { clip-path: inset(-10% 0 -60% 0); }
}

@keyframes appear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes drop {
  from { transform: translateY(-140%); }
  to   { transform: translateY(0); }
}

@keyframes blink {
  0%  { opacity: 1; }
  62% { opacity: 0.3; }
}

@keyframes bump {
  0%  { transform: translateY(-4px); }
  50% { transform: translateY(0); }
}

.logo     { animation: slam 0.34s steps(4, end) 0.1s backwards; }
.soon     { animation: wipe 0.48s steps(8, end) 0.5s backwards; }
.tagline  { animation: appear 0.3s steps(3, end) 1.05s backwards; }
.back     { animation: appear 0.3s steps(3, end) 1.25s backwards; }
.js .hud  { animation: drop 0.4s steps(5, end) 0.8s backwards; }

.hud[data-fresh] .cta { animation: blink 1.4s steps(1, end) 2s infinite; }
.hud[data-winner='blaze'] .fighter--blaze .fighter__wins,
.hud[data-winner='volt'] .fighter--volt .fighter__wins { animation: bump 0.24s steps(1, end) 3; }
.hud__prompt.is-win { animation: blink 0.28s steps(1, end) 4; }

/* Effects off (the FX switch, or the visitor's reduced-motion setting): nothing moves on its own. */
.fx-off *,
.fx-off *::before,
.fx-off *::after { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  html:not(.js) *,
  html:not(.js) *::before,
  html:not(.js) *::after { animation: none !important; }
}

/* ---------- small screens -------------------------------------------------- */

@media (max-width: 640px) {
  .js .hud {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'blaze  volt'
      'meter  meter'
      'prompt prompt';
    row-gap: var(--u);
  }

  .hud__prompt { margin-top: var(--u); }

  /* the stacked HUD and two-line tagline are taller here, so the logo gives up a little more */
  :root { --logo-w: max(13.75rem, min(92vw, 103.6vh - 276px)); }

  @supports (height: 1svh) {
    :root { --logo-w: max(13.75rem, min(92vw, 103.6svh - 276px)); }
  }
}

@media (max-width: 440px) {
  .br-narrow { display: inline; }
}

@media (max-width: 370px) {
  .footer__year { display: none; }                       /* keeps the footer on one line */
}

@media (pointer: coarse) {
  .scene { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
}
