html {
  background: white;
}

body #gallery { display: none; }

body.mode-gallery #start { display: none; }
body.mode-gallery nav { display: none; }
body.mode-gallery #gallery { display: block; }
body.mode-gallery footer { display: none; }

#gallery {
  max-width: none;
  margin: 0 12em;
  margin-top: 4px;
}

img.g-img {
  display: block;
  max-height: calc(95vh - 120px);
  width: 100%;
}

.g-back {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 3.5em;
  font-family: 'Arial', sans-serif;
  font-size: small;
  text-transform: uppercase;
  padding: 4px;
  border: 1px solid grey;
  background: #EEEEEE;
  text-align: center;
}

.g-back a {
  text-decoration: none;
  color: black;
}

#g-aside {
  position: absolute;
  left: 0;
  top: 4px;
  vertical-align: top;
  padding: 2em 1em;
  width: 12em;
  text-align: center;
}

#g-left, #g-right {
  display: table-cell;
}

.g-box {
  display: table;
  max-width: calc(95vw - 24em);
  margin: 0 auto;
  border-collapse: collapse;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#g-aside img {
  display: block;
  margin: 1em auto;
  width: 8em;
}

#g-aside p {
  text-align: left;
}

#g-left, #g-right {
  background-color: black;
  border: 4px solid black;
}

.g-control {
  margin: 1em 0;
  text-align: center;
}

.g-control a {
  text-decoration: none;
  color: lightgrey;
  font-size: x-large;
  margin: 0 0.3em;
}

.g-control a:first-child {
  padding-left: 4em;
}

.g-control a:last-child {
  padding-right: 4em;
}

.g-control .comment-button {
  display: none;
}

.g-control .comment-button.flash {
  box-shadow: 0 0 20px 0px yellow;
  background: yellow;
}

.g-control .comment-button.flash-fade {
  box-shadow: none;
  background: transparent;
  -webkit-transition: -webkit-box-shadow 3s ease-out, background 3s ease-out;
  -moz-transition: -moz-box-shadow 3s ease-out, background 3s ease-out;
  transition: box-shadow 3s ease-out, background 3s ease-out;
}

#g-nav {
  margin: 0 auto;
  min-width: 70vw;
  max-width: 700px;
  width: 100%;
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
}

#g-row {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.g-thumb {
  max-height: 50px;
  max-width: 50px;
}

.g-thumb.selected {
  outline: 4px solid #f7931d;
  outline-offset: -4px;
}

figcaption {
  margin-top: 4em;
}

.tooltip span {
  position: relative;
  display: none;
  z-index: 1;
  padding: 15px;
  text-align: left;
}

.tooltip.right {
  border-bottom: 1px dotted grey;
}

.tooltip.right span {
  margin-top: -40px;
  margin-left: 12px;
  width: 12em;
}

.tooltip.above span {
  bottom: 80px;
  margin-left: 25px;
  transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  width: 220px;
}

.tooltip:hover span, .tooltip.hovered span {
  display: inline;
  position: absolute;
  border: 1px solid dimgray;
  background: whitesmoke;
  border-radius: 3px;
  box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.tooltip span h3 {
  margin: 0;
  text-align: center;
}

.tooltip span img {
  width: 100px;
  margin: 1em 0.3em 0.3em 0;
  vertical-align: top;
}

.overlay-enabled, .commentary-enabled {
  position: relative;
}

.commentary-enabled .commentary, .overlay-enabled .overlay {
  display: initial;
}

.overlay {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  padding: 4em 3em 0 4em;
  opacity: 0;
  color: white;
  text-align: left;
  overflow: auto;
}

.overlay div h2 {
  margin-top: 0;
}

.overlay div img {
  float: right;
  padding: 0 0 2em 4em;
  width: 20%;
  min-width: 144px;
}

.overlay p.break {
  margin-top: 4em;
}

.overlay hr {
  height: 1px;
  color: white;
  background-color: white;
  border-width: 0;
  margin: 2em 0;
  clear: both;
}

.commentary {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  max-height: calc(100% - 4em);
  overflow: auto;
  color: white;
  padding: 2em 3em;
}

@media (max-width: 400px) {
  .g-control a {
    padding: 0 !important;
  }
}

@media (max-width: 1000px) {
  #gallery {
    margin: 0;
  }
  
  .g-back {
    position: static;
    display: block;
    margin: 1em 0 0 auto;
  }
 
  #g-aside {
    position: static;
    max-width: 90vw;
    margin: 0 auto;
    padding-top: 0;
  }
  
  #g-aside h2 {
    margin-top: 0;
  }
  
  #g-left, #g-right {
    display: block;
  }
  
  .g-box {
    max-width: none !important;
  }
  
  img.g-img {
    max-width: calc(95vw - 40px);
    max-height: calc(95vh - 40px);
    width: auto;
  }
  
  figcaption {
    margin-top: 2em;
  }
  
  .fullscreen-toggle {
    display: none;
  }
  
  #g-nav {
    position: static;
  }
  
  .overlay-enabled #g-left img, .overlay-enabled #g-right img {
    display: none !important;
  }
  
  .overlay-enabled .overlay {
    display: block;
    position: initial;
    background: black;
    padding: 1em;
  }
  
  .overlay div img {
    float: none;
    display: block;
    margin: 0 auto;
    width: initial;
    padding: 1em 0;
  }
  
  .tooltip:hover span {
    display: none;
  }
}

@media (max-width: 1050px) {
  #gallery {
    margin-right: 0px;
  }
  
  .g-box {
    max-width: calc(95vw - 12em);
  }
  
  #g-nav {
    max-width: none;
    width: 80%;
  }
}

@media (max-aspect-ratio: 15/10) {
  #gallery {
    margin-right: 0px;
  }
  
  .g-box {
    max-width: calc(95vw - 12em);
  }
  
  #g-nav {
    max-width: none;
    width: 80%;
  }
}