:root {
  --color-dem: #1a80c4;
  --color-dem-light: #6e9cc1;
  --color-gop: #cc3d3d;
  --color-gop-light: #d88d8d;
  --color-ind: #1ba733;
  --color-ind-light: #8bc194;
  --color-lgrey: #e8e8ed;
  --color-grey: #616467;
}

*,
*:before,
*:after {
  box-sizing: border-box;
}

body {
  font-family: Rubik, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  margin: 0;
}

.edash {
  min-height: 200px;
}

.edash-head {
  align-items: end;
  border-bottom: 2px solid #ececed;
  display: flex;
  justify-content: space-between;
  line-height: 1.5rem;
  margin: 0 0 10px;
  padding-bottom: .5rem;
  text-align: center;
  text-transform: uppercase;
}

.edash-head-title {
  color: var(--color-gop);
  font-size: 1.5rem;
  line-height: 1;
}

.edash-head-title span:last-of-type {
  color: var(--color-dem);
}

.edash-head-title span {
  display: inline-block;
}

#refresh {
  color: var(--color-grey);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
}

.races {
  --gap: 4rem;
  display: grid;
  gap: 2rem var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(calc((700px - var(--gap))/2), 1fr));
}

@media (width < 800px) {
    .races {
      --gap: 2rem;
    }
}

.electoral-bars {
  background: var(--color-lgrey);
  display: flex;
  height: 0.5rem;
  justify-content: space-between;
  margin-inline: auto;
  position: relative;
}

.electoral-bars .bar {
  height: 100%;
  transition: width .8s ease 0s;
  width: 0;
}

.bar.dem {
  background: var(--color-dem);
}

.bar.gop {
  background: var(--color-gop);
}

.bar.ind {
  background: var(--color-ind);
  margin-right: auto;
}

.victory {
  border: 0;
  border-right: 2px solid currentColor;
  bottom: -5px;
  color: var(--color-grey);
  left: calc(50% - 1px);
  position: absolute;
  top: -5px;
}

.victory .label {
  font-weight: 400;
  position: absolute;
  top: 1.2rem;
  transform: translateX(-50%);
  white-space: nowrap;
}

.electoral-leaderboard {
  align-items: flex-start;
  display: flex;
  font-weight: 800;
  justify-content: space-evenly;
  line-height: 1;
  list-style-type: none;
  margin: 2.5rem auto 0;
  padding: 0;
  text-transform: uppercase;
}

.electoral-leaderboard .party {
  color: #666;
  display: flex;
  flex-direction: column;
  font-size: 2.5rem;
  justify-content: flex-end;
  text-align: center;
}

.electoral-leaderboard .party .label {
  align-items: center;
  display: flex;
  font-size: 1rem;
  font-weight: normal;
  gap: 0.4rem;
  margin: 0 auto 6px auto;
}

.votes {
  min-width: 3ch;
}

.electoral-leaderboard .party.dem {
  color: var(--color-dem);
}

.electoral-leaderboard .party.gop {
  color: var(--color-gop);
}

.electoral-leaderboard .party.ind {
  color: var(--color-ind);
}

.edash-footer {
  align-items: baseline;
  border-top: 2px solid #e8e8ed;
  color: #616467;
  display: flex;
  font-size: 0.75rem;
  font-weight: 200;
  justify-content: space-between;
  margin: 2rem 0 0;
  padding: 5px 0 0;
}

@media (width < 500px) {
  .edash-footer {
    flex-direction: column;
    padding-inline: 0.25rem;
  }
}

.gain {
  color: #ffffff;
  font-weight: 500;
  line-height: 1;
  padding: .35rem .5rem;
  text-transform: uppercase;
}

.change {
  color: #000000;
  display: none;
  font-size: .75rem;
  margin-left: auto;
  margin-top: 2rem;
  width: fit-content;
}

/* Motion off for anyone who asks. The seat bars grow on every update, and
   bop.js checks the same query and writes the seat counts out directly rather
   than counting up over two seconds. */
@media (prefers-reduced-motion: reduce) {
  .bar {
    transition: none;
  }
}
