/* The studio frame: the bar at the top of every page, its game switcher, and the one footer.
   Every page links this first; a game's own stylesheet comes after it and styles only its <main>.
   Everything here is under .bbg-, so a game's classes can't collide with it. The frame looks the
   same on every page, in light and dark alike, so the games' own looks sit inside it.
   System fonts only; nothing loads from another site. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
}

body > main {
  flex: 1;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- The bar ---------- */

.bbg-bar,
.bbg-foot {
  --bbg-bg: #111315;
  --bbg-line: #2a2e33;
  --bbg-ink: #eceae6;
  --bbg-dim: #a8adb3;
  --bbg-hi: #7fd8bd;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  letter-spacing: 0;
  text-transform: none;
  color: var(--bbg-ink);
  background: var(--bbg-bg);
}

.bbg-skip {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 20;
  padding: 10px 14px;
  font: 600 15px/1.2 system-ui, sans-serif;
  color: #111315;
  background: #eceae6;
  border-radius: 8px;
}

.bbg-skip:focus {
  top: 8px;
}

/* a game section's own rules for bare elements (Slingularity's `footer { margin-top }` and
   `a:hover { color }`, say) don't reach the frame, whichever stylesheet comes last */
.bbg-bar,
.bbg-foot {
  margin: 0;
  width: auto;
  box-shadow: none;
}

.bbg-bar a:hover {
  color: inherit;
}

.bbg-bar {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--bbg-line);
}

.bbg-bar__in {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100% - 16px, 72rem);
  min-height: 48px;
  margin-inline: auto;
}

.bbg-bar a {
  color: inherit;
  text-decoration: none;
}

.bbg-bar a:focus-visible,
.bbg-bar summary:focus-visible,
.bbg-foot a:focus-visible {
  outline: 2px solid var(--bbg-hi);
  outline-offset: 2px;
  border-radius: 6px;
}

.bbg-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 8px;
  margin-right: auto;
  font-weight: 650;
  white-space: nowrap;
}

.bbg-mark img {
  display: block;
  width: 24px;
  height: 24px;
}

/* the games, in a row where there's room... */
.bbg-games {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* a page's own list styles never reach the frame's lists */
.bbg-bar ul,
.bbg-bar li,
.bbg-foot p {
  margin: 0;
  padding: 0;
}

.bbg-games a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--bbg-dim);
  border-radius: 8px;
}

.bbg-games a:hover,
.bbg-switch a:hover {
  color: var(--bbg-ink);
  background: #1d2125;
}

.bbg-games a[aria-current="page"] {
  color: var(--bbg-ink);
  box-shadow: inset 0 -2px 0 var(--bbg-hi);
  border-radius: 0;
}

/* ...and behind a "Games" button on a phone */
.bbg-switch {
  position: relative;
}

.bbg-switch summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--bbg-line);
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.bbg-switch summary::-webkit-details-marker {
  display: none;
}

.bbg-switch summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: -3px 2px 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.bbg-switch[open] summary::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.bbg-switch ul {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(260px, calc(100vw - 16px));
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bbg-bg);
  border: 1px solid var(--bbg-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);
}

.bbg-switch li + li {
  margin-top: 2px;
}

.bbg-switch ul {
  padding: 6px;
}

.bbg-switch a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px;
  border-radius: 8px;
}

.bbg-switch a img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.bbg-switch a[aria-current="page"] {
  background: #1d2125;
  box-shadow: inset 3px 0 0 var(--bbg-hi);
}

@media (min-width: 760px) {
  .bbg-games {
    display: flex;
  }

  .bbg-switch {
    display: none;
  }
}

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

.bbg-foot {
  border-top: 1px solid var(--bbg-line);
  color: var(--bbg-dim);
}

.bbg-foot__in {
  width: min(100% - 32px, 72rem);
  margin-inline: auto;
  padding: 22px 0 28px;
}

.bbg-foot .bbg-foot__in p {
  margin: 0 0 8px;
}

.bbg-foot a {
  color: var(--bbg-ink);
  text-decoration: underline;
  text-decoration-color: rgb(236 234 230 / 0.35);
  text-underline-offset: 0.2em;
  /* a taller line box, so each inline link is an easy tap */
  display: inline-block;
  padding: 6px 0;
}

.bbg-foot a:hover {
  color: var(--bbg-ink);
  text-decoration-color: currentColor;
}

.bbg-foot__studio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.bbg-foot__studio span {
  color: var(--bbg-dim);
}

.bbg-foot .bbg-foot__mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  text-decoration: none;
}

.bbg-foot__small {
  font-size: 13.5px;
}

@media print {
  .bbg-bar,
  .bbg-skip {
    display: none;
  }

  .bbg-foot {
    color: #000;
    background: none;
  }
}

/* ---------- "More from the studio": the band at the end of a game's page ----------
   Paper and ink in both colour schemes, a green rule on top, like the home page's end card. */

.bbg-more {
  margin-top: 56px;
  padding: 44px 0 52px;
  color: #111315;
  background: #f6f4ef;
  border-top: 6px solid #1b6a56;
}

.bbg-more__in {
  width: min(100% - 32px, 72rem);
  margin-inline: auto;
}

.bbg-more__studio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  font: 700 0.95rem/1 system-ui, sans-serif;
  color: #eceae6;
  background: #111315;
}

.bbg-more__studio img {
  border-radius: 8px;
}

.bbg-more h2 {
  margin: 0 0 20px;
  font: 900 clamp(1.8rem, 1.2rem + 2vw, 2.6rem)/1 "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  letter-spacing: -0.02em;
  color: #111315;
}

.bbg-more__list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 760px) {
  .bbg-more__list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.bbg-more__list a {
  display: block;
  text-decoration: none;
  font: 800 1.15rem/1.2 "Archivo", system-ui, sans-serif;
  color: #111315;
  transition: transform 350ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bbg-more__list a:hover {
  transform: translateY(-4px);
}

.bbg-more__list img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 10px;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgb(0 0 0 / 0.3);
}

.bbg-more__list span {
  display: block;
}

.bbg-more__list .bbg-more__kind {
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1b6a56;
}

@media (prefers-reduced-motion: reduce) {
  .bbg-more__list a {
    transition: none;
  }
}

@media print {
  .bbg-more {
    display: none;
  }
}
