/* The live demo (demo-host.tsx, demo-frame.tsx): the section reserves the window's place and holds the tour; the app's
   window is drawn over that place from the page's root, so it lives on while the visitor reads other pages. */

[data-component="demo-window"] {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  border: 1px solid var(--color-border-weak);
  border-radius: 8px;
  background: var(--color-background-weak);

  iframe {
    position: absolute;
    top: 0;
    left: 0;
    border: 0;
    transform-origin: 0 0;
    background: #fafafa;
  }

  [data-slot="loading"] {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-background-weak);
    color: var(--color-text-weak);
    font-size: 0.875rem;
  }

  /* Off the home page: out of sight and out of reach, still running. */
  &[data-away] {
    position: fixed;
    top: 0;
    left: -20000px;
    visibility: hidden;
    pointer-events: none;
  }

  @media (max-width: 40rem) {
    display: none;
  }
}

[data-component="demo"] {
  [data-slot="window"] {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--color-background-weak);
  }

  [data-slot="tour"] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;

    [role="group"] {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    button {
      padding: 6px 14px;
      border: 1px solid var(--color-border);
      border-radius: 4px;
      background: var(--color-background);
      color: var(--color-text-strong);
      font: inherit;
      font-size: 0.875rem;
      cursor: pointer;
    }

    button:hover:not(:disabled) {
      background: var(--color-background-weak);
    }

    button[aria-pressed="true"] {
      background: var(--color-background-strong);
      border-color: var(--color-background-strong);
      color: var(--color-text-inverted);
    }

    button:disabled {
      color: var(--color-text-weaker);
      cursor: default;
    }

    button:focus-visible {
      outline: 2px solid var(--color-accent);
      outline-offset: 2px;
    }
  }

  [data-slot="actions"] {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  [data-slot="full"] {
    font-size: 0.875rem;
    color: var(--color-text-strong);
  }

  /* A phone is too narrow to read the scaled app: it gets the full-screen link only. */
  @media (max-width: 40rem) {
    [data-slot="window"],
    [data-slot="tour"] [role="group"],
    [data-slot="replay"] {
      display: none;
    }

    [data-slot="tour"] {
      margin-top: 0;
    }

    [data-slot="full"] {
      padding: 10px 18px;
      border-radius: 4px;
      background: var(--color-background-strong);
      color: var(--color-text-inverted);
      text-decoration: none;
    }
  }

  [data-slot="note"] {
    margin: 12px 0 0;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--color-text-weak);
  }
}
