/* The stats card of a made-up personal newsletter, alone on white. GSAP moves only whole elements (the card, the bar
   bodies, the digit columns, the lines of text, the small lines); colours, edges and states live in CSS on classes. An
   element GSAP moves never has a transform in the CSS. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --card-low: #faf9f7;      /* the bottom of the card */
  --ink: #17161a;           /* the main text */
  --muted: #8b8881;         /* labels and notes */
  --faint: #ecebe7;         /* grid lines, empty bars, edges */
  --accent: #ef5b2a;        /* the one accent: the bars, the ring, the light */
  --accent-deep: #c8431a;   /* the accent in shadow, the top of a bar */
  --accent-soft: #ffe3d6;   /* the accent washed out */
  --good: #2f7d57;          /* the delta that went up */
}

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

/* ---- the card ---- */
.letter {
  position: relative;
  width: min(364px, 92vw);
  padding: clamp(13px, 3vh, 20px) clamp(14px, 4vw, 19px) clamp(13px, 2.8vh, 18px);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card) 55%, var(--card-low) 100%);
  box-shadow:
    0 0 0 1px rgba(23, 22, 26, 0.06),
    0 1px 2px rgba(23, 22, 26, 0.05),
    0 6px 14px -6px rgba(23, 22, 26, 0.08),
    0 26px 48px -22px rgba(60, 30, 10, 0.18),
    inset 0 1px 0 #ffffff;
  display: grid;
  gap: clamp(8px, 1.9vh, 13px);
}
/* a faint warm light in the top edge, stronger once the letter is out */
.letter__rim {
  position: absolute;
  left: 18%; right: 18%; top: -1px; height: 1px;
  border-radius: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(239, 91, 42, 0.55), transparent);
  opacity: 0;
  transition: opacity 0.8s ease;
}
.letter.is-sent .letter__rim { opacity: 1; }

