html {
  font-size: 100%;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f7f7f2;
  color: #333;
  font-family: Calibri, arial, sans-serif;
}

#canvas {
  display: grid;
  column-gap: 0;
  row-gap: 0;

  grid-template-columns: 320px auto;

  height: 100%;
}

/* main body container */


#mapContainer {
  grid-column-start: 2;
  grid-column-end: 3;

  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* control box */
#controlsContainer {
  box-shadow: 3px 0px 5px -2px #555;
  position: relative;
  z-index: 100;
  overflow-y: auto;
}

#controls {
  grid-column-start: 1;
  grid-column-end: 2;

  overflow-y: auto;

  font-size: 1rem;
}

.button-bar {
  display: flex;
  border: 2px solid #ccc;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin-left: 8px;
  margin-right: 8px;
  margin-top: 12px;
}

.button-bar .button {
  flex: 1;
  padding: 10px 20px;
  border: none;
  background: #fff;
  color: #333;
  cursor: auto;
  font-size: 1em;
  text-transform: uppercase;
  transition: background-color 0.3s, color 0.3s;
}

.button-bar .button.active {
  background-color: #f05c2d;
  color: #fff;
}

.button-bar .button:not(.active):hover {
  background-color: #ddd;
  /* TODO: make this a little more interesting */
}

.button-bar .button:not(.active) {
  cursor: pointer;
}

.hidden {
  display: none;
}

/* bill selection list */
#ulBills {
  list-style-type: none;
  padding-left: 0;
}

.billCategoryList {
  border-top: 2px solid #a9bbd6;
}

.billCategoryList:last-child,
.billCategoryList.active .billCategoryLabel {
  border-bottom: 2px solid #a9bbd6;
}

.billCategoryLabel,
.billLabel {
  all: unset;
  cursor: pointer;
}

.billCategoryLabel {
  padding: 6px;
  font-size: 1.2em;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 300ms;
}

.billCategoryLabel:hover {
  background: #dde4ef;
  color: inherit;
}

.billCategoryLabel>span {
  margin-left: 10px;
}

.billCategoryLabel img {
  flex: 0 0 auto;
  width: 1.5em;
  height: 1.5em;
  transition: transform 300ms ease-in-out;
}

.billCategoryList.active .billCategoryLabel img {
  transform: rotate(-180deg);
}

.billCategoryList .child {
  border-style: solid;
  border-color: #b6b6b6;
  border-width: 0 1px;
  background: #e9e9ed;
  /* margin-left: 20px; */
  padding-left: 0;
}

.billCategoryList .child li {
  list-style: none;
  padding: 8px 10px 8px 30px;
}

.billCategoryList .child li:not(:last-child) {
  border-bottom: 1px solid #b6b6b6;
}

.billItem {
  transition: background-color 300ms;
}

.billItem:not(.active):hover {
  cursor: pointer;
  background: #ffdfd6;
}

.billLabel {
  font-size: 1rem;
}

.billLabel:hover {
  color: inherit;
}

.billItem.active {
  pointer-events: none;
}

.billItem.active {
  font-weight: 700;
  background: #ff916f;
}

/* house level selectors */
#layerControls {
  width: 90%;
  margin: 0 auto;
  background: #f7f7f2;
  margin-top: 20px;
}

#layerControls.active #layersList {
  display: flex;
  flex-wrap: wrap;
}

/* special mini map controls */
#canvas.mini {
  display: block;
}

#canvas.mini #controlsContainer {
  position: absolute;
  bottom: 0;
  left: 0;
  background: rgba(247, 247, 242, .5);
  backdrop-filter: blur(2px);
  box-shadow: 3px 3px 5px -2px #555;
}

#canvas.mini #layerControls.active {
  width: auto;
  margin: 20px 10px;
  background: transparent;
}


.mini #layerControls.active #layersList {
  flex-direction: column;
  flex-wrap: nowrap;
}

