/*
 * The download page. Colours come from the master layout's `--site-*` tokens (site-layout.css), so
 * light and dark follow the header's theme toggle; sizes come from the console's type scale
 * (style/token/font.css). Body text is 15px, section headings 28–34px, the hero headline at most
 * 52px, and every section sits in the same 1200px column.
 */

[data-page="download"] {
  --dl-max: 75rem;
  --dl-gutter: clamp(1rem, 3vw, 2rem);
  --dl-radius: 14px;
  --dl-card-bg: var(--site-surface);
  --dl-card-edge: var(--site-hairline);
  --dl-card-shadow: 0 1px 1px rgb(13 23 68 / 0.03), 0 14px 32px -24px rgb(13 23 68 / 0.28);
  --dl-code-bg: #140c24;
  --dl-code-fg: #e9e3ff;
  --dl-code-dim: #b3a8d1;
  --dl-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  background:
    radial-gradient(56rem 32rem at 8% -6%, rgb(122 31 168 / 0.07), transparent 60%),
    radial-gradient(44rem 28rem at 96% 2%, rgb(43 180 214 / 0.06), transparent 62%),
    var(--site-surface);
  color: var(--site-text);
  font-family: var(--dl-sans);
  font-size: var(--font-size-md, 0.9375rem);
  line-height: 1.6;

  :root[data-theme="dark"] & {
    --dl-card-bg: color-mix(in srgb, var(--site-surface) 70%, #1b1030);
    --dl-card-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 18px 36px -24px rgb(0 0 0 / 0.8);
    --dl-code-bg: #0a0512;
    background:
      radial-gradient(56rem 34rem at 6% -8%, rgb(122 31 168 / 0.2), transparent 60%),
      radial-gradient(46rem 30rem at 96% 0%, rgb(59 11 110 / 0.24), transparent 62%),
      var(--site-surface);
  }

  ::selection {
    background: rgb(122 31 168 / 0.22);
  }

  h1,
  h2,
  h3 {
    margin: 0;
    color: var(--site-text-strong);
    font-family: var(--dl-sans);
  }

  p,
  ol,
  ul {
    margin: 0;
  }

  a:focus-visible,
  button:focus-visible {
    outline: 2px solid var(--site-focus);
    outline-offset: 3px;
  }

  code,
  pre {
    font-family: var(--site-font);
  }
}

/* --- hero ----------------------------------------------------------------------------------- */

[data-component="dl-hero"] {
  box-sizing: border-box;
  max-width: var(--dl-max);
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4.5rem) var(--dl-gutter) clamp(2rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 4vw, 4rem);

  @media (max-width: 60rem) {
    grid-template-columns: minmax(0, 1fr);
  }

  [data-slot="copy"] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
    max-width: 34rem;
    animation: dl-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  [data-slot="eyebrow"] {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem 0.35rem 0.6rem;
    border-radius: 999px;
    background: var(--site-sheen-soft), var(--site-surface);
    box-shadow: inset 0 0 0 1px var(--site-hairline);
    color: var(--site-text-strong);
    font-family: var(--site-font);
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: 500;
    line-height: 1.3;
  }

  [data-slot="eyebrow-dot"] {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #28c840;
    animation: dl-live 2.4s ease-out infinite;
  }

  [data-slot="eyebrow-version"] {
    color: var(--site-text-weak);
    font-weight: 400;
  }

  /* 36px on phones, 52px from about 1280px up. */
  h1 {
    font-size: clamp(2.25rem, 1.5rem + 1.9vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    font-weight: 650;
    text-wrap: balance;
    background: linear-gradient(120deg, var(--site-text-strong) 35%, #7a1fa8 80%, #2bb4d6 115%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;

    :root[data-theme="dark"] & {
      background: linear-gradient(120deg, #ffffff 35%, #d8bcff 80%, #7dd3e8 115%);
      -webkit-background-clip: text;
      background-clip: text;
    }
  }

  [data-slot="lede"] {
    font-size: var(--font-size-lg, 1.125rem);
    line-height: 1.6;
    color: var(--site-text);
    text-wrap: pretty;
  }

  [data-slot="cta"] {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
  }

  [data-slot="primary"],
  [data-slot="secondary"] {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1.15rem;
    border-radius: 10px;
    font-size: var(--font-size-md, 0.9375rem);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition:
      transform 0.2s ease,
      background-color 0.2s ease,
      box-shadow 0.2s ease;
  }

  [data-slot="primary"] {
    background: linear-gradient(135deg, #3b0b6e 0%, #7a1fa8 55%, #2bb4d6 140%);
    color: #ffffff;
    box-shadow:
      0 1px 0 rgb(255 255 255 / 0.22) inset,
      0 10px 24px -12px rgb(122 31 168 / 0.7);
  }

  [data-slot="secondary"] {
    background: var(--site-surface);
    color: var(--site-text-strong);
    box-shadow: inset 0 0 0 1px var(--site-hairline);
  }

  [data-slot="primary"]:hover,
  [data-slot="secondary"]:hover {
    transform: translateY(-1px);
  }

  [data-slot="secondary"]:hover {
    box-shadow: inset 0 0 0 1px #9a5fd0;
  }

  [data-slot="plan"] {
    color: var(--site-text-weak);
    font-size: var(--font-size-sm, 0.8125rem);
  }

  [data-slot="scene"] {
    width: 100%;
    max-width: 36rem;
    justify-self: center;
    animation: dl-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
  }
}

/* --- sections ------------------------------------------------------------------------------- */

[data-component="dl-section"] {
  box-sizing: border-box;
  max-width: var(--dl-max);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.25rem) var(--dl-gutter) 0;
  scroll-margin-top: calc(var(--site-header-h) + 1rem);

  [data-slot="head"] {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;

    h2 {
      font-size: clamp(1.75rem, 1.4rem + 0.8vw, 2.125rem);
      line-height: 1.2;
      letter-spacing: -0.02em;
      font-weight: 650;
    }

    p {
      max-width: 46rem;
    }
  }

  [data-slot="version"] {
    display: inline-block;
    margin-inline-start: 0.5rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--site-sheen-soft), var(--site-surface);
    box-shadow: inset 0 0 0 1px var(--site-hairline);
    color: var(--site-text-strong);
    font-family: var(--site-font);
    font-size: var(--font-size-xs, 0.75rem);
    vertical-align: 1px;
  }

  [data-slot="footnote"] {
    margin-top: 1rem;
    color: var(--site-text-weak);
    font-size: var(--font-size-sm, 0.8125rem);

    code {
      padding: 0.1rem 0.4rem;
      border-radius: 6px;
      background: var(--site-sheen-soft), var(--site-surface);
      box-shadow: inset 0 0 0 1px var(--site-hairline);
      color: var(--site-text-strong);
    }
  }
}

/* A card, shared by every boxed element on the page. */
[data-component="dl-platform"],
[data-component="dl-steps"],
[data-component="dl-command"],
[data-component="dl-editor"],
[data-component="dl-link-card"] {
  box-sizing: border-box;
  min-width: 0;
  border-radius: var(--dl-radius);
  background: var(--dl-card-bg);
  box-shadow: inset 0 0 0 1px var(--dl-card-edge), var(--dl-card-shadow);
}

[data-page="download"] h3 {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: 600;
  line-height: 1.3;
}

/* --- desktop platforms ---------------------------------------------------------------------- */

[data-component="dl-section"] [data-slot="platforms"] {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;

  @media (max-width: 64rem) {
    grid-template-columns: minmax(0, 1fr);
  }
}

[data-component="dl-platform"] {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;

  [data-slot="platform-head"] {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;

    > div {
      flex: 1;
      min-width: 0;
    }
  }

  [data-slot="platform-icon"] {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    background: var(--site-sheen-soft), var(--site-surface);
    box-shadow: inset 0 0 0 1px var(--site-hairline);
    color: var(--site-text-strong);
  }

  [data-slot="requirement"] {
    color: var(--site-text-weak);
    font-size: var(--font-size-sm, 0.8125rem);
    line-height: 1.45;
  }

  /* The subtle marker: a small pill and a slightly stronger edge, nothing that demotes the others. */
  [data-slot="recommended"] {
    flex-shrink: 0;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px #9a5fd0;
    color: var(--site-text-strong);
    font-size: var(--font-size-2xs, 0.6875rem);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
  }

  [data-slot="builds"] {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    list-style: none;
  }

  li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 0.75rem;
    padding: 0.75rem 0.8rem;
    border-radius: 10px;
    background: var(--site-surface-sunk);
  }

  li[data-recommended] {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #9a5fd0 60%, transparent);
  }

  [data-slot="build-info"] {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
  }

  [data-slot="build-name"] {
    color: var(--site-text-strong);
    font-weight: 600;
  }

  [data-slot="build-actions"] {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  [data-slot="build-alt"] {
    color: var(--site-text-strong);
    font-size: var(--font-size-sm, 0.8125rem);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  [data-slot="which"] {
    margin-top: auto;
    color: var(--site-text);
    font-size: var(--font-size-sm, 0.8125rem);
    line-height: 1.5;

    strong {
      color: var(--site-text-strong);
      font-weight: 600;
    }
  }
}

[data-page="download"] [data-slot="build-meta"] {
  color: var(--site-text-weak);
  font-family: var(--site-font);
  font-size: var(--font-size-xs, 0.75rem);
}

[data-page="download"] [data-slot="build-button"] {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: var(--site-hover-bg);
  color: var(--site-hover-fg);
  font-size: var(--font-size-sm, 0.8125rem);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease;
}

[data-page="download"] [data-slot="build-button"][data-variant="quiet"] {
  background: var(--site-surface);
  color: var(--site-text-strong);
  box-shadow: inset 0 0 0 1px var(--site-hairline);
}

[data-page="download"] [data-slot="build-button"]:hover {
  transform: translateY(-1px);
}

/* --- after install -------------------------------------------------------------------------- */

[data-component="dl-section"] [data-slot="next"] {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
  counter-reset: next;

  @media (max-width: 64rem) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  @media (max-width: 36rem) {
    grid-template-columns: minmax(0, 1fr);
  }

  li {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 2.6rem 1.1rem 1.1rem;
    border-radius: var(--dl-radius);
    background: var(--dl-card-bg);
    box-shadow: inset 0 0 0 1px var(--dl-card-edge), var(--dl-card-shadow);
    counter-increment: next;
  }

  li::before {
    content: counter(next);
    position: absolute;
    top: 1rem;
    inset-inline-start: 1.1rem;
    display: grid;
    place-items: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b0b6e, #7a1fa8 60%, #2bb4d6 140%);
    color: #ffffff;
    font-family: var(--site-font);
    font-size: var(--font-size-2xs, 0.6875rem);
    font-weight: 600;
  }

  p {
    font-size: var(--font-size-sm, 0.8125rem);
    line-height: 1.55;
  }

  a {
    color: var(--site-text-strong);
    font-weight: 600;
  }
}

[data-component="dl-section"] [data-slot="steps"] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

[data-component="dl-steps"] {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.25rem;

  ol {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0;
    list-style: none;
    counter-reset: step;
  }

  li {
    position: relative;
    padding-inline-start: 2rem;
    counter-increment: step;
  }

  li::before {
    content: counter(step);
    position: absolute;
    inset-inline-start: 0;
    top: 0.1rem;
    display: grid;
    place-items: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--site-sheen-soft), var(--site-surface);
    box-shadow: inset 0 0 0 1px var(--site-hairline);
    color: var(--site-text-strong);
    font-family: var(--site-font);
    font-size: var(--font-size-2xs, 0.6875rem);
    font-weight: 600;
  }

  [data-slot="linux"] {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }
}

[data-page="download"] [data-slot="note"] {
  color: var(--site-text-weak);
  font-size: var(--font-size-sm, 0.8125rem);
}

/* --- terminal ------------------------------------------------------------------------------- */

[data-component="dl-section"] [data-slot="commands"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;

  @media (max-width: 52rem) {
    grid-template-columns: minmax(0, 1fr);
  }
}

[data-component="dl-command"] {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.25rem;

  &[data-wide] {
    grid-column: 1 / -1;
  }

  [data-slot="label"] {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;

    h3 {
      font-size: var(--font-size-md, 0.9375rem);
    }

    p {
      color: var(--site-text-weak);
      font-size: var(--font-size-sm, 0.8125rem);
      line-height: 1.5;
    }
  }

  [data-slot="manual"] {
    font-size: var(--font-size-sm, 0.8125rem);
  }

  [data-slot="manual-links"] {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

[data-component="dl-code"] {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.35rem 0.35rem 0.35rem 0.9rem;
  border-radius: 10px;
  background: var(--dl-code-bg);
  box-shadow: inset 0 0 0 1px rgb(168 120 214 / 0.2);

  pre {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0.5rem 0;
    overflow-x: auto;
    color: var(--dl-code-fg);
    font-size: var(--font-size-sm, 0.8125rem);
    line-height: 1.6;
    /* One-line commands wrap at spaces; multi-line scripts keep their lines and scroll sideways. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    scrollbar-width: thin;
  }

  &[data-multiline] pre {
    white-space: pre;
    overflow-wrap: normal;
  }

  button {
    position: relative;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: rgb(255 255 255 / 0.07);
    color: var(--dl-code-fg);
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  button:hover {
    background: rgb(255 255 255 / 0.15);
  }

  button[data-copied] {
    color: #5fe096;
  }

  [data-slot="status"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* --- editors -------------------------------------------------------------------------------- */

[data-component="dl-section"] [data-slot="editors"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;

  @media (max-width: 52rem) {
    grid-template-columns: minmax(0, 1fr);
  }
}

[data-component="dl-editor"] {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.25rem;

  > [data-component="dl-code"] {
    align-self: stretch;
  }

  ol {
    padding-inline-start: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }
}

[data-component="dl-link-card"] {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.1rem 3.25rem 1.1rem 1.25rem;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.2s ease;

  [data-slot="title"] {
    color: var(--site-text-strong);
    font-weight: 600;
  }

  [data-slot="body"] {
    color: var(--site-text-weak);
    font-family: var(--site-font);
    font-size: var(--font-size-xs, 0.75rem);
  }

  [data-slot="arrow"] {
    position: absolute;
    inset-inline-end: 1.25rem;
    top: 50%;
    translate: 0 -50%;
    color: var(--site-text-strong);
    transition: transform 0.2s ease;
  }
}

[data-component="dl-link-card"]:hover {
  box-shadow: inset 0 0 0 1px #9a5fd0, var(--dl-card-shadow);

  [data-slot="arrow"] {
    transform: translateX(3px);
  }
}

/* --- faq ------------------------------------------------------------------------------------ */

[data-component="dl-faq"] {
  max-width: 52rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--site-hairline);

  li {
    border-bottom: 1px solid var(--site-hairline);
  }

  [data-slot="faq-question"] {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 0;
    border: 0;
    background: none;
    color: var(--site-text-strong);
    font: 600 var(--font-size-md, 0.9375rem) / 1.4 var(--dl-sans);
    text-align: start;
    cursor: pointer;

    svg {
      flex-shrink: 0;
      width: 20px;
      height: 20px;
      color: var(--site-text-weak);
    }
  }

  [data-slot="faq-question"][aria-expanded="true"] [data-slot="faq-icon-plus"],
  [data-slot="faq-question"]:not([aria-expanded="true"]) [data-slot="faq-icon-minus"] {
    display: none;
  }

  [data-slot="faq-question-text"] {
    flex: 1;
  }

  [data-slot="faq-answer"] {
    padding: 0 0 1rem 2rem;
    line-height: 1.65;
  }
}

/* --- motion --------------------------------------------------------------------------------- */

@keyframes dl-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes dl-live {
  0% {
    box-shadow: 0 0 0 0 rgb(40 200 64 / 0.5);
  }
  70%,
  100% {
    box-shadow: 0 0 0 7px rgb(40 200 64 / 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-page="download"] *,
  [data-page="download"] *::before,
  [data-page="download"] *::after {
    animation: none !important;
    transition: none !important;
  }
}
/*
 * The download hero's animated app. Every moving part shares one 8s timeline, so the story reads in
 * order: lead agent (0%) → hand-off to the team (10-50%) → plan and code fill in (12-60%) → steps
 * ticked (45-65%) → the pointer drives the preview and presses the button (55-80%) → rest, then
 * everything settles back (92-100%) and the loop begins again.
 */

[data-component="download-scene"] {
  --dl-window: #ffffff;
  --dl-chrome: #f3f1f8;
  --dl-sidebar: #f8f7fc;
  --dl-card: #f1eff7;
  --dl-page: #fbfaff;
  --dl-code: #1a1230;
  --dl-ink: #1f1a3a;
  --dl-line: #d9d4e8;
  --dl-line-soft: #e8e4f2;
  --dl-edge-a: #26104a;
  --dl-edge-b: #9a5fd0;
  --dl-edge-c: #16256b;

  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 30px 50px rgb(31 12 61 / 0.18)) drop-shadow(0 6px 14px rgb(31 12 61 / 0.08));

  * {
    transform-box: fill-box;
  }
}

:root[data-theme="dark"] [data-component="download-scene"] {
  --dl-window: #160c26;
  --dl-chrome: #1f1333;
  --dl-sidebar: #1a0f2c;
  --dl-card: #251939;
  --dl-page: #1b1030;
  --dl-code: #0c0616;
  --dl-ink: #efe8ff;
  --dl-line: #3d2e57;
  --dl-line-soft: #30234a;
  --dl-edge-a: #6b2fa8;
  --dl-edge-b: #d8bcff;
  --dl-edge-c: #2bb4d6;

  filter: drop-shadow(0 30px 60px rgb(0 0 0 / 0.55)) drop-shadow(0 0 40px rgb(122 31 168 / 0.25));
}

[data-component="download-scene"] [data-slot="orb-a"] {
  transform-origin: center;
  animation: dl-orb 16s ease-in-out infinite alternate;
}

[data-component="download-scene"] [data-slot="orb-b"] {
  transform-origin: center;
  animation: dl-orb 19s ease-in-out -6s infinite alternate-reverse;
}

[data-component="download-scene"] [data-slot="window"] {
  animation: dl-float 8s ease-in-out infinite;
}

/* Team: each agent brightens in turn as the work is handed down. */
[data-component="download-scene"] [data-slot="agent"] {
  opacity: 0.55;
  animation: dl-agent 8s ease-in-out infinite;
}
[data-component="download-scene"] [data-slot="agent"][data-index="1"] {
  animation-delay: 1.6s;
}
[data-component="download-scene"] [data-slot="agent"][data-index="2"] {
  animation-delay: 2.8s;
}

[data-component="download-scene"] [data-slot="pulse"] {
  transform-origin: center;
  animation: dl-pulse 1.6s ease-in-out infinite;
}

[data-component="download-scene"] [data-slot="handoff"] {
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: dl-handoff 8s ease-in-out infinite;
}

/* Plan: each step's bar grows, then its tick is drawn. */
[data-component="download-scene"] [data-slot="step"] [data-slot="bar"] {
  transform-origin: left center;
  transform: scaleX(0);
  animation: dl-grow 8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
[data-component="download-scene"] [data-slot="step"][data-index="1"] [data-slot="bar"] {
  animation-delay: 0.5s;
}
[data-component="download-scene"] [data-slot="step"][data-index="2"] [data-slot="bar"] {
  animation-delay: 1s;
}

[data-component="download-scene"] [data-slot="tick"] {
  stroke-dasharray: 12;
  stroke-dashoffset: 12;
  animation: dl-tick 8s ease-out infinite;
}
[data-component="download-scene"] [data-slot="step"][data-index="0"] [data-slot="tick"] {
  animation-delay: 2.4s;
}
[data-component="download-scene"] [data-slot="step"][data-index="1"] [data-slot="tick"] {
  animation-delay: 3.2s;
}
[data-component="download-scene"] [data-slot="step"][data-index="2"] [data-slot="tick"] {
  animation-delay: 4s;
}

/* Code: lines are written one after another. */
[data-component="download-scene"] [data-slot="code"] rect {
  transform-origin: left center;
  transform: scaleX(0);
  animation: dl-type 8s steps(12, end) infinite;
}
[data-component="download-scene"] [data-slot="code"] rect[data-index="1"] {
  animation-delay: 0.45s;
}
[data-component="download-scene"] [data-slot="code"] rect[data-index="2"] {
  animation-delay: 0.9s;
}
[data-component="download-scene"] [data-slot="code"] rect[data-index="3"] {
  animation-delay: 1.35s;
}
[data-component="download-scene"] [data-slot="code"] rect[data-index="4"] {
  animation-delay: 1.8s;
}
[data-component="download-scene"] [data-slot="code"] rect[data-index="5"] {
  animation-delay: 2.25s;
}
[data-component="download-scene"] [data-slot="code"] rect[data-index="6"] {
  animation-delay: 2.7s;
}

[data-component="download-scene"] [data-slot="caret"] {
  animation: dl-caret 1s steps(1, end) infinite;
}

/* Preview: the pointer travels to the button and presses it. */
[data-component="download-scene"] [data-slot="pointer"] {
  transform-box: view-box;
  animation: dl-pointer 8s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

[data-component="download-scene"] [data-slot="button-fill"] {
  animation: dl-button 8s ease infinite;
}

[data-component="download-scene"] [data-slot="ripple"] {
  transform-origin: center;
  opacity: 0;
  animation: dl-ripple 8s ease-out infinite;
}

[data-component="download-scene"] [data-slot="done"] {
  transform-origin: center;
  opacity: 0;
  animation: dl-done 8s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

@keyframes dl-orb {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(24px, 18px) scale(1.12);
  }
}

@keyframes dl-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes dl-agent {
  0%,
  100% {
    opacity: 0.55;
  }
  6%,
  30% {
    opacity: 1;
  }
  40% {
    opacity: 0.55;
  }
}

@keyframes dl-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.55;
  }
}

@keyframes dl-handoff {
  0%,
  8% {
    stroke-dashoffset: 80;
    opacity: 1;
  }
  45%,
  88% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}

@keyframes dl-grow {
  0%,
  10% {
    transform: scaleX(0);
  }
  22%,
  90% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

@keyframes dl-tick {
  0% {
    stroke-dashoffset: 12;
  }
  8%,
  60% {
    stroke-dashoffset: 0;
  }
  70%,
  100% {
    stroke-dashoffset: 12;
  }
}

@keyframes dl-type {
  0%,
  14% {
    transform: scaleX(0);
  }
  22%,
  90% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

@keyframes dl-caret {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes dl-pointer {
  0%,
  52% {
    transform: translate(560px, 392px);
  }
  68% {
    transform: translate(500px, 298px);
  }
  71% {
    transform: translate(500px, 298px) scale(0.86);
  }
  74%,
  88% {
    transform: translate(500px, 298px) scale(1);
  }
  100% {
    transform: translate(560px, 392px);
  }
}

@keyframes dl-button {
  0%,
  71% {
    fill: var(--dl-ink);
  }
  73%,
  92% {
    fill: #7a1fa8;
  }
  100% {
    fill: var(--dl-ink);
  }
}

@keyframes dl-ripple {
  0%,
  71% {
    opacity: 0;
    transform: scale(0.4);
  }
  73% {
    opacity: 0.9;
  }
  84%,
  100% {
    opacity: 0;
    transform: scale(2.2);
  }
}

@keyframes dl-done {
  0%,
  76% {
    opacity: 0;
    transform: scale(0.3);
  }
  80%,
  92% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* Reduced motion: no movement at all, every part shown in its finished state. */
@media (prefers-reduced-motion: reduce) {
  [data-component="download-scene"] *,
  [data-component="download-scene"] [data-slot="window"] {
    animation: none !important;
  }

  [data-component="download-scene"] [data-slot="agent"] {
    opacity: 1;
  }

  [data-component="download-scene"] [data-slot="handoff"],
  [data-component="download-scene"] [data-slot="tick"] {
    stroke-dashoffset: 0;
  }

  [data-component="download-scene"] [data-slot="step"] [data-slot="bar"],
  [data-component="download-scene"] [data-slot="code"] rect {
    transform: none;
  }

  [data-component="download-scene"] [data-slot="pointer"] {
    transform: translate(500px, 298px);
  }

  [data-component="download-scene"] [data-slot="done"] {
    opacity: 1;
    transform: none;
  }
}
