/**
 * Main project styling goes here.
 * http://lesscss.org/
 */
.hidden {
  display: none;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  padding: 0 15px;
}

h1 {
  font-weight: normal;
  font-size: 2em;
}

.last-updated {
  color: #666;
  margin-bottom: 1em;
}

.filter,
.toggle {
  display: inline-block;
  padding: 0.25em 0;
  background-color: #f0f9e8;
  color: #7bccc4;
  font-weight: 600;
  border: 1px solid #7bccc4;
  text-align: center;
  width: 150px;
}

.filter {
  margin-bottom: 6px;
}

.toggle-groups {
  margin-bottom: 15px;
}

.toggle-groups .short {
  display: none;
}

.filters-label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
}

.filters .short {
  display: none;
}

.filter:not(.on):hover,
.toggle:hover {
  cursor: pointer;
}

.filter.on,
.filter:hover,
.toggle.on,
.toggle:hover {
  background-color: #7bccc4;
  color: #fff;
}

.toggle-group,
.conjunction {
  display: inline-block;
}

.incumbent {
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+CjxwYXRoIGQ9Ik0wLDBMMTAsMEwwLDEwWiIgZmlsbD0iIzAwMCI+PC9wYXRoPgo8L3N2Zz4=");
}

.swatch {
  width: 20px;
  height: 20px;
  display: inline-block;
  margin-right: 8px;
  position: relative;
  top: 5px;
  background-size: 40px 40px;
}

.swatch.winner {
  background-color: #ffdb67;
}

.legend {
  float: right;
}

.legend > div {
  display: inline-block;
  margin-left: 1em;
}

.district,
.no-close-races {
  border-top: 1px solid #ddd;
  margin: 0.75em 0 3em 0;
}

.district-header,
.no-close-races {
  font-size: 1.25em;
  padding: 1.5em 0 0.5em 0;
}

.no-close-races {
  text-align: center;
}

.race-header {
  padding-bottom: 0.6em;
}

.race {
  margin-bottom: 2em;
}

.party {
  font-weight: 600;
  padding-right: 0.4em;
  text-transform: uppercase;
}

.GOP {
  color: #f14f9a;
}

.Dem {
  color: #1b9ac0;
}

table,
th,
tr {
  border-collapse: collapse;
}

span.votes-label {
  width: 50px;
  display: inline-block;
  text-align: left;
}

.results {
  width: 100%;
}

.results td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #fff;
}

.results tr {
  background-color: #eee;
}

.results tr.winner {
  background-color: #ffdb67;
}

td.votes,
td.pct {
  text-align: right;
}

td.name,
td.pct {
  font-weight: bold;
}

td.votes {
  font-size: 14px;
}

td.name {
  width: 45%;
}

td.votes {
  width: 35%;
}

td.pct {
  width: 20%;
}

.map-outer {
  margin-top: 22px;
  padding: 1em;
}

.map {
  width: 100%;
  height: auto;
}

.map-description {
  text-align: center;
}

.map-small-description {
  font-size: 12px;
}

.races {
  width: 100%;
}

.map-outer + .races {
  width: 70%;
  float: right;
}

.map-outer {
  width: 30%;
  float: right;
}

.legend {
  width: 235px;
}

.legend-on-top .legend,
.legend-on-top .toggle-groups {
  float: none;
}

.legend-on-top .toggle-groups {
  width: 100%;
}

.legend-on-top .legend {
  position: absolute;
  width: 100%;
  text-align: right;
  top: 0;
  right: 0;
}

.legend-on-top .legend > div {
  margin: 0 0.5em;
}

.single-district .legend,
.single-district .toggle-groups {
  float: none;
}

.single-district .toggle-groups {
  width: 100%;
}

.single-district .legend {
  position: absolute;
  width: 100%;
  text-align: right;
  top: 0;
  right: 0;
}

.single-district .legend > div {
  margin: 0 0.5em;
}

.single-district .toggle-groups {
  display: none;
}

.single-district .last-updated {
  margin-bottom: 0em;
}

