/* The Game Matrix (/matrix, assets/js/matrix/app.js): my-game-matrix's own
   dashboard filling the screen under the hub's bar. The bar is the hub's
   (achromatic, the room's dark); the dashboard below keeps its own colours. */

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--room-deep);
  color: var(--light);
  font-family: var(--face);
  font-size: var(--step-0);
}

.matrix {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* --- the bar: where you are, what this is, the three ways to play, the dashboard on its own, the account and Settings --- */

.matrix-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem 1rem;
  padding-block: max(0.7rem, env(safe-area-inset-top)) 0.7rem;
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--hair);
  background: var(--room-deep);
}

.matrix-bar__brand {
  flex: none;
  color: var(--light);
  text-decoration: none;
  white-space: nowrap;
  font-variation-settings: 'wdth' 100, 'wght' 800;
}

.matrix-bar__brand span {
  color: var(--dust);
  font-variation-settings: 'wdth' 100, 'wght' 500;
}

.matrix-bar__what {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--dust-dim);
  font-size: var(--step--1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matrix-bar__ways,
.matrix-bar__side {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
}

/* The three ways to play: light buttons, as every view's corner draws them (account.css). */
/* Big enough to press: 40 pixels at least each way (scripts/ways-browser.mjs). */
.matrix-way {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  box-sizing: border-box;
  gap: 0.45rem;
  padding-block: 0.32rem;
  padding-inline: 0.4rem 0.85rem;
  border: 0;
  border-radius: 2rem;
  background: var(--light);
  color: var(--room-deep);
  font: inherit;
  font-size: 0.82rem;
  font-variation-settings: 'wdth' 100, 'wght' 760;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.15s var(--ease);
}

.matrix-way:hover {
  background: #fff;
  transform: translateY(-1px);
}

.matrix-way__mark {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--room-deep);
  color: var(--light);
}

.matrix-way[data-way='world'] .matrix-way__mark {
  color: var(--attract);
}

/* The dashboard on a page of its own, for the whole screen. */
.matrix-own {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--hair-bright);
  border-radius: 2rem;
  color: var(--light);
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
}

.matrix-own:hover {
  border-color: var(--light);
}

.matrix-own[hidden] {
  display: none;
}

.matrix-way:focus-visible,
.matrix-own:focus-visible {
  outline: 2px solid var(--attract);
  outline-offset: 3px;
}

html.is-pad .matrix-way:focus,
html.is-pad .matrix-own:focus {
  outline: 3px solid var(--pad-ring, #8fb8ff);
  outline-offset: 3px;
}

/* --- the dashboard -------------------------------------------------------------------- */

.matrix-stage {
  position: relative;
  min-height: 0;
}

.matrix-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f6f6f4;
}

@media (prefers-color-scheme: dark) {
  .matrix-frame {
    background: #151515;
  }
}

/* Until the dashboard has loaded (it is a big page: every run is in it), or when the library has none. */
.matrix-wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 2rem var(--gutter);
  background: var(--room-deep);
  color: var(--dust);
  text-align: center;
}

.matrix-wait[hidden] {
  display: none;
}

.matrix-wait a {
  color: var(--light);
}

/* --- smaller screens: the words go before the buttons do ------------------------------------ */

@media (max-width: 64rem) {
  .matrix-bar__what {
    display: none;
  }
  .matrix-bar__ways {
    margin-inline-start: auto;
  }
}

/* A phone: the three ways are their marks, the dashboard's own page its arrow; their words stay for a screen reader.
   With the comments' bell, the account's name and the bell may not fit beside them: the account and Settings go to a
   line of their own, at its end (only then, so the bar is as it was while comments are off). */
@media (max-width: 40rem) {
  .matrix-bar {
    gap: 0.4rem;
  }
  .matrix-bar:has(.account__bell) {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .matrix-way {
    gap: 0;
    padding: 0.32rem;
  }
  .matrix-way__label,
  .matrix-own__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .matrix-own {
    padding: 0.4rem;
  }
  .matrix-bar__brand span {
    display: none;
  }
}
