/* Base */
body {
  margin: 0;
  overflow-x: hidden;
}

#main,
main .row,
.col-12,
.col-lg-7 {
  margin: 0;
  padding: 0;
}

/* Theme utilities */
.dark-pink-background {
  background-color: #82045e;
  color: white;
}

.pink-background {
  background-color: #af0e80;
  color: white;
}

.orange-background {
  background-color: #9b430d;
  color: white;
}

.orange-text {
  color: #9b430d;
}

.grey-background {
  background-color: #e9e9e9;
}

/* Progress */
.progress-container {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  height: 8px;
  background: #ccc;
}

.progress-bar {
  height: 8px;
  background: #af0e80;
  width: 0%;
}

/* Panels */
.scrolly-section {
  margin: 0;
}

.panel {
  min-height: 100vh;
}

.small-panel {
  margin-bottom: 0;
  padding: 6rem 0rem;
  text-align: center;
}

.small-panel h2 {
  margin: auto;
  margin-bottom: 2rem;
  font-size: 25.12px;
  max-width: 550px;
}

.small-panel p {
  margin: auto;
  max-width: 400px;
}

.picture-panel {
  min-height: 175vh;
}

.space-between-section {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sticky-background-panel {
  position: relative;
  background: black;
}

/* Scrolly layout */
.scrolly {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.scrolly-step {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.scrolly-step p {
  max-width: 464px;
  margin: auto;
  border: 1px solid #adadad;
  padding: 1rem;
  box-shadow: 1px 2px 4px #adadad;
  background-color: white;
}

.scrolly-text {
  margin: 40vh 0;
}

.scrolly-right .scrolly-text {
  margin-right: -10vw;
  z-index: 2;
}

.scrolly-left .scrolly-text {
  margin-left: -10vw;
  z-index: 2;
}

.graphic {
  position: sticky;
  top: 15vh;
  height: 70vh;
  width: 50vw;
  margin-top: 15vh;
}

.graphic-section {
  padding-bottom: 20vh;
}

.scrolly-right .graphic {
  margin-left: -15vw;
}

.scrolly-left .graphic {
  margin-right: -15vw;
}

/* Intro video */
.video-container {
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  position: sticky;
}

#intro-video {
  height: 100%;
  width: 100%;
  min-height: 100%;
  min-width: 100%;
  object-fit: cover;
}

.intro-video-overlay {
  text-align: center;
  position: absolute;
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  z-index: 2;
  top: 0;
  pointer-events: none;
}

.video-overlay-title {
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
}

.intro-video-overlay h1 {
  font-size: 40px;
  color: white;
  padding: 0.6rem 1rem;
  background-color: #d9328a;
  width: fit-content;
  margin: auto;
}

.intro-video-overlay h2 {
  margin: 0;
  font-size: 25.12px;
  padding: 0.6rem 1.2rem;
  color: white;
  background-color: #82045e;
}

.video-overlay-text > div {
  margin: 1rem 0;
}

/* Video controls */
.video-toggle-button {
  position: absolute;
  z-index: 4;
  right: 1rem;
  bottom: 1rem;
  border: 0;
  border-radius: 50%;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.65);
  font-family: var(--font-family-titles), sans-serif;
  font-size: 1.25rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.video-toggle-button:hover,
.video-toggle-button:focus {
  background: rgba(0, 0, 0, 0.82);
}

.video-toggle-button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.old-video-toggle {
  right: 32.5%;
  bottom: 25%;
}

/* Picture panels */
.picture-overlay {
  position: absolute;
  display: flex;
  margin: auto;
  height: 60%;
  width: 100%;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  z-index: 2;
  top: 0;
}

.end-panel .picture-overlay {
  top: auto;
  bottom: 12vh;
}

.car-growth-reason-panel .picture-overlay {
  top: 10vh;
}

.picture-text-wrapper {
  max-width: 700px;
  margin: 3rem 0;
  background: white;
  border: 1px solid #adadad;
  padding: 2rem 3rem;
  box-shadow: 1px 2px 4px #adadad;
}

.picture-text-wrapper h2 {
  margin-bottom: 2rem;
  font-size: var(--font-size-extra-large);
  color: #82045e;
}

.image-wrapper {
  width: 100%;
  height: 100vh;
  position: sticky;
  overflow: hidden;
  top: 0;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 100%;
  min-width: 100%;
}

/* Car grid */
.car-scrolly .graphic {
  margin-left: auto;
  max-height: 60vh;
  top: 20vh;
  margin-top: 20vh;
}

.car-scrolly h2 {
  text-align: center;
  margin-top: 5rem;
  font-size: 25.12px;
  color: #82045e;
}

#car-grid {
  aspect-ratio: 1.1 / 1;
  width: min(100%, 66vh);
  margin: auto;
  max-height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols, 16), 1fr);
  align-content: center;
  justify-content: center;
  column-gap: 1%;
  row-gap: 3%;
}

.car {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  opacity: 0;
  align-self: center;
  transform: translateX(-70vw);
  transition: all 1s ease;
}

.car.visible {
  opacity: 1;
  transform: translateX(0);
}

