/* The fundraising milestone line that draws itself with the scroll
   A tall track with a sticky stage of one screen; inside it one campaign card. The chart is an SVG drawn by the script
   in pixels (rebuilt on resize); the milestone labels, the months, the tag and the thank you are HTML over it. GSAP
   writes the transforms on the inner elements: the centring here is done with grid and flex, never with a transform. */

:root {
  --page: #090c0a;          /* the page */
  --page-glow: #11201a;     /* the soft light behind the card */
  --card: #101512;          /* the body of the card */
  --edge: rgba(226, 255, 236, 0.08); /* its edge at rest */
  --ink: #eef3ee;           /* the words */
  --muted: #84928a;         /* the small words */
  --faint: rgba(206, 232, 214, 0.12); /* guides and the line still to come */
  --accent: #8fe3a8;        /* the young leaf: line, reached milestones, the thank you */
  --accent-ink: #07130c;    /* words on the accent */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--page); touch-action: manipulation; }
html, body { overflow-x: clip; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.track { position: relative; height: 420vh; }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.4vmin, 28px);
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 50% 58%, var(--page-glow), transparent 72%),
    var(--page);
}
@supports (height: 100lvh) {
  .stage { height: 100lvh; }
}

/* ------------------------------------------------ the card */
.card {
  --mx: 30%;
  --my: 0%;
  position: relative;
  width: min(94vw, 920px);
  height: min(100%, 660px);
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.6vh, 18px);
  padding: clamp(14px, min(3.2vw, 3.6vh), 34px);
  border-radius: clamp(16px, 2.6vmin, 26px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 38%),
    var(--card);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 18px 40px -18px rgba(0, 0, 0, 0.8),
    0 60px 120px -50px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  isolation: isolate;
}

.card__grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* the light that follows the pointer, and the accent that grows with the total */
.card__light {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(420px 260px at var(--mx) var(--my), rgba(214, 255, 228, 0.06), transparent 70%),
    radial-gradient(70% 60% at 100% 0%, color-mix(in srgb, var(--accent) calc(var(--warm, 0) * 14%), transparent), transparent 70%);
}

/* ------------------------------------------------ the head */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: clamp(12px, min(1.5vw, 2.2vh), 15px);
  white-space: nowrap;
}
.brand__mark { width: 1.45em; height: 1.45em; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.brand__name { font-weight: 640; font-stretch: 112%; letter-spacing: -0.01em; }
.brand__sub { color: var(--muted); padding-left: 9px; border-left: 1px solid var(--faint); overflow: hidden; text-overflow: ellipsis; }

.state {
  position: relative;
  display: grid;
  height: 26px;
  padding: 0 11px;
  border-radius: 99px;
  font-size: clamp(10.5px, min(1.2vw, 1.8vh), 12.5px);
  font-weight: 520;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--edge);
}
.state__word { grid-area: 1 / 1; align-self: center; justify-self: center; color: var(--muted); }
.state__word--done { color: var(--accent); opacity: 0; }

/* ------------------------------------------------ the total */
.total__label {
  font-size: clamp(11px, min(1.3vw, 1.9vh), 13.5px);
  color: var(--muted);
}

.total__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(2px, 0.6vh, 8px);
}

.total__amount {
  display: flex;
  align-items: flex-start;
  font-size: clamp(30px, min(7.4vw, 10vh), 78px);
  font-weight: 560;
  font-stretch: 92%;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--ink);
  transform-origin: 0% 100%;
}
.total__cur { font-size: 0.56em; margin: 0.12em 0.06em 0 0; color: var(--muted); font-weight: 480; }
.total__reels { display: flex; }

.reel {
  position: relative;
  display: block;
  height: 1em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}
.reel__col { display: block; will-change: transform; }
.reel__col span { display: block; height: 1em; line-height: 1; text-align: center; }
.comma { display: block; overflow: hidden; width: 0.26em; color: var(--muted); }

.total__side {
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.6vw, 20px);
  padding-bottom: 0.2em;
}
.total__pct {
  min-width: 3.4em;
  height: 1.9em;
  display: grid;
  place-items: center;
  padding: 0 0.6em;
  border-radius: 99px;
  font-size: clamp(11px, min(1.3vw, 1.9vh), 14px);
  font-weight: 620;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}
.total__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: clamp(10.5px, min(1.25vw, 1.8vh), 13px);
  color: var(--muted);
  white-space: nowrap;
}
.total__meta b { color: var(--ink); font-weight: 560; }

/* ------------------------------------------------ the chart */
.chart {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 calc(-0.2 * clamp(14px, min(3.2vw, 3.6vh), 34px));
}
.chart__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }

