/* The portfolio chart with a spring crosshair: the portfolio card of an investing app, dark graphite on a near black
   page. The chart is one SVG drawn in pixels (its viewBox is rebuilt on resize); the glass tag over it is HTML so its
   blur and its rolling figures stay sharp. */
:root {
  --page: #0a0b0d;            /* the page */
  --card: #131418;            /* the body of the card */
  --card-top: #181a1f;        /* the top of the card, where the light falls */
  --ink: #eef0f2;             /* the words */
  --muted: #8b9098;           /* the small words */
  --faint: rgba(255, 255, 255, 0.06); /* hairlines */
  --accent: #74f0c4;          /* the line, the area, the point */
  --down: #ff8a78;            /* the change when it is negative */
  --glass: rgba(30, 33, 38, 0.52); /* the tag */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background:
    radial-gradient(120% 70% at 50% 0%, #14171b 0%, var(--page) 62%) fixed,
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px 12px;
  font-size: min(26.12px, 3.755vw, calc((100vh - 32px) * 0.0416));
  overflow: hidden;
}

.card {
  position: relative;
  width: 24.5em;
  padding: 1.25em 1.25em 1em;
  border-radius: 1.5em;
  background:
    linear-gradient(180deg, var(--card-top), var(--card) 46%),
    var(--card);
  box-shadow:
    inset 0 0.0625em 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 0.0625em rgba(255, 255, 255, 0.05),
    0 0.0625em 0.125em rgba(0, 0, 0, 0.5),
    0 0.75em 1.5em -0.625em rgba(0, 0, 0, 0.6),
    0 2.5em 5em -1.875em rgba(0, 0, 0, 0.85);
  isolation: isolate;
}

/* a fine grain over the body of the card */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.06;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: -1;
}

/* a soft accent light behind the chart, low in the card */
.card::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 18%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 9%, transparent), transparent);
  pointer-events: none;
  z-index: -1;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
}

.card__brand {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.card__mark {
  width: 1.375em;
  height: 1.375em;
  padding: 0.25em;
  border-radius: 0.4375em;
  background: linear-gradient(160deg, #23262c, #16181c);
  box-shadow: inset 0 0 0 0.0625em rgba(255, 255, 255, 0.08), inset 0 0.0625em 0 rgba(255, 255, 255, 0.08);
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__name {
  font-size: 0.8125em;
  font-weight: 600;
  font-variation-settings: 'wdth' 106;
  letter-spacing: 0.01em;
}

.card__span {
  font-size: 0.75em;
  color: var(--muted);
  padding: 0.3333em 0.8333em;
  border-radius: 83.25em;
  box-shadow: inset 0 0 0 0.0833em rgba(255, 255, 255, 0.08);
}

.card__value {
  margin-top: 0.3684em;
  font-size: 2.375em;
  line-height: 1.12;
  font-weight: 620;
  font-variation-settings: 'wdth' 94;
  letter-spacing: -0.025em;
  height: 1.12em;
  white-space: nowrap;
}

.card__change {
  margin-top: 0.4615em;
  display: flex;
  align-items: center;
  gap: 0.6154em;
  font-size: 0.8125em;
  height: 1.6923em;
}

.chip {
  --tone: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  height: 1.375em;
  padding: 0 0.5em 0 0.375em;
  border-radius: 62.4375em;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  box-shadow: inset 0 0 0 0.0625em color-mix(in srgb, var(--tone) 22%, transparent);
  font-weight: 560;
  transition: color 0.35s ease, background-color 0.35s ease, box-shadow 0.35s ease;
}

.chip.is-down {
  --tone: var(--down);
}

.chip__arrow {
  width: 0.75em;
  height: 0.75em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__pct {
  color: var(--muted);
}

/* the rolling figures: each character is a slot; the old one leaves and the new one arrives in the same cell */
.roll {
  display: inline-flex;
  white-space: nowrap;
}

.roll__slot {
  display: inline-grid;
  overflow: hidden;
  height: 1.2em;
  line-height: 1.2em;
  vertical-align: top;
}

.card__value .roll__slot {
  height: 1.12em;
  line-height: 1.12em;
}

.roll__ch {
  grid-area: 1 / 1;
  display: block;
}

.chart {
  position: relative;
  margin: 0.625em -1.25em 0;
  height: 10em;
  cursor: crosshair;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.chart__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.stop-acc {
  stop-color: var(--accent);
}

.grid line {
  stroke: var(--faint);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.base {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

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

.line--future {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1.6;
}

.line--light {
  stroke-width: 2.4;
  mix-blend-mode: screen;
}

.cross__hair {
  stroke-width: 1;
}

.cross__ring {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 50%, transparent);
  stroke-width: 1;
}

.cross__dot {
  fill: var(--accent);
  stroke: var(--card);
  stroke-width: 2;
}

.cross__shine {
  fill: #ffffff;
  opacity: 0.85;
}

/* the glass tag over the crosshair: blur kept small, a 0.0625em edge that takes the light, a soft highlight on top */
.tag {
  position: absolute;
  left: 0;
  top: 0.125em;
  display: flex;
  flex-direction: column;
  gap: 0.0625em;
  padding: 0.375em 0.625em 0.4375em;
  border-radius: 0.75em;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02) 60%),
    var(--glass);
  -webkit-backdrop-filter: blur(0.625em) saturate(140%);
  backdrop-filter: blur(0.625em) saturate(140%);
  box-shadow:
    inset 0 0 0 0.0625em rgba(255, 255, 255, 0.12),
    inset 0 0.0625em 0 rgba(255, 255, 255, 0.16),
    0 0.5em 1.25em -0.5em rgba(0, 0, 0, 0.7);
  pointer-events: none;
  white-space: nowrap;
  will-change: transform;
}

.tag__value {
  font-size: 0.8125em;
  font-weight: 620;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.01em;
}

.tag__date {
  font-size: 0.6875em;
  color: var(--muted);
}

.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3636em;
  font-size: 0.6875em;
  color: color-mix(in srgb, var(--muted) 80%, transparent);
  height: 1.2727em;
}

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 0.75em;
  padding: 0.1875em;
  border-radius: 62.4375em;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 0.0625em rgba(255, 255, 255, 0.06);
}

.tabs__pill {
  position: absolute;
  left: 0;
  top: 0.1875em;
  bottom: 0.1875em;
  width: 0;
  border-radius: 62.4375em;
  background: linear-gradient(180deg, #2a2d33, #212328);
  box-shadow:
    inset 0 0.0625em 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 0.0625em rgba(255, 255, 255, 0.06),
    0 0.125em 0.375em rgba(0, 0, 0, 0.45);
}

.tabs__tab {
  position: relative;
  height: 2.4002em;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.7812em;
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  cursor: pointer;
  transition: color 0.3s ease, font-variation-settings 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

.tabs__tab span {
  display: inline-block;
}

.tabs__tab[aria-pressed='true'] {
  color: var(--ink);
  font-variation-settings: 'wdth' 112;
}

@media (hover: hover) {
  .tabs__tab:hover {
    color: var(--ink);
  }
}

.tabs__tab:focus-visible {
  outline: 0.125em solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 0.0625em;
  border-radius: 62.4375em;
}

/* the drawn pointer of the autopilot */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 1.375em;
  height: 1.375em;
  fill: #f4f5f6;
  stroke: #0a0b0d;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 0.125em 0.1875em rgba(0, 0, 0, 0.5));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}
