/*
CSS for Codex Lucida Grid Interface
*/

/* setup */

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

html {  
  flex-direction: column;
}

body {
  flex-direction: row;
  overflow: hidden;
  touch-action: none;
}

* {
  box-sizing: border-box;
  -webkit-touch-callout: none;
}

/* grid layout and perspective */

#grid {
  position: fixed;
  width: 100%;
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  /* prevent selection of page content, which interferes with interaction */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.square:nth-child(1) {grid-area: a}
.square:nth-child(2) {grid-area: b}
.square:nth-child(3) {grid-area: c}
.square:nth-child(4) {grid-area: d}

nav {
  width: 320px;
  height: 320px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-areas:
    'a b'
    'd c';
  perspective: 600px;
}

/* grid shapes */

.square {
  width: 160px;
  height: 160px;
  transition: transform 500ms ease-out, opacity 600ms;
}

img {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* media queries for grid dimensions */

@media (min-width: 640px) and (min-height: 640px) {
  nav {
    width: 480px;
    height: 480px;
  }

  .square {
    width: 240px;
    height: 240px;
  }
}

@media (min-width: 1280px) and (min-height: 1280px) {
  nav {
    width: 640px;
    height: 640px;
  }

  .square {
    width: 320px;
    height: 320px;
  }
}

@media (min-width: 1920px) and (min-height: 1920px) {
  nav {
    width: 960px;
    height: 960px;
  }

  .square {
    width: 480px;
    height: 480px;
  }
}

@media (min-width: 2560px) and (min-height: 2560px) {
  nav {
    width: 1280px;
    height: 1280px;
  }

  .square {
    width: 640px;
    height: 640px;
  }
}

@media (min-width: 3200px) and (min-height: 3200px) {
  nav {
    width: 1600px;
    height: 1600px;
  }

  .square {
    width: 800px;
    height: 800px;
  }
}