@import url("fonts.css");
@import url("sidebar.css");
@import url("footer.css");
@import url("text-image-layout.css");
@import url("figcaption-fix.css");
@import url("charts-row.css");
@import url("d3-container.css");
@import url("carousel.css");

html,
body {
  font-family: "lora", Georgia, "Times New Roman", Times, serif;
  font-size: 21px;
  margin: 0 auto;
  display: block;
  background-color: #f2f2f2;
  height: 100%;
  /* display: flex;
  flex-direction: column; */
  min-height: 100vh;
}

p {
  max-width: 600px;
  margin: 1rem auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  line-height: 1.6;
  color: #000000;
}

.immigration-part {
  margin-top: 5rem;
  text-align: left;
}

#progress-container {
  position: fixed;
  top: 0;
  left: 0;
  height: 5px;
  width: 100%;
  background: rgba(255, 255, 255, 0.3);
  z-index: 9999;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: #333;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.hero {
  position: relative;
  top: 0;
  height: 93vh;
  width: 100vw;
  z-index: 1;
  display: flex;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#bg {
  position: absolute;
  top: 0;
  left: 0;
  height: 93vh;
  width: 100vw;
  object-fit: cover;
  z-index: 1;
}

/* .hero-content {
  position: relative;
  z-index: 2;
  color: white;
  text-align: center;
} */

#char {
  opacity: 0;
  transition: opacity 0.5s ease;
  position: absolute;
  width: auto;
  height: 30%;
  left: 15%;
  top: 60%;
  z-index: 4;
}

.step {
  height: 100vh;
  border-bottom: 1px solid #1f1f1f00;
}

h1 {
  font-size: 2.5rem;
  font-family: Postoni Standard, Postoni, BodoniSvtyTwoITCTT-Book, georgia, serif;
  font-weight: bold;
  line-height: 1.1;
  color: rgb(0, 0, 0);
  text-align: center;
  letter-spacing: 0.02em;
  max-width: 800px;
  margin: 0.5rem auto 1rem;
}

.deck {
  font-size: 22px;
  font-family: "Libre Franklin", Arial, Helvetica, sans-serif;
  font-weight: normal;
  line-height: 1.4;
  margin-bottom: 2rem;
  color: rgb(68, 67, 67);
  text-align: center;
  max-width: 800px;
  margin: 2rem auto 0;
  max-width: 600px;
}

.author {
  font-size: 20px;
  font-family: "Libre Franklin", Arial, Helvetica, sans-serif;
  font-weight: normal;
  line-height: 1.3;
  color: rgb(68, 67, 67);
  margin-top: 1.5rem;
  margin-bottom: 3rem;
  text-align: center;
  opacity: 0.9;
}

.visible {
  opacity: 1;
}

.dropcap {
  float: left;
  font-size: 75px;
  font-weight: 800;
  line-height: 60px;
  font-family: Merriweather;
  padding-top: 5px;
  padding-right: 7px;
  padding-left: 3px;
  color: rgb(34, 28, 28);
}

.immigration {
  padding: 0 0 2vh;
}

h2 {
  font-size: 1.5em;
  margin-block-start: 0.83em;
  margin-block-end: 0.83em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 2rem;
}

section {
  padding: 0 0 5vh;
}

.us-part {
  margin-top: 5rem;
}

.deportation-part {
  margin-top: 7rem;
}

.hidden {
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

figure.news-app-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
}

figure.news-app-figure img {
  width: 150%;
}

.overlay-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgb(255, 255, 255);
  width: 90vw;
  max-width: 800px;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.headline {
  padding-top: 0;
}

/* Hero-specific styles for headline, deck, and author */
.overlay-text .headline {
  color: rgb(255, 255, 255);
  margin-bottom: 1.5rem;
  transition: opacity 1s ease-in-out;
}

.overlay-text .deck {
  color: rgb(255, 255, 255);
  margin-top: 0;
  margin-bottom: 2rem;
  text-align: center;
  transition: opacity 1s ease-in-out;
}

.overlay-text .author {
  color: rgb(255, 255, 255);
  margin-top: 1.5rem;
  transition: opacity 1s ease-in-out;
}

.process-chart {
  text-align: center;
  margin: 0 auto;
  width: 100%;
  max-width: 1000px;
}

.process-chart img {
  margin-top: 1.5rem;
  margin-bottom: 2rem;
  padding-left: 3rem;
  width: 100%;
  max-width: 1000px;
}