#car-legend {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3rem;
  transition: opacity 0.6s ease;
  font-size: 0.85em;
  color: #82045e;
  font-family: var(--font-family-titles), sans-serif;
  white-space: nowrap;
  pointer-events: none;
}

#car-legend img {
  height: 2vh;
}

#car-counter {
  position: absolute;
  top: -110px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 3;
  font-family: var(--font-family-titles), sans-serif;
  color: #82045e;
}

#car-counter .year {
  font-size: 40px;
  font-weight: bold;
  margin-bottom: 6px;
}

#car-counter .amount {
  font-size: 18px;
  opacity: 0.8;
}

/* Charts */
.chart-graphic {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding-inline: 1rem;
}

.chart-graphic svg {
  flex: 1;
  min-height: 0;
  width: 100%;
}

#chart,
#chart2 {
  width: 100%;
  height: 100%;
}

.chart-heading {
  margin: 0 0 0.25rem;
  padding: 0;
  color: #111827;
  font-size: 18px;
  font-family: var(--font-family-titles), sans-serif;
  line-height: 1.25;
}

.x-axis text,
.y-axis text {
  fill: #4b5563;
  font-size: 12px;
}

.y-axis line {
  stroke: #d1d5db;
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.x-axis line {
  display: none;
}

.x-axis path {
  stroke: #9ca3af;
  stroke-opacity: 0.6;
}

.y-axis path {
  display: none;
}

.line {
  transition: opacity 0.2s;
}

.line:hover {
  opacity: 0.8;
}

.chart-highlight {
  pointer-events: none;
}

.highlight-guide {
  stroke: #111827;
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.32;
}

/* Old TV section */
.sticky-wrapper {
  height: 100vh;
  top: 0;
  position: sticky;
  display: flex;
  text-align: center;
  align-items: center;
  min-height: 90vh;
  will-change: opacity;
}

#step-12.sticky-wrapper {
  align-items: flex-start;
}

