/* The speed test page. Tokens, fonts, buttons, the form and the footer come from /styles.css. */

/* The header stays put while the page scrolls. The logo sits in the middle until a test is done;
   then, on wider screens, it hops to the left and the run again and share icons take the right. */
.speed-top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: env(safe-area-inset-top);
}
/* No edge: two blur layers reach past the header and fade to nothing, the stronger one sooner,
   so the page softens gradually as it slides under. They appear once something is underneath. */
.speed-top::before, .speed-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.speed-top::before {
  bottom: -40px;
  background: linear-gradient(180deg, rgba(11, 11, 12, 0.82) 0%, rgba(11, 11, 12, 0.5) 55%, rgba(11, 11, 12, 0) 100%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
}
.speed-top::after {
  bottom: -16px;
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
}
.speed-top.is-scrolled::before, .speed-top.is-scrolled::after { opacity: 1; }
.speed-top-inner { position: relative; height: 72px; max-width: 1180px; margin: 0 auto; }
.speed-top .wordmark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 104px;
  margin: 0;
  transform: translate(-50%, -50%);
  transition: left 0.75s var(--ease), transform 0.75s var(--ease);
}
.speed-tools {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
}

/* The letters: they drop in on load like the home page intro, and hop whenever the logo moves. */
.speed-top .letter { transform-box: fill-box; transform-origin: 50% 100%; }
.speed-top.is-intro .letter { animation: speed-drop 0.95s both; }
.speed-top.is-hop .letter { animation: speed-letter-hop 0.8s both; }
.speed-top .letter[data-letter="1"] { animation-delay: 0.08s; }
.speed-top .letter[data-letter="2"] { animation-delay: 0.16s; }
.speed-top .letter[data-letter="3"] { animation-delay: 0.24s; }
@keyframes speed-drop {
  0% { opacity: 0; transform: translateY(-460px) scaleX(0.9) scaleY(1.15); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  42% { opacity: 1; transform: translateY(0) scaleX(0.92) scaleY(1.1); animation-timing-function: ease-out; }
  54% { transform: translateY(0) scaleX(1.25) scaleY(0.72); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  76% { transform: translateY(-40px) scaleX(0.96) scaleY(1.05); }
  100% { opacity: 1; transform: none; }
}
@keyframes speed-letter-hop {
  0% { transform: none; }
  12% { transform: scaleX(1.12) scaleY(0.86); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  38% { transform: translateY(-110px) scaleX(0.95) scaleY(1.08); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  60% { transform: translateY(0) scaleX(1.18) scaleY(0.8); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  100% { transform: none; }
}
.speed-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--glass);
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--glass-line);
  cursor: pointer;
  animation: rise 0.5s var(--ease) both;
  transition: background 0.2s, transform 0.25s var(--ease);
}
.speed-icon:hover { background: rgba(253, 253, 253, 0.14); }
.speed-icon:active { transform: scale(0.94); }
.speed-icon:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.speed-top .wordmark-svg { display: block; width: 100%; height: auto; overflow: visible; }

.speed-main { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.speed-app { padding-top: 48px; text-align: center; }

/* The headline: two lines' worth of room so the page does not jump when a verdict wraps. */
.speed-headline {
  font-size: clamp(38px, 11vw, 76px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0 auto 14px;
  min-height: 2.04em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-wrap: balance;
}
.speed-headline > [aria-hidden] { display: block; }
.speed-word { display: inline-block; white-space: nowrap; }
.speed-char {
  display: inline-block;
  transform-origin: 50% 100%;
  animation: speed-hop 0.7s var(--ease) both;
  animation-delay: calc(var(--i) * 16ms);
}
@keyframes speed-hop {
  0% { opacity: 0; transform: translateY(0.55em) scaleY(1.25) scaleX(0.9); }
  55% { opacity: 1; transform: translateY(-0.08em) scaleY(0.94) scaleX(1.04); }
  100% { opacity: 1; transform: none; }
}

.speed-sub { color: var(--ink-2); font-size: 17px; margin: 0 auto 8px; max-width: 30em; }

.speed-chart {
  height: 240px;
  margin: 20px -12px 0;
  transition: opacity 0.4s var(--ease);
}
.speed-chart.is-idle { opacity: 0.55; }

.speed-stat { margin-top: 8px; }
.speed-number {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: clamp(56px, 17vw, 104px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.speed-unit { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink-2); }
.speed-label {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}
.speed-badge {
  color: var(--ground);
  background: var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 500;
  animation: rise 0.6s var(--ease) both;
}

.speed-actions {
  margin: 28px auto 0;
  display: flex;
  gap: 10px;
  justify-content: center;
  max-width: 420px;
}
.speed-actions .button { flex: 1 1 0; }
.speed-start { max-width: 320px; }
.speed-ghost {
  font: inherit;
  font-size: 15px;
  color: var(--ink-3);
  background: none;
  border: 0;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.speed-ghost:hover { color: var(--ink); }
.speed-ghost:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }

.speed-details {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  text-align: left;
  animation: rise 0.6s var(--ease) both;
}
.speed-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--glass-line);
  font-size: 16px;
}
.speed-row dt { color: var(--ink-3); flex: 0 0 auto; }
.speed-row dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.speed-row dd.is-pending { color: var(--ink-3); animation: speed-breathe 1.6s ease-in-out infinite; }
@keyframes speed-breathe { 50% { opacity: 0.45; } }

/* Download is white, upload is Juno blue. */
.speed-page { --up: #5b83ff; }
.speed-number.is-up, .speed-number.is-up .speed-unit { color: var(--up); }
.speed-label.is-up { color: var(--up); }
.speed-summary {
  margin: 18px auto 0;
  max-width: 26em;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
  text-wrap: balance;
  animation: rise 0.6s var(--ease) both;
}

.speed-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 8px auto 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-line);
  animation: rise 0.6s var(--ease) both;
}
.speed-tab {
  font: inherit;
  font-size: 15px;
  color: var(--ink-3);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.speed-tab strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.speed-tab:hover { color: var(--ink-2); }
.speed-tab[aria-pressed="true"].is-down { color: var(--ground); background: var(--ink); }
.speed-tab[aria-pressed="true"].is-up { color: var(--ground); background: var(--up); }
.speed-tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* What the line handles: a dot per use that fills in as the speed clears it. */
.speed-section {
  margin: 48px 0 6px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
}
.speed-section + .speed-details { margin-top: 0; }
.speed-uses { list-style: none; margin: 0; padding: 0; text-align: left; display: grid; grid-template-columns: 1fr; }
.speed-use {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--glass-line);
  font-size: 16px;
}
.speed-use-label { flex: 1 1 auto; transition: color 0.3s; }
.speed-use-note { color: var(--ink-3); font-size: 14px; text-align: right; white-space: nowrap; }
.speed-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}
.speed-use.is-wait .speed-use-label { color: var(--ink-3); }
.speed-use.is-wait .speed-dot { box-shadow: inset 0 0 0 1.5px var(--glass-line); animation: speed-breathe 1.6s ease-in-out infinite; }
.speed-use.is-no .speed-use-label { color: var(--ink-2); }
.speed-use.is-yes .speed-dot { background: var(--ink); box-shadow: none; animation: speed-pop 0.5s var(--ease); }
@keyframes speed-pop { 0% { transform: scale(0.3); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* The pitch under the tool. */
.speed-pitch { margin: 96px 0 0; }
.speed-pitch .rule { display: block; height: 1px; background: var(--glass-line); margin-bottom: 36px; }
.speed-pitch-line {
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 16px;
}
.speed-pitch-copy { color: var(--ink-2); font-size: 18px; margin: 0 0 28px; }
.speed-pitch-copy a { color: var(--ink); text-underline-offset: 3px; }
.speed-pitch .signup, .speed-pitch .done { margin: 0; }
.speed-privacy { color: var(--ink-3); font-size: 14px; margin: 36px 0 56px; }

@media (min-width: 900px) {
  .speed-top-inner { height: 88px; }
  .speed-top .wordmark { width: 120px; }
  .speed-top.is-done .wordmark { left: 48px; transform: translate(0, -50%); }
  .speed-tools { right: 48px; }
  .speed-icon { width: 44px; height: 44px; }
  .speed-main { padding: 0 48px; }
  .speed-app { padding-top: 40px; }
  .speed-chart { height: 340px; margin: 28px -24px 0; }
  .speed-details { grid-template-columns: 1fr 1fr; column-gap: 48px; }
  .speed-uses { grid-template-columns: 1fr 1fr; column-gap: 48px; }
  .speed-row:nth-child(2) { border-top: 1px solid var(--glass-line); }
  .speed-pitch { margin-top: 128px; }
  .speed-pitch .signup-row { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  .speed-char, .speed-details, .speed-badge, .speed-summary, .speed-tabs, .speed-use .speed-dot, .speed-icon { animation: none; }
  .speed-top .letter { animation: none !important; }
  .speed-top .wordmark { transition: none; }
  .speed-row dd.is-pending { animation: none; }
}
