/* The drawing chart: a dark card on a black page, a mint line with its area fading into the dark, a cursor and
   its label. */
:root {
  --page: #000000;          /* the page */
  --card: #0d0e11;          /* the card */
  --edge: #1e2026;
  --ink: #f3f4f6;
  --muted: #7f838d;
  --grid: #1b1d22;          /* the lines across the chart */
  --line: #6cefb5;          /* the line, and its area */
  --dim: #2b3a34;           /* the line after the cursor */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Sora Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.chart {
  width: min(640px, 100%);
  padding: 22px 22px 14px;
  border: 1px solid var(--edge);
  border-radius: 26px;
  background: var(--card);
}

/* ---------------------------------------------------------------- the head */
.chart__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 18px;
}

.chart__title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.chart__total {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 0;
  font-size: clamp(32px, 9vw, 42px);
  font-weight: 640;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.chart__delta {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(108, 239, 181, 0.12);
  color: var(--line);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.chart__delta.is-down {
  background: rgba(255, 120, 110, 0.12);
  color: #ff8a80;
}

/* the periods: a pill slides under the one chosen */
.chart__ranges {
  position: relative;
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: #16181c;
}

.chart__pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  border-radius: 999px;
  background: #2a2d34;
}

.chart__range {
  position: relative;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chart__range[aria-selected='true'] {
  color: var(--ink);
}

.chart__range:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------- the plot */
.chart__plot {
  position: relative;
  outline: none;
  touch-action: pan-y;
  cursor: crosshair;
}

.chart__plot:focus-visible {
  border-radius: 14px;
  box-shadow: 0 0 0 2px var(--ink);
}

.chart__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

#chart-area stop {
  stop-color: var(--line);
}

.chart__grid line {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart__grid text,
.chart__days text {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart__days text {
  text-anchor: middle;
}

.chart__line {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__line--dim {
  stroke: var(--dim);
}

.chart__cursor {
  stroke: rgba(243, 244, 246, 0.35);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0;
}

/* the label over the cursor, moved by the script */
.chart__tip {
  position: absolute;
  top: -6px;
  left: 0;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 6px 10px 7px;
  border-radius: 12px;
  background: var(--ink);
  color: #0d0e11;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  translate: -50% -100%;
}

.chart__tip strong {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