.text-wrapper {
  padding-top: 22vh;
  top: 0;
  width: min(70rem, calc(100vw - 4rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(18rem, 0.82fr);
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: center;
  text-align: left;
}

.text-wrapper h2 {
  margin-bottom: 2rem;
  font-size: 25.12px;
  max-width: 550px;
}

.text-wrapper p {
  max-width: 400px;
  margin: 2rem 0;
}

.household-text {
  justify-self: end;
  max-width: 34rem;
}

.household-stat {
  justify-self: start;
  width: min(100%, 24rem);
  padding-left: clamp(1.25rem, 2.4vw, 2.25rem);
  border-left: 2px solid rgba(155, 67, 13, 0.28);
  opacity: 0;
  transform: translateY(24px);
  will-change: opacity, transform;
}

.household-stat p {
  margin: 0;
}

.household-stat .stat-label {
  color: #9b430d;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.stat-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(0.8rem, 2vw, 1.4rem);
  align-items: center;
  margin-top: 0.9rem;
}

.stat-item {
  display: grid;
  gap: 0.3rem;
}

.stat-year {
  color: #1f2f37;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.stat-number {
  color: #9b430d;
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: bold;
  font-family: var(--font-family-titles), sans-serif;
  line-height: 1;
}

.stat-caption {
  max-width: 8rem;
}

.stat-arrow {
  color: #9b430d;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1;
}

.tv-text-wrapper {
  margin-top: -15vh;
  margin-bottom: 4rem;
  position: relative;
  height: 200vh;
  transition: opacity 0.8s ease;
}

.tv-sticky-content {
  position: sticky;
  top: 0;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(10rem, 0.55fr) auto minmax(10rem, 0.55fr);
  gap: clamp(1rem, 3vw, 3rem);
  justify-content: center;
  align-items: center;
}

.arrow-text {
  display: contents;
}

.tv-caption-group {
  display: contents;
}

.tv-caption {
  display: grid;
  gap: 0.35rem;
  width: min(100%, 13rem);
  margin: 0;
  color: #9b430d;
  text-align: center;
  font-family: var(--font-family-titles), sans-serif;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(16px);
  will-change: opacity, transform;
}

.tv-caption-label {
  color: #1f2f37;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.tv-caption-then {
  grid-row: 1;
  grid-column: 1;
  justify-self: end;
}

.tv-caption-now {
  grid-row: 1;
  grid-column: 3;
  justify-self: start;
}

.old-tv-wrapper {
  grid-row: 1;
  grid-column: 2;
  position: relative;
  --old-tv-size: min(52rem, 62vw, calc(100svh - 4rem));
  width: var(--old-tv-size);
  height: var(--old-tv-size);
  opacity: 0;
  transform: rotate(-5deg);
  will-change: opacity, transform;
}

#old-tv-frame {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
}

.old-tv-video {
  position: absolute;
  top: 31.9%;
  left: 10%;
  width: auto;
  height: 46.9%;
  object-fit: cover;
  z-index: 1;
  border-radius: 6px;
}

/* Accessibility */
.scrolly-section:focus,
.scrolly-section *:focus {
  box-shadow: none;
  outline: solid 0.125rem;
  outline-color: var(--cbs-web-text) !important;
  outline-offset: -0.2rem;
}

.scrolly-section .video-toggle-button:focus-visible {
  outline: 3px solid #ffffff !important;
  outline-offset: 3px;
}

/* Responsive */
@media (max-width: 1279px) {
  .graphic {
    width: 70vw;
  }

  .old-tv-wrapper {
    --old-tv-size: min(34rem, 70vw, calc(100svh - 4rem));
  }
}

@media (max-width: 1024px) {
  .scrolly {
    display: flex;
    flex-direction: column;
  }

  .graphic {
    width: min(100%, 100vw);
    margin: 20vh auto 0 auto;
    z-index: 1;
    order: 1;
  }

  .scrolly-text {
    order: 2;
  }

  .scrolly-right .graphic,
  .scrolly-left .graphic,
  .car-scrolly .graphic {
    margin-left: auto;
    margin-right: auto;
  }

  .car-scrolly .scrolly {
    padding-top: 140px;
  }

  .scrolly-right .scrolly-text,
  .scrolly-left .scrolly-text {
    margin-left: 0;
    margin-right: 0;
    position: relative;
    z-index: 2;
  }

  .scrolly-step {
    min-height: 88vh;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
  }

  .scrolly-step p {
    width: min(100%, 464px);
    margin-left: auto;
    margin-right: auto;
  }

  .x-axis text,
  .y-axis text {
    font-size: 10px;
  }

  .text-wrapper {
    width: min(34rem, calc(100vw - 2rem));
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .household-text,
  .household-stat {
    justify-self: center;
  }

  .text-wrapper p {
    margin-left: auto;
    margin-right: auto;
  }

  .household-tv-section {
    min-height: auto;
    justify-content: flex-start;
    gap: 1.5rem;
  }

  .household-tv-section .tv-text-wrapper {
    margin-top: 2rem;
    height: auto;
    padding-top: 0;
  }

  .household-tv-section .tv-text-wrapper::before {
    content: "";
    order: 0;
    width: min(100%, 24rem);
    border-top: 2px solid rgba(155, 67, 13, 0.28);
    margin: 0 auto 1.5rem;
  }

  .household-stat {
    padding: 3rem 0 0;
    border-left: 0;
    border-top: 2px solid rgba(155, 67, 13, 0.28);
  }

  .tv-text-wrapper {
    margin-top: 2rem;
    margin-left: 0;
    bottom: auto;
    height: auto;
    padding: 0 1rem 3rem;
  }

  .tv-sticky-content {
    position: relative;
    top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transform: none;
  }

  .arrow-text {
    display: contents;
  }

  .old-tv-wrapper {
    --old-tv-size: min(28.75rem, 92vw, calc(100svh - 7rem));
    grid-row: auto;
    grid-column: auto;
    order: 2;
    margin-top: clamp(-4rem, -8vw, -2.5rem);
    margin-bottom: clamp(2.5rem, 8vw, 4rem);
    opacity: 1;
  }

  .tv-caption-then {
    grid-row: auto;
    grid-column: auto;
    order: 1;
  }

  .tv-caption-now {
    grid-row: auto;
    grid-column: auto;
    order: 3;
  }

  .tv-caption {
    opacity: 1;
    transform: none;
  }

  #step-12.sticky-wrapper {
    position: relative;
    height: auto;
    min-height: auto;
    padding: 4rem 1rem 0;
  }

  #step-12 .text-wrapper {
    padding-top: 0;
  }
}

@media (max-width: 480px) {
  .video-overlay-title h1 {
    font-size: 28px;
  }

  .scrolly-section h2 {
    padding: 0.6rem 1rem;
    font-size: 18px;
  }

  .scrolly-section p {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .text-wrapper {
    padding-top: 3rem;
  }

  .stat-comparison {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .stat-caption {
    max-width: none;
  }

  .stat-arrow {
    transform: rotate(90deg);
  }

  .small-panel {
    padding: 4rem 1rem;
  }

  .picture-text-wrapper {
    width: calc(100% - 2rem);
    padding: 1.25rem;
  }

  .car-scrolly .graphic {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
  }

  #car-grid {
    width: min(100%, 22rem);
    max-height: 48vh;
  }

  .car {
    width: 100%;
    min-width: 0;
  }

  #car-legend {
    position: static;
    transform: none;
    margin-top: 1rem;
  }

  #car-counter {
    position: static;
    transform: none;
    margin-bottom: 1.5rem;
  }

  #car-counter .year {
    font-size: 30px;
  }

  #car-counter .amount {
    font-size: 15px;
  }

  .line-car {
    opacity: 0;
  }

  .tv-text-wrapper {
    flex-direction: column;
    padding: 3rem 1rem;
  }

  .arrow-text,
  .tv-caption-group {
    display: contents;
  }

  .tv-caption {
    width: min(100%, 17rem);
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
  }

  .tv-caption-then {
    order: 1;
  }

  .old-tv-wrapper {
    order: 2;
  }

  .tv-caption-now {
    order: 3;
  }
}
