/* The fund's ten years with the scale that widens at each record, on scroll. Colours in :root (the Playground
   palette): gold is the value of the fund, everything else is a cool neutral on a near black page. GSAP moves .frame,
   the CSS styles .card inside it; the script places the point, the tip, the notes and the gridlines in pixels inside
   .chart__plot and redraws them on resize. GSAP moves .note and .tip, the CSS styles their children. */
:root {
  --page: #0a0b0e;          /* the page */
  --page-lift: #15161b;     /* the soft lift of the page behind the card */
  --card: #14151a;          /* the card */
  --ink: #f1efe9;           /* the words */
  --muted: #8b8d95;         /* the small words */
  --line: rgba(255, 255, 255, 0.07); /* the hairlines of the chart */
  --gold: #e7c47c;          /* the value of the fund */
  --gold-ink: #241a06;      /* the words on gold */
  --down: #c9a6a0;          /* the figure of the fall */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page); }
html, body { overflow-x: clip; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

.years { position: relative; height: 400vh; }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vh, 40px) 12px;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(120% 90% at 50% 40%, var(--page-lift), var(--page) 70%);
}
@supports (height: 100lvh) {
  .stage { height: 100lvh; }
}

/* two soft lights behind the card, gold high on the right and a cool one low on the left */
.light {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: min(74vw, 74vh, 560px);
  height: min(74vw, 74vh, 560px);
  margin: calc(min(74vw, 74vh, 560px) / -2) 0 0 calc(min(74vw, 74vh, 560px) / -2);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(48px);
}
.light--a { background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 24%, transparent), color-mix(in srgb, var(--gold) 5%, transparent) 60%, transparent); }
.light--b { background: radial-gradient(closest-side, rgba(140, 160, 200, 0.16), rgba(140, 160, 200, 0.04) 60%, transparent); }
.grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- the card */
.frame { width: min(100%, 440px); }
.card {
  position: relative;
  border-radius: clamp(18px, 4.4vh, 26px);
  padding: clamp(11px, 3vh, 22px) clamp(12px, 3.6vw, 22px) clamp(11px, 2.8vh, 20px);
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 255, 255, 0.06), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--card) 86%, transparent), color-mix(in srgb, var(--card) 96%, transparent));
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 10px 24px -10px rgba(0, 0, 0, 0.6),
    0 40px 80px -30px rgba(0, 0, 0, 0.7);
}
.card__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.02) 34%, transparent 60%, color-mix(in srgb, var(--gold) 24%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.card__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, -30%), color-mix(in srgb, var(--gold) 7%, transparent), transparent 70%);
}
@media (hover: hover) {
  .card:hover .card__glow { opacity: 1; }
}

