/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base Styles */
body {
  background-color: #eef8f8;
  color: #234;
  font-family: Verdana, sans-serif;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-bottom: 24px;
}

article {
  margin-bottom: 40px;
  padding: 16px;
  border: 2px solid #678;
  border-radius: 8px;
  background-color: #f6f9ff;
}

h2 {
  margin-bottom: 12px;
}

/* Flexbox Base Styles */
.flex-parent {
  display: flex;
  border: 2px solid transparent;
  margin: 8px 0;
  min-height: 120px;
}

.flex-child {
  border: 3px solid #468;
  min-height: 80px;
  margin: 8px;
  flex-grow: 1;
  text-align: center;
  line-height: 80px;
  color: #fff;
  font-weight: bold;
  border-radius: 6px;
}

/* Color variety for clarity */
.demo1 .flex-child { background-color: #2e8b57; }
.demo2 .flex-child { background-color: #1e90ff; }
.demo3 .flex-child { background-color: #6a5acd; }
.demo4 .flex-child { background-color: #8b0000; }
.demo5 .flex-child { background-color: #ff8c00; }
.demo6 .flex-child { background-color: #20b2aa; }
.demo7 .flex-child { background-color: #b03060; }
.demo8 .flex-child { background-color: #708090; }

/* Demo 1: display flex & grow */
.demo1-parent .flex-child {
  flex-grow: 1;
}

/* Demo 2: justify-content space-around */
.demo2-parent {
  justify-content: space-around;
}

/* Demo 3: order & space-between */
.demo3-parent {
  justify-content: space-between;
}

/* Demo 4: align-items center */
.demo4-parent {
  justify-content: space-evenly;
  align-items: center;
}

.demo4-parent .tall { height: 120px; }
.demo4-parent .short { height: 60px; }
.demo4-parent .medium { height: 90px; }

/* Demo 5: column + align-self */
.demo5-parent {
  flex-direction: column;
  align-items: flex-start;
}

.special-align {
  align-self: center;
  background-color: #ffb347;
}

/* Demo 6: wrap */
.demo6-parent {
  flex-wrap: wrap;
}

/* Demo 7: flex-flow shorthand */
.demo7-parent {
  flex-flow: row wrap;
}

/* Demo 8: align-content, flex-basis, flex-shrink */
.demo8-parent {
  flex-wrap: wrap;
  align-content: space-between;
  min-height: 300px;
}

.demo8-parent .flex-child {
  flex: 1 1 150px; /* grow: 1, shrink: 1, basis: 150px */
}

/* Footer */
footer {
  text-align: center;
  margin-top: 60px;
  padding: 10px;
  border-top: 2px solid #678;
  color: #456;
}