.mini #layerControls .layer-toggle-item {
  width: 100%;
  margin: 16px 0;
}

#layerControls .layer-controls-label {
  font-weight: 700;
  padding-bottom: 4px;
  text-align: center;
}

#layerControls .layer-toggle-item {
  /* display: inline-block; */
  text-align: center;
  width: 50%;
  margin: 12px 0;
}

#layerControls a {
  text-align: center;
  border: 1px solid #999;
  background-color: #fff;
  box-shadow: 0 3px 5px -2px;
  font-size: 0.8rem;
  color: #333;
  padding: 8px 16px;
  border-radius: 100px;
  text-decoration: none;
  transition: background-color 0.3s, color 0.3s;
}

#layerControls a.active {
  background-color: #f05c2d;
  border-color: #333;
  color: #fff;
  box-shadow: 0 3px 5px -2px #333;
}

#layerControls a.active:hover {
  cursor: default;
}

#layerControls a:not(.active):hover {
  background: #ddd;
  color: #333;
}

#layerControls.mini-controls {
  width: 30%;
}

#layerControls.mini-controls a {
  font-size: 1rem;
  padding: 6px 0;
}

.mapboxgl-ctrl-logo {
  display: none !important;
}

#mobileControls {
  display: none;
}

/* "Loading..." shield */
#shield {
  position: absolute;
  top: 0;
  left: 0;

  display: none;
  z-index: 1000;

  width: 100%;
  height: 100%;

  background: rgba(44, 44, 44, .9);
  color: #f7f7f2;
}

#shield.active {
  display: table;
}

.shieldMsg {
  display: table-cell;
  width: 300px;
  height: 300px;
  margin: auto;
  vertical-align: middle;
  text-align: center;
}

.shieldMsg img {
  margin: auto;
}

/* "Random Mode" notification text */
#randomNotice {
  background-color: #f7f7f2;
  text-align: center;
  z-index: 99;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid #333;
}

a {
  text-decoration: none;
  color: #365d98;
}

a:hover,
a:active {
  color: #7592bd;
}

/* add a little external icon like wikipedia*/
a.external:after {
  content: " " url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAVklEQVR4Xn3PgQkAMQhDUXfqTu7kTtkpd5RA8AInfArtQ2iRXFWT2QedAfttj2FsPIOE1eCOlEuoWWjgzYaB/IkeGOrxXhqB+uA9Bfcm0lAZuh+YIeAD+cAqSz4kCMUAAAAASUVORK5CYII=);
}

/* change mapbox popup color */
.tally-popup.mapboxgl-popup-content {
  background: #f7f7f2;
  color: #333;
}

.tally-popup.mapboxgl-popup-anchor-top>.mapboxgl-popup-tip,
.tally-popup.mapboxgl-popup-anchor-top-left>.mapboxgl-popup-tip,
.tally-popup.mapboxgl-popup-anchor-top-right>.mapboxgl-popup-tip {
  border-bottom-color: #f7f7f2;
}

.tally-popup.mapboxgl-popup-anchor-bottom>.mapboxgl-popup-tip,
.tally-popup.mapboxgl-popup-anchor-bottom-left>.mapboxgl-popup-tip,
.tally-popup.mapboxgl-popup-anchor-bottom-right>.mapboxgl-popup-tip {
  border-top-color: #f7f7f2;
}

.tally-popup.mapboxgl-popup-anchor-left>.mapboxgl-popup-tip {
  border-right-color: #f7f7f2;
}

.tally-popup.mapboxgl-popup-anchor-right>.mapboxgl-popup-tip {
  border-left-color: #f7f7f2;
}



.mini-popup .mapboxgl-popup-content {
  background: black;
  color: #f7f7f2;
  font-weight: bold;
  padding: 0 6px;
}

.mini-popup.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.mini-popup.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,
.mini-popup.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip {
  border-bottom-color: black !important;
}