.head { position: relative; display: flex; align-items: center; gap: 10px; }
.head__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(26px, 7vh, 34px);
  height: clamp(26px, 7vh, 34px);
  border-radius: 10px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 78%, white), color-mix(in srgb, var(--gold) 72%, #3a2706));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 6px 14px -6px color-mix(in srgb, var(--gold) 60%, transparent);
}
.head__mark svg { width: 15px; height: 15px; fill: none; stroke: var(--gold-ink); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.head__mark svg .thin { stroke-width: 1.2; opacity: 0.6; }
.head__text { flex: 1; min-width: 0; }
.head__title { font-size: clamp(13px, 3.4vh, 15px); font-weight: 640; font-variation-settings: 'wdth' 104; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head__text .muted { font-size: clamp(10.5px, 2.8vh, 12px); margin-top: 1px; white-space: nowrap; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---------------------------------------------------------------- the value */
.value { margin-top: clamp(8px, 2.6vh, 20px); }
.value__label { font-size: clamp(10px, 2.6vh, 11.5px); font-weight: 520; letter-spacing: 0.01em; }
.value__row { display: flex; align-items: baseline; gap: 10px; margin-top: 1px; }
.value__num {
  font-size: clamp(26px, 8.4vh, 40px);
  line-height: 1.05;
  font-weight: 640;
  font-variation-settings: 'wdth' 92;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff 30%, color-mix(in srgb, var(--ink) 70%, var(--gold)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.delta {
  display: inline-block;
  font-size: clamp(11px, 2.9vh, 13px);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  transition: color 0.4s ease;
}
.delta.is-down { color: var(--down); }

/* ---------------------------------------------------------------- the chart */
.chart { margin-top: clamp(8px, 2.4vh, 18px); }
.chart__plot {
  position: relative;
  height: clamp(92px, 30vh, 210px);
  margin-right: 32px;
}
.chart__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.area { fill: url(#fill); }
.under { fill: url(#hatch); }
.peak { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; stroke-dasharray: 2 3; }
.ln { fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--gold) 35%, transparent)); }

/* the gridlines: the script slides them as the scale widens */
.gl {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--line), var(--line) 50%, transparent 50%) 0 0 / 6px 1px;
  transform-origin: 0 50%;
  will-change: transform, opacity;
}
.gl--start { background: rgba(255, 255, 255, 0.1); }
.gl em {
  position: absolute;
  left: calc(100% + 6px);
  top: -0.65em;
  font-style: normal;
  font-size: clamp(9px, 2.3vh, 10.5px);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color 0.5s ease;
}
.gl.is-new em { color: var(--gold); }

/* the point on the tip */
.pt {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 3px color-mix(in srgb, var(--card) 80%, transparent);
  z-index: 2;
}
.pt__ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  opacity: 0;
}

/* the value on the tip */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 9px;
  overflow: hidden;
  white-space: nowrap;
  background: rgba(30, 31, 37, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 14px -6px rgba(0, 0, 0, 0.7);
  will-change: transform;
}
.tip__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 84%, white), var(--gold));
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.tip__val {
  position: relative;
  font-size: 11px;
  line-height: 14px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  transition: color 0.35s ease;
}
.tip__rec {
  position: relative;
  display: none;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  line-height: 12px;
  font-weight: 620;
  letter-spacing: 0.01em;
  color: var(--gold-ink);
}
.tip__rec svg { width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tip.is-rec .tip__rec { display: inline-flex; }
.tip.is-rec .tip__val { color: var(--gold-ink); }

/* the notes of the story */
.note {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  padding: 4px 8px 5px;
  border-radius: 9px;
  white-space: nowrap;
  opacity: 0;
  background: rgba(26, 27, 33, 0.84);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 8px 18px -8px rgba(0, 0, 0, 0.75);
  transition: filter 0.5s ease;
}
.note__when { font-size: 9px; line-height: 11px; font-weight: 520; letter-spacing: 0.01em; }
.note__what { font-size: 10.5px; line-height: 13px; font-weight: 560; margin-top: 1px; }
.note__what b { font-weight: 660; font-variant-numeric: tabular-nums; color: var(--down); }
.note--up .note__what b { color: var(--gold); }
.note.is-past { filter: saturate(0.4) brightness(0.8); }
.lead {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: 10px;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
  transform-origin: 100% 50%;
  opacity: 0;
}
.lead--v { width: 1px; height: 11px; transform-origin: 50% 100%; }

/* the years: the ticks light up as the tip passes */
.axis {
  position: relative;
  height: clamp(16px, 4.2vh, 20px);
  margin: 4px 32px 0 0;
  font-size: clamp(9px, 2.3vh, 10.5px);
  font-variant-numeric: tabular-nums;
}
.yr {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 0;
}
.yr i {
  display: block;
  width: 1px;
  height: 4px;
  background: rgba(255, 255, 255, 0.16);
  transition: background-color 0.4s ease;
}
.yr span { margin-top: 2px; color: var(--muted); transition: color 0.4s ease; }
.yr .s { display: none; }
.yr.is-on i { background: var(--gold); }
.yr.is-on span { color: var(--ink); }

/* ---------------------------------------------------------------- the foot */
.foot {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 18px);
  margin-top: clamp(8px, 2.4vh, 18px);
  padding-top: clamp(9px, 2.4vh, 16px);
  border-top: 1px solid var(--line);
}
.stat { min-width: 0; }
.stat p { font-size: clamp(9.5px, 2.5vh, 11px); white-space: nowrap; }
.stat b { display: block; margin-top: 1px; font-size: clamp(12px, 3.3vh, 14px); font-weight: 640; font-variant-numeric: tabular-nums; }
.stat:first-child b { color: var(--gold); }
.btn {
  position: relative;
  flex: none;
  margin-left: auto;
  height: clamp(32px, 8.6vh, 40px);
  padding: 0 clamp(12px, 3.4vw, 16px);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: clamp(12px, 3.2vh, 13px);
  font-weight: 620;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 20px -10px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
}
.btn__face { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn__icon { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (hover: hover) {
  .btn__icon { transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .btn:hover .btn__icon { transform: translateX(2px); }
  .btn { transition: background-color 0.3s ease; }
  .btn:hover { background: rgba(255, 255, 255, 0.11); }
}

@media (max-width: 440px) {
  .yr .l { display: none; }
  .yr .s { display: inline; }
}
@media (max-width: 340px) {
  .stat:nth-child(2) { display: none; }
}
@media (max-height: 460px) {
  .value__label { display: none; }
  .chart__plot { height: clamp(80px, 26vh, 210px); }
}
