/* Bye Bye, Hell demo page. Scoped to body.bbh so nothing leaks into the rest of the site.
   Everything here is lifted from the game itself:
   - the font is the game's own 5x7 bitmap font, rebuilt from its atlas (1 art pixel = 1/8 em, so keep sizes on multiples of 8px);
   - sprites are cut from the same atlas and drawn at whole-number scales with pixelated scaling;
   - colours come from Hud.ts (title, prompts, buttons), clipped from the game's overbright values. */

@font-face {
  font-family: "BBH Pixel";
  src: url("../../assets/projects/bye-bye-hell/fonts/bbh-pixel.woff") format("woff");
  font-display: block;
}

body.bbh {
  --void: #07040a;
  --floor: #2a1a17;
  --cream: #fff3e0; /* BYE BYE, (2.6, 2, 1.1) */
  --hell: #ff6a33; /* HELL (2.6, 0.45, 0.2) */
  --hell-dark: #330000; /* title shadow (0.2, 0, 0) */
  --gold: #ffe699; /* DEMO (1, 0.9, 0.6) */
  --prompt: #ffe6b3; /* TOUCH TO ESCAPE (1, 0.9, 0.7) */
  --sub: #cc998c; /* A ONE-THUMB ROGUELITE (0.8, 0.6, 0.55) */
  --band: rgb(10 6 20 / 0.82); /* tutorial text band */
  --btn: #ffbf40; /* orange button (1.3, 0.75, 0.25) */
  --btn-fill: #3d2611;
  --blue: #73bfff; /* STATS button (0.45, 0.75, 1.2) */
  --blue-fill: #17263d;
  --hp: #e8323c;
  --px: "BBH Pixel", "Courier New", monospace;
  background: var(--void);
  color: var(--cream);
}

.bbh main {
  font-family: var(--px);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: none;
  font-smooth: never;
  letter-spacing: 0;
}
.bbh main img,
.bbh .anim {
  image-rendering: pixelated;
}
.bbh main ::selection {
  background: var(--hell);
  color: var(--void);
}

/* ---- The floor every screen is drawn on: bricks, darkened, with the game's vignette ---- */
/* Floors are baked from the atlas with each layer's tint from Story.ts. 16px tiles at the game's 3x = 48px. */
.bbh-room {
  --floor-img: url("../../assets/projects/bye-bye-hell/sprites/floor-l1.png");
  --accent: #ff4d1a; /* layer accent */
  --ember: 255 102 38;
  position: relative;
  padding: 72px 16px;
  background:
    radial-gradient(60% 50% at 50% 30%, rgb(var(--ember) / 0.16), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 45%, rgb(0 0 0 / 0.85) 100%),
    var(--floor-img) 0 0 / 576px 576px,
    #1c0f0e;
  border-top: 6px solid #000;
}
.bbh-room.l1 {
  --floor-img: url("../../assets/projects/bye-bye-hell/sprites/floor-l1.png");
  --accent: #ff4d1a; /* The Furnace (1, 0.3, 0.1) */
  --ember: 255 153 38;
}
.bbh-room.l2 {
  --floor-img: url("../../assets/projects/bye-bye-hell/sprites/floor-l2.png");
  --accent: #ff9e33; /* The Larder (1, 0.62, 0.2) */
  --ember: 255 242 77;
}
.bbh-room.l3 {
  --floor-img: url("../../assets/projects/bye-bye-hell/sprites/floor-l3.png");
  --accent: #ff40a6; /* The Drowned Choir (1, 0.25, 0.65) */
  --ember: 255 102 255;
}
.bbh-room.l4 {
  --floor-img: url("../../assets/projects/bye-bye-hell/sprites/floor-l4.png");
  --accent: #ffd933; /* The Vault (1, 0.85, 0.2) */
  --ember: 255 230 77;
}
.bbh-wrap {
  max-width: 1040px;
  margin: 0 auto;
}

