main {
  max-width: 1400px;
}

h1 {
  margin-bottom: 1.5rem;
  font-weight: 550;
  font-size: clamp(26px, 4vw, 36px);
  color: var(--color-quiver-white-light);
}

.midterm-visuals-outer {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  margin-bottom: 1rem;
}

div.charts-tabs,
div.maps-tabs {
  display: flex;
  border: 2px solid var(--color-border-gray);
  border-radius: 9999px;
  background-color: #181818;
  transition: opacity 0.3s ease;
  height: min-content;


  &.tabs-inactive {
    opacity: 0.5;
    pointer-events: none;
  }

  > div {
    margin: .2rem;
    border-radius: 9999px;
    padding: 0.2rem 0.9rem;
    min-width: 75px;
    cursor: pointer;
    font-size: clamp(13px, 1.2vw, 14px);
    color: var(--color-quiver-white-4);
    text-align: center;

    &:first-child {
      margin-right: 0;
    }

    &:last-child {
      margin-left: 0;
    }

    &.active-tab {
      background-image: linear-gradient(175deg, #545454 -25%, #272727 30%);
      font-weight: 500;
      color: var(--color-quiver-white-light);
    }
  }
}

div.maps-tabs {
  > div {
    padding: 0.25rem 1.25rem;
    font-size: clamp(13.5px, 2vw, 16px);
  }
}

.projection-charts {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;

  > div#projectionChartsHouse, > div#projectionChartsSenate {
    position: relative;
    flex: 1;
    border: 1px solid var(--color-border-gray-dark);
    border-radius: 8px;
    padding: 1.125rem 1.125rem 1rem;
    padding-bottom: 1rem;
    min-width: 300px;
    min-height: 345px;
    background-image: linear-gradient(175deg, #333333 -50%, #141414 30%);
    
    > div.charts-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 1rem;
      font-size: clamp(18px, 2vw, 19px);
      white-space: nowrap;

      strong {
        display: inline-block;
        min-width: 225px;
        font-weight: 550;
      }

      i {
        display: none;
        margin-right: 0.25rem;
        color: #525258;
      }
    }

    div.chart-description {
      display: flex;
      flex-direction: column;
      gap: .125rem;

      p.projection-text {
        padding: 1rem 0 .125rem;
        font-size: clamp(13px, 1.5vw, 15px);
        color: var(--color-quiver-white-2);
        font-weight: 400;
      }

      span.projection-subtext {
        font-size: clamp(12px, 1.2vw, 13px);
        color: var(--color-quiver-gray-3);
      }
    }

    .charts-content {
      position: relative;
    }

    .projection-chart-outer {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-wrap: wrap;
      gap: 1rem;
      margin: 1.5rem 0 .25rem;

      /* match with chart heights from midtermElectionsDash.js */
      min-height: 190px;

      .projection-chart {
        display: flex;
        justify-content: center;
        margin: 0 .5rem;
      }

      .chart-legend {
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1;
        max-width: 250px;
        margin: 0 auto;
        white-space: nowrap;

        > .legend-item {
          display: flex;
          align-items: center;
          justify-content: flex-start;
          padding: .33rem .25rem;
          gap: .5rem;
          font-weight: 400;
          font-size: clamp(12px, 1.2vw, 14px);

          &.legend-item-seats {
            padding: .125rem .25rem;
            font-size: clamp(12px, 1.2vw, 13px);
          }

          .square {
            border-radius: 1px;
            padding: 0;
            min-width: 8px;
            width: 8px;
            max-width: 8px;
            height: 8px;
  
            &.square-democrat {
              background-color: #3498db;
            }
  
            &.square-republican {
              background-color: #e74c3c;
            }
          }

          .democrat {
            color: #3498db;
          }

          .republican {
            color: #e74c3c;
          }

          span {
            width: 140px;
          }
          
          strong {
            margin-left: auto;
            padding-left: .5rem;
            font-family: "Roboto", sans-serif;
          }
        }
      }

      &:not(.chart-active) {
        display: none;
      }
    }

    #chartSeatsHouse, #chartSeatsSenate {
      .chart-legend {
        min-height: 185px;
        justify-content: space-evenly !important;
      }
    }

    .content-placeholder-outer {
      top: 0;
      border-radius: inherit;
      background-color: #181818;
    }
  }
}

.projection-maps {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1rem;
  border: 1px solid var(--color-border-gray-dark);
  border-radius: 8px;
  padding: 1.125rem;
  padding-bottom: 1rem;
  background-image: linear-gradient(175deg, #333333 -50%, #141414 30%);

  .projection-maps-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: .25rem .25rem 0;
    font-size: clamp(18px, 2.5vw, 22px);
    line-height: 1.4;

    strong {
      font-weight: 550;
    }

    i {
      display: none;
      margin-right: 0.25rem;
      color: #525258;
    }

    p {
      padding-top: .75rem;
      font-size: clamp(13px, 1.5vw, 15px);
      font-weight: 300;
      color: var(--color-quiver-gray);
    }
  }

  .map-title {
    padding: 1rem;
    font-size: clamp(16px, 1.8vw, 18px);
    font-weight: 500;
  }

  .map-content {
    position: relative;
    flex: 1;
    min-height: 400px;

    &:not(.map-active) {
      display: none;
    }

    svg path {
      cursor: pointer;
    }
  }

  .tooltip-map {
    z-index: 10;
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid var(--color-border-gray);
    border-radius: 4px;
    padding: .75rem;
    background: rgba(0, 0, 0, 0.8);
    color: var(--color-quiver-white-light);
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
    visibility: hidden;

    strong {
      margin-bottom: .25rem;
      font-weight: 600;
    }

    p {
      display: flex;
      gap: 1rem;
      justify-content: space-between;
      font-weight: 400;
      font-size: 13px;

      span {
        color: var(--color-quiver-white-3);
      }
    }
  }
}

/* congressional races table overwrites */
.table-outer {
  margin-top: 0;
}

.table-preview {
  margin-top: 1.4rem;
  border: 1px solid var(--color-border-gray-dark);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 1.375rem 1.375rem 1rem;
  background-image: linear-gradient(175deg, #333333 -50%, #141414 30%);

  h3 {
    font-size: clamp(18px, 2.5vw, 22px);
  }
}

.races-table th:nth-child(1),
.races-table td:nth-child(1),
.races-table th:nth-child(2),
.races-table td:nth-child(2),
.races-table th:nth-child(3),
.races-table td:nth-child(3),
.races-table th:nth-child(4),
.races-table td:nth-child(4),
.races-table th:nth-child(5),
.races-table td:nth-child(5) {
  min-width: initial;
  width: initial;
  max-width: initial;
}

.races-table td a {
  font-size: 13px;
}

.paginated-table td:last-child span {
  width: 75px;
}

.politician-cell span, .race-cell span {
  max-width: 25ch;
}

.data-disclaimer {
  justify-content: flex-start;
  padding: 2rem 1rem 0;

   p {
    max-width: 88ch;
   }
}

@media screen and (min-width: 1280px) {
  .midterm-visuals-outer {
    flex-direction: row-reverse;
  }
  
  .projection-charts {
    flex-direction: column;
    min-width: 350px;
    width: 29%;
    max-width: 29%;

    > div#projectionChartsHouse, > div#projectionChartsSenate {
      flex: initial;
      padding: 1.5rem 1.5rem 1rem;
    }

    .chart-legend {
      max-width: 115px;
    }
  }

  .projection-maps {
    padding: 1.5rem;
  }
}