.mini-popup.mapboxgl-popup.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
  border-top-color: black !important;
}

.mini-popup.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.mini-popup.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.mini-popup.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip {
  border-top-color: black !important;
}

.mini-popup.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
  border-right-color: black !important;
}

.mini-popup.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
  border-left-color: black !important;
}


.mapboxgl-canvas-container {
  cursor: default !important;
}

.details {
  font-size: 1rem;
  margin: 0;
}

.detailsContent {
  padding: 0 8px;
}

.billTitle {
  font-size: 1.3em;
  margin: 4px 12px 8px 0;
}

.billDescription {
  clear: both;
  font-size: .85em;
  margin: 0 8px 8px 0;
}

.billLinks ul {
  font-size: .8rem;
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.billLinks a {
  display: block;
  padding-left: 22px;
  line-height: 22px;
}

.billLinks ul li a img {
  width: 16px;
  height: 16px;
}

.openStatesLink,
.discussLink,
.govLink {}

#tallyStats {
  font-size: 10px;
  color: #f7f7f2;
  background-color: #333;

  position: absolute;
  top: 0;
  right: 0;
  border-radius: 0 0 0 5px;
  padding: 4px;

  display: none;
}

.tallyStatsItemLabel::after {
  content: ":";
}

/* shift mapbox controls down a bit */
.mapboxgl-ctrl-top-right {
  top: 30px;
}


#detailsOverlay {
  display: none;
}

.talliesCounts {
  clear: both;
  width: 100%;
  font-size: .8rem;
  margin-bottom: 8px;
}

.talliesCounts caption {
  text-align: left;
  font-size: 1.1rem;
}

.talliesCounts th {
  text-align: left;
  padding-right: 8px;
}

.talliesCounts td {
  text-align: right;
  padding-left: 4px;
}

.talliesCounts th,
.talliesCounts td {
  min-width: 2em;
}

.talliesPieChart {
  margin: auto;
  height: 50px;
  width: 50px;

  border-radius: 50%;
  border: 1px solid #89a2a6;
}


/* expandableText */

/* expanded/collapsed states */
.extExpanded {
  display: inline;
}

.extCollapsed {
  display: none;
}

/* states for the trailer ("...") are inverted */
.extTrailer.extCollapsed {
  display: inline;
}

.extTrailer.extExpanded {
  display: none;
}

.extRemainder {}

.extToggle {}

.extToggle:hover {}

.extToggle:active {}


/*
 * target mobile devices:
 * - phones in portrait or landscape
 * - tablets in portrait
 * - having no hover capability
 */