.guide { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 5; fill: none; }
.guide--base { stroke-dasharray: none; }
.guide--lit { stroke: color-mix(in srgb, var(--accent) 34%, transparent); }
.guide__pct { font-family: 'Geist Mono Variable', ui-monospace, monospace; font-size: 10px; fill: var(--muted); }

.chart__ghost { fill: none; stroke: var(--faint); stroke-width: 1; stroke-dasharray: 1 4; stroke-linecap: round; }
.chart__line { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chart__glow { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; opacity: 0.32; }

.node__ring { fill: var(--card); stroke: var(--muted); stroke-width: 1; }
.node__core { fill: var(--accent); }
.node__ripple { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0; }
.node__tick { stroke: var(--accent); stroke-width: 1; opacity: 0; }

.tip__halo { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: color-mix(in srgb, var(--accent) 50%, transparent); stroke-width: 1; }
.tip__core { fill: #f2fff5; }

.chart__labels, .chart__months { position: absolute; inset: 0; pointer-events: none; }

.mile {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
  pointer-events: auto;
}
.mile__in { display: flex; flex-direction: column; gap: 2px; }
.mile__amount {
  font-size: clamp(11.5px, min(1.45vw, 2.1vh), 15px);
  font-weight: 600;
  font-stretch: 96%;
  color: var(--muted);
  opacity: 0.6;
}
.mile__date {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(9.5px, min(1.05vw, 1.6vh), 11.5px);
  color: var(--muted);
  opacity: 0.55;
}
.mile.is-on .mile__amount { color: var(--ink); opacity: 1; }
.mile.is-on .mile__date { color: var(--accent); opacity: 0.9; }

.month {
  position: absolute;
  bottom: 0;
  left: 0;
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(9px, min(1vw, 1.5vh), 11px);
  color: var(--muted);
  opacity: 0.7;
  white-space: nowrap;
}

/* the small glass tag the line carries */
.tag {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform;
}
.tag__in {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px 0 7px;
  border-radius: 99px;
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
  background: rgba(28, 38, 32, 0.66);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(226, 255, 236, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 18px -8px rgba(0, 0, 0, 0.7);
}
.tag__leaf { width: 12px; height: 12px; fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.hint {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(11px, min(1.3vw, 1.9vh), 13px);
  color: var(--muted);
  pointer-events: none;
}
.hint svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------ the thank you */
.thanks {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.3vh, 14px);
  padding: 12px;
  text-align: center;
  border-radius: clamp(12px, 2vmin, 20px);
  background:
    radial-gradient(80% 90% at 50% 0%, color-mix(in srgb, var(--accent) 16%, var(--card)), var(--card) 70%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
  clip-path: circle(0px at 100% 0%);
  visibility: hidden;
}
.thanks__rings {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: repeating-radial-gradient(circle at 50% 30%, transparent 0 38px, color-mix(in srgb, var(--accent) 7%, transparent) 38px 39px);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 30%, #000, transparent 75%);
  mask-image: radial-gradient(70% 70% at 50% 30%, #000, transparent 75%);
}
.thanks__mark { width: clamp(30px, min(5.4vw, 8vh), 54px); height: auto; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.thanks__ring { stroke: color-mix(in srgb, var(--accent) 40%, transparent); stroke-width: 1; }
.thanks__eyebrow { font-family: 'Geist Mono Variable', ui-monospace, monospace; font-size: clamp(9.5px, min(1.1vw, 1.7vh), 12px); color: var(--accent); letter-spacing: 0.02em; }
.thanks__title {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-style: italic;
  font-weight: 380;
  font-variation-settings: 'opsz' 144;
  font-size: clamp(30px, min(7vw, 10vh), 84px);
  letter-spacing: -0.03em;
  line-height: 0.95;
}
.thanks__text { max-width: 34em; font-size: clamp(11px, min(1.4vw, 2vh), 15px); line-height: 1.4; color: var(--muted); text-wrap: balance; }

.go {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: clamp(32px, 5.4vh, 44px);
  margin-top: clamp(2px, 0.8vh, 8px);
  padding: 0 clamp(14px, 2vw, 20px);
  border-radius: 99px;
  font-size: clamp(11.5px, min(1.35vw, 2vh), 14px);
  font-weight: 600;
  color: var(--accent-ink);
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.go__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, #b4f3c6, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 24px -10px color-mix(in srgb, var(--accent) 60%, transparent);
}
.go__arrow { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.go:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ------------------------------------------------ small screens */
@media (max-width: 560px) {
  .brand__sub { display: none; }
  .total__side { flex-direction: column; align-items: flex-end; gap: 4px; }
}