.image-content {
  float: left;
  max-width: 700px;
  margin-left: 40px;
  margin-right: 20px;
}

.image-content img {
  width: 100%;
  max-width: 600px;
}

@media (max-width: 1000px) {
  .overlay-text .headline {
    font-size: 3rem;
  }

  .overlay-text .deck {
    font-size: 1rem;
  }

  .overlay-text .author {
    font-size: 0.9rem;
  }

  .overlay-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 600px;
    text-align: center;
    z-index: 4;
  }
}

.hero-text {
  margin-bottom: 0rem;
}

.future-part {
  margin-top: 3rem;
}

.subhead-icon {
  text-align: center;
  margin: 0 auto;
  width: 100%;
  max-width: 200px;
  display: flex;
  justify-content: center;
}

.subhead-icon img {
  width: 100%;
  display: block;
  margin: 0 auto;
}

.fast-fade {
  transition: opacity 0.5s ease-out !important;
}

.chart-headline {
  font-size: 1rem;
  font-family: Arial, Helvetica, sans-serif;
  margin-bottom: 1rem;
  text-align: left;
  font-weight: bold;
  color: #000000;
  max-width: 600px;
  margin: 2rem auto 0;
}

/* Adjust figcaption size on tablets */
@media (max-width: 768px) {
  .image-caption,
  figcaption {
    font-size: 13px;
    padding: 6px 8px 0;
    text-align: left;
  }
  .hero-text {
    margin-bottom: 5rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  /* Adjust figcaption size on mobile */
  .image-caption,
  figcaption {
    font-size: 12px;
    padding: 5px 5px 0;
    line-height: 1.3;
  }
}

.full-width-image {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  margin-bottom: 3rem;
  margin-top: 2rem;
  position: relative;
  text-align: center; /* Center the image */
}

.full-width-image img {
  width: 100%;
  height: auto; /* Maintain aspect ratio */
  max-height: none; /* Remove max-height constraint */
  object-fit: cover; /* Fill the container while maintaining aspect ratio */
  display: block;
}

.hidden {
  display: none !important;
  visibility: hidden !important;
}

/* Responsive styles for full-width-image on tablets */
@media (max-width: 768px) {
  .full-width-image figcaption {
    padding-left: 2rem;
    padding-right: 2rem;
    font-style: italic;
  }

  /* Responsive styles for news app image on tablets */
  figure.news-app-figure {
    max-width: 1000px;
  }

  /* Responsive styles for card on tablets */
  figure.card {
    max-width: 600px;
    gap: 12px;
  }

  figure.card img {
    width: calc(50% - 6px); /* Two images side by side with smaller gap */
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  /* Responsive styles for full-width-image on mobile */
  .full-width-image {
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
  }

  .full-width-image figcaption {
    padding-left: 1rem;
    padding-right: 1rem;
    font-size: 13px;
  }

  /* Responsive styles for news app image on mobile */
  figure.news-app-figure {
    max-width: 90%; /* Use percentage for better responsiveness */
    margin: 1.5rem auto;
  }

  figure.news-app-figure figcaption {
    font-size: 13px;
    padding: 6px 5px 0;
    text-align: center;
  }

  /* Responsive styles for card on mobile */
  figure.card {
    max-width: 100%;
    margin: 1.5rem auto;
    gap: 10px;
  }

  figure.card img {
    width: 100%; /* Full width on mobile */
    margin-bottom: 10px;
  }

  figure.card figcaption {
    font-size: 13px;
    padding: 6px 5px 0;
    text-align: left;
  }
}

/* Style for the image caption */
.image-caption,
figcaption {
  font-size: 14px;
  color: #666;
  text-align: left;
  padding: 8px 10px 0;
  line-height: 1.4;
  font-style: italic;
  display: block;
  width: 100%;
}

/* Special styling for news app image */
figure.news-app-figure {
  max-width: 600px; /* Match text width */
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

figure.news-app-figure img {
  width: 100%; /* Full width of container */
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

figure.news-app-figure figcaption {
  text-align: left;
  margin-top: 10px;
  width: 100%;
}

/* Card with multiple images in a row */
figure.card {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 15px;
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
}

figure.card img {
  width: calc(50% - 10px); /* Two images side by side with gap */
  height: auto;
  object-fit: contain;
  display: block;
}

figure.card figcaption {
  width: 100%;
  margin-top: 10px;
  text-align: left;
}

/* Special styling for full-width-image figcaptions */
.full-width-image figcaption {
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  padding-left: 3rem;
  padding-right: 3rem;
  font-style: italic;
}

/* Italic figcaption style */
figcaption.italic {
  font-style: italic !important;
}

/* Image row for displaying two images side by side */
.image-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 15px;
  width: 100%;
  max-width: 1400px; /* Increased max-width for larger container */
  margin: 3rem auto; /* Center the container */
  text-align: center;
}

.image-row img {
  width: calc(45% - 10px); /* Reduced width from 50% to 45% */
  max-width: 650px; /* Reduced max-width from 800px to 650px */
  height: auto;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle; /* Align images vertically */
}

/* Single caption for the image row */
.image-row figcaption {
  margin: 0;
  text-align: left;
  width: 100%;
  max-width: 1400px;
  font-style: normal;
  color: #666;
  font-size: 14px;
  padding-left: 0 !important; /* Remove left padding to align with edge */
  flex-basis: 100%; /* Ensures caption takes full width on new line */
  order: 3; /* Places caption after images */
  max-width: 600px;
}

/* Asymmetric image row for displaying two images with different widths */
.asymmetric-image-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 15px;
  width: 100%;
  padding-top: 2rem;
  max-width: 90%; /* Full width container */
  margin: 0 auto 1rem auto; /* Reduced margin */
  text-align: center;
}

.asymmetric-image-row img.left-image {
  width: calc(35% - 7.5px); /* Equal to right image minus half the gap */
  max-width: none; /* Remove max-width constraint */
  height: auto;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

.asymmetric-image-row img.right-image {
  width: calc(65% - 7.5px); /* Equal to left image minus half the gap */
  max-width: none; /* Remove max-width constraint */
  height: auto;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

.asymmetric-image-row figcaption {
  margin: 0.5rem 0 0 0;
  text-align: left;
  width: 100%;
  max-width: 100%;
  font-style: normal;
  color: #666;
  font-size: 15px;
  padding-left: 0 !important;
  flex-basis: 100%;
  order: 3;
}

/* Responsive design for image row */
@media (max-width: 768px) {
  .image-row,
  .asymmetric-image-row {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .image-row img,
  .asymmetric-image-row img.left-image,
  .asymmetric-image-row img.right-image {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
  }

  .image-row figcaption,
  .asymmetric-image-row figcaption {
    margin-top: 10px;
    font-size: 14px;
    text-align: left;
  }
}

@media (max-width: 1080px) {
  .hero {
    position: relative;
    height: auto;
    min-height: auto;
    width: 100%;
    display: block;
  }

  #bg {
    position: relative;
    object-fit: contain;
    width: 100%;
    height: auto;
    max-height: 100vh;
    transform: none;
    background-color: #000;
  }

  .hero-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
  }

  /* Ensure scrolling works on mobile */
  html,
  body {
    overflow-x: hidden;
    overflow-y: auto;
    /* height: auto;
    -webkit-overflow-scrolling: touch; */
  }
}

@media (max-width: 768px) {
  /* Additional mobile-specific adjustments */
  .hero {
    height: auto;
  }

  #bg {
    height: auto;
    max-height: 100vh;
  }

  /* Additional fixes for Mapbox on mobile */
  .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,
  .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas {
    touch-action: pan-y pinch-zoom;
  }

  /* Make content above map accessible for scrolling */
  .main-content {
    position: relative;
    z-index: 2;
  }
}

/* Mobile Back to Top Button */
/* .mobile-back-to-top {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 20px;
  text-align: center;
  z-index: 1000;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
} */

@media (max-width: 768px) {
  /* Show Back to Top button on mobile
  .mobile-back-to-top {
    display: block;
  } */

  /* Ensure body can scroll on mobile */
  body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Fix map container for mobile scrolling */
  #map {
    position: sticky !important;
    top: 0;
    height: 100vh;
    width: 100%;
    z-index: 0;
    touch-action: pan-y pinch-zoom !important;
  }

  /* Ensure the mapbox container allows scrolling */
  .mapboxgl-canvas-container {
    touch-action: pan-y pinch-zoom !important;
  }

  /* Ensure story content is above the map */
  #story {
    position: relative;
    z-index: 1;
  }

  /* Ensure scroll container has proper positioning */
  #scroll-container {
    position: relative;
    z-index: 1;
  }
}

@media (max-width: 768px) {
  p,
  .deck {
    margin: auto 1rem;
  }
}
