:root {
  --thumb-size: 20px;
  --thumb-offset: -7px;
  --bg-color: rgb(20, 20, 20) /*rgb(238, 238, 238)*/;
  --text-color: rgb(245, 101, 87);
  --slider-color: var(--text-color);
}
body {
  font-family: sans-serif;
  --body-margin: max(1em, (100% - 165ch) / 2);
  margin-inline: var(--body-margin);
  overflow-x: hidden;
  background-color: var(--bg-color);
  transition: background-color 200ms linear;
  color: white;
  font-family: "Times New Roman", serif;
}
#tooltip {
  position: fixed;
  background: black;
  border-radius: 0.5em;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
  padding: 1em;
  display: none;
  pointer-events: none;
  font-size: 12px;
  text-align: center;
}
dl {
  display: grid;
  grid-template-columns: repeat(auto, 1fr);
  column-gap: 1em;
  dt {
    grid-row: 1;
  }
  dd {
    grid-row: 2;
    font-size: 2em;
    margin: 0;
  }
}
select {
  /* Basic styling for the select box */
  background-color: #ccc;
  border: 1px solid black;
  padding: 0.5em;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 16px;
  color: #333;
  width: 100%;
  transition: 200ms;

  /* Hiding the default arrow (browser-specific) */
  -webkit-appearance: none; /* For Chrome, Safari */
  -moz-appearance: none; /* For Firefox */
  appearance: none; /* Standard property */
}

select:hover {
  outline: none; /* Remove default focus outline */
  background-color: var(--text-color);
}
input[type="range"] {
  -webkit-appearance: none; /* For Chrome, Safari, Opera */
  -moz-appearance: none; /* For Firefox */
  appearance: none; /* Standard property */
  width: 100%; /* Adjust as needed */
  background: transparent; /* Remove default background */
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: var(--thumb-size); /* Set desired height */
  width: var(--thumb-size); /* Set desired width */
  border-radius: 50%; /* Make it a circle */
  background: var(--slider-color); /* Set desired color */
  cursor: pointer;
  margin-top: var(
    --thumb-offset
  ); /* Adjust to center vertically on the track */
  border: 1px solid black;
  transition: 200ms;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px; /* Set desired height */
  background: #ddd; /* Set desired background color */
  border-radius: 4px; /* Round the corners */
  box-shadow: 0 0 2px black;
}

input[type="range"]:hover {
  --slider-color: red;
  --thumb-size: 30px;
  --thumb-offset: -10.5px;
}

.states {
  transition: 200ms;
  transform-origin: center;
  transform-box: fill-box;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
}

/*.selected {
  transform: translate(var(--x), var(--y)) scale(1.5);
}*/

#chart {
  overflow: visible;
}

/* State name message under subplot */
/*#state-name {
  position: absolute;
  left: 50vw; 
  top: 88vh; 
  width: 35vw;
  text-align: center;
  font-size: 14px;
  color: #333;
}*/

/* === Year line and label === */
/*.year-line {
  stroke: #ff6666;
  stroke-dasharray: 5 5;
  stroke-width: 2px;
  opacity: 0.8;
  pointer-events: none;
}*/

/* === Legend === */
#legend {
  visibility: hidden;
  transition: 400ms linear;
}

#legend text {
  font-family: sans-serif;
  user-select: none;
}

#legend rect {
  transition: 200ms ease;
}

/* Tooltip fade-in animation */
#tooltip {
  transition: opacity 0.15s ease-in-out;
}

#main-container {
  padding-top: 25vh;
  position: relative;
  display: flex;
  gap: 2rem;
  /* height: 100vh; */
}

#mainText {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 50vh;
}

#last-text {
  margin-bottom: 30vh;
}

#plot-container {
  position: sticky;
  flex: 2;
  top: 45%;
  left: 0;
  transform: translateY(-50%);
  bottom: auto;
  height: 50vh;
}

.textContainer {
  position: relative;
  padding: 1em;
  border-radius: 2em;
  background-color: black;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.4);

  h2{
    color: var(--text-color);
  }
}

#filterSection {
  position: relative;
}

#showFilter {
  transition: 200ms;
  text-align: center;
}

#showFilter:hover {
  background-color: var(--text-color);
}

small {
  font-size: 0.5em;
  opacity: 0.5;
}

a:link,
a:visited {
  text-decoration: none;
  color: var(--text-color);
}

a:hover {
  color: red;
}

.instructions {
  display: block;
  font-size: 0.85em;
}

.instructionStar {
  font-size: 1.25em;
}