@media screen and ((max-width: 768px)
  /* phones in portrait */
  or ((max-height: 600px) and (orientation: landscape))
  /* phones in landscape */
  or ((min-width: 601px) and (max-width: 1024px) and (orientation: portrait))
  /* tablets in portrait */
) and (hover: none) {
  /* (hover:none), (hover:on-demand), (pointer:coarse) { */

  html {
    font-size: 1rem;
  }

  #canvas {
    display: block;
    grid-template-columns: auto 40vh;
  }

  #canvas.mini #controlsContainer {
    top: 0;
    bottom: auto;
    backdrop-filter: none;
  }

  /* transitions */
  .tstandard {
    -webkit-transition: all 300ms ease-in-out;
    transition: all 300ms ease-in-out;
  }

  .tlong {
    -webkit-transition: all 600ms ease-in-out;
    transition: all 600ms ease-in-out;
  }

  #controls {}

  #controlsContainer {}

  #mobileControls {
    pointer-events: none;

    display: initial;
    position: fixed;
    top: 0;

    width: 100vw;
    height: 50px;

    margin: 0;

    padding-bottom: 8px;
  }

  #mobileControls.active {
    top: 40vh;
    pointer-events: auto;
  }

  .mobileControl {
    pointer-events: none;
  }

  .drawer {
    background-color: rgba(247, 247, 242, .85);

    position: fixed;
    top: -40vh;
    left: 0;
    z-index: 100;

    width: 100vw;
    height: 40vh;
    max-height: 40vh;

    transition: all 600ms ease-in-out;

    overflow-y: auto;
  }

  .drawer.active {
    top: 0;
  }

  .drawerHandle {
    display: block;
    width: 75px;
    height: 40px;

    margin: 0 auto;

    text-align: center;

    border-radius: 0 0 50% 50%;

    text-indent: -1000px;

    background: rgba(247, 247, 242, .85);

    pointer-events: auto;
  }

  .drawerHandle span {
    display: none;
  }

  .drawerIcon {
    width: 100%;
    height: 100%;
    /* make sure width/height match .drawerHandle dimensions */
    background: url("data:image/svg+xml;utf8,<svg viewBox='0 0 130 110' width='75' height='40' xmlns='http://www.w3.org/2000/svg'><g><path d='m121.3,34.6c-1.6-1.6-4.2-1.6-5.8,0l-51,51.1-51.1-51.1c-1.6-1.6-4.2-1.6-5.8,0-1.6,1.6-1.6,4.2 0,5.8l53.9,53.9c0.8,0.8 1.8,1.2 2.9,1.2 1,0 2.1-0.4 2.9-1.2l53.9-53.9c1.7-1.6 1.7-4.2 0.1-5.8z' fill='black'/></g></svg>") center center no-repeat;
    transition: transform 600ms ease-in-out;
    -webkit-transition: -webkit-transform 600ms ease-in-out;
    -moz-transition: -moz-transform 600ms ease-in-out;
  }

  .drawerHandle.active .drawerIcon {
    transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
  }

  .popup {}

  #layerControls {
    border-radius: 10px;
  }

  #layerControls a {
    width: 100%;
    border-radius: 10px;
  }

  #layerControls a:first-child {
    border-radius: 10px 10px 0 0;
  }

  #layerControls a:last-child {
    border-radius: 0 0 10px 10px;
  }

  .mini #layerControls.active #layersList {
    flex-direction: row;
  }

  #detailsOverlay {
    background: rgba(44, 44, 44, .9);
    color: #f7f7f2;

    position: fixed;
    bottom: -35vh;
    left: 0;
    z-index: 101;

    display: block;
    width: 100vw;
    height: 35vh;
    max-height: 35vh;

    transition: all 600ms ease-in-out;

    overflow-y: auto;
  }

  #detailsOverlay.active {
    bottom: 0vh;
  }

  .details {}

  .detailsContent {
    padding: 24px 24px 0 24px;
  }

  table {
    color: #f7f7f2;
  }

  .mini table {
    color: #333;
  }

  .mini table.talliesCounts {
    color: #f7f7f2;
  }

  .talliesCounts caption {
    text-align: left;
  }

  .talliesPieChart {}

  .billDescription {
    margin: 16px;
  }

  .billLinks ul {}

  .billLinks ul li {
    display: block;

    text-align: center;

    margin-bottom: 16px;
  }

  .billLinks ul li a {
    font-size: 1.1rem;
    line-height: 2.5rem;
    height: 2.5rem;

    border: 1px solid #f05c2d;
    border-radius: 30px;
  }

  .billLinks ul li a:active {
    border: 1px solid #ff916f;
  }

  .detailsOverlayControls {
    position: fixed;
    right: 20px;
    top: 8px;
  }

  .closeIcon {
    position: absolute;
    top: 1vh;
    right: 2vw;

    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 16 16'><g><path d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z' fill='white'/></g></svg>") center center no-repeat;
    height: 3vh;
    width: 3vh;

    transition: transform 300ms ease-in-out;
  }

  .detailsClose span {
    display: none;
  }


  .details a {
    text-decoration: none;
    color: #f05c2d;
  }

  .details a:active {
    color: hsl(14, 87%, 76%);
  }
}