/* ---- Title screen ---- */
.bbh-title-screen {
  position: relative;
  overflow: hidden;
  padding: 64px 16px 0;
  text-align: center;
  /* The lobby behind the logo (drawHubFloor), under the title screen's 35% shade and its big orange halo. */
  background:
    radial-gradient(60% 40% at 50% 34%, rgb(255 77 26 / 0.4), transparent 70%),
    radial-gradient(130% 100% at 50% 40%, transparent 40%, rgb(0 0 0 / 0.9) 100%),
    linear-gradient(rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.35)),
    url("../../assets/projects/bye-bye-hell/sprites/carpet.png") 50% 0 / 192px 576px repeat-y,
    url("../../assets/projects/bye-bye-hell/sprites/floor-hub.png") 50% 0 / 576px 576px,
    #170d16;
}
.bbh-logo {
  margin: 0;
  font-weight: normal;
  line-height: 1;
}
.bbh-logo span {
  display: block;
}
.bbh-logo .bye {
  font-size: 56px;
  color: var(--cream);
  text-shadow:
    0 7px 0 var(--hell-dark),
    0 0 24px rgb(255 214 140 / 0.35);
  animation: bbh-jitter 0.14s steps(2) infinite;
}
.bbh-logo .hell {
  margin-top: 8px;
  font-size: 104px;
  color: var(--hell);
  text-shadow:
    0 13px 0 var(--hell-dark),
    0 0 40px rgb(255 90 30 / 0.65);
  animation: bbh-jitter 0.14s steps(2) infinite reverse;
}
@keyframes bbh-jitter {
  50% {
    transform: translateX(2px);
  }
}
.bbh-flames {
  display: flex;
  justify-content: space-between;
  max-width: 760px;
  height: 72px;
  margin: -6px auto 0;
  filter: drop-shadow(0 0 16px rgb(255 110 30 / 0.7));
}
.bbh-flame {
  width: 42px; /* 7px frame x 6 */
  height: 54px;
  background: url("../../assets/projects/bye-bye-hell/sprites/flames.png") 0 0 / 126px 54px;
  animation:
    bbh-flame 0.33s steps(3) infinite,
    bbh-sway 1.4s ease-in-out infinite alternate;
  align-self: flex-end;
}
.bbh-flame:nth-child(odd) {
  animation-delay: -0.11s, -0.7s;
  transform: scale(1.2);
}
.bbh-flame:nth-child(3n) {
  animation-delay: -0.22s, -0.3s;
}
@keyframes bbh-flame {
  to {
    background-position: -126px 0;
  }
}
@keyframes bbh-sway {
  to {
    translate: 0 -10px;
  }
}
.bbh-demo-word {
  margin: 28px 0 0;
  font-size: 32px;
  line-height: 32px;
  color: var(--gold);
  animation: bbh-pulse 1.25s ease-in-out infinite alternate;
}
/* The blood pool you climb out of: four baked frames stacked, flipped at the game's 5 fps. */
.bbh-lava {
  height: 144px;
  margin: 40px -16px 0;
  background: url("../../assets/projects/bye-bye-hell/sprites/blood-pool.png") 50% 0 / 576px 576px;
  box-shadow:
    inset 0 0 40px rgb(0 0 0 / 0.6),
    0 0 60px rgb(190 30 35 / 0.3);
  animation: bbh-pool 0.8s steps(4) infinite;
}
@keyframes bbh-pool {
  to {
    background-position-y: -576px;
  }
}
.bbh-prompt {
  display: inline-block;
  margin: 32px 0 8px;
  font-size: 24px;
  line-height: 24px;
  color: var(--prompt);
  text-decoration: none;
  animation: bbh-pulse 0.63s ease-in-out infinite alternate;
}
.bbh-prompt:hover,
.bbh-prompt:focus-visible {
  color: #fff;
  outline: none;
}
.bbh-tagline {
  margin: 0;
  padding-bottom: 48px;
  color: var(--sub);
}
@keyframes bbh-pulse {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 1;
  }
}

