/* BASE */
body {
  font-family: "Georgia";
  margin: 0;
  background-color: #f3f0e8;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.article-header {
  max-width: 45rem;
  margin: 3rem auto 2rem;
  padding: 0 1.5rem;
  text-align: left;
  background-color: #f3f0e8;
}

.headline {

  font-size: 2.5rem;
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

.subhead {
  font-size: 1.25rem;
  line-height: 1.4;
  color: #000;
  font-weight: 400;
  margin: 0 0 1rem;
}

.byline {
  font-family: 'Roboto', sans-serif;
  font-size: 0.85rem;
  color: #f15a29;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

footer {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 200;
}

html,
body {
  margin: 0;
  width: 100%;
  background-color: #f3f0e8;
}

/* SCROLL CONTAINER  */
#scroll {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.scroll__graphic {
  grid-row: 1;
  grid-column: 2;
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  z-index: 0;
}

.scroll__graphic .chart {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.scroll__graphic .chart.is-active {
  opacity: 1;
  pointer-events: auto;
}

.scroll__text {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  z-index: 1;
  padding: 5rem 1rem;
  max-width: 30rem;
}

.step {
  opacity: 0;
  /* height: fit-content; */
  display: flex;
  align-items: center;
  padding: 1rem;
  transition: opacity 0.5s;
}

.step.is-active {
  opacity: 1;
}

.step p {
  font-family: "Georgia";
  font-size: 1rem;
}



.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}


/* UNIQUE IDS */
#houses-chart {
  transform: translateY(25vh);
  font-family: 'Roboto';
}

#zillow-line-chart {
  transform: translateY(25vh);
  font-family: 'Roboto';
}

#houses-chart,
#zillow-line-chart {
  width: 100%;
  height: auto;
  max-width: 600px;
  /* caps how large it gets on wide screens too */
}

/* MAP */
#map {
  width: 100dvw;
  /* dynamic, will follow as i scroll */
  height: 100dvh;
}

/* TEXT-ONLY MODE: text centered, no viz */
#scroll.mode-text-only {
  grid-template-columns: 1fr;
  background: none;
  border-radius: 12px;
  padding: 1.5rem;
}

#scroll.mode-text-only .scroll__graphic {
  opacity: 0;
  pointer-events: none;
}

#scroll.mode-text-only .scroll__text {
  grid-column: 1;
  max-width: 40rem;
  margin: 0 auto;
  text-align: left;
  border-radius: 12px;
  padding: 1.5rem;
}

#scroll.mode-text-only .step,
#scroll.mode-text-only .step-content {
  background: none;
  color: inherit;
  /* undo any white text color inherited from overlay mode */
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: 1rem 0;
  min-height: auto;
}

#scroll.mode-text-only .step p {
  font-family: Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  color: #1a1a1a;
}

/* OVERLAY MODE: text centered, card over the map  */
#scroll.mode-overlay {
  grid-template-columns: 1fr;
}

#scroll.mode-overlay .scroll__graphic {
  grid-column: 1;
}

#scroll.mode-overlay .scroll__text {
  grid-column: 1;
}

#scroll.mode-overlay .step {
  color: #fff;
  height: fit-content;
  border-radius: 12px;
  margin: 0 auto;
  padding: 1rem;

}

.step-content {
  background-color: rgba(123, 123, 123, 0.9);
  border: 2px solid #f7941d;
  border-radius: 12px;
  padding: 1rem;
  line-height: 1.6;
}

.tooltip {
  position: fixed;
  background: white;
  color: black;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  pointer-events: none;
  font-family: Roboto, sans-serif;
  font-size: 12px;
  z-index: 9999;
}

@media (max-width: 768px) {
  #scroll {
    display: block;
    /* abandon the desktop grid entirely on mobile */
  }

  #houses-chart,
  #zillow-line-chart {
    display: block;
    margin: 0 auto;
    /* centers the chart horizontally within its container */
  }

  .scroll__graphic {
    position: sticky;
    top: 0;
    height: 40vh;
    /* smaller than desktop's full-screen pin */
    width: 100%;
    z-index: 0;
  }

  .scroll__text {
    position: relative;
    z-index: 1;
    max-width: 100%;
    padding: 0 1rem;
  }

  .step {
    min-height: 60vh;
    /* shorter than desktop's 100vh */
    padding: 1.5rem 0;
  }

  .step p {
    font-size: 16px;
  }

  #scroll.mode-tall-graphic .scroll__graphic {
    height: 55vh;
  }

  .photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* was: cover */
    display: block;
  }

  #scroll.mode-photo .scroll__graphic {
    height: auto;
    aspect-ratio: 3 / 2;
    /* match actual photo's proportions */
  }

  #scroll.mode-text-only .scroll__text {
    max-width: 100%;
    padding: 1.5rem 1rem;
    border-radius: 12px;
  }

  #scroll.mode-text-only .step p {
    font-size: 16px;
    line-height: 1.6;
  }
}