/* ============================================================
   Breaking Down Brown's Budget — scroll stepper
   Body font: Roboto. Headlines: Georgia.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: Roboto, Arial, sans-serif;
  color: #121212;
  background: #ffffff;
  padding-bottom: 96px;
}

a { color: #2f6fa3; }
a:hover { color: #1f3b57; }

/* ---------- intro screen (hero + lede, centered on first glance) ---------- */

.intro-screen {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 0;
  box-sizing: border-box;
  background-image: linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .68)), url("./assets/DSCF1882.jpeg");
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

/* ---------- header ---------- */

.hero {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 16px;
}

.hero > * {
  max-width: calc((100% - 96px) / 2);
}

.hero .masthead {
  height: 52px;
  width: auto;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(28px, 4.5vw, 44px);
  line-height: 1.1;
  text-wrap: balance;
}

.hero .dek {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: #e6e6e6;
  text-wrap: pretty;
}

.byline {
  font-size: 13px;
  color: #d6d6d6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.byline-role {
  font-weight: 600;
  color: #ffffff;
}

.byline-name {
  color: #d6d6d6;
}

.byline-date {
  color: #d6d6d6;
}

/* ---------- lede ---------- */

.lede {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 18px;
  font-size: 19px;
  line-height: 1.6;
  color: #f2f2f2;
}

.lede > p {
  max-width: calc((100% - 96px) / 2);
}

/* ---------- story layout ---------- */

.story {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 96px;
}

.steps {
  display: flex;
  flex-direction: column;
  align-self: start;
  padding: 48px 0;
}

.step-body {
  max-width: 680px;
  margin: 0 0 22px;
  font-size: 19px;
  line-height: 1.65;
  color: #1a1a1a;
  text-wrap: pretty;
}

.step-body:last-child {
  margin-bottom: 0;
}

.panel {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  box-sizing: border-box;
  background: #ffffff;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d0d0d0;
}

.dots span.active {
  background: #121212;
}

.chart-stage {
  position: relative;
  width: 100%;
  display: grid;
  align-items: center;
}

/* all panels share one grid cell and cross-fade, so nothing jumps */
.panel-chart {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .4s ease, visibility 0s linear .4s;
}

.panel-chart.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .4s ease, visibility 0s;
}

.panel-chart.has-embed iframe,
.panel-chart.has-embed .flourish-embed {
  width: 100%;
}

.flourish-wrap {
  max-width: 335px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- bubble chart ---------- */

.chart {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 560;
  background: #fafaf8;
  border: 1px solid #ececec;
}

.ticks {
  position: absolute;
  inset: 0;
  display: none;
}

.ticks.show { display: block; }

.tick-line {
  position: absolute;
  top: 4%;
  bottom: 7%;
  border-left: 1px dashed #c9c9c9;
}

.tick-line.solid { border-left-style: solid; }

.tick-label {
  position: absolute;
  bottom: 1.5%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #5a5a5a;
}

.cuts-label, .increases-label {
  position: absolute;
  top: 2%;
  font-size: 12px;
  font-weight: 600;
}

.cuts-label { left: 2%; color: #b8541f; }
.increases-label { right: 2%; color: #2f6fa3; }

.group-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.group-label {
  position: absolute;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.group-label .name { font-size: 12px; font-weight: 700; }
.group-label .sub { font-size: 11px; color: #5a5a5a; }

.bubbles {
  position: absolute;
  inset: 0;
}

.bub {
  position: absolute;
  border-radius: 50%;
  aspect-ratio: 1;
  box-sizing: border-box;
  transition: left .9s cubic-bezier(.45, 0, .2, 1), top .9s cubic-bezier(.45, 0, .2, 1), width .9s cubic-bezier(.45, 0, .2, 1);
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #5a5a5a;
  align-items: center;
}

.legend-label { font-weight: 600; color: #121212; }

.legend-item {
  display: flex;
  gap: 6px;
  align-items: center;
}

.legend .swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
}

.legend-note strong { color: #b8541f; }

/* ---------- revenue bar ---------- */

.revenue-bar {
  display: flex;
  height: 96px;
  width: 100%;
  font-size: 13px;
  font-weight: 600;
}

.revenue-seg {
  color: #121212;
  padding: 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.revenue-seg span:last-child {
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-note {
  font-size: 12px;
  color: #5a5a5a;
}

/* ---------- embed placeholder ---------- */

.chart-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #f3f3f1;
  border: 1px dashed #b5b5b5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #5a5a5a;
  text-align: center;
  padding: 24px;
}

.embed-placeholder {
  aspect-ratio: 16 / 10;
  background: #f3f3f1;
  border: 1px dashed #b5b5b5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #5a5a5a;
  text-align: center;
  padding: 24px;
}

/* ---------- ivy comparison ---------- */

.ivy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  padding-top: 24px;
}

.ivy-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.ivy-row .ivy-name {
  text-align: right;
  font-weight: 400;
}

.ivy-row.is-brown .ivy-name,
.ivy-row.is-brown .ivy-val {
  font-weight: 700;
}

.ivy-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ivy-bar {
  height: 26px;
  background: #c9c9c9;
}

.ivy-row.is-brown .ivy-bar {
  background: #b8541f;
}

.ivy-val {
  white-space: nowrap;
  font-weight: 400;
}

/* ---------- footer ---------- */

footer {
  max-width: 1200px;
  margin: 96px auto 0;
  padding: 0 24px;
}

.footer-inner {
  max-width: calc((100% - 96px) / 2);
  padding-top: 20px;
  border-top: 1px solid #e2e2e2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #5a5a5a;
}

footer strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  color: #121212;
}

/* ---------- mobile ---------- */

@media (max-width: 820px) {
  .story {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .panel {
    order: -1;
    position: sticky;
    top: 0;
    height: auto;
    justify-content: flex-start;
    z-index: 5;
    box-shadow: 0 6px 12px -8px rgba(0, 0, 0, .18);
  }
}