/* ---- Room headings: LAYER I / THE FURNACE ---- */
.bbh-head {
  margin: 0 0 32px;
  text-align: center;
  font-weight: normal;
}
.bbh-head small {
  display: block;
  font-size: 24px;
  line-height: 24px;
  color: var(--sub);
}
.bbh-head span {
  display: block;
  margin-top: 8px;
  font-size: 48px;
  line-height: 48px;
  color: var(--accent, var(--hell));
  text-shadow:
    0 6px 0 var(--hell-dark),
    0 0 28px rgb(255 90 30 / 0.45);
}
.bbh-band {
  margin: 0 auto 32px;
  padding: 16px 24px;
  max-width: 760px;
  text-align: center;
  background: var(--band);
  color: var(--cream);
}

/* ---- Buttons, as drawn by Hud.button(): bright border, dark fill of the same hue, a soft halo ---- */
.bbh-btn {
  display: inline-block;
  margin: 8px;
  padding: 16px 24px;
  font-family: var(--px);
  font-size: 24px;
  line-height: 24px;
  color: var(--cream);
  text-decoration: none;
  background: var(--btn-fill);
  border: 4px solid var(--btn);
  box-shadow: 0 0 32px rgb(255 191 64 / 0.3);
  cursor: pointer;
}
.bbh-btn:hover,
.bbh-btn:focus-visible {
  background: #6b4219;
  box-shadow: 0 0 48px rgb(255 191 64 / 0.6);
  outline: none;
}
.bbh-btn:active {
  translate: 0 2px;
}
.bbh-btn--blue {
  border-color: var(--blue);
  background: var(--blue-fill);
  box-shadow: 0 0 32px rgb(115 191 255 / 0.3);
}
.bbh-btn--blue:hover,
.bbh-btn--blue:focus-visible {
  background: #22406a;
  box-shadow: 0 0 48px rgb(115 191 255 / 0.6);
}

/* ---- Play ---- */
.bbh-play {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 48px;
  align-items: center;
}
.bbh-screen {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  background: #000;
  border: 4px solid var(--btn);
  box-shadow: 0 0 56px rgb(255 120 40 / 0.35);
}
.bbh-screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.bbh-start {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  width: 100%;
  padding: 0;
  border: 0;
  font-family: var(--px);
  color: var(--prompt);
  cursor: pointer;
  background:
    radial-gradient(60% 40% at 50% 50%, rgb(255 102 26 / 0.3), transparent 70%),
    linear-gradient(rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.35)),
    url("../../assets/projects/bye-bye-hell/sprites/floor-l1.png") 50% 50% / 576px 576px;
}
.bbh-start[hidden] {
  display: none;
}
.bbh-start .bbh-prompt {
  margin: 0;
}
.bbh-start small {
  font-size: 16px;
  color: var(--sub);
}
.bbh-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.bbh-list li {
  margin: 0 0 16px;
  padding: 16px 24px;
  background: var(--band);
}
.bbh-list b {
  display: block;
  margin-bottom: 8px;
  font-weight: normal;
  color: var(--gold);
}

/* ---- Sprites ---- */
.bbh-cast {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 24px 40px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}
.bbh-cast li {
  display: grid;
  justify-items: center;
  gap: 16px;
  color: var(--sub);
  text-align: center;
}
.bbh-cast li > span:not(.anim) {
  display: flex;
  gap: 8px;
}
.bbh-cast img {
  filter: drop-shadow(0 0 12px rgb(255 90 30 / 0.45));
}
.anim {
  display: block;
  background-repeat: no-repeat;
}
.anim--helen {
  width: 84px; /* 14 x 6 */
  height: 90px;
  background-image: url("../../assets/projects/bye-bye-hell/sprites/helen-run.png");
  background-size: 252px 90px;
  animation: bbh-run 0.36s steps(3) infinite;
  filter: drop-shadow(0 0 14px rgb(255 214 140 / 0.45));
}
@keyframes bbh-run {
  to {
    background-position: -252px 0;
  }
}
.anim--imp {
  width: 72px; /* 12 x 6 */
  height: 60px;
  background-image: url("../../assets/projects/bye-bye-hell/sprites/imp.png");
  background-size: 144px 60px;
  animation: bbh-imp 0.4s steps(2) infinite;
  filter: drop-shadow(0 0 12px rgb(255 50 40 / 0.55));
}
@keyframes bbh-imp {
  to {
    background-position: -144px 0;
  }
}