.faded {
  opacity: 0.3;
  fill-opacity: 0.3 !important;
}

.zoomed {
  fill-opacity: 1 !important;
}

.line-graph {
  font-family: "Arial", sans-serif;
}

.line-graph rect {
  transition: fill 0.3s;
}

.line-graph:not([data-brushing="true"]):hover rect {
  fill: rgba(75, 75, 75, 0.95);
}

/*.dot {
  transition: all 0.3s;
  cursor: pointer;
}

.dot:hover {
  r: 6;
  fill: #ff6b6b;
  stroke: #ff6b6b;
} */

.line-graph circle {
  transition: 0.3s;
}

.close-btn:hover circle {
  transform: scale(1.2);
}

.x-axis,
.y-axis {
  font-size: 11px;
  color: #666;
}

.x-axis path,
.y-axis path,
.x-axis line,
.y-axis line {
  stroke: #ccc;
  shape-rendering: crispEdges;
}

.gridLayout {
  dl {
    display: grid;
    grid-template-columns: repeat(auto, 1fr);
    gap: 5px;
  }
  dt {
    font-weight: bold;
    grid-row: 1;
  }
  dd {
    grid-row: 2;
    font-size: 2em;
    margin: 0;
  }
}

#stats {
  display: none;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
  transition: 200ms linear;
}

#stats:hover {
  transform: scale(1.05);
}

#graphButtons {
  display: none;
  width: 100%;
  text-align: center;
}

button {
  border-radius: 0.25em;
  font-size: 1em;
  width: 50%;
  background-color: black;
  color: white;
  border: white solid 1px;
}

button:hover {
  background-color: var(--text-color);
}

@keyframes marching-ants {
  to {
    stroke-dashoffset: -8; /* 5 + 3 */
  }
}

.selection {
  fill-opacity: 0.1;
  stroke: white;
  stroke-opacity: 0.7;
  stroke-dasharray: 5 3;
  fill: white;
  animation: marching-ants 2s linear infinite;
}

/* Target only the overlay, not the selection */
.line-graph .brush rect:not(.selection) {
  fill: transparent !important;
  pointer-events: all;
}

.grid line {
  stroke: #e0e0e0;
  stroke-opacity: 0.7;
  stroke-width: 0.5;
  shape-rendering: crispEdges;
}

.grid path {
  stroke-width: 0; /* Remove the axis line */
}

/* Optional: Different styles for horizontal vs vertical */
.grid-horizontal line {
  stroke: #a5a5a578;
}

#introContainer {
  text-align: center;
  display: flex;
  align-items: center; /* Vertical center */
  justify-content: center; /* Horizontal center */
  box-sizing: border-box;
  min-height: 100vh; /* Full viewport height */
  margin: 0;
  transition: opacity 600ms ease, transform 600ms ease;
}

#intro {
  flex: 1;
  background-image: url("https://cdn.dribbble.com/userupload/23298462/file/original-2b6de588ba070314868062ea7c6142c9.gif");
  background-size: contain; /* or 'contain' depending on your needs */
  background-position: center center;
  background-repeat: no-repeat;

  height: 75vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  h1 {
    text-shadow: 0 0 50px rgb(255, 255, 255, 0.8);
    font-size: 3em;
  }
  h2 {
    text-shadow: 0 0 10px rgba(245, 101, 87, 0.75);
  }
}

#introContainer2{
  position: relative;
  display: flex;
  gap: 2rem;
  margin-bottom: 50vh;
}

#introText{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10em;
}

#introStats{
  position: sticky;
  top: 40%;
  left: 0;
  bottom: auto;
  flex: 1;
  height: 50vh;
  transform: translateY(-50%);
}

.specialText{
  color: var(--text-color);
}


/* Scroll indicator animation remains */
#scrollIndicator {
  position: absolute;
  bottom: 7.5%;
  margin-top: 3.5rem;
  font-size: 1.15rem;
  color: #afb8c2;
  animation: bounce 1.3s infinite alternate;
}

/* Fade + shrink effect still active */
#introContainer.fadeOut {
  opacity: 0;
  transform: translateY(-20px);
}
#mainTitle.shrink {
  font-size: 2.2rem;
}

#mainTitle{
  transition: font-size 600ms ease;
}

@keyframes bounce {
  from {
    transform: translateY(0);
    opacity: 0.4;
  }
  to {
    transform: translateY(8px);
    opacity: 1;
  }
}

.texts{
  font-size: 1.25em;
}

.sideNote{
  color: rgb(185, 185, 185);
}

.threshold-label{
  opacity: 0;
}