*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

p {
  text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

ul,
ol {
  list-style: none;
}

a {
  color: currentColor;
}

:root {
  --color-critics: #fa320a;
  --color-critics-rgb: 250, 50, 10;
  --color-audience: #ffb600;
  --color-audience-rgb: 255, 182, 0;
  --color-agree: #dcdce6;
  --color-agree-rgb: 220, 220, 230;
  --color-tick: #bcbdbe;
  --color-text: #2a2c32;
  --color-background: #fff;

  --font-weight-heading: 900;
  --font-weight-body: 500;

  --font-size-2xl: 2.369rem;
  --font-size-xl: 1.777rem;
  --font-size-lg: 1.333rem;
  --font-size-md: 1rem;
  --font-size-sm: 0.75rem;
}

body {
  font-family: "Libre Franklin", sans-serif;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-body);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-background);
}

h1 {
  font-weight: var(--font-weight-heading);
  font-size: var(--font-size-2xl);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p {
  margin-block: 1rem;
}

header,
footer {
  width: min(100% - 2rem, 60rem);
  margin: 2rem auto;
}

main {
  overflow-x: auto;
}

.swatch[data-color="critics"] {
  --bg-base: var(--color-critics-rgb);
}

.swatch[data-color="audience"] {
  --bg-base: var(--color-audience-rgb);
}

@property --starting-offset {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 0;
}

.movie__link,
.swatch {
  --bg-opacity: 0.25;
  --starting-offset: 65%;
  --bg-color: rgba(var(--bg-base), var(--bg-opacity));
  background: linear-gradient(
    180deg,
    transparent 0 var(--starting-offset),
    var(--bg-color) var(--starting-offset) 100%
  );
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: --starting-offset 0.2s;
}

.movie__link:hover {
  --starting-offset: 0%;
}

.search {
  display: flex;
  justify-content: center;
}

.search input {
  width: 15em;
  padding: 0.25em 0.5em;
  border-radius: 0.25em;
  border: 1px solid var(--color-tick);
}

.search input:focus-visible {
  outline-color: var(--color-text);
}

.chart {
  position: relative;
  margin-inline: auto;
}

.chart > svg {
  width: 100%;
  height: auto;
}

text {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
}

.axis {
  font-family: inherit;
}

.axis .tick line {
  stroke: var(--color-tick);
}

.axis-title {
  font-weight: var(--font-weight-heading);
  letter-spacing: 0.05em;
}

.active {
  opacity: 0;
  transition: opacity 0.2s;
}

.active.visible {
  opacity: 1;
}

.active text {
  font-weight: var(--font-weight-heading);
}

.tooltip {
  font-size: var(--font-size-sm);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  background-color: var(--color-background);
  padding: 0.5em 1em;
  border-radius: 0.5em;
  border: 1px solid currentColor;
  display: none;
  opacity: 0;
  transition: display 0.2s, opacity 0.2s;
}

.tooltip.visible {
  display: block;
  opacity: 1;
}

.tooltip .scores {
  display: flex;
  gap: 1em;
}

.tooltip .score {
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.tooltip .score > img {
  width: 1.5em;
  height: 1.5em;
}

.tooltip li {
  margin-block-start: 0.5em;
}