/* ---- Menu rows: LABEL ......... VALUE ---- */
.bbh-rows {
  max-width: 760px;
  margin: 0 auto;
}
.bbh-rows > div {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 16px;
  background: var(--band);
  border-bottom: 2px solid #000;
}
.bbh-rows dt {
  flex: none;
  color: var(--sub);
}
.bbh-rows dt::after {
  content: "";
}
.bbh-rows .dots {
  flex: 1;
  min-width: 16px;
  border-bottom: 4px dotted rgb(204 153 140 / 0.35);
  translate: 0 -6px;
}
.bbh-rows dd {
  margin: 0;
  text-align: right;
  color: var(--cream);
}

/* ---- HUD counters ---- */
.bbh-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0 0 48px;
  padding: 0;
  list-style: none;
}
.bbh-hud li {
  padding: 16px;
  text-align: center;
  background: var(--band);
  color: var(--sub);
}
.bbh-hud b {
  display: block;
  margin-bottom: 8px;
  font-size: 48px;
  line-height: 48px;
  font-weight: normal;
  color: var(--gold);
  text-shadow: 0 0 20px rgb(255 214 120 / 0.45);
}

/* ---- Upgrade cards (optimisations) ---- */
.bbh-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bbh-cards li {
  padding: 24px;
  background: var(--btn-fill);
  border: 4px solid var(--btn);
  box-shadow: 0 0 32px rgb(255 191 64 / 0.18);
}
.bbh-cards li:nth-child(even) {
  background: var(--blue-fill);
  border-color: var(--blue);
  box-shadow: 0 0 32px rgb(115 191 255 / 0.18);
}
.bbh-cards h3 {
  margin: 0 0 16px;
  font-weight: normal;
  font-size: 24px;
  line-height: 32px;
  color: var(--gold);
}
.bbh-cards li:nth-child(even) h3 {
  color: #bfe3ff;
}
.bbh-cards h3 small {
  display: block;
  font-size: 16px;
  color: var(--sub);
}
.bbh-cards p {
  margin: 0 0 16px;
}
.bbh-cards .where {
  margin: 0;
  color: var(--sub);
}
.bbh code {
  font-family: var(--px);
  color: var(--gold);
}

.bbh main a:not(.bbh-btn):not(.bbh-prompt) {
  color: var(--gold);
}

/* ---- Small screens: step the font down by whole art pixels ---- */
@media (max-width: 820px) {
  .bbh-play {
    grid-template-columns: 1fr;
  }
  .bbh-screen {
    max-width: 360px;
    margin: 0 auto;
  }
  .bbh-cards {
    grid-template-columns: 1fr;
  }
  .bbh-hud {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .bbh-logo .bye {
    font-size: 40px;
  }
  .bbh-logo .hell {
    font-size: 72px;
  }
  .bbh-head span {
    font-size: 32px;
    line-height: 40px;
  }
  .bbh-head small,
  .bbh-btn,
  .bbh-prompt {
    font-size: 16px;
  }
  .bbh-flame {
    width: 28px;
    height: 36px;
    background-size: 84px 36px;
  }
  @keyframes bbh-flame {
    to {
      background-position: -84px 0;
    }
  }
  .bbh-rows > div {
    flex-wrap: wrap;
  }
  .bbh-rows .dots {
    display: none;
  }
  .bbh-rows dd {
    flex-basis: 100%;
    text-align: left;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bbh main *,
  .bbh .bbh-title-screen * {
    animation: none !important;
  }
}