/* ---- the head ---- */
.head { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #fff3ec, #ffe6da);
  box-shadow: inset 0 0 0 1px rgba(239, 91, 42, 0.2), 0 1px 2px rgba(200, 67, 26, 0.12);
}
.mark svg { width: 17px; height: 17px; fill: none; stroke: var(--accent-deep); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.head__txt { display: grid; line-height: 1.15; min-width: 0; }
.head__name { font-size: 14px; font-weight: 660; letter-spacing: -0.01em; }
.head__sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.pill {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 7px; border-radius: 999px;
  background: #f6f5f2;
  box-shadow: inset 0 0 0 1px rgba(23, 22, 26, 0.06);
  font-size: 11.5px; font-weight: 560;
  transition: background 0.5s ease, box-shadow 0.5s ease, color 0.5s ease;
}
.pill__ring { width: 15px; height: 15px; flex: none; overflow: visible; }
.pill__track { fill: none; stroke: #dedcd6; stroke-width: 1.8; }
.pill__arc { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transform: rotate(-90deg); transform-origin: 8px 8px; }
.pill__tick { fill: none; stroke: #ffffff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.pill__roll { position: relative; display: block; height: 16px; width: 54px; overflow: hidden; }
.pill__line { position: absolute; left: 0; top: 0; line-height: 16px; white-space: nowrap; }
.letter.is-sent .pill { background: #fff0e8; box-shadow: inset 0 0 0 1px rgba(239, 91, 42, 0.22); color: var(--accent-deep); }
.letter.is-sent .pill__track { stroke: var(--accent); fill: var(--accent); transition: fill 0.3s ease 0.1s; }

/* ---- the issue ---- */
.issue { display: grid; gap: 2px; }
.issue__title { font-size: clamp(14.5px, 2.4vh, 16px); font-weight: 620; letter-spacing: -0.015em; line-height: 1.25; }
.issue__meta { font-size: 11.5px; color: var(--muted); }
.issue__meta b { color: var(--ink); font-weight: 600; }

/* ---- the big numbers ---- */
.big { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.big__count { display: flex; align-items: flex-end; gap: 7px; min-width: 0; }
.odo {
  display: inline-flex;
  height: clamp(32px, 5.6vh, 38px);
  font-size: clamp(30px, 5.4vh, 36px);
  line-height: clamp(32px, 5.6vh, 38px);
  font-weight: 680; font-stretch: 92%;
  letter-spacing: -0.035em;
  overflow: hidden;
}
.odo__col { display: block; width: 0.6em; text-align: center; }
.odo__strip { display: block; }
.odo__strip span { display: block; height: clamp(32px, 5.6vh, 38px); }
.odo__sep { display: block; width: 0.24em; text-align: center; }
.big__label { position: relative; display: block; height: 16px; width: 120px; overflow: hidden; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.big__line { position: absolute; left: 0; top: 0; line-height: 16px; white-space: nowrap; }
.big__rate { display: grid; justify-items: end; gap: 3px; padding-bottom: 3px; }
.rate { font-size: 17px; font-weight: 640; letter-spacing: -0.02em; line-height: 1; }
.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--good);
  padding: 2px 6px 2px 4px; border-radius: 999px;
  background: rgba(47, 125, 87, 0.09);
  opacity: 0;
}
.delta svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the chart ---- */
.chart {
  position: relative;
  height: clamp(54px, 15vh, 92px);
  touch-action: pan-y;
  cursor: crosshair;
}
.chart__glow {
  position: absolute; bottom: 0; left: 0;
  width: 70px; height: 100%;
  margin-left: -35px;
  pointer-events: none;
  transform-origin: 50% 100%;
  background: radial-gradient(50% 70% at 50% 100%, rgba(239, 91, 42, 0.22), rgba(239, 91, 42, 0) 70%);
  opacity: 0;
}
.chart__grid { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr 1fr 1fr; pointer-events: none; }
.chart__grid i { border-top: 1px dashed var(--faint); }
.bars {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; gap: 3px;
  border-bottom: 1px solid #dcdad4;
}
.bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar__body {
  display: block; width: 100%;
  border-radius: 3px 3px 1px 1px;
  transform-origin: 50% 100%;
}
.bar__paint {
  display: block; width: 100%; height: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--accent) 0%, #f58660 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.bar.is-later .bar__paint { background: linear-gradient(180deg, #f3a487 0%, #f8c3ae 100%); }
.chart.is-peek .bar .bar__paint { opacity: 0.32; }
.chart.is-peek .bar.is-hot .bar__paint { opacity: 1; filter: saturate(1.15); }

.now { position: absolute; top: -6px; bottom: 0; left: 0; width: 1px; pointer-events: none; opacity: 0; }
.now__line { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(239, 91, 42, 0), var(--accent)); }

.axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: -5px; }

/* ---- the three small numbers ---- */
.minis { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: 14px; background: #f7f6f3; box-shadow: inset 0 0 0 1px rgba(23, 22, 26, 0.04); }
.mini { padding: clamp(6px, 1.3vh, 9px) 10px; display: grid; gap: 1px; }
.mini + .mini { border-left: 1px solid var(--faint); }
.mini dt { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.mini dd { font-size: 14.5px; font-weight: 640; letter-spacing: -0.01em; }

/* ---- the button ---- */
.resend {
  position: relative;
  appearance: none; border: 0; font: inherit; cursor: pointer;
  height: clamp(42px, 6.8vh, 48px);
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(180deg, #2a2830 0%, #17161a 100%);
  box-shadow: 0 0 0 1px #0d0c0f, 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 10px 18px -10px rgba(23, 22, 26, 0.7);
  transition: background 0.5s ease, box-shadow 0.5s ease, color 0.5s ease;
}
.resend:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.resend__face { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; }
.resend__icon { width: 17px; height: 17px; flex: none; overflow: visible; }
.resend__plane path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.resend__spin { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 0.28 0.72; opacity: 0; transform-origin: 10px 10px; }
.resend__tick { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.resend__roll { position: relative; display: block; height: 20px; width: 190px; overflow: hidden; }
.resend__line { position: absolute; left: 0; right: 0; top: 0; text-align: left; font-size: 13.5px; line-height: 20px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; }
.resend.is-busy { cursor: default; }
.resend.is-done { color: var(--accent-deep); background: linear-gradient(180deg, #fff4ee 0%, #ffebe1 100%); box-shadow: 0 0 0 1px rgba(239, 91, 42, 0.28), 0 1px 0 #ffffff inset, 0 10px 18px -12px rgba(200, 67, 26, 0.35); }
@media (hover: hover) {
  .resend:not(.is-busy):not(.is-done):hover { background: linear-gradient(180deg, #34313b 0%, #1d1c21 100%); }
}

/* ---- the drawn pointer of the autopilot ---- */
.ghost {
  position: fixed; left: 0; top: 0;
  width: 22px; height: 22px;
  margin: -3px 0 0 -4px;
  pointer-events: none;
  opacity: 0; visibility: hidden;
  z-index: 9;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.ghost path { fill: #17161a; stroke: #ffffff; stroke-width: 1.4; stroke-linejoin: round; }

@media (max-height: 470px) {
  .axis { display: none; }
  .issue__meta { display: none; }
}