.permalink {
  padding-bottom: 0.55em;
  font-size: 14px;
}

.permalink a {
  color: #666;
  text-decoration: none;
}

.permalink .fa-external-link {
  margin-left: 0.5em;
  position: relative;
  top: 1px;
}

.runoff-message {
  background-color: #7ffbd4;
  padding: 10px 12px;
  font-size: 14px;
}

@media screen and (max-width: 765px) {
  .legend,
  .toggle-groups {
    float: none;
  }

  .toggle-groups {
    width: 100%;
  }

  .legend {
    position: absolute;
    width: 100%;
    text-align: right;
    top: 0;
    right: 0;
  }

  .legend > div {
    margin: 0 0.5em;
  }
}

@media screen and (max-width: 719px) {
  .map-outer + .races,
  .map-outer {
    width: 100%;
    float: none;
  }

  .map-outer {
    position: relative;
    margin: 0.75em 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
  }

  .map {
    width: 150px;
    height: 150px;
  }
}

.legend-on-bottom .legend {
  position: static;
  text-align: center;
}

.legend-on-bottom .toggle-groups {
  padding-bottom: 0.5em;
}

.legend-on-bottom .district {
  margin-top: 0.75em;
  text-align: center;
}

@media screen and (max-width: 640px) {
  .legend {
    position: static;
    text-align: center;
  }

  .toggle-groups {
    padding-bottom: 0.5em;
  }

  .district {
    margin-top: 0.75em;
    text-align: center;
  }

  .single-district .legend {
    position: static;
    text-align: center;
  }

  .single-district .toggle-groups {
    padding-bottom: 0.5em;
  }

  .single-district .district {
    margin-top: 0.75em;
    text-align: center;
  }
}

@media screen and (max-width: 590px) {
  .filters,
  .toggle-groups,
  .legend {
    text-align: center;
    margin-bottom: 0;
  }

  .filters .short,
  .toggle-groups .short {
    display: inline;
    font-size: 12px;
  }

  .filters .long,
  .toggle-groups .long {
    display: none;
  }

  .toggle {
    width: 130px;
  }

  .filter {
    width: 90px;
  }
}

@media screen and (max-width: 480px) {
  td.name {
    width: 50%;
  }

  td.votes {
    width: 25%;
  }

  td.pct {
    width: 25%;
  }

  span.votes-label {
    display: none;
  }
}

@media screen and (max-width: 419px) {
  body {
    font-size: 14px;
  }

  td.votes {
    font-size: 13px;
  }

  td.name {
    width: 56%;
  }

  td.votes {
    width: 23%;
  }

  td.pct {
    width: 21%;
  }

  h1 {
    font-size: 1.75em;
  }
}

@media screen and (max-width: 370px) {
  .results td {
    padding: 12px 8px;
  }
}

@media screen and (max-width: 360px) {
  body {
    font-size: 13px;
  }

  .results td {
    padding: 10px 6px;
  }
}

.enlarge {
  -webkit-animation: enlarge 0.8s 1 ease-in-out;
  -moz-animation: enlarge 0.8s 1 ease-in-out;
  -o-animation: enlarge 0.8s 1 ease-in-out;
  animation: enlarge 0.8s 1 ease-in-out;
}

@-webkit-keyframes enlarge {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }

  50% {
    -webkit-transform: scale3d(1.4, 1.4, 1.4);
    transform: scale3d(1.4, 1.4, 1.4);
  }

  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}

@-moz-keyframes enlarge {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }

  50% {
    -webkit-transform: scale3d(1.4, 1.4, 1.4);
    transform: scale3d(1.4, 1.4, 1.4);
  }

  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}

@-o-keyframes enlarge {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }

  50% {
    -webkit-transform: scale3d(1.4, 1.4, 1.4);
    transform: scale3d(1.4, 1.4, 1.4);
  }

  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}

@keyframes enlarge {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }

  50% {
    -webkit-transform: scale3d(1.4, 1.4, 1.4);
    transform: scale3d(1.4, 1.4, 1.4);
  }

  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}
