/* buhs.tk site styles (plain CSS; no build step). */

:root {
  --gallery-border-color: #6D7280;
  --gallery-background-color: rgba(71, 73, 83, .7);
}

/* reset */
html {
  box-sizing: border-box;
  font-size: 16px;
}
*, *:before, *:after {
  box-sizing: inherit;
}
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
  margin: 0;
  padding: 0;
  font-weight: normal;
}
ol, ul {
  list-style: none;
}
img {
  max-width: 100%;
  height: auto;
}

/* custom elements are layout-neutral wrappers */
site-search, game-gallery, nav-bottom {
  display: contents;
}
game-player {
  display: block;
}
/* --game-w/--game-h are set by game-player.js from the game's size. The player shows at that
   size, shrinks to fit narrow screens, and keeps the game's shape. */
game-player ruffle-player {
  display: block;
  width: calc(var(--game-w) * 1px);
  max-width: 100%;
  height: auto;
  aspect-ratio: var(--game-w) / var(--game-h);
  margin: 0 auto;
}
/* Fullscreen: as large as the screen allows, same shape, black bars on the spare sides. */
game-player:fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
game-player:fullscreen ruffle-player {
  width: min(100vw, calc(100vh * var(--game-w) / var(--game-h)));
  max-width: none;
}

/* nav */
ul {
  display: flex;
}
li:not(:last-of-type) {
  margin-right: 10px;
}
.nav-bottom {
  border: 1px solid var(--gallery-border-color);
  margin-top: 10px;
  padding: 5px;
  text-align: center;
}
.nav-bottom ul {
  justify-content: space-evenly;
  padding: 0 3rem;
}
.nav-item {
  display: inline-block;
  height: 25px;
  width: 30px;
  text-indent: -30000px;
}
.nav-item.active, .nav-item:hover {
  background-position: 30px 0;
}
.home { background: url('/images/nav-home.png'); }
.allgames { background: url('/images/nav-all.png'); }
.highscores { background: url('/images/nav-high.png'); }
.back { background: url('/images/nav-back.png'); }
.random { background: url('/images/nav-shuffle.png'); }
.fullscreen { background: url('/images/nav-full.png'); }

/* gallery */
.nav-search {
  background: url('/images/searchdull.png') no-repeat scroll 8px 6px #F5F5F5;
  border: 1px solid #FFFFFF;
  border-radius: 15px 15px 15px 15px;
  margin: 3px;
  padding: 6px 15px 6px 30px;
  position: absolute;
  right: 25px;
  top: 15px;
}
.grid-container {
  display: grid;
}
.grid-item {
  grid-column: 1/2;
  grid-row: 1/2;
}
.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.gallery-item {
  border: 1px solid #333333;
  display: inline-flex;
  flex-direction: column;
  max-width: 80px;
  min-height: 100px;
  padding: 10px;
  background-color: #6d6e76;
}
a.gallery-item {
  color: inherit;
  text-decoration: none;
}
.gallery-item:hover {
  background: none repeat scroll 0 0 #FF6600;
  border: 1px solid #333333;
  cursor: pointer;
}
.gallery-item img {
  border: 1px solid black;
  display: block;
  margin-bottom: 1px;
  margin-left: auto;
  margin-right: auto;
  max-height: 200px;
  max-width: 150px;
  vertical-align: middle;
}
.gallery-item p {
  font-family: "Trebuchet MS", serif;
  font-size: 11px;
  line-height: 1;
  margin: 0;
  max-width: 150px;
  text-align: center;
  vertical-align: middle;
}
@media (min-width: 1024px) {
  .gallery-item {
    margin: 5px;
  }
}
@media (max-width: 1024px) {
  .game .game-object, .game game-player {
    width: 100%;
  }
}

/* global */
body {
  background-image: url('/images/bg.gif');
  background-repeat: repeat;
  overflow-y: scroll;
}
body:before {
  content: '';
  background-image: url('/images/banner.gif');
  background-repeat: no-repeat;
  height: 100%;
  overflow: hidden;
  position: fixed;
  width: 100%;
}
.main-gallery {
  background-color: var(--gallery-background-color);
  background-repeat: repeat;
  border: 1px solid var(--gallery-border-color);
  height: 100%;
  padding: 15px 0;
  position: absolute;
  width: 100%;
  overflow-x: hidden;
}
@media (min-width: 1024px) {
  .main-gallery {
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    max-width: 500px;
    margin-top: 150px;
    min-height: 600px;
    height: initial;
  }
  .main-gallery.gamepage {
    width: auto;
    max-width: initial;
  }
}

/* gallery wrapper */
.gallery {
  display: grid;
  margin-top: 15px;
}

/* home page only */
game-gallery[view="home"] .heading {
  margin-left: 5px;
}

/* game page */
.reportLink {
  margin: 0 auto;
  text-align: center;
  margin-top: 1rem;
}
.reportLink p {
  color: #fff;
}
.title {
  color: #BDBDBD;
  font-size: 20px;
  margin-bottom: 10px;
  text-align: center;
  text-shadow: 2px 1px 1px #000000;
}

/* high scores page */
.page-highscores p {
  color: #FFFFFF;
  font-family: trebuchet ms;
  font-size: 1rem;
  margin: 4rem 0 8rem;
  text-align: center;
  border-bottom: solid 2px #ff6600;
}

/* error page */
.page-error h1, .page-error p {
  margin: 0 auto;
}
.page-error h1 {
  font-size: 2.8em;
  font-weight: 700;
  margin: 0 0 0.5em 0;
}
.page-error p {
  margin: 1em auto;
}
@media (min-width: 480px) {
  .page-error h1 {
    font-size: 4em;
  }
}
